// 重点关注的剧集取出全部剧集链接
  private static AuditEpisodeLogBo.SiteEpisodeLog processConcernProgramme(int psId, int siteId)
      throws Exception {

    Criteria peCrit = new Criteria();
    peCrit.add(ProgrammeEpisodePeer.FK_PROGRAMME_SITE_ID, psId);
    List<ProgrammeEpisode> peList = ProgrammeEpisodePeer.doSelect(peCrit);
    List<EpisodeLog> logList = new ArrayList<EpisodeLog>();
    log.info("peList size" + peList.size());
    if (peList != null && !peList.isEmpty()) {
      for (ProgrammeEpisode pe : peList) {
        EpisodeLog el = new EpisodeLog();
        el.setTitle(pe.getTitle());
        el.setHd(pe.getHd());
        el.setOrderId(pe.getOrderId());
        el.setUrl(pe.getUrl());
        el.setSeconds(pe.getSeconds());
        el.setId(-1);
        logList.add(el);
      }
    }

    AuditEpisodeLogBo.SiteEpisodeLog siteLog = new AuditEpisodeLogBo.SiteEpisodeLog();
    siteLog.setSiteId(siteId);
    siteLog.setSiteName(SiteService.getSiteName(siteId));
    log.info("siteName" + siteLog.getSiteName());
    siteLog.setEpisodeLogList(logList);

    return siteLog;
  }
Esempio n. 2
0
 public DBOutputWriter(Scenario scenario) {
   super(scenario);
   try {
     db_scenario = ScenariosPeer.retrieveByPK(str2id(scenario.getId()));
   } catch (NoRowsException exc) {
     logger.error("Scenario " + str2id(scenario.getId()) + " was not found in the database");
   } catch (TooManyRowsException exc) {
     logger.error("Data integrity violation", exc);
   } catch (TorqueException exc) {
     logger.error("Could not load scenario " + str2id(scenario.getId()), exc);
   }
   db_vehicle_type = new VehicleTypes[scenario.getNumVehicleTypes()];
   if (null != db_scenario) {
     logger.info("Loading vehicle types");
     Criteria crit = new Criteria();
     crit.addJoin(VehicleTypesPeer.VEHICLE_TYPE_ID, VehicleTypesInSetsPeer.VEHICLE_TYPE_ID);
     crit.add(VehicleTypesInSetsPeer.VEHICLE_TYPE_SET_ID, db_scenario.getVehicleTypeSetId());
     try {
       @SuppressWarnings("unchecked")
       List<VehicleTypes> db_vt_l = VehicleTypesPeer.doSelect(crit);
       for (VehicleTypes db_vt : db_vt_l)
         for (int i = 0; i < scenario.getNumVehicleTypes(); ++i)
           if (db_vt.getName().equals(scenario.getVehicleTypeNames()[i]))
             db_vehicle_type[i] = db_vt;
     } catch (TorqueException exc) {
       logger.error("Failed to load vehicle types for scenario " + db_scenario.getId(), exc);
     }
   }
 }
Esempio n. 3
0
 /**
  * Loads filterCategoryBeans by repository
  *
  * @param repository
  * @param personID
  * @return
  */
 @Override
 public List<TReportCategoryBean> loadByRepositoryPersonProjects(
     Integer repository, Integer personID, List<Integer> projects) {
   List<TReportCategory> categories = new ArrayList<TReportCategory>();
   Criteria criteria = new Criteria();
   criteria.add(REPOSITORY, repository);
   if (personID != null) {
     criteria.add(CREATEDBY, personID);
   }
   if (projects != null && !projects.isEmpty()) {
     criteria.addIn(PROJECT, projects);
   }
   criteria.addAscendingOrderByColumn(LABEL);
   try {
     categories.addAll(doSelect(criteria));
   } catch (Exception e) {
     LOGGER.error(
         "Getting filter categories by repository "
             + repository
             + " personID "
             + personID
             + " projects "
             + projects
             + " failed with "
             + e.getMessage(),
         e);
   }
   return convertTorqueListToBeanList(categories);
 }
