Package fr.soleil.salsa.entity

Examples of fr.soleil.salsa.entity.IConfig


    private IConfig unwrap(IConfig configModel) {
        if (configModel instanceof ConfigModel) {
            configModel = loadConfig(configModel);
        }

        IConfig configImpl = AutoCopier.copyToImpl(configModel);

        return configImpl;

    }
View Full Code Here


     * @param config
     * @return
     */
    @SuppressWarnings("unchecked")
    private IConfig loadConfig(IConfig config) {
        IConfig newConfig;
        if (config.getId() != null && !config.isLoaded()) {
            IConfig loadedConfig = ConfigApi.getConfigById(config.getId());

            newConfig = wrap(loadedConfig);
            addListenerTo((IEventSource<EntityPropertyChangedEvent<IConfig>>) newConfig);
            // Replaces the old, not loaded config with the new, fully loaded config in the
            // directory.
View Full Code Here

            IDirectory loadRootDirectory = ConfigApi.getRootDirectory();
            boolean refreshCurrent = false;
            boolean currentAlreadyRefreshed = false;
            for (ATreeNode treeNode : multipleSelection) {
                if (treeNode instanceof ConfigTreeNode) {
                    IConfig configToRefresh = ((ConfigTreeNode) treeNode).getConfig();
                    if (configToRefresh.equals(currentConfig)) {
                        currentAlreadyRefreshed = true;
                    }
                    refreshConfig(configToRefresh, loadRootDirectory);
                }
                else {
                    if (isChild(new ConfigTreeNode(currentConfig, null), treeNode)) {
                        refreshCurrent = true;
                    }
                    refreshDirectory(((DirectoryTreeNode) treeNode).getDirectory(),
                            loadRootDirectory);
                }
            }
            if (refreshCurrent && !currentAlreadyRefreshed) {
                IConfig newCurrentConfig = loadConfig(currentConfig);
                this.currentConfig = newCurrentConfig;
                applicationController.setConfig(newCurrentConfig);
            }
        }
        else {
View Full Code Here

     * @param treeNode
     */
    private void refreshConfig(IConfig oldConfigModel, IDirectory loadRootDirectory) {
        Integer configId = oldConfigModel.getId();
        if (configId != null) {
            IConfig newConfigImpl = searchConfig(configId, loadRootDirectory);
            if (newConfigImpl == null) {
                // The config has been removed.
                if (oldConfigModel.isModified()) {
                    if (view.askRefreshConfigDeleted(oldConfigModel.getName())) {
                        oldConfigModel.getDirectory().getConfigList().remove(oldConfigModel);
                        if (oldConfigModel.equals(currentConfig)) {
                            currentConfig = null;
                            applicationController.setConfig(null);
                        }
                    }
                    else {
                        // The config no longer exist on the database, so it no longer has an id.
                        oldConfigModel.setId(null);
                    }
                }
                else {
                    oldConfigModel.getDirectory().getConfigList().remove(oldConfigModel);
                    if (oldConfigModel.equals(currentConfig)) {
                        currentConfig = null;
                        applicationController.setConfig(null);
                    }
                }
            }
            else {
                if (!newConfigImpl.getTimestamp().equals(oldConfigModel.getTimestamp())) {
                    if (oldConfigModel.isModified()) {
                        if (view.askRefreshConfigModified(oldConfigModel.getName())) {
                            doRefreshConfig(oldConfigModel, newConfigImpl);
                        }
                        else {
                            oldConfigModel.setTimestamp(newConfigImpl.getTimestamp());
                        }
                    }
                    else {
                        doRefreshConfig(oldConfigModel, newConfigImpl);
                    }
View Full Code Here

        IDirectory newDirectory = searchDirectory(newConfigImpl.getDirectory().getId(),
                rootDirectory);
        if (newDirectory == null) {
            newDirectory = rootDirectory;
        }
        IConfig newConfigLoaded = ConfigApi.getConfigById(oldConfigModel.getId());
        IConfig newConfigModel = wrap(newConfigLoaded);
        newConfigModel.setDirectory(newDirectory);
        newDirectory.getConfigList().add(newConfigModel);
        if (oldConfigModel.equals(currentConfig)) {
            currentConfig = newConfigModel;
            applicationController.setConfig(newConfigModel);
        }
View Full Code Here

            else {
                oldDirectoryModel.getDirectory().getSubDirectoriesList().remove(oldDirectoryModel);
            }
        }
        // We restore the modified configs.
        IConfig foundConfig;
        for (IConfig modifiedConfig : modifiedConfigsList) {
            if (modifiedConfig.getId() != null) {
                foundConfig = searchConfig(modifiedConfig.getId(), rootDirectory);
                if (foundConfig != null) {
                    if (!foundConfig.isModified()) {
                        if (!view.askRefreshConfigModified(modifiedConfig.getName())) {
                            IDirectory parentDirectory = foundConfig.getDirectory();
                            parentDirectory.getConfigList().remove(foundConfig);
                            parentDirectory.getConfigList().add(modifiedConfig);
                            modifiedConfig.setDirectory(parentDirectory);
                        }
                        else {
                            if (modifiedConfig.equals(currentConfig)) {
                                IConfig newConfigLoaded = ConfigApi.getConfigById(foundConfig
                                        .getId());

                                IConfig newConfigModel = wrap(newConfigLoaded);
                                IDirectory parentDirectory = foundConfig.getDirectory();
                                newConfigModel.setDirectory(parentDirectory);
                                parentDirectory.getConfigList().remove(foundConfig);
                                parentDirectory.getConfigList().add(newConfigModel);
                                currentConfig = newConfigModel;
                                applicationController.setConfig(newConfigModel);
                            }
View Full Code Here

     */
    private void removeContent(IDirectory container, IDirectory content) {
        for (IDirectory contentSubDirectory : content.getSubDirectoriesList()) {
            removeContent(container, contentSubDirectory);
        }
        IConfig foundConfig;
        for (IConfig contentConfig : content.getConfigList()) {
            foundConfig = searchConfig(contentConfig.getId(), container);
            if (foundConfig != null) {
                foundConfig.getDirectory().getConfigList().remove(foundConfig);
            }
        }
        IDirectory foundDirectory = searchDirectory(content.getId(), container);
        if (foundDirectory.getDirectory() != null) {
            foundDirectory.getDirectory().getSubDirectoriesList().remove(foundDirectory);
View Full Code Here

        for (IConfig config : directory.getConfigList()) {
            if (configId.equals(config.getId())) {
                return config;
            }
        }
        IConfig config;
        for (IDirectory subDirectory : directory.getSubDirectoriesList()) {
            config = searchConfig(configId, subDirectory);
            if (config != null) {
                return config;
            }
View Full Code Here

        }
        else if(obj == null) {
            return false;
        }
        else if(obj instanceof IConfig) {
            IConfig that = (IConfig) obj;
            if(this.getId() != null) {
                if(that.getId() != null) {
                    return this.getId().equals(that.getId());
                }
                else {
                    return false;
                }
            }
            else {
                if(that.getId() != null) {
                    return false;
                }
                else {
                    return getPath(this).equals(getPath(that));
                }
View Full Code Here

    public void notifyEndOfScanDetected() {

        String userLogFileName = ModelPreferences.getInstance().getUserLogFile();
        if (userLogFileName != null && !userLogFileName.trim().isEmpty()) {
            IConfig lastStartScanImpl = (IConfig) AutoCopier.toImpl(lastStartScan);
            ContextImpl context = new ContextImpl();
            context.setScanServerName(ModelPreferences.getInstance().getScanServer());
            context.setUserLogFile(userLogFileName);
            context.setMaxLineNumber(ModelPreferences.getInstance().getMaxLineNumber());
View Full Code Here

TOP

Related Classes of fr.soleil.salsa.entity.IConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.