View Javadoc

1   /**
2    * Copyright 2005-2012 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kew.api.action;
17  
18  import java.util.Collection;
19  
20  import javax.xml.bind.annotation.XmlAccessType;
21  import javax.xml.bind.annotation.XmlAccessorType;
22  import javax.xml.bind.annotation.XmlAnyElement;
23  import javax.xml.bind.annotation.XmlElement;
24  import javax.xml.bind.annotation.XmlRootElement;
25  import javax.xml.bind.annotation.XmlType;
26  
27  import org.apache.commons.lang.StringUtils;
28  import org.kuali.rice.core.api.CoreConstants;
29  import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
30  import org.w3c.dom.Element;
31  
32  @XmlRootElement(name = MovePoint.Constants.ROOT_ELEMENT_NAME)
33  @XmlAccessorType(XmlAccessType.NONE)
34  @XmlType(name = MovePoint.Constants.TYPE_NAME, propOrder = {
35  		MovePoint.Elements.START_NODE_NAME,
36  		MovePoint.Elements.STEPS_TO_MOVE,
37  		CoreConstants.CommonElements.FUTURE_ELEMENTS
38  })
39  public final class MovePoint extends AbstractDataTransferObject {
40      
41  	@XmlElement(name = Elements.START_NODE_NAME, required = true)
42      private final String startNodeName;
43  	
44  	@XmlElement(name = Elements.STEPS_TO_MOVE, required = true)
45      private final int stepsToMove;
46      
47      @SuppressWarnings("unused")
48      @XmlAnyElement
49      private final Collection<Element> _futureElements = null;
50  
51      private MovePoint() {
52      	this.startNodeName = null;
53      	this.stepsToMove = 0;
54      }
55      
56      private MovePoint(String startNodeName, int stepsToMove) {
57      	if (StringUtils.isBlank(startNodeName)) {
58      		throw new IllegalArgumentException("startNodeName was null or blank");
59      	}
60          this.startNodeName = startNodeName;
61          this.stepsToMove = stepsToMove;
62      }
63      
64      public static MovePoint create(String startNodeName, int stepsToMove) {
65      	return new MovePoint(startNodeName, stepsToMove);
66      }
67      
68      public String getStartNodeName() {
69          return startNodeName;
70      }
71  
72      public int getStepsToMove() {
73          return stepsToMove;
74      }
75      
76      /**
77       * Defines some internal constants used on this class.
78       */
79      static class Constants {
80          final static String ROOT_ELEMENT_NAME = "movePoint";
81          final static String TYPE_NAME = "MovePointType";
82      }
83      
84      /**
85       * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML.
86       */
87      static class Elements {
88          final static String START_NODE_NAME = "startNodeName";
89          final static String STEPS_TO_MOVE = "stepsToMove";
90      }
91  
92  }