Esempio n. 4
0
 /**
  * Loads a filterCategoryBeans by parentIDs
  *
  * @param parentIDs
  * @return
  */
 @Override
 public List<TReportCategoryBean> loadByParents(List<Integer> parentIDs) {
   List<TReportCategory> categories = new ArrayList<TReportCategory>();
   if (parentIDs == null || parentIDs.isEmpty()) {
     return new ArrayList<TReportCategoryBean>();
   }
   List<int[]> parentIDChunksList = GeneralUtils.getListOfChunks(parentIDs);
   if (parentIDChunksList != null && !parentIDChunksList.isEmpty()) {
     Iterator<int[]> iterator = parentIDChunksList.iterator();
     while (iterator.hasNext()) {
       int[] parentIDsChunk = iterator.next();
       Criteria criteria = new Criteria();
       criteria.addIn(PARENTID, parentIDsChunk);
       criteria.addAscendingOrderByColumn(LABEL);
       try {
         categories.addAll(doSelect(criteria));
       } catch (Exception e) {
         LOGGER.error(
             "Getting the report categories by parents "
                 + parentIDsChunk.length
                 + " failed with "
                 + e.getMessage(),
             e);
       }
     }
   }
   return convertTorqueListToBeanList(categories);
 }
Esempio n. 5
0
 /**
  * Whether a system option from list appears as custom attribute The reflection does not work
  * because an additional condition should be satisfied (no direct foreign key relationship exists)
  *
  * @param objectIDs
  * @param fieldID
  */
 @Override
 public boolean isSystemOptionAttribute(List<Integer> objectIDs, Integer fieldID) {
   if (objectIDs == null || objectIDs.isEmpty()) {
     return false;
   }
   List attributes = null;
   Criteria selectCriteria;
   List<int[]> chunkList = GeneralUtils.getListOfChunks(objectIDs);
   Iterator<int[]> iterator = chunkList.iterator();
   while (iterator.hasNext()) {
     int[] idChunk = iterator.next();
     selectCriteria = new Criteria();
     selectCriteria.addIn(SYSTEMOPTIONID, idChunk);
     selectCriteria.add(SYSTEMOPTIONTYPE, fieldID);
     selectCriteria.setDistinct();
     try {
       attributes = doSelect(selectCriteria);
     } catch (Exception e) {
       LOGGER.error(
           "Verifiying the dependent "
               + "oldPersonIDs "
               + objectIDs.size()
               + " for the user picker failed with "
               + e.getMessage(),
           e);
     }
     if (attributes != null && !attributes.isEmpty()) {
       return true;
     }
   }
   return false;
 }
  /* (non-Javadoc)
   * @see net.sf.iquiver.service.BaseService#doStart()
   */
  protected void doStart() {
    String indexDirectory = IQuiver.getConfiguration().getString("lucene.index.path");

    Criteria crit = new Criteria();

    try {
      List sources = ContentSourcePeer.doSelectAll();

      for (Iterator iter = sources.iterator(); iter.hasNext(); ) {
        ContentSource source = (ContentSource) iter.next();
        crit.clear();
        crit.add(ContentPeer.CONTENT_TO_DELETE, true);
        crit.add(ContentPeer.CONTENT_SOURCE_ID, source.getContentSourceId());
        List docs = ContentPeer.doSelect(crit);

        if (docs != null) {
          for (Iterator it = docs.iterator(); it.hasNext(); ) {
            Content content = (Content) it.next();
            content.setRemoved(true);
          }

          IndexScheduler scheduler =
              IndexScheduler.getInstance(
                  indexDirectory + File.separator + String.valueOf(source.getContentSourceId()));
          scheduler.scheduleForIndexing(docs);
        }

        ContentPeer.doDelete(crit);
      }
    } catch (TorqueException e) {
      logger.error("Error occured while deleting all marked contents from database!", e);
    }
  }
