Package net.sf.archimede.model.collection

Examples of net.sf.archimede.model.collection.Collection


        this.newName = newName1;
    }
   
    public String newCollection() throws ObjectLockedException, ObjectExistsException {
        if (this.newName != null && !this.newName.trim().equals("")) {
            Collection collection = new CollectionImpl();
            collection.setName(this.newName);
            collection.setParent(this.selectedCollection.getCollection());
            CollectionDao.createInstance().save(collection);
            this.newName = null;
        }
        this.selectedCollection = new ViewCollection(CollectionDao.createInstance().retrieve(this.selectedCollection.getId()));
        this.collections = this.selectedCollection.getCollectionsModel();
View Full Code Here


    public String seeParentCollectionFromFolder() {
        ViewCollection selectedCollection = (ViewCollection) this.selectedFolder.getParentCollectionsModel().getRowData();
       
        //Get a fresh copy
        String selectCollectionId = selectedCollection.getId();
        Collection collection = CollectionDao.createInstance().retrieve(selectCollectionId);
       
        List collectionCollections = collection.getCollections();
        List collectionViewCollections = new ArrayList(collectionCollections.size());
        for (Iterator it = collectionCollections.iterator(); it.hasNext(); ) {
            collectionViewCollections.add(new ViewCollection((Collection) it.next()));
        }
        DataModel collections = new ListDataModel();
        collections.setWrappedData(collectionViewCollections);
        CollectionBean collectionBean = (CollectionBean) FacesContext.getCurrentInstance().getApplication().createValueBinding(CollectionBean.BEAN_REF).getValue(FacesContext.getCurrentInstance());
        collectionBean.setCollections(collections);
        collectionBean.setSelectedCollection(new ViewCollection(collection));
       
        List collectionFolders = collection.getFolders();
        List collectionViewFolders = new ArrayList(collectionFolders.size());
        for (Iterator it = collectionFolders.iterator(); it.hasNext(); ) {
            collectionViewFolders.add(new ViewFolder((Folder) it.next()));
        }
       
View Full Code Here

        return "";
    }
    public String paste() throws ObjectLockedException, ObjectExistsException {
        FolderDao folderDao = FolderDao.createInstance();
        CollectionBean collectionBean = (CollectionBean) FacesContext.getCurrentInstance().getApplication().createValueBinding(CollectionBean.BEAN_REF).getValue(FacesContext.getCurrentInstance());    
        Collection destinationCollection = collectionBean.getSelectedCollection();
        if (this.selectedFolders != null) {
            if (this.cutRequested && this.copyRequested) {
                throw new IllegalStateException("The object cannot request cut and copy operations all at once.");
            }
            if (this.cutRequested) {
                for (Iterator it = this.selectedFolders.iterator(); it.hasNext(); ){
                    ViewFolder viewFolder = (ViewFolder) it.next();
                    Folder cutFolder = viewFolder.getFolder();
                    folderDao.cutTo(cutFolder, destinationCollection);
                    this.cutRequested = false;
                }               
            } else if (this.copyRequested) {
                for (Iterator it = this.selectedFolders.iterator(); it.hasNext(); ){
                    ViewFolder viewFolder = (ViewFolder) it.next();
                    Folder copiedFolder = viewFolder.getFolder();
                    folderDao.copyTo(copiedFolder, destinationCollection);
                    this.copyRequested = false;
               
            } else {
                //All false: nothing to do
            }
            this.selectedFolders = null;
            ViewCollection viewDestinationCollection = new ViewCollection(CollectionDao.createInstance().retrieve(destinationCollection.getId()));
            this.folders = viewDestinationCollection.getFoldersModel();
        }
        return "";
    }
View Full Code Here

            if (currentViewFolder.isSelected()) {
                FolderDao.createInstance().remove(currentViewFolder.getFolder());
            }
        }
        CollectionBean collectionBean = (CollectionBean) FacesContext.getCurrentInstance().getApplication().createValueBinding(CollectionBean.BEAN_REF).getValue(FacesContext.getCurrentInstance());    
        Collection destinationCollection = collectionBean.getSelectedCollection();
        ViewCollection viewDestinationCollection = new ViewCollection(CollectionDao.createInstance().retrieve(destinationCollection.getId()));
        this.folders = viewDestinationCollection.getFoldersModel();
        return "";
    }
