Package org.kuali.rice.krad.bo

Examples of org.kuali.rice.krad.bo.DocumentHeader


  public void testIdMgrPermissions_populateGroup() throws WorkflowException {
    Map<String, Boolean> authUsers = getTestUtils().getAuthUsers();
    GlobalVariables.setUserSession(new UserSession("admin"));
    //Document document = KRADServiceLocatorWeb.getDocumentService().getNewDocument(IdentityManagementPersonDocument.class);
    Document document = mock(IdentityManagementPersonDocument.class);
    DocumentHeader header = mock(DocumentHeader.class);
    WorkflowDocument wd = mock(WorkflowDocument.class);
    when(document.getDocumentHeader()).thenReturn(header);
    when(header.getWorkflowDocument()).thenReturn(wd);
    when(document.getDocumentNumber()).thenReturn("1001");
    when(wd.getDocumentTypeName()).thenReturn("IdentityManagementPersonDocument");
    when(wd.isInitiated()).thenReturn(true);
    when(wd.getStatus()).thenReturn(DocumentStatus.fromCode("I"));
    // assign users to groups
View Full Code Here


   *
   * @return String initiator name
   */
  public String getDocumentInitiatorNetworkId() {
    String initiatorNetworkId = "";
    DocumentHeader tmpDocumentHeader = getDocumentHeader();
    if (tmpDocumentHeader != null && !StringUtils.isEmpty(tmpDocumentHeader.getDocumentNumber())) {
      String initiatorPrincipalId = tmpDocumentHeader.getWorkflowDocument().getInitiatorPrincipalId();
      Person initiator = KimApiServiceLocator.getPersonService().getPerson(initiatorPrincipalId);
      if (initiator != null) {
        initiatorNetworkId = initiator.getPrincipalName();
      }
    }
View Full Code Here

   * initializes {@link #workflowDocument} so that info can be displayed on the work inquiry section table
   * <p>This is because during the inquiry, the work bo is fetched via ojb directly and not via the document service</p>
   */
  @Override
  public DocumentHeader getDocumentHeader() {
    DocumentHeader tmpDocumentHeader = super.getDocumentHeader();
    if (tmpDocumentHeader != null && ! tmpDocumentHeader.hasWorkflowDocument()) {
      WorkflowDocument wfd = null;
      if (! StringUtils.isEmpty(getDocumentNumber())) {
        wfd = WorkflowDocumentFactory.loadDocument(
            GlobalVariables.getUserSession().getPrincipalId(), getDocumentNumber());
      }
      if (wfd == null) {
        log.debug("set dummy WorkflowDocument");
        tmpDocumentHeader.setWorkflowDocument(new DummyWorkFlowDocument());
      } else {
        tmpDocumentHeader.setWorkflowDocument(wfd);
        log.debug("set found WorkflowDocument");
      }
    }
    return tmpDocumentHeader;
  }
View Full Code Here

   * {@link org.kuali.rice.kew.api.WorkflowDocument} to return a timestamp since it will be displayed is the configured format
   * @return the timestamp if {@link #getDocumentHeader().getWorkflowDocument().getDateCreated()} is not null, otherwise null
   */
  public Timestamp getDateCreated() {
    DateTime dateCreated = null;
    DocumentHeader tmpHdr = getDocumentHeader();
    if (tmpHdr != null && (dateCreated = tmpHdr.getWorkflowDocument().getDateCreated()) != null) {
      return new Timestamp(dateCreated.getMillis());
    } else {
      return null;
    }
  }
View Full Code Here

  /**
   * the time period between creation and last modification
   * @return empty string if any of created or last modification times are null, the period otherwise
   */
  public String getPeriodToLastModification() {
    final DocumentHeader tmpHdr = getDocumentHeader();
    if (tmpHdr == null) {
      return "";
    } else {
      final DateTime dateCreated = tmpHdr.getWorkflowDocument().getDateCreated();
      final DateTime dateLastModified = tmpHdr.getWorkflowDocument().getDateLastModified();
      if(dateCreated != null && dateLastModified != null) {
        Period period = new Period(dateCreated, dateLastModified);
        return period.toString(PeriodFormat.getDefault());
      } else {
        return "";
View Full Code Here

  /**
   * the time period between creation and completion
   * @return empty string if any of created or completion times are null, the period otherwise
   */
  public String getPeriodToCompletion() {
    final DocumentHeader tmpHdr = getDocumentHeader();
    if (tmpHdr == null) {
      return "";
    }
    final DateTime dateCreated = tmpHdr.getWorkflowDocument().getDateCreated();
    DateTime dateCompleted = getActionDate(tmpHdr, KewApiConstants.ACTION_TAKEN_COMPLETED_CD);
    if (dateCreated != null && dateCompleted != null) {
      Period period = new Period(dateCreated, dateCompleted);
      return period.toString(PeriodFormat.getDefault());
    } else {
View Full Code Here

  /**
   * the time period between completion and approval
   * @return empty string if any of created or completion times are null, the period otherwise
   */
  public String getPeriodToApprove() {
    final DocumentHeader tmpHdr = getDocumentHeader();
    if (tmpHdr == null) {
      return "";
    }
    DateTime dateCompleted = getActionDate(tmpHdr, KewApiConstants.ACTION_TAKEN_COMPLETED_CD);
    DateTime dateApproved = getActionDate(tmpHdr, KewApiConstants.ACTION_TAKEN_APPROVED_CD);
View Full Code Here

   * add mock header and workflow doc to the work document
   */
  public void setupHeader() {
    wfd = mock(WorkflowDocument.class);
    when(wfd.getDateCreated()).thenReturn(DateTime.now());
    DocumentHeader docHdr = mock(DocumentHeader.class);
    when(docHdr.getWorkflowDocument()).thenReturn(wfd);
    when(work.getDocumentHeader()).thenReturn(docHdr);
  }
View Full Code Here

TOP

Related Classes of org.kuali.rice.krad.bo.DocumentHeader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.