use of org.jbei.ice.lib.entry.sequence.SequenceFormat in project ice by JBEI.
the class SequenceDAO method getSequenceFormat.
/**
* Retrieves the sequence format of the specified entry, if there is one available.
* Typically, the format is not available if there is no sequence associated with the entry
*
* @param entryId unique identifier for entry
* @return container containing sequence format, if one is found, or null otherwise
* @throws DAOException on hibernate exception
*/
public Optional<SequenceFormat> getSequenceFormat(long entryId) {
try {
CriteriaQuery<SequenceFormat> query = getBuilder().createQuery(SequenceFormat.class);
Root<Sequence> from = query.from(Sequence.class);
Join<Sequence, Entry> entry = from.join("entry");
query.select(from.get("format")).where(getBuilder().equal(entry.get("id"), entryId));
return currentSession().createQuery(query).uniqueResultOptional();
} catch (HibernateException he) {
Logger.error(he);
throw new DAOException(he);
}
}
use of org.jbei.ice.lib.entry.sequence.SequenceFormat in project ice by JBEI.
the class PartResource method customExport.
@POST
@Path("/custom")
@Produces(MediaType.APPLICATION_JSON)
public Response customExport(@QueryParam("sequenceFormat") String sequenceFormat, @DefaultValue("true") @QueryParam("onePerFolder") boolean onePerFolder, EntrySelection selection) {
String userId = super.requireUserId();
SequenceFormat format = SequenceFormat.fromString(sequenceFormat.toUpperCase());
CustomExportTask task = new CustomExportTask(userId, selection, format, onePerFolder);
IceExecutorService.getInstance().runTask(task);
return super.respond(true);
}
Aggregations