Search in sources :

Example 6 with ManuscriptModel

use of org.jbei.ice.storage.model.ManuscriptModel in project ice by JBEI.

the class Manuscripts method add.

public Manuscript add(Manuscript manuscript) {
    // todo : validation
    ManuscriptModel model = new ManuscriptModel();
    model.setCreationTime(new Date());
    model.setStatus(manuscript.getStatus());
    model.setParagonUrl(manuscript.getParagonUrl());
    model.setTitle(manuscript.getTitle());
    model.setAuthorFirstName(manuscript.getAuthorFirstName());
    model.setAuthorLastName(manuscript.getAuthorLastName());
    FolderDetails details = manuscript.getFolder();
    Folder folder = DAOFactory.getFolderDAO().get(details.getId());
    model.setFolder(folder);
    return dao.create(model).toDataTransferObject();
}
Also used : ManuscriptModel(org.jbei.ice.storage.model.ManuscriptModel) FolderDetails(org.jbei.ice.lib.dto.folder.FolderDetails) Folder(org.jbei.ice.storage.model.Folder) Date(java.util.Date)

Example 7 with ManuscriptModel

use of org.jbei.ice.storage.model.ManuscriptModel in project ice by JBEI.

the class Manuscripts method generateZip.

public Manuscript generateZip(long id) {
    ManuscriptModel model = dao.get(id);
    if (model == null)
        return null;
    // get folder
    List<Long> entryIds = this.folderDAO.getFolderContentIds(model.getFolder().getId(), null, true);
    EntriesAsCSV entriesAsCSV = new EntriesAsCSV("GENBANK", "SBOL2");
    entriesAsCSV.setEntries(this.userId, entryIds);
    Manuscript manuscript = model.toDataTransferObject();
    manuscript.setZipFileName(entriesAsCSV.getFilePath().getFileName().toString());
    return manuscript;
}
Also used : ManuscriptModel(org.jbei.ice.storage.model.ManuscriptModel) EntriesAsCSV(org.jbei.ice.lib.entry.EntriesAsCSV)

Aggregations

ManuscriptModel (org.jbei.ice.storage.model.ManuscriptModel)7 HibernateException (org.hibernate.HibernateException)2 DAOException (org.jbei.ice.storage.DAOException)2 Date (java.util.Date)1 Results (org.jbei.ice.lib.dto.common.Results)1 FolderDetails (org.jbei.ice.lib.dto.folder.FolderDetails)1 EntriesAsCSV (org.jbei.ice.lib.entry.EntriesAsCSV)1 FolderPermissions (org.jbei.ice.lib.folder.FolderPermissions)1 Folder (org.jbei.ice.storage.model.Folder)1