Esempio n. 7
0
 /**
  * Loads a list of attributeValueBeans from the TAttributeValue table by an array of workItemIDs
  *
  * @param workItemIDs
  * @return
  */
 @Override
 public List<TAttributeValueBean> loadByWorkItemKeys(int[] workItemIDs) {
   List<TAttributeValueBean> attributeValueBeansList = new ArrayList<TAttributeValueBean>();
   List<TAttributeValue> tav = new ArrayList<TAttributeValue>();
   if (workItemIDs == null || workItemIDs.length == 0) {
     return attributeValueBeansList;
   }
   Criteria criteria;
   List<int[]> workItemIDChunksList = GeneralUtils.getListOfChunks(workItemIDs);
   if (workItemIDChunksList == null) {
     return attributeValueBeansList;
   }
   Iterator<int[]> iterator = workItemIDChunksList.iterator();
   while (iterator.hasNext()) {
     int[] workItemIDChunk = iterator.next();
     criteria = new Criteria();
     criteria.addIn(WORKITEM, workItemIDChunk);
     try {
       tav.addAll(doSelect(criteria));
     } catch (Exception e) {
       LOGGER.error(
           "Loading the attributeValueBeans by workItemIDs failed with " + e.getMessage());
     }
   }
   return convertTorqueListToBeanList(tav);
 }
Esempio n. 8
0
 private com.relteq.sirius.jaxb.NetworkConnections restoreNetworkConnections(
     NetworkConnectionSets db_ncs) throws TorqueException {
   if (null == db_ncs) return null;
   com.relteq.sirius.jaxb.NetworkConnections nc = factory.createNetworkConnections();
   nc.setId(id2str(db_ncs.getId()));
   nc.setName(db_ncs.getName());
   nc.setDescription(db_ncs.getDescription());
   Criteria crit = new Criteria();
   crit.addAscendingOrderByColumn(NetworkConnectionsPeer.FROM_NETWORK_ID);
   crit.addAscendingOrderByColumn(NetworkConnectionsPeer.TO_NETWORK_ID);
   @SuppressWarnings("unchecked")
   List<NetworkConnections> db_nc_l = db_ncs.getNetworkConnectionss(crit);
   com.relteq.sirius.jaxb.Networkpair np = null;
   for (NetworkConnections db_nc : db_nc_l) {
     if (null != np
         && (!np.getNetworkA().equals(id2str(db_nc.getFromNetworkId()))
             || !np.getNetworkB().equals(id2str(db_nc.getToNetworkId())))) {
       nc.getNetworkpair().add(np);
       np = null;
     }
     if (null == np) {
       np = factory.createNetworkpair();
       np.setNetworkA(id2str(db_nc.getFromNetworkId()));
       np.setNetworkB(id2str(db_nc.getToNetworkId()));
     }
     com.relteq.sirius.jaxb.Linkpair lp = factory.createLinkpair();
     lp.setLinkA(id2str(db_nc.getFromLinkId()));
     lp.setLinkB(id2str(db_nc.getToLinkId()));
     np.getLinkpair().add(lp);
   }
   if (null != np) nc.getNetworkpair().add(np);
   return nc;
 }
Esempio n. 9
0
  private com.relteq.sirius.jaxb.DemandProfile restoreDemandProfile(DemandProfiles db_dp)
      throws TorqueException {
    com.relteq.sirius.jaxb.DemandProfile dp = factory.createDemandProfile();
    dp.setKnob(db_dp.getKnob());
    dp.setStartTime(db_dp.getStartTime());
    dp.setDt(db_dp.getDt());
    dp.setLinkIdOrigin(id2str(db_dp.getOriginLinkId()));
    if (null != db_dp.getDestinationLinkId())
      dp.setDestinationLinkId(id2str(db_dp.getDestinationLinkId()));
    dp.setStdDevAdd(db_dp.getStdDeviationAdditive());
    dp.setStdDevMult(db_dp.getStdDeviationMultiplicative());

    Criteria crit = new Criteria();
    crit.addAscendingOrderByColumn(DemandsPeer.NUMBER);
    crit.addAscendingOrderByColumn(DemandsPeer.VEHICLE_TYPE_ID);
    @SuppressWarnings("unchecked")
    List<Demands> db_demand_l = db_dp.getDemandss(crit);
    StringBuilder sb = null;
    Integer number = null;
    for (Demands db_demand : db_demand_l) {
      if (null == sb) sb = new StringBuilder();
      else sb.append(db_demand.getNumber().equals(number) ? ':' : ',');
      number = db_demand.getNumber();
      sb.append(db_demand.getDemand().toPlainString());
    }
    if (null != sb) dp.setContent(sb.toString());
    return dp;
  }
