Package de.innovationgate.webgate.api.workflow

Examples of de.innovationgate.webgate.api.workflow.WGWorkflow


            // Add the newly created content key to prevent using it again (while
            // the content has not been saved)
            newContentKeys.put(newContent.getContentKey(), null);
           
            // Initialize by workflow engine
            WGWorkflow workflow = this.getWorkflowEngine().getWorkflow(newContent);
            workflow.initialize();
        }


        // Event contentCreated
        String contentType = null;
View Full Code Here


                newContent.setMetaData(WGContent.META_AUTHOR, getSessionContext().getUser());
                newContentKeys.put(newContent.getContentKey(), null);
            }

            // Initialize by workflow engine
            WGWorkflow workflow = getWorkflowEngine().getWorkflow(newContent);
            workflow.initialize();
            if (!projectMode) {
                newContent.addWorkflowHistoryEntry("Draft copy created");
            }
            else {
                newContent.addWorkflowHistoryEntry("Changed to draft status in project mode");
View Full Code Here

    if (!this.getStatus().equals(WGContent.STATUS_DRAFT)) {
      throw new WGWorkflowException("The content is not in status draft and cannot be published");
    }
    */
    // Test workflow role
    WGWorkflow workflow = getWorkflow();
    if (workflow.getWorkflowRole() != WGWorkflow.ROLE_ADMINISTRATOR) {
      throw new WGAuthorisationException("You are no workflow administrator");
    }

    synchronized( db ) {
   
View Full Code Here

            throw new WGBackendException("Could not publish document " + getContentKey().toString() + " because it could not be saved");
        }
   
   
    synchronized ( db ) {
            WGWorkflow workflow = getWorkflow();
       
        if (getDatabase().isProjectMode()) {
            release(comment, workflow);
            this.addWorkflowHistoryEntry("Released in project mode");
        }
        else {
           
            boolean result = workflow.publish(comment);
           
            if (result == false) {
                this.setStatus(WGContent.STATUS_REVIEW);
                this.addWorkflowHistoryEntry("Submitted for approval");
               
                WGContentEvent event = new WGContentEvent(WGContentEvent.TYPE_STATUSCHANGED, getDocumentKey(), getStructEntry().getContentType().getName(), getDatabase());
                  event.setContent(this);
                  getDatabase().fireContentEvent(event);
               
                // Automatic approval - approve method will automatically release content if workflow was done
                if (getDatabase().isAutoApprove()) {
                    while (result == false && workflow.isApprovableByUser()) {
                       result = approve("Automatic approval for user '" + getDatabase().getSessionContext().getUser() + "'", workflow);
                    }
                }
            }
           
View Full Code Here

   * For a content document in status REVIEW, approves this document and continues the workflow. The user must be a valid approver of the current workflow level to do this action.
   * @param comment A comment for the approval action
   * @throws WGAPIException
   */
  public void approve(String comment) throws WGAPIException {
      WGWorkflow workflow = getWorkflow();
      approve(comment, workflow);
  }
View Full Code Here

    if (!this.getStatus().equals(WGContent.STATUS_REVIEW) && !this.getStatus().equals(WGContent.STATUS_RELEASE)) {
      throw new WGIllegalStateException("The content is not in status review or release and cannot be rejected");
    }

    // Test workflow role
    WGWorkflow workflow = getWorkflow();
    if (workflow.getWorkflowRole() < WGWorkflow.ROLE_APPROVER) {
      throw new WGAuthorisationException("You are no approver for the current workflow level");
    }
   
    String previousStatus = getStatus();

    // Reject
    workflow.reject(comment);
    this.setStatus(WGContent.STATUS_DRAFT);
   
    // If the previous state was released, query- and structentry cache must be cleared (default cache maintenance won't do this)
    if (previousStatus == WGContent.STATUS_RELEASE) {
      getDatabase().queryCache.clear();
View Full Code Here

      throw new WGIllegalStateException("The content is in status '" + getStatus() + "' and cannot be archived");
    }

    // Archive
    this.setStatus(WGContent.STATUS_ARCHIVE);
    WGWorkflow workflow = getWorkflow();
    workflow.archive(comment);

    // Write workflow history
    if (comment != null && !comment.trim().equals("")) {
      this.addWorkflowHistoryEntry("Archived. Replace reason: " + comment);
    }
View Full Code Here

            }
           
            // Check workflow status and special dependencies related to them
            if (performStatusTests) {
                if (getStatus().equals(WGContent.STATUS_REVIEW)) {
                  WGWorkflow workflow = db.getWorkflowEngine().getWorkflow(this);
                if (workflow.getWorkflowRole() < WGWorkflow.ROLE_APPROVER) {
                  throw new WGAuthorisationException("This content is in review and can only be edited by an appover or workflow administrator");
                }
                }
       
                if (getStatus().equals(WGContent.STATUS_ARCHIVE)) {
View Full Code Here

   * @return A constant of type WGWorkflow.ROLE_....
   * @throws WGAPIException
   */
  public int getWorkflowRole() throws WGAPIException {

    WGWorkflow workflow = getWorkflow();
    return workflow.getWorkflowRole();
  }
View Full Code Here

TOP

Related Classes of de.innovationgate.webgate.api.workflow.WGWorkflow

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.