Package net.sf.archimede.model.folder

Examples of net.sf.archimede.model.folder.FolderImpl


            collectionDao.save(seriesCollection);
           
        }
        Folder folder = getFolderInRepository(seriesCollection);
        if (folder == null) {
            folder = new FolderImpl();
            folder.setName(this.oldFolder.getOiDb());
            folder.setDatestamp(new GregorianCalendar());
            folder.setParentCollection(seriesCollection);
           
            if (folder.getReadUsers() == null) {
View Full Code Here


    private File retrieveMetadataFile(File thesisFolder) {
        return new File(this.sourceFolder.getPath() + File.separator + META + File.separator + new File(thesisFolder.getParent()).getName() + File.separator + thesisFolder.getName() + ".xml");  
    }
   
    private void populateRepositoryFromThesis(File thesisFolderFile) throws ObjectLockedException, ObjectExistsException, FileNotFoundException {
        Folder thesisFolder = new FolderImpl();
        thesisFolder.setName(thesisFolderFile.getName());
        thesisFolder.setDatestamp(new GregorianCalendar());
       
        File metadataFile = this.retrieveMetadataFile(thesisFolderFile);
        ThesisMetadata thesisMetadata = ThesisMetadata.createInstanceFromFile(metadataFile);
       
        DatabaseUtil dbUtil = DatabaseUtil.getSingleton();
        try {
            //FIXME Do not hardcode
            dbUtil.beginTransaction(new CredentialsWrapper(username, password));
           
            Collection folderCollection = this.createOrGetThesisCollection(thesisMetadata);
            if (folderCollection.getFolders() == null) {
                folderCollection.setFolders( new ArrayList() );
            }
            folderCollection.getFolders().add(thesisFolder);
            thesisFolder.setParentCollection(folderCollection);
            if (thesisFolder.getReadUsers() == null) {
                thesisFolder.setReadUsers(new ArrayList());
            }
            thesisFolder.getReadUsers().add(new UserImpl("anonymous", ""));
           
            FolderDao.createInstance().save(thesisFolder);
            this.addMetadateInFolder(thesisMetadata, thesisFolder);
            this.addFilesInFolder(thesisFolderFile, thesisFolder);
           
View Full Code Here

  }
 
  public void testSave() throws TransactionException {
        DatabaseUtil.getSingleton().beginTransaction(new CredentialsWrapper(AllTests.ADMIN_USERNAME, AllTests.ADMIN_PASSWORD));
       
        Folder folder3 = new FolderImpl();
    folder3.setName("folder_3");
    folder3.setParentCollection(this.aCollection);
    folder3.setDatestamp(new GregorianCalendar());
    this.folderDao.save(folder3);
       
        DatabaseUtil.getSingleton().commitTransaction();
    }
View Full Code Here

    public int hashCode() {
        return getId().hashCode();
    }
   
    public static void main(String[] a) {
        FolderImpl folder = new FolderImpl();
        folder.setId("1");
        Object obj1 = folder;
       
        FolderImpl folder2 = new FolderImpl();
        folder2.setId("1");
        Object obj2 = folder2;
       
        System.out.println(obj1.equals(obj2));
       
       
        Set set = new HashSet();
        for (int i = 0; i < 10 ; i++) {
            FolderImpl folder3 = new FolderImpl();
            folder3.setId("1");
            set.add(folder3);
        }
       
        for (Iterator it = set.iterator(); it.hasNext(); ) {
            System.out.println(obj1.equals(it.next()));
View Full Code Here

    public String submit() {
        if (!this.files.isEmpty()) {
            // Re-init the files
            FolderDao folderDao = FolderDao.createInstance();
            Folder folder = new FolderImpl();
            folder.setName("UnamedDocument");
            folder.setParentCollection((Collection) CollectionDao.createInstance().getRootCollection().getCollections().get(0));
            folder.setDatestamp(new GregorianCalendar());
            folderDao.save(folder);
            for (Iterator it = this.files.values().iterator(); it.hasNext();) {
                UploadedFile currentFile = (UploadedFile) it.next();
                List storedFiles = new ArrayList();
                StoredFile newFile = new StoredFileImpl();
                newFile.setName("content" + Math.random() + ".doc");
                newFile.setParent(folder);
                try {
                    newFile.setData(currentFile.getInputStream());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                newFile.setMimeType("application/msword");
                newFile.setLastModified(new GregorianCalendar());
                StoredFileDao.createInstance().save(newFile);
                storedFiles.add(newFile);
                folder.setStoredFiles(storedFiles);
            }

            this.reset();
        }
        return "";
View Full Code Here

        this.newName = newName1;
    }
   
    public String newFolder() throws ObjectLockedException, ObjectExistsException {
        if (this.newName != null && !this.newName.trim().equals("")) {
            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());    
View Full Code Here

TOP

Related Classes of net.sf.archimede.model.folder.FolderImpl

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.