Esempio n. 10
0
 /**
  * Get the custom option type attributeValueBeans for an array of workItemIDs
  *
  * @param workItemIDs
  * @return
  */
 @Override
 public List<TAttributeValueBean> loadLuceneCustomOptionAttributeValues(int[] workItemIDs) {
   List<TAttributeValueBean> attributeValueBeansList = new ArrayList<TAttributeValueBean>();
   if (workItemIDs == null || workItemIDs.length == 0) {
     return attributeValueBeansList;
   }
   Criteria criteria;
   List<int[]> workItemIDChunksList = GeneralUtils.getListOfChunks(workItemIDs);
   if (workItemIDChunksList == null) {
     return attributeValueBeansList;
   }
   Iterator<int[]> iterator = workItemIDChunksList.iterator();
   while (iterator.hasNext()) {
     int[] workItemIDChunk = iterator.next();
     criteria = new Criteria();
     criteria.addIn(WORKITEM, workItemIDChunk);
     try {
       attributeValueBeansList.addAll(getReportCustomOptionAttributeValues(criteria));
     } catch (Exception e) {
       LOGGER.error(
           "Loading the custom option type attributeValueBeans by workItemIDs failed with "
               + e.getMessage());
     }
   }
   return attributeValueBeansList;
 }
  private static AuditEpisodeLogBo.SiteEpisodeLog getSiteEpisodeLog(int psId, int siteId)
      throws Exception {
    Criteria logCrit = new Criteria();
    logCrit.add(EpisodeLogPeer.FK_PROGRAMME_SITE_ID, psId);
    logCrit.add(EpisodeLogPeer.STATUS, Constants.EPISODE_LOG_NOTHANDLED);
    logCrit.add(EpisodeLogPeer.SOURCE, (Object) "", Criteria.NOT_EQUAL);
    // logCrit.add(EpisodeLogPeer.OPERATOR, (Object) "Spider", Criteria.NOT_EQUAL);
    // log.info(logCrit);
    List<EpisodeLog> logList = EpisodeLogPeer.doSelect(logCrit);
    AuditEpisodeLogBo.SiteEpisodeLog siteLog = new AuditEpisodeLogBo.SiteEpisodeLog();
    siteLog.setSiteId(siteId);
    siteLog.setSiteName(SiteService.getSiteName(siteId));
    // log.info("siteName" + siteLog.getSiteName());

    List<EpisodeLog> noSpiderLogList = new ArrayList<EpisodeLog>();
    for (EpisodeLog l : logList) {
      if (StringUtils.isBlank(l.getOperator())) {
        noSpiderLogList.add(l);
      }
    }

    siteLog.setEpisodeLogList(noSpiderLogList);

    return siteLog;
  }
Esempio n. 12
0
 /** Build a Criteria object from the data object for this peer */
 public static Criteria buildCriteria(TRoleListType obj) {
   Criteria criteria = new Criteria(DATABASE_NAME);
   if (!obj.isNew()) criteria.add(OBJECTID, obj.getObjectID());
   criteria.add(PROLE, obj.getRole());
   criteria.add(LISTTYPE, obj.getListType());
   criteria.add(TPUUID, obj.getUuid());
   return criteria;
 }
