Package fr.soleil.salsa.entity

Examples of fr.soleil.salsa.entity.IDirectory


     * @param oldConfigModel
     * @param newConfigImpl
     */
    private void doRefreshConfig(IConfig<?> oldConfigModel, IConfig<?> newConfigImpl) {
        oldConfigModel.getDirectory().getConfigList().remove(oldConfigModel);
        IDirectory newDirectory = searchDirectory(newConfigImpl.getDirectory().getId(),
                rootDirectory);
        if (newDirectory == null) {
            newDirectory = rootDirectory;
        }
        IConfig<?> newConfigLoaded;
        try {
            newConfigLoaded = ConfigApi.getConfigById(oldConfigModel.getId());
        }
        catch (ScanNotFoundException snfe) {
            snfe.printStackTrace();
            newConfigLoaded = oldConfigModel;
        }
        IConfig<?> newConfigModel = wrap(newConfigLoaded);
        newConfigModel.setDirectory(newDirectory);
        newDirectory.getConfigList().add(newConfigModel);
        if (oldConfigModel.equals(currentConfig)) {
            currentConfig = newConfigModel;
            applicationController.setConfig(newConfigModel);
        }
    }
View Full Code Here


        return baseBean.getDirectory();
    }

    @Override
    public void setDirectory(IDirectory directory) {
        IDirectory oldValue = this.baseBean.getDirectory();
        this.baseBean.setDirectory(directory);
        this.firePropertyChange("directory", oldValue, directory);
    }
View Full Code Here

                applicationController
                        .errorMessage("Error : no root directory was found in the database. Attempt to create one resulted in the error : "
                                + e.getMessage());
            }
        }
        IDirectory newDirectoryImpl = searchDirectory(oldDirectoryModel.getId(), loadRootDirectory);
        List<IConfig<?>> modifiedConfigsList = unsavedConfigList();
        if (newDirectoryImpl != null) {
            newDirectoryImpl.setDirectory(null);
            IDirectory newDirectoryModel = AutoCopier.copyDirectoryToModel(newDirectoryImpl);
            /*DirectoryModelWrapperFactory.getInstance().wrap(
                newDirectoryImpl);*/
            if (oldDirectoryModel.equals(rootDirectory)) {
                rootDirectory = newDirectoryModel;
            }
            else {
                removeContent(rootDirectory, newDirectoryModel);
                IDirectory parentDirectory = searchDirectory(oldDirectoryModel.getDirectory()
                        .getId(), rootDirectory);
                if (parentDirectory == null) {
                    parentDirectory = rootDirectory;
                }
                newDirectoryModel.setDirectory(parentDirectory);
                parentDirectory.getSubDirectoriesList().add(newDirectoryModel);
            }
        }
        else {
            if (oldDirectoryModel.equals(rootDirectory)) {
                IDirectory newDirectoryModel = AutoCopier.copyDirectoryToModel(loadRootDirectory);
                // DirectoryModelWrapperFactory.getInstance().wrap(
                // loadRootDirectory);
                rootDirectory = newDirectoryModel;
            }
            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;
                                try {
                                    newConfigLoaded = ConfigApi.getConfigById(foundConfig.getId());
                                }
                                catch (ScanNotFoundException e) {
                                    e.printStackTrace();
                                    newConfigLoaded = foundConfig;
                                }

                                IConfig<?> newConfigModel = wrap(newConfigLoaded);
                                IDirectory parentDirectory = foundConfig.getDirectory();
                                newConfigModel.setDirectory(parentDirectory);
                                parentDirectory.getConfigList().remove(foundConfig);
                                parentDirectory.getConfigList().add(newConfigModel);
                                currentConfig = newConfigModel;
                                applicationController.setConfig(newConfigModel);
                            }
                        }
                    }
                }
                else {
                    // The modified config has been deleted.
                    if (!view.askRefreshConfigDeleted(modifiedConfig.getName())) {
                        IDirectory foundDirectory = searchDirectory(modifiedConfig.getDirectory()
                                .getId(), rootDirectory);
                        if (foundDirectory == null) {
                            foundDirectory = rootDirectory;
                        }
                        foundDirectory.getConfigList().add(modifiedConfig);
                        modifiedConfig.setDirectory(foundDirectory);
                    }
                    else {
                        if (modifiedConfig.equals(currentDirectory)) {
                            currentConfig = null;
                            applicationController.setConfig(null);
                        }
                    }
                }
            }
            else {
                modifiedConfig.getDirectory().getConfigList().remove(modifiedConfig);
                IDirectory foundDirectory = searchDirectory(modifiedConfig.getDirectory().getId(),
                        rootDirectory);
                if (foundDirectory == null) {
                    foundDirectory = rootDirectory;
                }
                foundDirectory.getConfigList().add(modifiedConfig);
                modifiedConfig.setDirectory(foundDirectory);
            }
        }
        if (currentDirectory != null) {
            currentDirectory = searchDirectory(currentDirectory.getId(), rootDirectory);
View Full Code Here

            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

            return null;
        }
        if (directoryId.equals(directory.getId())) {
            return directory;
        }
        IDirectory searchDirectory;
        for (IDirectory subDirectory : directory.getSubDirectoriesList()) {
            searchDirectory = searchDirectory(directoryId, subDirectory);
            if (searchDirectory != null) {
                return searchDirectory;
            }
View Full Code Here

                    // Partial mode for recording, must be manage by an external client
                    // setAttribute("dataRecorderPartialMode", false);

                    // Run name.
                    String runName = config.getName();
                    IDirectory directory = config.getDirectory();
                    while (directory != null) {
                        runName = directory.getName() + "." + runName;
                        directory = directory.getDirectory();
                    }
                    setAttribute("runName", runName);

                    // Scan number.
                    setAttribute("scanNumber", config.getScanNumber());
View Full Code Here

    /**
     *
     */
    public void setDirectory(IDirectory directory) {
        IDirectory oldValue = this.baseBean.getDirectory();
        this.baseBean.setDirectory(directory);
        this.firePropertyChange("directory", oldValue, directory);
    }
View Full Code Here

        finalizeCopy(o, result);
        return result;
    }

    public static IDirectory copyDirectoryToImpl(IDirectory d) {
        IDirectory result = (IDirectory) Map(d, DirectoryImpl.class, false);
        return result;
    }
View Full Code Here

        IDirectory result = (IDirectory) Map(d, DirectoryImpl.class, false);
        return result;
    }

    public static IDirectory copyDirectoryToModel(IDirectory d) {
        IDirectory result = (IDirectory) Map(d, DirectoryModel.class, false);
        return result;
    }
View Full Code Here

     *
     * @see IDirectory#setDirectory(IDirectory)
     * @param IDirectory
     */
    public void setDirectory(IDirectory directory) {
        IDirectory oldValue = this.baseBean.getDirectory();
        this.baseBean.setDirectory(directory);
        this.firePropertyChange("directory", oldValue, directory);
    }
View Full Code Here

TOP

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

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.