Search in sources :

Example 1 with AttachmentController

use of org.jbei.ice.lib.entry.attachment.AttachmentController in project ice by JBEI.

the class PartResource method addAttachment.

@POST
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Path("/{id}/attachments")
public AttachmentInfo addAttachment(@PathParam("id") final long partId, final AttachmentInfo attachment) {
    final String userId = getUserId();
    final AttachmentController attachmentController = new AttachmentController();
    return attachmentController.addAttachmentToEntry(userId, partId, attachment);
}
Also used : AttachmentController(org.jbei.ice.lib.entry.attachment.AttachmentController)

Example 2 with AttachmentController

use of org.jbei.ice.lib.entry.attachment.AttachmentController in project ice by JBEI.

the class Collection method setFileData.

protected PartData setFileData(String userId, Entry entry, PartData partData) {
    SequenceDAO sequenceDAO = DAOFactory.getSequenceDAO();
    if (sequenceDAO.hasSequence(entry.getId())) {
        partData.setHasSequence(true);
        String name = sequenceDAO.getSequenceFilename(entry);
        partData.setSequenceFileName(name);
    }
    AttachmentController attachmentController = new AttachmentController();
    // check attachment
    if (attachmentController.hasAttachment(entry)) {
        partData.setHasAttachment(true);
        partData.setAttachments(attachmentController.getByEntry(userId, entry.getId()));
    }
    return partData;
}
Also used : AttachmentController(org.jbei.ice.lib.entry.attachment.AttachmentController) SequenceDAO(org.jbei.ice.storage.hibernate.dao.SequenceDAO)

Aggregations

AttachmentController (org.jbei.ice.lib.entry.attachment.AttachmentController)2 SequenceDAO (org.jbei.ice.storage.hibernate.dao.SequenceDAO)1