Esempio n. 13
0
 /** Build a Criteria object from the data object for this peer */
 public static Criteria buildCriteria(TDomain obj) {
   Criteria criteria = new Criteria(DATABASE_NAME);
   if (!obj.isNew()) criteria.add(OBJECTID, obj.getObjectID());
   criteria.add(LABEL, obj.getLabel());
   criteria.add(DESCRIPTION, obj.getDescription());
   criteria.add(TPUUID, obj.getUuid());
   return criteria;
 }
Esempio n. 14
0
  /**
   * Find hot words on index page
   *
   * @param conn
   * @return
   * @throws TorqueException
   */
  public static List<Hotword> findIndexVideo() throws TorqueException {
    Criteria crit = new Criteria();
    crit.add(HotwordPeer.INDEX_TYPE, Constants.INDEX_DISPLAY);
    crit.addDescendingOrderByColumn(HotwordPeer.SORT);

    List<Hotword> hotwordList = HotwordPeer.doSelect(crit);
    return hotwordList;
  }
Esempio n. 15
0
  public static List<Hotword> findHotwordByName(String hotwordName) throws TorqueException {

    Criteria crit = new Criteria();
    crit.add(HotwordPeer.NAME, hotwordName);

    List<Hotword> hotwordList = HotwordPeer.doSelect(crit);
    return hotwordList;
  }
 /** Build a Criteria object from the data object for this peer */
 public static Criteria buildCriteria(AttendenceSeet obj) {
   Criteria criteria = new Criteria(DATABASE_NAME);
   if (!obj.isNew()) criteria.add(ID, obj.getId());
   criteria.add(USER_ID, obj.getUserId());
   criteria.add(LOGIN_DATE, obj.getLoginDate());
   criteria.add(IPADDRESS, obj.getIpaddress());
   return criteria;
 }
Esempio n. 17
0
  public static List<Hotword> findHotwordByItemId(int itemId) throws TorqueException {

    Criteria crit = new Criteria();
    crit.add(HotwordPeer.ITEM_ID, itemId);

    List<Hotword> hotwordList = HotwordPeer.doSelect(crit);
    return hotwordList;
  }
 private static void setDbName(Criteria crit) {
   // Set the correct dbName if it has not been overridden
   // crit.getDbName will return the same object if not set to
   // another value so == check is okay and faster
   if (crit.getDbName() == Torque.getDefaultDB()) {
     crit.setDbName(DATABASE_NAME);
   }
 }
Esempio n. 19
0
 private com.relteq.sirius.jaxb.Outputs restoreOutputs(Nodes db_node) throws TorqueException {
   Criteria crit = new Criteria();
   crit.add(LinksPeer.NETWORK_ID, db_node.getNetworkId());
   crit.add(LinksPeer.BEG_NODE_ID, db_node.getId());
   @SuppressWarnings("unchecked")
   List<Links> db_link_l = LinksPeer.doSelect(crit);
   com.relteq.sirius.jaxb.Outputs outputs = factory.createOutputs();
   for (Links db_link : db_link_l) outputs.getOutput().add(restoreOutput(db_link));
   return outputs;
 }
Esempio n. 20
0
 /**
  * Deletes an attributeValueBean from the TAttributeValue table by ID
  *
  * @param objectID
  */
 @Override
 public void deleteByObjectID(Integer objectID) {
   Criteria crit = new Criteria();
   crit.add(OBJECTID, objectID);
   try {
     doDelete(crit);
   } catch (TorqueException e) {
     LOGGER.error("Deleting an attribute value by ID " + objectID + " failed with: " + e);
   }
 }
