コード例 #1
0
 public int anonymizeHelperAddresses() {
   SessionHolder sessionHolder = SessionManager.getInstance().registerSession(this, null);
   try {
     sessionHolder.beginTransaction();
     Query qry =
         sessionHolder.createQuery(
             "UPDATE "
                 + Helper.class.getSimpleName()
                 + " SET "
                 + Helper.ATTR_MAIL_ADDRESS
                 + " = :address WHERE "
                 + Helper.ATTR_MAIL_ADDRESS
                 + " IS NOT NULL AND "
                 + Helper.ATTR_MAIL_ADDRESS
                 + " <> ''");
     qry.setParameter(
         "address",
         AppConfiguration.getInstance()
             .getConfigurationValue(AppConfigurationValues.PROCESS_TEST_MAIL));
     int rows = qry.executeUpdate();
     sessionHolder.commitTransaction();
     return rows;
   } catch (Exception e) {
     sessionHolder.rollbackTransaction();
     ;
     throw new ResourcePlanningException(
         "helper addresses could not be anonymized : " + e.getMessage());
   } finally {
     SessionManager.getInstance().unregisterSession(sessionHolder);
   }
 }
コード例 #2
0
 private void createSomePersonAndSimpleEvents() {
   SessionHolder sessionHolder = SessionManager.getInstance().registerSession(this, null);
   try {
     sessionHolder.beginTransaction();
     createSimpleEvent(sessionHolder, "some simple event", new Date(), "sse-123");
     createPerson(sessionHolder, "Hanke", "Jan", "*****@*****.**", new Date());
     sessionHolder.commitTransaction();
   } catch (Exception e) {
     sessionHolder.rollbackTransaction();
     throw new ResourcePlanningException(
         "helper addresses could not be anonymized : " + e.getMessage());
   } finally {
     SessionManager.getInstance().unregisterSession(sessionHolder);
   }
 }