Package fr.soleil.salsa.entity

Examples of fr.soleil.salsa.entity.IDirectory


        if (directory == null)
            return 0;// Operation of delete is not successful.

        String sql = "DELETE FROM directory WHERE directoryid=? AND timestamp=? ";

        IDirectory directoryResult = null;

        int row = 0;

        // Check if the DirectoryImpl exists in the database
        directoryResult = getDirectoryById(directory.getId());
        if (directoryResult == null
                || !directoryResult.getTimestamp().equals(directory.getTimestamp())) {
            conn.rollback();
            throw new DirectoryOutOfSyncException();
        }

        preStmt = conn.prepareStatement(sql);
View Full Code Here


                deleteConfigNoCommit(c);
            }
        }

        // Delete the directory
        IDirectory d = new DirectoryImpl();
        d.setId(directory.getId());
        d.setTimestamp(directory.getTimestamp());
        deleteDirectoryNoCommit(d);

        return true;
    }
View Full Code Here

                directory.setTimestamp(rs.getTimestamp("timestamp"));

                int parentDirectoryId = rs.getInt("directory");

                if (!rs.wasNull()) {
                    IDirectory parent = new DirectoryImpl();
                    parent.setId(parentDirectoryId);
                    directory.setDirectory(parent);
                    // directory.setParentDirectoryId(parentDirectoryId);
                }
                directoryList.add(directory);
            }
View Full Code Here

    public IDirectory getRootDirectory() {

        List<IDirectory> directories = getDirectoryList();
        Hashtable<Integer, IDirectory> ht = new Hashtable<Integer, IDirectory>();

        IDirectory root = null;

        for (IDirectory d : directories) {
            if (d.getDirectory() == null) {
                root = d;
            }

            d.setSubDirectoriesList(new ArrayList<IDirectory>());
            d.setConfigList(new ArrayList<IConfig<?>>());
            ht.put(d.getId(), d);
        }

        for (IDirectory d : directories) {

            // Set parent
            if (d.getDirectory() != null) {
                int parentId = d.getDirectory().getId();
                IDirectory parent = ht.get(parentId);
                d.setDirectory(parent);

                parent.getSubDirectoriesList().add(d);
            }
        }

        List<Configuration> configs = getConfigList();

        for (Configuration c : configs) {
            String type = c.getType();
            IConfig<?> scan = null;
            if (type.equals("Config1DImpl") || type.equals("Config1D")) {
                scan = new Config1DImpl(); // new Config1D();
                scan.setType(IConfig.ScanType.SCAN_1D);
            }
            else if (type.equals("Config2DImpl") || type.equals("Config2D")) {
                scan = new Config2DImpl(); // new Config1D();
                scan.setType(IConfig.ScanType.SCAN_2D);
            }
            else if (type.equals("ConfigHCSImpl") || type.equals("ConfigHCS")) {
                scan = new ConfigHCSImpl();
                scan.setType(IConfig.ScanType.SCAN_HCS);
            }
            else if (type.equals("ConfigKImpl") || type.equals("ConfigK")) {
                scan = new ConfigKImpl();
                scan.setType(IConfig.ScanType.SCAN_K);
            }
            else if (type.equals("ConfigEnergyImpl") || type.equals("ConfigEnergy")) {
                scan = new ConfigEnergyImpl();
                scan.setType(IConfig.ScanType.SCAN_ENERGY);
            }
            // Former code
            // if (type.equals("Config1DImpl") || type.equals("Config1D")) {
            // scan = new ConfigImpl(); // new Config1D();
            // scan.setType(IConfig.ScanType.SCAN_1D);
            // }
            // else if (type.equals("Config2DImpl") || type.equals("Config2D")) {
            // scan = new ConfigImpl(); // new Config1D();
            // scan.setType(IConfig.ScanType.SCAN_2D);
            // }
            // else if (type.equals("ConfigHCSImpl") || type.equals("ConfigHCS")) {
            // scan = new ConfigImpl();
            // scan.setType(IConfig.ScanType.SCAN_HCS);
            // }
            // else if (type.equals("ConfigKImpl") || type.equals("ConfigK")) {
            // scan = new ConfigImpl();
            // scan.setType(IConfig.ScanType.SCAN_K);
            // }
            // else if (type.equals("ConfigEnergyImpl") || type.equals("ConfigEnergy")) {
            // scan = new ConfigImpl();
            // scan.setType(IConfig.ScanType.SCAN_ENERGY);
            // }
            // else if (type.equals("ConfigEnergy")) {
            // scan = new ConfigEnergyImpl();
            // scan.setType(IConfig.ScanType.SCAN_ENERGY);
            // }
            /*
             * else if (type.equals("Config2D")) { scan = new Config2D(); } else
             * if (type.equals("ConfigK")) { scan = new ConfigK(); } else if
             * (type.equals("ConfigEnergy")) { scan = new ConfigEnergy(); } else
             * if (type.equals("ConfigHCS")) { scan = new ConfigHCS(); }
             */
            scan.setName(c.getName());
            scan.setId(c.getId());
            scan.setTimestamp(c.getTimestamp());

            int directoryId = c.getDirectoryId();// scan.getDirectory().getId();
            IDirectory directory = ht.get(directoryId);
            scan.setDirectory(directory);
            directory.getConfigList().add(scan);
        }

        return root;
    }
View Full Code Here

            throw new ScanConfigOutOfSyncException();

        // Checking if the configuration directory
        // has been deleted

        IDirectory directory = getDirectoryById(config.getDirectoryId());
        if (directory == null
                || !directory.getTimestamp().equals(config.getDirectory().getTimestamp())) {
            throw new ScanConfigOutOfSyncException();
        }

        try {
View Full Code Here

            throw new ScanConfigOutOfSyncException();
        }

        // V�rification si le r�pertoire de la config
        // a �t� supprim� entre temps ou pas
        IDirectory directory = getDirectoryById(config.getDirectoryId());
        if (directory == null
                || !directory.getTimestamp().equals(config.getDirectory().getTimestamp())) {
            throw new ScanConfigOutOfSyncException();
        }

        String query = " UPDATE config SET name=? ";
        query += " , type=? ";
View Full Code Here

        System.out.println("/" + _d.getName() + "/");
        List<IDirectory> subs = _d.getSubDirectoriesList();
        Iterator<IDirectory> i = subs.iterator();
        while (i.hasNext()) {
            IDirectory child = i.next();
            show(child, _depth + 1);
        }

        List<IConfig<?>> configs = _d.getConfigList();
        Iterator<IConfig<?>> i2 = configs.iterator();
View Full Code Here

        return false;
    }*/

    private static boolean TestSaveConfig() {
        ConfigDAO dao = new ConfigDAO();
        IDirectory root = dao.getRootDirectory();
        IConfig1D dummy = createDummyConfig1D(3, 2, 4);
        dummy.setDirectory(root);

        try {
            IConfig<?> result = dao.saveConfig(dummy);
            if (result != null && result.getId() != null
                    && result.getDirectory().getId() == root.getId()) {
                return true;
            }
        }
        catch (PersistenceException e) {
            // TODO Auto-generated catch block
View Full Code Here

                // Partial mode for recording.
                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

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.