Search in sources :

Example 1 with Attachments

use of org.jbei.ice.lib.entry.attachment.Attachments 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 Attachments attachments = new Attachments();
    return attachments.addAttachmentToEntry(userId, partId, attachment);
}
Also used : Attachments(org.jbei.ice.lib.entry.attachment.Attachments)

Example 2 with Attachments

use of org.jbei.ice.lib.entry.attachment.Attachments 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);
    }
    Attachments attachments = new Attachments();
    // check attachment
    if (DAOFactory.getAttachmentDAO().hasAttachment(entry)) {
        partData.setHasAttachment(true);
        partData.setAttachments(attachments.getByEntry(userId, entry.getId()));
    }
    return partData;
}
Also used : SequenceDAO(org.jbei.ice.storage.hibernate.dao.SequenceDAO) Attachments(org.jbei.ice.lib.entry.attachment.Attachments)

Aggregations

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