001    /**
002     * Copyright 2005-2012 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.rice.kew.framework.postprocessor;
017    
018    import org.kuali.rice.kew.framework.postprocessor.IDocumentEvent;
019    
020    /**
021     * <p><Title> </p>
022     * <p><Description> </p>
023     * <p><p><p>Copyright: Copyright (c) 2002</p>
024     * <p><p>Company: UIS - Indiana University</p>
025     * @author Kuali Rice Team (rice.collab@kuali.org)
026     */
027    public class DocumentRouteLevelChange implements IDocumentEvent {
028            
029            // TODO for now we will include the new node-based routing fields onto this object to avoid an interface
030            // change to the PostProcessor interface.
031            
032      private static final long serialVersionUID = 785552701611174468L;
033    
034      private String documentId;
035      private String appDocId;
036      private Integer oldRouteLevel;
037      private Integer newRouteLevel;
038      private String oldNodeName;
039      private String newNodeName;
040      private String oldNodeInstanceId;
041      private String newNodeInstanceId;
042      
043      //  this constructor is for backwards compatibility
044      public DocumentRouteLevelChange(String documentId, String appDocId, Integer oldRouteLevel, Integer newRouteLevel) {
045              this(documentId, appDocId, oldRouteLevel, newRouteLevel, null, null, null, null);
046      }
047      
048      public DocumentRouteLevelChange(String documentId, String appDocId, Integer oldRouteLevel,
049        Integer newRouteLevel, String oldNodeName, String newNodeName, String oldNodeInstanceId, String newNodeInstanceId) {
050        this.documentId = documentId;
051        this.oldRouteLevel = oldRouteLevel;
052        this.newRouteLevel = newRouteLevel;
053        this.oldNodeName = oldNodeName;
054        this.newNodeName = newNodeName;
055        this.oldNodeInstanceId = oldNodeInstanceId;
056        this.newNodeInstanceId = newNodeInstanceId;
057        this.appDocId = appDocId;
058      }
059    
060      public String getDocumentEventCode() {
061        return ROUTE_LEVEL_CHANGE;
062      }
063    
064      public String getDocumentId() {
065        return documentId;
066      }
067    
068      public Integer getOldRouteLevel() {
069        return oldRouteLevel;
070      }
071    
072      public Integer getNewRouteLevel() {
073        return newRouteLevel;
074      }
075    
076      public String getNewNodeInstanceId() {
077            return newNodeInstanceId;
078      }
079    
080      public String getNewNodeName() {
081            return newNodeName;
082      }
083    
084      public String getOldNodeInstanceId() {
085            return oldNodeInstanceId;
086      }
087    
088      public String getOldNodeName() {
089            return oldNodeName;
090      }
091    
092      public String toString() {
093        StringBuffer buffer = new StringBuffer();
094        buffer.append("DocumentId ").append(documentId);
095        buffer.append(" changing from routeLevel ").append(oldRouteLevel);
096        buffer.append(" to routeLevel ").append(newRouteLevel);
097    
098        return buffer.toString();
099      }
100    
101      /**
102       * @return
103       */
104      public String getAppDocId() {
105        return appDocId;
106      }
107    }