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