Пример #1
0
  /** . The method is for doRouteStatusChange */
  @Override
  public void doRouteStatusChange(DocumentRouteStatusChange statusChangeEvent) {
    super.doRouteStatusChange(statusChangeEvent);

    String newStatus = statusChangeEvent.getNewRouteStatus();

    if (KewApiConstants.ROUTE_HEADER_FINAL_CD.equalsIgnoreCase(newStatus)) {
      getVersionHistoryService()
          .updateVersionHistory(
              getSubAward(),
              VersionStatus.ACTIVE,
              GlobalVariables.getUserSession().getPrincipalName());
    }
    if (newStatus.equalsIgnoreCase(KewApiConstants.ROUTE_HEADER_CANCEL_CD)
        || newStatus.equalsIgnoreCase(KewApiConstants.ROUTE_HEADER_DISAPPROVED_CD)) {
      getVersionHistoryService()
          .updateVersionHistory(
              getSubAward(),
              VersionStatus.CANCELED,
              GlobalVariables.getUserSession().getPrincipalName());
    }

    for (SubAward subAward : subAwardList) {
      subAward.setSubAwardDocument(this);
    }
  }
Пример #2
0
 @Override
 public void doRouteStatusChange(DocumentRouteStatusChange dto) {
   super.doRouteStatusChange(dto);
   String newStatus = dto.getNewRouteStatus();
   String oldStatus = dto.getOldRouteStatus();
   if (LOG.isDebugEnabled()) {
     LOG.debug(
         String.format(
             "Route Status change for document %s from %s to %s",
             this.getDocumentNumber(), oldStatus, newStatus));
   }
   if (!isProposalDeleted()) {
     DevelopmentProposal bp = this.getDevelopmentProposal();
     LOG.info(
         String.format(
             "Route status change for document %s - proposal number %s is moving from %s to %s",
             bp.getProposalDocument().getDocumentHeader().getDocumentNumber(),
             bp.getProposalNumber(),
             oldStatus,
             newStatus));
     if (bp.isParent()) {
       try {
         getProposalHierarchyService().routeHierarchyChildren(this, dto);
       } catch (ProposalHierarchyException e) {
         throw new RuntimeException(
             "ProposalHierarchyException thrown while routing children.", e);
       }
     } else if (!bp.isInHierarchy()) {
       try {
         getProposalHierarchyService().calculateAndSetProposalAppDocStatus(this, dto);
       } catch (ProposalHierarchyException pe) {
         throw new RuntimeException(
             String.format(
                 "ProposalHierarchyException thrown while updating app doc status for document %s",
                 getDocumentNumber()));
       }
     }
     bp.setProposalStateTypeCode(
         getProposalStateService().getProposalStateTypeCode(this, true, false));
   }
 }
  /** collect all the information and build the notification body */
  protected String buildNotificationBody(
      TravelDocument travelDocument,
      DocumentRouteStatusChange statusChange,
      NotificationPreference preference) {
    Map<String, Object> notificationInformationHolder = new HashMap<String, Object>();
    notificationInformationHolder.put(TemConstants.NOTIFICATION_PREFERENCE, preference.getLabel());
    notificationInformationHolder.put(KFSPropertyConstants.DOCUMENT, travelDocument);
    notificationInformationHolder.put(TemConstants.STATUS_CHANGE_DTO, statusChange);
    String newStatusLabel = KewApiConstants.DOCUMENT_STATUSES.get(statusChange.getNewRouteStatus());
    notificationInformationHolder.put(TemPropertyConstants.NEW_ROUTE_STATUS, newStatusLabel);

    String oldStatusLabel = KewApiConstants.DOCUMENT_STATUSES.get(statusChange.getOldRouteStatus());
    notificationInformationHolder.put(TemPropertyConstants.OLD_ROUTE_STATUS, oldStatusLabel);

    String campusTravelEmailAddress = this.getCampusTravelEmailAddress();
    notificationInformationHolder.put(
        TemConstants.CAMPUS_TRAVEL_EMAIL_ADDRESS, campusTravelEmailAddress);

    notificationInformationHolder.put(DateTimeService.class.getSimpleName(), dateTimeService);

    return this.getKfsNotificationService()
        .generateNotificationContent(this.getNotificationTemplate(), notificationInformationHolder);
  }
  /**
   * @see
   *     org.kuali.kfs.module.tem.service.TravelDocumentNotificationService#sendNotificationOnChange(org.kuali.kfs.module.tem.document.TravelDocument,
   *     org.kuali.rice.kew.dto.DocumentRouteStatusChange)
   */
  @Override
  public void sendNotificationOnChange(
      TravelDocument travelDocument, DocumentRouteStatusChange statusChangeDTO) {
    String documentTypeCode =
        travelDocument.getDocumentHeader().getWorkflowDocument().getDocumentTypeName();
    NotificationPreference preference = null;
    if (this.isNotificationEnabled()) {
      TemProfile travelProfile = this.getTravelProfile(travelDocument);
      String newRouteStatus = statusChangeDTO.getNewRouteStatus();

      if (travelProfile == null) {
        LOG.error("travelProfile is null.");
        return;
      }

      if (travelDocument instanceof TravelAuthorizationDocument) {
        if (!verifyDocumentTypeCodes(
            documentTypeCode, this.getEligibleTravelAuthorizationDocumentTypeCodes())) {
          return;
        }

        preference =
            getEmailNotificationPreference(
                preference,
                newRouteStatus,
                travelProfile.getNotifyTAFinal(),
                travelProfile.getNotifyTAStatusChange(),
                documentTypeCode);
      } else {
        // TR/ENT/RELO
        if (!verifyDocumentTypeCodes(
            documentTypeCode, this.getEligibleTravelExpenseDocumentTypeCodes())) {
          return;
        }

        preference =
            getEmailNotificationPreference(
                preference,
                newRouteStatus,
                travelProfile.getNotifyTERFinal(),
                travelProfile.getNotifyTERStatusChange(),
                documentTypeCode);
      }

      this.sendNotificationByPreference(travelDocument, statusChangeDTO, preference);
    }
  }
 public void handleRouteStatusChange(DocumentRouteStatusChange routeStatusChange)
     throws Exception {
   notifyEvent(routeStatusChange.getDocumentId(), toJson(routeStatusChange));
 }