Esempio n. 21
0
 /**
  * Retrieve a multiple objects by pk
  *
  * @param pks List of primary keys
  * @param dbcon the connection to use
  * @throws TorqueException Any exceptions caught during processing will be rethrown wrapped into a
  *     TorqueException.
  */
 public static List retrieveByPKs(List pks, Connection dbcon) throws TorqueException {
   List objs = null;
   if (pks == null || pks.size() == 0) {
     objs = new LinkedList();
   } else {
     Criteria criteria = new Criteria();
     criteria.addIn(EXAM_ID, pks);
     objs = doSelect(criteria, dbcon);
   }
   return objs;
 }
 private Criteria ordenacion(Criteria c, String CampoOrdenacion, String OrdenOrdenacion) {
   if ((OrdenOrdenacion != null) && (OrdenOrdenacion.compareTo("ASC") == 0))
     if ((CampoOrdenacion != null)) {
       c.addAscendingOrderByColumn(CampoOrdenacion.toString());
     }
   if ((OrdenOrdenacion != null) && (OrdenOrdenacion.compareTo("DESC") == 0))
     if ((CampoOrdenacion != null)) {
       c.addDescendingOrderByColumn(CampoOrdenacion.toString());
     }
   return c;
 }
Esempio n. 23
0
 /**
  * Delete all private report categories of a person
  *
  * @param personID
  */
 @Override
 public void deletePrivateReportCategories(Integer personID) {
   Criteria criteria = new Criteria();
   criteria.add(CREATEDBY, personID);
   criteria.add(REPOSITORY, TQueryRepositoryBean.REPOSITORY_TYPE.PRIVATE);
   try {
     doDelete(criteria);
   } catch (TorqueException e) {
     LOGGER.error("Deleting the private filter categories failed with " + e.getMessage());
   }
 }
Esempio n. 24
0
 private List<com.relteq.sirius.jaxb.Table> restoreTables(com.relteq.sirius.db.BaseObject db_obj)
     throws TorqueException {
   Criteria crit = new Criteria();
   crit.add(TablesPeer.PARENT_ELEMENT_ID, db_obj.getId());
   crit.add(TablesPeer.PARENT_ELEMENT_TYPE, db_obj.getElementType());
   @SuppressWarnings("unchecked")
   List<Tables> db_table_l = TablesPeer.doSelect(crit);
   List<com.relteq.sirius.jaxb.Table> table_l =
       new java.util.ArrayList<com.relteq.sirius.jaxb.Table>(db_table_l.size());
   for (Tables db_table : db_table_l) table_l.add(restoreTable(db_table));
   return table_l;
 }
  /**
   * Method to do updates. This method is to be used during a transaction, otherwise use the
   * doUpdate(Criteria) method. It will take care of the connection details internally.
   *
   * @param criteria object containing data that is used to create the UPDATE statement.
   * @param con the connection to use
   * @throws TorqueException Any exceptions caught during processing will be rethrown wrapped into a
   *     TorqueException.
   */
  public static void doUpdate(Criteria criteria, Connection con) throws TorqueException {
    Criteria selectCriteria = new Criteria(DATABASE_NAME, 2);
    selectCriteria.put(ID, criteria.remove(ID));

    setDbName(criteria);

    if (con == null) {
      BasePeer.doUpdate(selectCriteria, criteria);
    } else {
      BasePeer.doUpdate(selectCriteria, criteria, con);
    }
  }
 /**
  * Add all the columns needed to create a new object.
  *
  * @param criteria object containing the columns to add.
  * @throws TorqueException Any exceptions caught during processing will be rethrown wrapped into a
  *     TorqueException.
  */
 public static void addSelectColumns(Criteria criteria) throws TorqueException {
   criteria.addSelectColumn(ID);
   criteria.addSelectColumn(FECHA_ENTRADA);
   criteria.addSelectColumn(FECHA_SALIDA);
   criteria.addSelectColumn(OBSERVACION);
   criteria.addSelectColumn(REPARACION_ID);
   criteria.addSelectColumn(IMPORTE);
   criteria.addSelectColumn(TIPO);
   criteria.addSelectColumn(RESPONSABLE_ID);
   criteria.addSelectColumn(HORAS);
   criteria.addSelectColumn(DESCRIPCION);
 }
