Package net.sf.archimede.model.collection

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


        }
        return this.exists.booleanValue();
    }
   
    private Collection getGroupInRepository() throws TransactionException {
        CollectionDao collectionDao = CollectionDao.createInstance();
        Collection rootCollection = collectionDao.getRootCollection();
       
        List collections = rootCollection.getCollections();
        //Community
        for (Iterator collIt = collections.iterator(); collIt.hasNext(); ){
            Collection currentCollection = (Collection) collIt.next();
View Full Code Here


            throw new IllegalStateException("Cannot insert folder: Folder already exists.");
        }
       
        Collection groupCollection = getGroupInRepository();
        if (groupCollection == null) {
            CollectionDao collectionDao = CollectionDao.createInstance();
            Collection rootCollection = collectionDao.getRootCollection();
            groupCollection = new CollectionImpl();
            groupCollection.setName(this.oldFolder.getGroupName());
            groupCollection.setParent(rootCollection);
           
            if (groupCollection.getReadUsers() == null) {
              groupCollection.setReadUsers(new ArrayList());
            }
            groupCollection.getReadUsers().add(new UserImpl("anonymous", ""));
           
            if (rootCollection.getCollections() != null) {
                rootCollection.getCollections().add(groupCollection);
            } else {
                List collections = new ArrayList();
                collections.add(groupCollection);
                rootCollection.setCollections(collections);
            }
           
            collectionDao.save(groupCollection);
        }
           
        Collection seriesCollection = getSeriesInRepository(groupCollection);
        if (seriesCollection == null) {
            CollectionDao collectionDao = CollectionDao.createInstance();
            seriesCollection = new CollectionImpl();
            seriesCollection.setName(this.oldFolder.getSeriesName());
            seriesCollection.setParent(groupCollection);
           
            if (seriesCollection.getReadUsers() == null) {
              seriesCollection.setReadUsers(new ArrayList());
            }
            seriesCollection.getReadUsers().add(new UserImpl("anonymous", ""));
           
            if (groupCollection.getCollections() != null) {
                groupCollection.getCollections().add(seriesCollection);
            } else {
                List collections = new ArrayList();
                collections.add(seriesCollection);
                groupCollection.setCollections(collections);
            }
            collectionDao.save(seriesCollection);
           
        }
        Folder folder = getFolderInRepository(seriesCollection);
        if (folder == null) {
            folder = new FolderImpl();
View Full Code Here

        }
        thesisFolder.setStoredFiles(storedFiles);
    }
   
    private Collection createOrGetThesisCollection(ThesisMetadata thesisMetadata) throws ObjectLockedException, ObjectExistsException {
        CollectionDao collectionDao = CollectionDao.createInstance();
        Collection rootCollection = collectionDao.getRootCollection();
       
        Collection thesisCollection = this.createOrGetCollection(rootCollection, this.thesesCollectionName);
       
        String classification = thesisMetadata.getClassification();
        Collection classificationCollection = this.createOrGetCollection(thesisCollection, classification);
View Full Code Here

        this.limitPerRequest = Integer.parseInt((String) properties.get("Archimede.limitPerRequest"));
    }
   
    private List listCollections() {
        DatabaseUtil.getSingleton().beginTransaction(new CredentialsWrapper(this.username, this.password));
        CollectionDao collectionDao = CollectionDao.createInstance();
        List collections = collectionDao.list();
        return collections;
    }
View Full Code Here

   
    private ViewFolder selectedFolder;
    private ViewCollection currentCollection;
   
    public WorkspaceBean() {
        CollectionDao collectionDao = CollectionDao.createInstance();
        this.currentCollection = new ViewCollection(collectionDao.getRootCollection());
    }
View Full Code Here

    return this.treeModel;
  }

  private TreeNode getTreeNode() {

    CollectionDao collectionDao = CollectionDao.createInstance();
    Collection collection = collectionDao.getRootCollection();
    if (collection == null) {
      CustomTreeNode treeData = new CustomTreeNode("root", " ", false);
      return treeData;
    }
View Full Code Here

        FolderBean.BEAN_REF).getValue(
        FacesContext.getCurrentInstance());
   
    TreeNode treeNode = this.treeModel.getNode();
    String identifier = treeNode.getIdentifier();
    CollectionDao collectionDao = CollectionDao.createInstance();
    Collection collection = collectionDao.retrieve(identifier);
    List allViewFolders = new ArrayList();
    List elem = populateAllViewFolders(collection,
        allViewFolders);
    ListDataModel ldm = new ListDataModel();
    ldm.setWrappedData(elem);
View Full Code Here

    public void setSelectedCollection(ViewCollection selectedCollection1) {
        this.selectedCollection = selectedCollection1;
    }
   
    public String update() {
        CollectionDao collectionDao = CollectionDao.createInstance();
        try {
            collectionDao.update(this.selectedCollection.getCollection());
        } catch (ObjectLockedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (ObjectExistsException e) {
            // TODO Auto-generated catch block
View Full Code Here

    }
   
    public String open() {
        this.selectedCollection = (ViewCollection) this.collections.getRowData();
        //Refresh the value
        CollectionDao collectionDao = CollectionDao.createInstance();
        Collection collection = collectionDao.retrieve(this.selectedCollection.getId());
        this.selectedCollection = new ViewCollection(collection);
       
        return "workspace_collection_edition";
    }
View Full Code Here

            }
        }
        return "";
    }
    public String paste() throws ObjectLockedException, ObjectExistsException {
        CollectionDao collectionDao = CollectionDao.createInstance();
        Collection destinationCollection = this.selectedCollection.getCollection();
        if (this.selectedCollections != 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.selectedCollections.iterator(); it.hasNext(); ){
                    ViewCollection viewCollection = (ViewCollection) it.next();
                    Collection cutCollection = viewCollection.getCollection();
                    collectionDao.cutTo(cutCollection, destinationCollection);
                    this.cutRequested = false;
                }               
            } else if (this.copyRequested) {
                for (Iterator it = this.selectedCollections.iterator(); it.hasNext(); ){
                    ViewCollection viewCollection = (ViewCollection) it.next();
                    Collection copiedCollection = viewCollection.getCollection();
                    collectionDao.copyTo(copiedCollection, destinationCollection);
                    this.copyRequested = false;
               
            } else {
                //All false: nothing to do
            }
View Full Code Here

TOP

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

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.