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);
}
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;
}
Aggregations