コード例 #1
0
  // @EJB
  // private UserAccountBeanRemote useracc;
  @Override
  public SocioResearchDTO getResearch(long id) {

    SocioResearch res = em.find(SocioResearch.class, id);
    return res.toDTO();
    // throw new UnsupportedOperationException("Not supported yet.");
  }
コード例 #2
0
 @Override
 public ResearchFilesDTO getResearchFiles(long research_id) {
   SocioResearch dsResearch;
   ResearchFilesDTO dto;
   try {
     dsResearch = em.find(SocioResearch.class, research_id);
     dto = dsResearch.toFilesDTO(em);
   } finally {
   }
   return dto;
 }
コード例 #3
0
 @Override
 public SocioResearchFilesDTO getResearchFilesInCategory(long research_id, String category) {
   // WTF???????????//
   SocioResearch dsResearch, detached;
   ResearchFilesDTO dto;
   SocioResearchFilesDTO dto2;
   try {
     dsResearch = em.find(SocioResearch.class, research_id);
     // dsResearch.addFile(id_file, desc);
     dto = dsResearch.toFilesDTO(em);
     dto2 = new SocioResearchFilesDTO();
     dto2.setFiles_ids(dto.getFileIds(category));
     dto2.setFiles_descs(dto.getFileNames(category));
   } finally {
   }
   return dto2;
 }
コード例 #4
0
 public ArrayList<Long> getSubFiltered(ArrayList<Long> processed, FilterBaseDTO next_filter) {
   // TODO just rewritten from appengine variant. Here we can optimize on multiple filters in one
   // sql statement!!!!
   ArrayList<Long> ids = processed;
   //	if(next_filter instanceof FilterDiapasonDTO)
   //	{
   //		for(FilterBaseDTO dto_sub:((FilterDiapasonDTO)
   // next_filter).getMulti_dto_proxy().getFilters())
   //		{
   //			//here we suppose that multifilter is AND-filter (for diapa)
   //			ids = getSubFiltered(processed, dto_sub);
   //		}
   //	}else
   if (next_filter instanceof FilterMultiDTO) {
     ArrayList<Long> or_ids = new ArrayList<Long>();
     for (FilterBaseDTO dto_sub : ((FilterMultiDTO) next_filter).getFilters()) {
       // here we suppose that multifilter is OR-filter
       ArrayList<Long> curr_ids = getSubFiltered(processed, dto_sub);
       or_ids = union(or_ids, curr_ids);
     }
     if (((FilterMultiDTO) next_filter).getFilters().size() > 0) ids = or_ids;
   } else {
     String filt = next_filter.getFilter();
     if (filt != null && !filt.equals("")) {
       // Query q = pm.newQuery(SocioResearch.class);
       String q_str = "SELECT x FROM SocioResearch AS x WHERE ";
       if (next_filter.getTarget_class_name().equals("SocioResearch")) {
         q_str += filt;
         // q.setFilter(filt);
       }
       TypedQuery<SocioResearch> tq = em.createQuery(q_str, SocioResearch.class);
       ArrayList<Long> current_ids = new ArrayList<Long>();
       List<SocioResearch> res = tq.getResultList();
       for (SocioResearch research : res) {
         current_ids.add(research.getID());
       }
       ids = intersection(ids, current_ids);
     }
   }
   return ids;
 }
コード例 #5
0
  @Override
  public ArrayList<SocioResearchDTO_Light> getResearchDTOs(ArrayList<Long> ids) {
    //       ArrayList<SocioResearchDTO> arr = new ArrayList<SocioResearchDTO>();
    //	if (ids != null)
    //		for(Long key:ids)
    //		{
    //			SocioResearchDTO dto = getResearch(key);
    //			arr.add(dto);
    //		}

    return SocioResearch.getResearchsLightDTOs(em, ids);
  }
コード例 #6
0
  @Override
  public ArrayList<SocioResearchDTO_Light> getResearchSummaries() {
    //     ArrayList<SocioResearchDTO_Light> list = new ArrayList<SocioResearchDTO_Light>();

    // SocioResearch dsResearch, detached;
    //	try {
    //		TypedQuery<SocioResearch> q = em.createQuery("SELECT x FROM SocioResearch x",
    // SocioResearch.class);
    //		List<SocioResearch> res = (List<SocioResearch>)q.getResultList();
    //		for(SocioResearch research:res)
    //		{
    //			list.add(research.toLightDTO());
    //		}
    //	} finally {
    //        }

    return SocioResearch.getResearchsLight(em);
    //     throw new UnsupportedOperationException("Not supported yet.");
  }