Esempio n. 27
0
  @Override
  public void open(int run_id) throws SiriusException {
    success = false;
    if (1 != scenario.numEnsemble) logger.warn("scenario.numEnsembles != 1");
    if (null == db_scenario) throw new SiriusException("Scenario was not loaded from the database");

    logger.info("Initializing simulation run");
    Connection conn = null;
    try {
      conn = Transaction.begin();

      DataSources db_ds = new DataSources();
      db_ds.setId(DataSourcesPeer.nextId(DataSourcesPeer.ID, conn));
      db_ds.save(conn);

      Criteria crit = new Criteria();
      crit.add(ScenariosPeer.ID, db_scenario.getId());
      com.workingdogs.village.Value max_runnum =
          SimulationRunsPeer.maxColumnValue(SimulationRunsPeer.RUN_NUMBER, crit, conn);
      final long run_number = null == max_runnum ? 1 : max_runnum.asLong() + 1;
      logger.info("Run number: " + run_number);

      db_simulation_run = new com.relteq.sirius.om.SimulationRuns();
      db_simulation_run.setDataSources(db_ds);
      db_simulation_run.setScenarios(db_scenario);
      db_simulation_run.setRunNumber(run_number);
      db_simulation_run.setVersion(com.relteq.sirius.Version.get().getEngineVersion());
      db_simulation_run.setBuild("");
      db_simulation_run.setSimulationStartTime(BigDecimal.valueOf(scenario.getTimeStart()));
      db_simulation_run.setSimulationDuration(
          BigDecimal.valueOf(scenario.getTimeEnd() - scenario.getTimeStart()));
      db_simulation_run.setSimulationDt(BigDecimal.valueOf(scenario.getSimDtInSeconds()));
      db_simulation_run.setOutputDt(BigDecimal.valueOf(scenario.getOutputDt()));
      db_simulation_run.setExecutionStartTime(Calendar.getInstance().getTime());
      db_simulation_run.setStatus(-1);
      db_simulation_run.save(conn);

      Transaction.commit(conn);
      conn = null;
      success = true;
    } catch (TorqueException exc) {
      throw new SiriusException(exc);
    } catch (DataSetException exc) {
      throw new SiriusException(exc);
    } finally {
      if (null != conn) {
        Transaction.safeRollback(conn);
        db_simulation_run = null;
      }
    }
    ts = Calendar.getInstance();
    ts.set(Calendar.MILLISECOND, 0);
  }
Esempio n. 28
0
 /**
  * Retrieve a multiple objects by pk
  *
  * @param pks List of primary keys
  * @param dbcon the connection to use
  * @throws TorqueException Any exceptions caught during processing will be rethrown wrapped into a
  *     TorqueException.
  */
 public static List<TRoleListType> retrieveByPKs(List<ObjectKey> pks, Connection dbcon)
     throws TorqueException {
   List<TRoleListType> objs = null;
   if (pks == null || pks.size() == 0) {
     objs = new LinkedList<TRoleListType>();
   } else {
     Criteria criteria = new Criteria();
     criteria.addIn(OBJECTID, pks);
     objs = doSelect(criteria, dbcon);
   }
   return objs;
 }
  public boolean removeInteresseVendaHistoricoById(int id) {
    try {
      Criteria c = new Criteria();
      c.add(BaseInteresseVendaHistoricoPeer.ID, id);
      BaseInteresseVendaHistoricoPeer.doDelete(c);
      return true;

    } catch (Exception e) {
      LOG.error("Ocorreu um erro ao remover o interesse de venda historico de id[" + id + "]", e);
    }

    return false;
  }
 public InteresseVendaHistorico searchInteresseVendaHistoricoById(int id) {
   try {
     Criteria c = new Criteria();
     c.add(BaseInteresseVendaHistoricoPeer.ID, id);
     List<InteresseVendaHistorico> interesses = BaseInteresseVendaHistoricoPeer.doSelect(c);
     if (CollectionUtils.isNotEmpty(interesses)) {
       return interesses.get(0);
     }
   } catch (Exception e) {
     LOG.error("Ocorreu um erro ao buscar o interesse de venda historico de id[" + id + "]", e);
   }
   return null;
 }