| 1 | |
package org.kuali.rice.kew.api.doctype; |
| 2 | |
|
| 3 | |
import java.io.Serializable; |
| 4 | |
import java.util.Collection; |
| 5 | |
|
| 6 | |
import javax.xml.bind.annotation.XmlAccessType; |
| 7 | |
import javax.xml.bind.annotation.XmlAccessorType; |
| 8 | |
import javax.xml.bind.annotation.XmlAnyElement; |
| 9 | |
import javax.xml.bind.annotation.XmlElement; |
| 10 | |
import javax.xml.bind.annotation.XmlRootElement; |
| 11 | |
import javax.xml.bind.annotation.XmlType; |
| 12 | |
|
| 13 | |
import org.apache.commons.lang.StringUtils; |
| 14 | |
import org.kuali.rice.core.api.CoreConstants; |
| 15 | |
import org.kuali.rice.core.api.mo.AbstractDataTransferObject; |
| 16 | |
import org.kuali.rice.core.api.mo.ModelBuilder; |
| 17 | |
import org.w3c.dom.Element; |
| 18 | |
|
| 19 | |
@XmlRootElement(name = RouteNodeConfigurationParameter.Constants.ROOT_ELEMENT_NAME) |
| 20 | |
@XmlAccessorType(XmlAccessType.NONE) |
| 21 | |
@XmlType(name = RouteNodeConfigurationParameter.Constants.TYPE_NAME, propOrder = { |
| 22 | |
RouteNodeConfigurationParameter.Elements.ID, |
| 23 | |
RouteNodeConfigurationParameter.Elements.ROUTE_NODE_ID, |
| 24 | |
RouteNodeConfigurationParameter.Elements.KEY, |
| 25 | |
RouteNodeConfigurationParameter.Elements.VALUE, |
| 26 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
| 27 | |
}) |
| 28 | 0 | public final class RouteNodeConfigurationParameter extends AbstractDataTransferObject |
| 29 | |
implements RouteNodeConfigurationParameterContract { |
| 30 | |
|
| 31 | |
private static final long serialVersionUID = 3494982096398369148L; |
| 32 | |
|
| 33 | |
@XmlElement(name = Elements.ID, required = false) |
| 34 | |
private final String id; |
| 35 | |
|
| 36 | |
@XmlElement(name = Elements.ROUTE_NODE_ID, required = false) |
| 37 | |
private final String routeNodeId; |
| 38 | |
|
| 39 | |
@XmlElement(name = Elements.KEY, required = true) |
| 40 | |
private final String key; |
| 41 | |
|
| 42 | |
@XmlElement(name = Elements.VALUE, required = false) |
| 43 | |
private final String value; |
| 44 | |
|
| 45 | 0 | @SuppressWarnings("unused") |
| 46 | |
@XmlAnyElement |
| 47 | |
private final Collection<Element> _futureElements = null; |
| 48 | |
|
| 49 | |
|
| 50 | |
|
| 51 | |
|
| 52 | 0 | private RouteNodeConfigurationParameter() { |
| 53 | 0 | this.id = null; |
| 54 | 0 | this.routeNodeId = null; |
| 55 | 0 | this.key = null; |
| 56 | 0 | this.value = null; |
| 57 | 0 | } |
| 58 | |
|
| 59 | 0 | private RouteNodeConfigurationParameter(Builder builder) { |
| 60 | 0 | this.id = builder.getId(); |
| 61 | 0 | this.routeNodeId = builder.getRouteNodeId(); |
| 62 | 0 | this.key = builder.getKey(); |
| 63 | 0 | this.value = builder.getValue(); |
| 64 | 0 | } |
| 65 | |
|
| 66 | |
@Override |
| 67 | |
public String getId() { |
| 68 | 0 | return this.id; |
| 69 | |
} |
| 70 | |
|
| 71 | |
@Override |
| 72 | |
public String getRouteNodeId() { |
| 73 | 0 | return this.routeNodeId; |
| 74 | |
} |
| 75 | |
|
| 76 | |
@Override |
| 77 | |
public String getKey() { |
| 78 | 0 | return this.key; |
| 79 | |
} |
| 80 | |
|
| 81 | |
@Override |
| 82 | |
public String getValue() { |
| 83 | 0 | return this.value; |
| 84 | |
} |
| 85 | |
|
| 86 | |
|
| 87 | |
|
| 88 | |
|
| 89 | |
|
| 90 | |
|
| 91 | 0 | public final static class Builder |
| 92 | |
implements Serializable, ModelBuilder, RouteNodeConfigurationParameterContract { |
| 93 | |
|
| 94 | |
private static final long serialVersionUID = -7040162478345153231L; |
| 95 | |
|
| 96 | |
private String id; |
| 97 | |
private String routeNodeId; |
| 98 | |
private String key; |
| 99 | |
private String value; |
| 100 | |
|
| 101 | 0 | private Builder(String key) { |
| 102 | 0 | setKey(key); |
| 103 | 0 | } |
| 104 | |
|
| 105 | |
public static Builder create(String key) { |
| 106 | 0 | return new Builder(key); |
| 107 | |
} |
| 108 | |
|
| 109 | |
public static Builder create(RouteNodeConfigurationParameterContract contract) { |
| 110 | 0 | if (contract == null) { |
| 111 | 0 | throw new IllegalArgumentException("contract was null"); |
| 112 | |
} |
| 113 | 0 | Builder builder = create(contract.getKey()); |
| 114 | 0 | builder.setId(contract.getId()); |
| 115 | 0 | builder.setRouteNodeId(contract.getRouteNodeId()); |
| 116 | 0 | builder.setValue(contract.getValue()); |
| 117 | 0 | return builder; |
| 118 | |
} |
| 119 | |
|
| 120 | |
public RouteNodeConfigurationParameter build() { |
| 121 | 0 | return new RouteNodeConfigurationParameter(this); |
| 122 | |
} |
| 123 | |
|
| 124 | |
@Override |
| 125 | |
public String getId() { |
| 126 | 0 | return this.id; |
| 127 | |
} |
| 128 | |
|
| 129 | |
@Override |
| 130 | |
public String getRouteNodeId() { |
| 131 | 0 | return this.routeNodeId; |
| 132 | |
} |
| 133 | |
|
| 134 | |
@Override |
| 135 | |
public String getKey() { |
| 136 | 0 | return this.key; |
| 137 | |
} |
| 138 | |
|
| 139 | |
@Override |
| 140 | |
public String getValue() { |
| 141 | 0 | return this.value; |
| 142 | |
} |
| 143 | |
|
| 144 | |
public void setId(String id) { |
| 145 | 0 | this.id = id; |
| 146 | 0 | } |
| 147 | |
|
| 148 | |
public void setRouteNodeId(String routeNodeId) { |
| 149 | 0 | this.routeNodeId = routeNodeId; |
| 150 | 0 | } |
| 151 | |
|
| 152 | |
public void setKey(String key) { |
| 153 | 0 | if (StringUtils.isBlank(key)) { |
| 154 | 0 | throw new IllegalArgumentException("key was null or blank"); |
| 155 | |
} |
| 156 | 0 | this.key = key; |
| 157 | 0 | } |
| 158 | |
|
| 159 | |
public void setValue(String value) { |
| 160 | 0 | this.value = value; |
| 161 | 0 | } |
| 162 | |
|
| 163 | |
} |
| 164 | |
|
| 165 | |
|
| 166 | |
|
| 167 | |
|
| 168 | 0 | static class Constants { |
| 169 | |
final static String ROOT_ELEMENT_NAME = "routeNodeConfigurationParameter"; |
| 170 | |
final static String TYPE_NAME = "RouteNodeConfigurationParameterType"; |
| 171 | |
} |
| 172 | |
|
| 173 | |
|
| 174 | |
|
| 175 | |
|
| 176 | |
|
| 177 | 0 | static class Elements { |
| 178 | |
final static String ID = "id"; |
| 179 | |
final static String ROUTE_NODE_ID = "routeNodeId"; |
| 180 | |
final static String KEY = "key"; |
| 181 | |
final static String VALUE = "value"; |
| 182 | |
} |
| 183 | |
|
| 184 | |
} |