Search in sources :

Example 1 with ShotgunSequenceDTO

use of org.jbei.ice.lib.dto.ShotgunSequenceDTO in project ice by JBEI.

the class PartResource method getShotgunSequences.

@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/{id}/shotgunsequences")
public ArrayList<ShotgunSequenceDTO> getShotgunSequences(@Context final UriInfo info, @PathParam("id") final long partId, @DefaultValue("100") @QueryParam("limit") int limit, @DefaultValue("0") @QueryParam("start") int start) {
    getUserId();
    ShotgunSequenceDAO dao = DAOFactory.getShotgunSequenceDAO();
    final EntryDAO entryDAO = DAOFactory.getEntryDAO();
    final Entry entry = entryDAO.get(partId);
    if (entry == null) {
        return null;
    }
    ArrayList<ShotgunSequenceDTO> returns = new ArrayList<>();
    List<ShotgunSequence> results = dao.getByEntry(entry);
    for (ShotgunSequence ret : results) {
        returns.add(new ShotgunSequenceDTO(ret));
    }
    Logger.info("Shotgun Sequences requested for entry " + partId);
    return returns;
}
Also used : Entry(org.jbei.ice.storage.model.Entry) ShotgunSequence(org.jbei.ice.storage.model.ShotgunSequence) ArrayList(java.util.ArrayList) ShotgunSequenceDAO(org.jbei.ice.storage.hibernate.dao.ShotgunSequenceDAO) EntryDAO(org.jbei.ice.storage.hibernate.dao.EntryDAO) ShotgunSequenceDTO(org.jbei.ice.lib.dto.ShotgunSequenceDTO)

Example 2 with ShotgunSequenceDTO

use of org.jbei.ice.lib.dto.ShotgunSequenceDTO in project ice by JBEI.

the class ShotgunSequence method toDataTransferObject.

// @Override
// public ShotgunSequenceDTO toDataTransferObject() {
//     return null;
// }
@Override
public ShotgunSequenceDTO toDataTransferObject() {
    ShotgunSequence info = new ShotgunSequence();
    info.setId(this.getId());
    info.setCreationTime(this.getCreationTime());
    info.setFilename(this.getFilename());
    info.setFileId(this.getFileId());
    ShotgunSequenceDTO newShotgunDTO = new ShotgunSequenceDTO(info);
    return newShotgunDTO;
}
Also used : ShotgunSequenceDTO(org.jbei.ice.lib.dto.ShotgunSequenceDTO)

Aggregations

ShotgunSequenceDTO (org.jbei.ice.lib.dto.ShotgunSequenceDTO)2 ArrayList (java.util.ArrayList)1 EntryDAO (org.jbei.ice.storage.hibernate.dao.EntryDAO)1 ShotgunSequenceDAO (org.jbei.ice.storage.hibernate.dao.ShotgunSequenceDAO)1 Entry (org.jbei.ice.storage.model.Entry)1 ShotgunSequence (org.jbei.ice.storage.model.ShotgunSequence)1