View Full Code Here

            Folder folder = new FolderImpl();
            folder.setName(this.newName);
            folder.setDatestamp(new GregorianCalendar());
           
            CollectionBean collectionBean = (CollectionBean) FacesContext.getCurrentInstance().getApplication().createValueBinding(CollectionBean.BEAN_REF).getValue(FacesContext.getCurrentInstance());    
            Collection destinationCollection = collectionBean.getSelectedCollection();
           
            folder.setParentCollection(destinationCollection);
            FolderDao.createInstance().save(folder);
            this.newName = null;
        }
       
        CollectionBean collectionBean = (CollectionBean) FacesContext.getCurrentInstance().getApplication().createValueBinding(CollectionBean.BEAN_REF).getValue(FacesContext.getCurrentInstance());    
        Collection destinationCollection = collectionBean.getSelectedCollection();
        ViewCollection viewDestinationCollection = new ViewCollection(CollectionDao.createInstance().retrieve(destinationCollection.getId()));
        this.folders = viewDestinationCollection.getFoldersModel();
       
        return "";
    }
View Full Code Here

     *
     * @return
     */
    public String seeParentFromResults() {
        ViewFolder selectedFolderResult = (ViewFolder) this.results.getRowData();
        Collection collection = (Collection) selectedFolderResult.getParentCollectionsModel().getRowData();
        CollectionBean collectionBean = (CollectionBean) FacesContext.getCurrentInstance().getApplication().createValueBinding(CollectionBean.BEAN_REF).getValue(FacesContext.getCurrentInstance());
        collectionBean.setSelectedCollection(new ViewCollection(collection));

        return "exploration_collection_description";
    }
View Full Code Here

        }
    }
   
    public void save(Group group) {
        try {
            Collection parent = group.getParent();
            if (parent == null) {
                throw new IllegalArgumentException("Parent collection cannot be null");
            } else if (parent.getId() == null) {
                throw new IllegalArgumentException("Parent collection needs to be saved first");
            }
           
            String parentId = parent.getId();
            Session session = (Session) DatabaseUtil.getSingleton().getDaoSession();
           
            Node parentNode = session.getNodeByUUID(parentId);
            Node groupNode = parentNode.getNode(NodesTypes.PREFIX + CollectionDao.GROUPS_NODE_NAME).addNode(group.getName(), NodesTypes.PREFIX + NAME);
           
View Full Code Here

            try {
                Session session = (Session) DatabaseUtil.getSingleton().getDaoSession();
                Node node = session.getNodeByUUID(this.group.getId());
                if (method.getName().equals("getParent") && !this.isParentInit) {
                    Node parentNode = node.getParent();
                    Collection parent = CollectionDao.createInstance().retrieve(parentNode.getParent().getUUID());
                    this.group.setParent(parent);
                    this.isParentInit = true;
                    return this.group.getParent();
                } else if (method.getName().equals("getUsers") && !this.isUsersInit) {
                    List users = new ArrayList();
View Full Code Here

            user.setUsername("user");
            user.setPassword("user");
            UserDao.createInstance().save(user);
           
            CollectionDao collectionDao = CollectionDao.createInstance();
            Collection rootCollection = new CollectionImpl();
            rootCollection.setName(CollectionDao.ROOT_COLLECTION);
            rootCollection.setDescription("Access point");
            //Read
            {
                List readUsers = new ArrayList();
                readUsers.add(anonymous);
                readUsers.add(admin);
                rootCollection.setReadUsers(readUsers);
            }
            {
                List writeUsers = new ArrayList();
                writeUsers.add(admin);
                rootCollection.setWriteUsers(writeUsers);
            }
            {
                List removeUsers = new ArrayList();
                removeUsers.add(admin);
                rootCollection.setRemoveUsers(removeUsers);
            }
            {
                List ownerUsers = new ArrayList();
                ownerUsers.add(admin);
                rootCollection.setOwnerUsers(ownerUsers);
            }
           
            collectionDao.save(rootCollection);
           
            dbUtil.commitTransaction();
View Full Code Here

    public void save(Folder folder) {
       
        //TODO Vérfier que les permissions sont correctes.

        try {
            Collection parentCollection = folder.getParentCollection();
            if (parentCollection == null) {
                throw new IllegalArgumentException("Parent collection cannot be null");
            } else if (parentCollection.getId() == null) {
                throw new IllegalArgumentException("Parent collection needs to be saved first");
            }
           
            String parentId = parentCollection.getId();
            Session session = (Session) DatabaseUtil.getSingleton().getDaoSession();
           
            Node folderNode = null;
            //New folder
            if (folder.getId() == null) {
View Full Code Here

TOP

Related Classes of net.sf.archimede.model.collection.Collection

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.