コード例 #1
0
  protected boolean process(WorkflowTransactionPhase phase) throws WorkflowException {
    if (LOG.isLoggable(Level.FINER)) {
      LOG.entering(AutoRejectNewItemTransition.class.getName(), "process", new Object[] {phase});
    }
    boolean success = false;
    boolean processed = false;
    try {
      DBHelper.startTransaction();

      NewItemPlacementBean nipb =
          NewItemServicesUtils.getNewItemPlacementCommand()
              ._getActivePlacementByTransactionId(phase.getTransactionId());
      long offset = Long.parseLong(DEFAULT_MAX_LENGTH_DAYS_OPEN);
      if (nipb != null) {
        if (handlesRegMbr(nipb.getRegionMemberId())) {
          DataItemBean dib =
              NewItemServicesUtils.getExpireDaysByRegionAlias(
                  NewItemServicesUtils.getPlacementRegionMemberAliasById(nipb.getRegionMemberId()));
          if (dib != null) offset = Long.parseLong(dib.getValue());

          this.triggerWhenBeforeOffset = new Long((-1) * offset * 24 * 60 * 60 * 1000);

          processed = super.process(phase);

          if (processed) {
            updateNewItemData(nipb);
          }
        }
        success = true;
      } else
        throw new WorkflowException(
            "Unable to locate placement data for AutoRejectNewItemTransition call on Transaction_ID ["
                + phase.getTransactionId()
                + "].");
    } catch (WorkflowException we) {
      LOG.log(
          Level.SEVERE, "Error invoking AutoRejectNewItemTransition for New Item Workflow!", we);
      throw new WorkflowException(
          "Error invoking AutoRejectNewItemTransition for New Item Workflow!  " + we.getMessage());
    } catch (Throwable th) {
      LOG.log(
          Level.SEVERE,
          "Error invoking AutoRejectNewItemTransition for New Item Workflow for phase ["
              + phase.getId()
              + "]!",
          th);
    } finally {
      try {
        DBHelper.finalizeActiveTransaction(null, success);
      } catch (Throwable th) {
        LOG.log(Level.SEVERE, "Error finalizing transaction for AutoRejectNewItemTransition time!");
        th.printStackTrace();
      }
    }

    if (LOG.isLoggable(Level.FINER)) {
      LOG.exiting(AutoRejectNewItemTransition.class.getName(), "process");
    }
    return processed;
  }
コード例 #2
0
  public Date getTriggerTimeForPhase(WorkflowTransactionPhase phase) throws ApplicationException {
    if (LOG.isLoggable(Level.FINER)) {
      LOG.entering(
          AutoRejectNewItemTransition.class.getName(),
          "#AutoReject: getTriggerTimeForPhase",
          new Object[] {phase});
    }

    NewItemPlacementBean nipb =
        NewItemServicesUtils.getNewItemPlacementCommand()
            ._getActivePlacementByTransactionId(phase.getTransactionId());
    if (nipb == null) {
      LOG.log(
          Level.SEVERE,
          "Error invoking AutoKillNewItemTransition timer for New Item Workflow on transaction ID: "
              + phase.getId());
      throw new ApplicationException(
          "Error invoking AutoKillNewItemTransition timer for New Item Workflow on transaction ID: "
              + phase.getId());
    }

    Calendar triggerDate = nipb.getReviewStartDate();

    triggerDate.set(Calendar.HOUR_OF_DAY, 0);
    triggerDate.set(Calendar.MINUTE, 0);
    triggerDate.set(Calendar.SECOND, 0);
    triggerDate.set(Calendar.MILLISECOND, 0);

    if (LOG.isLoggable(Level.FINER)) {
      LOG.exiting(
          AutoRejectNewItemTransition.class.getName(), "#AutoReject: getTriggerTimeForPhase");
    }
    return triggerDate.getTime();
  }
コード例 #3
0
 protected void updateNewItemData(NewItemPlacementBean nipb) throws Throwable {
   NewItemBean nib =
       NewItemServicesUtils.getNewItemCommand().getActiveNewItemBean(nipb.getNewItemId());
   if (nib == null) {
     if (LOG.isLoggable(Level.FINER))
       LOG.log(
           Level.FINER, "New Item information for id [" + nipb.getNewItemId() + "] is missing!");
     throw new ApplicationException(
         "New Item information for id [" + nipb.getNewItemId() + "] is missing!");
   }
   nipb.setRejectReason(AUTO_REJECT_REASON);
   nipb.setAccepted(-1);
   nipb.setUpdatedBy("system");
   nipb.setUpdatedOn(new GregorianCalendar());
   //		NewItemServicesUtils.getNewItemPlacementCommand()._storePlacement(nipb);
   //		NewItemServicesUtils.getNewItemPlacementCommand()._processSlotting(nipb, nib);
 }