| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.rice.kew.api.document.search; |
| 17 | |
|
| 18 | |
import org.apache.commons.lang.StringUtils; |
| 19 | |
import org.joda.time.DateTime; |
| 20 | |
import org.joda.time.DateTimeZone; |
| 21 | |
import org.kuali.rice.core.api.CoreConstants; |
| 22 | |
import org.kuali.rice.core.api.mo.AbstractDataTransferObject; |
| 23 | |
import org.kuali.rice.core.api.mo.ModelBuilder; |
| 24 | |
import org.kuali.rice.core.api.mo.ModelObjectUtils; |
| 25 | |
import org.kuali.rice.core.api.util.jaxb.DateTimeAdapter; |
| 26 | |
import org.kuali.rice.core.api.util.jaxb.MultiValuedStringMapAdapter; |
| 27 | |
import org.kuali.rice.kew.api.document.DocumentStatus; |
| 28 | |
import org.kuali.rice.kew.api.document.DocumentStatusCategory; |
| 29 | |
import org.w3c.dom.Element; |
| 30 | |
|
| 31 | |
import javax.xml.bind.annotation.XmlAccessType; |
| 32 | |
import javax.xml.bind.annotation.XmlAccessorType; |
| 33 | |
import javax.xml.bind.annotation.XmlAnyElement; |
| 34 | |
import javax.xml.bind.annotation.XmlElement; |
| 35 | |
import javax.xml.bind.annotation.XmlElementWrapper; |
| 36 | |
import javax.xml.bind.annotation.XmlRootElement; |
| 37 | |
import javax.xml.bind.annotation.XmlType; |
| 38 | |
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
| 39 | |
import java.io.Serializable; |
| 40 | |
import java.util.ArrayList; |
| 41 | |
import java.util.Collection; |
| 42 | |
import java.util.Collections; |
| 43 | |
import java.util.HashMap; |
| 44 | |
import java.util.List; |
| 45 | |
import java.util.Map; |
| 46 | |
|
| 47 | |
|
| 48 | |
|
| 49 | |
|
| 50 | |
|
| 51 | |
|
| 52 | |
|
| 53 | |
@XmlRootElement(name = DocumentSearchCriteria.Constants.ROOT_ELEMENT_NAME) |
| 54 | |
@XmlAccessorType(XmlAccessType.NONE) |
| 55 | |
@XmlType(name = DocumentSearchCriteria.Constants.TYPE_NAME, propOrder = { |
| 56 | |
DocumentSearchCriteria.Elements.DOCUMENT_ID, |
| 57 | |
DocumentSearchCriteria.Elements.DOCUMENT_STATUSES, |
| 58 | |
DocumentSearchCriteria.Elements.DOCUMENT_STATUS_CATEGORIES, |
| 59 | |
DocumentSearchCriteria.Elements.TITLE, |
| 60 | |
DocumentSearchCriteria.Elements.APPLICATION_DOCUMENT_ID, |
| 61 | |
DocumentSearchCriteria.Elements.APPLICATION_DOCUMENT_STATUS, |
| 62 | |
DocumentSearchCriteria.Elements.INITIATOR_PRINCIPAL_NAME, |
| 63 | |
DocumentSearchCriteria.Elements.VIEWER_PRINCIPAL_NAME, |
| 64 | |
DocumentSearchCriteria.Elements.VIEWER_GROUP_ID, |
| 65 | |
DocumentSearchCriteria.Elements.APPROVER_PRINCIPAL_NAME, |
| 66 | |
DocumentSearchCriteria.Elements.ROUTE_NODE_NAME, |
| 67 | |
DocumentSearchCriteria.Elements.ROUTE_NODE_LOOKUP_LOGIC, |
| 68 | |
DocumentSearchCriteria.Elements.DOCUMENT_TYPE_NAME, |
| 69 | |
DocumentSearchCriteria.Elements.ADDITIONAL_DOCUMENT_TYPE_NAMES, |
| 70 | |
DocumentSearchCriteria.Elements.DATE_CREATED_FROM, |
| 71 | |
DocumentSearchCriteria.Elements.DATE_CREATED_TO, |
| 72 | |
DocumentSearchCriteria.Elements.DATE_LAST_MODIFIED_FROM, |
| 73 | |
DocumentSearchCriteria.Elements.DATE_LAST_MODIFIED_TO, |
| 74 | |
DocumentSearchCriteria.Elements.DATE_APPROVED_FROM, |
| 75 | |
DocumentSearchCriteria.Elements.DATE_APPROVED_TO, |
| 76 | |
DocumentSearchCriteria.Elements.DATE_FINALIZED_FROM, |
| 77 | |
DocumentSearchCriteria.Elements.DATE_FINALIZED_TO, |
| 78 | |
DocumentSearchCriteria.Elements.DATE_APPLICATION_DOCUMENT_STATUS_CHANGED_FROM, |
| 79 | |
DocumentSearchCriteria.Elements.DATE_APPLICATION_DOCUMENT_STATUS_CHANGED_TO, |
| 80 | |
DocumentSearchCriteria.Elements.DOCUMENT_ATTRIBUTE_VALUES, |
| 81 | |
DocumentSearchCriteria.Elements.SAVE_NAME, |
| 82 | |
DocumentSearchCriteria.Elements.START_AT_INDEX, |
| 83 | |
DocumentSearchCriteria.Elements.MAX_RESULTS, |
| 84 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
| 85 | |
}) |
| 86 | 0 | public final class DocumentSearchCriteria extends AbstractDataTransferObject implements DocumentSearchCriteriaContract { |
| 87 | |
|
| 88 | |
private static final long serialVersionUID = -221440103480740497L; |
| 89 | |
|
| 90 | |
@XmlElement(name = Elements.DOCUMENT_ID, required = false) |
| 91 | |
private final String documentId; |
| 92 | |
|
| 93 | |
@XmlElementWrapper(name = Elements.DOCUMENT_STATUSES, required = false) |
| 94 | |
@XmlElement(name = Elements.DOCUMENT_STATUS, required = false) |
| 95 | |
private final List<DocumentStatus> documentStatuses; |
| 96 | |
|
| 97 | |
@XmlElementWrapper(name = Elements.DOCUMENT_STATUS_CATEGORIES, required = false) |
| 98 | |
@XmlElement(name = Elements.DOCUMENT_STATUS_CATEGORY, required = false) |
| 99 | |
private final List<DocumentStatusCategory> documentStatusCategories; |
| 100 | |
|
| 101 | |
@XmlElement(name = Elements.TITLE, required = false) |
| 102 | |
private final String title; |
| 103 | |
|
| 104 | |
@XmlElement(name = Elements.APPLICATION_DOCUMENT_ID, required = false) |
| 105 | |
private final String applicationDocumentId; |
| 106 | |
|
| 107 | |
@XmlElement(name = Elements.APPLICATION_DOCUMENT_STATUS, required = false) |
| 108 | |
private final String applicationDocumentStatus; |
| 109 | |
|
| 110 | |
@XmlElement(name = Elements.INITIATOR_PRINCIPAL_NAME, required = false) |
| 111 | |
private final String initiatorPrincipalName; |
| 112 | |
|
| 113 | |
@XmlElement(name = Elements.VIEWER_PRINCIPAL_NAME, required = false) |
| 114 | |
private final String viewerPrincipalName; |
| 115 | |
|
| 116 | |
@XmlElement(name = Elements.VIEWER_GROUP_ID, required = false) |
| 117 | |
private final String viewerGroupId; |
| 118 | |
|
| 119 | |
@XmlElement(name = Elements.APPROVER_PRINCIPAL_NAME, required = false) |
| 120 | |
private final String approverPrincipalName; |
| 121 | |
|
| 122 | |
@XmlElement(name = Elements.ROUTE_NODE_NAME, required = false) |
| 123 | |
private final String routeNodeName; |
| 124 | |
|
| 125 | |
@XmlElement(name = Elements.ROUTE_NODE_LOOKUP_LOGIC, required = false) |
| 126 | |
private final RouteNodeLookupLogic routeNodeLookupLogic; |
| 127 | |
|
| 128 | |
@XmlElement(name = Elements.DOCUMENT_TYPE_NAME, required = false) |
| 129 | |
private final String documentTypeName; |
| 130 | |
|
| 131 | |
@XmlElementWrapper(name = Elements.ADDITIONAL_DOCUMENT_TYPE_NAMES, required = false) |
| 132 | |
@XmlElement(name = Elements.ADDITIONAL_DOCUMENT_TYPE_NAME, required = false) |
| 133 | |
private final List<String> additionalDocumentTypeNames; |
| 134 | |
|
| 135 | |
|
| 136 | |
@XmlElement(name = Elements.DATE_CREATED_FROM, required = false) |
| 137 | |
@XmlJavaTypeAdapter(DateTimeAdapter.class) |
| 138 | |
private final DateTime dateCreatedFrom; |
| 139 | |
|
| 140 | |
@XmlElement(name = Elements.DATE_CREATED_TO, required = false) |
| 141 | |
@XmlJavaTypeAdapter(DateTimeAdapter.class) |
| 142 | |
private final DateTime dateCreatedTo; |
| 143 | |
|
| 144 | |
@XmlElement(name = Elements.DATE_LAST_MODIFIED_FROM, required = false) |
| 145 | |
@XmlJavaTypeAdapter(DateTimeAdapter.class) |
| 146 | |
private final DateTime dateLastModifiedFrom; |
| 147 | |
|
| 148 | |
@XmlElement(name = Elements.DATE_LAST_MODIFIED_TO, required = false) |
| 149 | |
@XmlJavaTypeAdapter(DateTimeAdapter.class) |
| 150 | |
private final DateTime dateLastModifiedTo; |
| 151 | |
|
| 152 | |
@XmlElement(name = Elements.DATE_APPROVED_FROM, required = false) |
| 153 | |
@XmlJavaTypeAdapter(DateTimeAdapter.class) |
| 154 | |
private final DateTime dateApprovedFrom; |
| 155 | |
|
| 156 | |
@XmlElement(name = Elements.DATE_APPROVED_TO, required = false) |
| 157 | |
@XmlJavaTypeAdapter(DateTimeAdapter.class) |
| 158 | |
private final DateTime dateApprovedTo; |
| 159 | |
|
| 160 | |
@XmlElement(name = Elements.DATE_FINALIZED_FROM, required = false) |
| 161 | |
@XmlJavaTypeAdapter(DateTimeAdapter.class) |
| 162 | |
private final DateTime dateFinalizedFrom; |
| 163 | |
|
| 164 | |
@XmlElement(name = Elements.DATE_FINALIZED_TO, required = false) |
| 165 | |
@XmlJavaTypeAdapter(DateTimeAdapter.class) |
| 166 | |
private final DateTime dateFinalizedTo; |
| 167 | |
|
| 168 | |
@XmlElement(name = Elements.DATE_APPLICATION_DOCUMENT_STATUS_CHANGED_FROM, required = false) |
| 169 | |
@XmlJavaTypeAdapter(DateTimeAdapter.class) |
| 170 | |
private final DateTime dateApplicationDocumentStatusChangedFrom; |
| 171 | |
|
| 172 | |
@XmlElement(name = Elements.DATE_APPLICATION_DOCUMENT_STATUS_CHANGED_TO, required = false) |
| 173 | |
@XmlJavaTypeAdapter(DateTimeAdapter.class) |
| 174 | |
private final DateTime dateApplicationDocumentStatusChangedTo; |
| 175 | |
|
| 176 | |
@XmlElement(name = Elements.DOCUMENT_ATTRIBUTE_VALUES, required = false) |
| 177 | |
@XmlJavaTypeAdapter(MultiValuedStringMapAdapter.class) |
| 178 | |
private final Map<String, List<String>> documentAttributeValues; |
| 179 | |
|
| 180 | |
@XmlElement(name = Elements.SAVE_NAME, required = false) |
| 181 | |
private final String saveName; |
| 182 | |
|
| 183 | |
@XmlElement(name = Elements.START_AT_INDEX, required = false) |
| 184 | |
private final Integer startAtIndex; |
| 185 | |
|
| 186 | |
@XmlElement(name = Elements.MAX_RESULTS, required = false) |
| 187 | |
private final Integer maxResults; |
| 188 | |
|
| 189 | 0 | @SuppressWarnings("unused") |
| 190 | |
@XmlAnyElement |
| 191 | |
private final Collection<Element> _futureElements = null; |
| 192 | |
|
| 193 | |
|
| 194 | |
|
| 195 | |
|
| 196 | 0 | private DocumentSearchCriteria() { |
| 197 | 0 | this.documentId = null; |
| 198 | 0 | this.documentStatuses = null; |
| 199 | 0 | this.documentStatusCategories = null; |
| 200 | 0 | this.title = null; |
| 201 | 0 | this.applicationDocumentId = null; |
| 202 | 0 | this.applicationDocumentStatus = null; |
| 203 | 0 | this.initiatorPrincipalName = null; |
| 204 | 0 | this.viewerPrincipalName = null; |
| 205 | 0 | this.viewerGroupId = null; |
| 206 | 0 | this.approverPrincipalName = null; |
| 207 | 0 | this.routeNodeName = null; |
| 208 | 0 | this.routeNodeLookupLogic = null; |
| 209 | 0 | this.documentTypeName = null; |
| 210 | 0 | this.additionalDocumentTypeNames = null; |
| 211 | 0 | this.dateCreatedFrom = null; |
| 212 | 0 | this.dateCreatedTo = null; |
| 213 | 0 | this.dateLastModifiedFrom = null; |
| 214 | 0 | this.dateLastModifiedTo = null; |
| 215 | 0 | this.dateApprovedFrom = null; |
| 216 | 0 | this.dateApprovedTo = null; |
| 217 | 0 | this.dateFinalizedFrom = null; |
| 218 | 0 | this.dateFinalizedTo = null; |
| 219 | 0 | this.dateApplicationDocumentStatusChangedFrom = null; |
| 220 | 0 | this.dateApplicationDocumentStatusChangedTo = null; |
| 221 | 0 | this.documentAttributeValues = null; |
| 222 | 0 | this.saveName = null; |
| 223 | 0 | this.startAtIndex = null; |
| 224 | 0 | this.maxResults = null; |
| 225 | 0 | } |
| 226 | |
|
| 227 | 0 | private DocumentSearchCriteria(Builder builder) { |
| 228 | 0 | this.documentId = builder.getDocumentId(); |
| 229 | 0 | this.documentStatuses = ModelObjectUtils.createImmutableCopy(builder.getDocumentStatuses()); |
| 230 | 0 | this.documentStatusCategories = ModelObjectUtils.createImmutableCopy(builder.getDocumentStatusCategories()); |
| 231 | 0 | this.title = builder.getTitle(); |
| 232 | 0 | this.applicationDocumentId = builder.getApplicationDocumentId(); |
| 233 | 0 | this.applicationDocumentStatus = builder.getApplicationDocumentStatus(); |
| 234 | 0 | this.initiatorPrincipalName = builder.getInitiatorPrincipalName(); |
| 235 | 0 | this.viewerPrincipalName = builder.getViewerPrincipalName(); |
| 236 | 0 | this.viewerGroupId = builder.getViewerGroupId(); |
| 237 | 0 | this.approverPrincipalName = builder.getApproverPrincipalName(); |
| 238 | 0 | this.routeNodeName = builder.getRouteNodeName(); |
| 239 | 0 | this.routeNodeLookupLogic = builder.getRouteNodeLookupLogic(); |
| 240 | 0 | this.documentTypeName = builder.getDocumentTypeName(); |
| 241 | 0 | this.additionalDocumentTypeNames = ModelObjectUtils.createImmutableCopy( |
| 242 | |
builder.getAdditionalDocumentTypeNames()); |
| 243 | 0 | this.dateCreatedFrom = builder.getDateCreatedFrom(); |
| 244 | 0 | this.dateCreatedTo = builder.getDateCreatedTo(); |
| 245 | 0 | this.dateLastModifiedFrom = builder.getDateLastModifiedFrom(); |
| 246 | 0 | this.dateLastModifiedTo = builder.getDateLastModifiedTo(); |
| 247 | 0 | this.dateApprovedFrom = builder.getDateApprovedFrom(); |
| 248 | 0 | this.dateApprovedTo = builder.getDateApprovedTo(); |
| 249 | 0 | this.dateFinalizedFrom = builder.getDateFinalizedFrom(); |
| 250 | 0 | this.dateFinalizedTo = builder.getDateFinalizedTo(); |
| 251 | 0 | this.dateApplicationDocumentStatusChangedFrom = builder.getDateApplicationDocumentStatusChangedFrom(); |
| 252 | 0 | this.dateApplicationDocumentStatusChangedTo = builder.getDateApplicationDocumentStatusChangedTo(); |
| 253 | 0 | this.documentAttributeValues = ModelObjectUtils.createImmutableCopy(builder.getDocumentAttributeValues()); |
| 254 | 0 | this.saveName = builder.getSaveName(); |
| 255 | 0 | this.startAtIndex = builder.getStartAtIndex(); |
| 256 | 0 | this.maxResults = builder.getMaxResults(); |
| 257 | 0 | } |
| 258 | |
|
| 259 | |
@Override |
| 260 | |
public String getDocumentId() { |
| 261 | 0 | return this.documentId; |
| 262 | |
} |
| 263 | |
|
| 264 | |
@Override |
| 265 | |
public List<DocumentStatus> getDocumentStatuses() { |
| 266 | 0 | return this.documentStatuses; |
| 267 | |
} |
| 268 | |
|
| 269 | |
@Override |
| 270 | |
public List<DocumentStatusCategory> getDocumentStatusCategories() { |
| 271 | 0 | return this.documentStatusCategories; |
| 272 | |
} |
| 273 | |
|
| 274 | |
@Override |
| 275 | |
public String getTitle() { |
| 276 | 0 | return this.title; |
| 277 | |
} |
| 278 | |
|
| 279 | |
@Override |
| 280 | |
public String getApplicationDocumentId() { |
| 281 | 0 | return this.applicationDocumentId; |
| 282 | |
} |
| 283 | |
|
| 284 | |
@Override |
| 285 | |
public String getApplicationDocumentStatus() { |
| 286 | 0 | return this.applicationDocumentStatus; |
| 287 | |
} |
| 288 | |
|
| 289 | |
@Override |
| 290 | |
public String getInitiatorPrincipalName() { |
| 291 | 0 | return this.initiatorPrincipalName; |
| 292 | |
} |
| 293 | |
|
| 294 | |
@Override |
| 295 | |
public String getViewerPrincipalName() { |
| 296 | 0 | return this.viewerPrincipalName; |
| 297 | |
} |
| 298 | |
|
| 299 | |
@Override |
| 300 | |
public String getViewerGroupId() { |
| 301 | 0 | return this.viewerGroupId; |
| 302 | |
} |
| 303 | |
|
| 304 | |
@Override |
| 305 | |
public String getApproverPrincipalName() { |
| 306 | 0 | return this.approverPrincipalName; |
| 307 | |
} |
| 308 | |
|
| 309 | |
@Override |
| 310 | |
public String getRouteNodeName() { |
| 311 | 0 | return this.routeNodeName; |
| 312 | |
} |
| 313 | |
|
| 314 | |
@Override |
| 315 | |
public RouteNodeLookupLogic getRouteNodeLookupLogic() { |
| 316 | 0 | return this.routeNodeLookupLogic; |
| 317 | |
} |
| 318 | |
|
| 319 | |
@Override |
| 320 | |
public String getDocumentTypeName() { |
| 321 | 0 | return this.documentTypeName; |
| 322 | |
} |
| 323 | |
|
| 324 | |
@Override |
| 325 | |
public List<String> getAdditionalDocumentTypeNames() { |
| 326 | 0 | return this.additionalDocumentTypeNames; |
| 327 | |
} |
| 328 | |
|
| 329 | |
@Override |
| 330 | |
public DateTime getDateCreatedFrom() { |
| 331 | 0 | return this.dateCreatedFrom; |
| 332 | |
} |
| 333 | |
|
| 334 | |
@Override |
| 335 | |
public DateTime getDateCreatedTo() { |
| 336 | 0 | return this.dateCreatedTo; |
| 337 | |
} |
| 338 | |
|
| 339 | |
@Override |
| 340 | |
public DateTime getDateLastModifiedFrom() { |
| 341 | 0 | return this.dateLastModifiedFrom; |
| 342 | |
} |
| 343 | |
|
| 344 | |
@Override |
| 345 | |
public DateTime getDateLastModifiedTo() { |
| 346 | 0 | return this.dateLastModifiedTo; |
| 347 | |
} |
| 348 | |
|
| 349 | |
@Override |
| 350 | |
public DateTime getDateApprovedFrom() { |
| 351 | 0 | return this.dateApprovedFrom; |
| 352 | |
} |
| 353 | |
|
| 354 | |
@Override |
| 355 | |
public DateTime getDateApprovedTo() { |
| 356 | 0 | return this.dateApprovedTo; |
| 357 | |
} |
| 358 | |
|
| 359 | |
@Override |
| 360 | |
public DateTime getDateFinalizedFrom() { |
| 361 | 0 | return this.dateFinalizedFrom; |
| 362 | |
} |
| 363 | |
|
| 364 | |
@Override |
| 365 | |
public DateTime getDateFinalizedTo() { |
| 366 | 0 | return this.dateFinalizedTo; |
| 367 | |
} |
| 368 | |
|
| 369 | |
@Override |
| 370 | |
public DateTime getDateApplicationDocumentStatusChangedFrom() { |
| 371 | 0 | return dateApplicationDocumentStatusChangedFrom; |
| 372 | |
} |
| 373 | |
|
| 374 | |
@Override |
| 375 | |
public DateTime getDateApplicationDocumentStatusChangedTo() { |
| 376 | 0 | return dateApplicationDocumentStatusChangedTo; |
| 377 | |
} |
| 378 | |
|
| 379 | |
@Override |
| 380 | |
public Map<String, List<String>> getDocumentAttributeValues() { |
| 381 | 0 | return this.documentAttributeValues; |
| 382 | |
} |
| 383 | |
|
| 384 | |
@Override |
| 385 | |
public String getSaveName() { |
| 386 | 0 | return saveName; |
| 387 | |
} |
| 388 | |
|
| 389 | |
@Override |
| 390 | |
public Integer getStartAtIndex() { |
| 391 | 0 | return this.startAtIndex; |
| 392 | |
} |
| 393 | |
|
| 394 | |
@Override |
| 395 | |
public Integer getMaxResults() { |
| 396 | 0 | return this.maxResults; |
| 397 | |
} |
| 398 | |
|
| 399 | |
|
| 400 | |
|
| 401 | |
|
| 402 | |
|
| 403 | 0 | public final static class Builder implements Serializable, ModelBuilder, DocumentSearchCriteriaContract { |
| 404 | |
|
| 405 | |
private String documentId; |
| 406 | |
private List<DocumentStatus> documentStatuses; |
| 407 | |
private List<DocumentStatusCategory> documentStatusCategories; |
| 408 | |
private String title; |
| 409 | |
private String applicationDocumentId; |
| 410 | |
private String applicationDocumentStatus; |
| 411 | |
private String initiatorPrincipalName; |
| 412 | |
private String viewerPrincipalName; |
| 413 | |
private String viewerGroupId; |
| 414 | |
private String approverPrincipalName; |
| 415 | |
private String routeNodeName; |
| 416 | |
private RouteNodeLookupLogic routeNodeLookupLogic; |
| 417 | |
private String documentTypeName; |
| 418 | |
private List<String> additionalDocumentTypeNames; |
| 419 | |
private DateTime dateCreatedFrom; |
| 420 | |
private DateTime dateCreatedTo; |
| 421 | |
private DateTime dateLastModifiedFrom; |
| 422 | |
private DateTime dateLastModifiedTo; |
| 423 | |
private DateTime dateApprovedFrom; |
| 424 | |
private DateTime dateApprovedTo; |
| 425 | |
private DateTime dateFinalizedFrom; |
| 426 | |
private DateTime dateFinalizedTo; |
| 427 | |
private DateTime dateApplicationDocumentStatusChangedFrom; |
| 428 | |
private DateTime dateApplicationDocumentStatusChangedTo; |
| 429 | |
private Map<String, List<String>> documentAttributeValues; |
| 430 | |
private String saveName; |
| 431 | |
private Integer startAtIndex; |
| 432 | |
private Integer maxResults; |
| 433 | |
|
| 434 | 0 | private Builder() { |
| 435 | 0 | setDocumentStatuses(new ArrayList<DocumentStatus>()); |
| 436 | 0 | setDocumentStatusCategories(new ArrayList<DocumentStatusCategory>()); |
| 437 | 0 | setAdditionalDocumentTypeNames(new ArrayList<String>()); |
| 438 | 0 | setDocumentAttributeValues(new HashMap<String, List<String>>()); |
| 439 | 0 | } |
| 440 | |
|
| 441 | |
|
| 442 | |
|
| 443 | |
|
| 444 | |
|
| 445 | |
|
| 446 | |
public static Builder create() { |
| 447 | 0 | return new Builder(); |
| 448 | |
} |
| 449 | |
|
| 450 | |
|
| 451 | |
|
| 452 | |
|
| 453 | |
|
| 454 | |
|
| 455 | |
|
| 456 | |
|
| 457 | |
|
| 458 | |
|
| 459 | |
public static Builder create(DocumentSearchCriteriaContract contract) { |
| 460 | 0 | if (contract == null) { |
| 461 | 0 | throw new IllegalArgumentException("contract was null"); |
| 462 | |
} |
| 463 | 0 | Builder builder = create(); |
| 464 | 0 | builder.setDocumentId(contract.getDocumentId()); |
| 465 | 0 | if (contract.getDocumentStatuses() != null) { |
| 466 | 0 | builder.setDocumentStatuses(new ArrayList<DocumentStatus>(contract.getDocumentStatuses())); |
| 467 | |
} |
| 468 | 0 | if (contract.getDocumentStatusCategories() != null) { |
| 469 | 0 | builder.setDocumentStatusCategories(new ArrayList<DocumentStatusCategory>(contract.getDocumentStatusCategories())); |
| 470 | |
} |
| 471 | 0 | builder.setTitle(contract.getTitle()); |
| 472 | 0 | builder.setApplicationDocumentId(contract.getApplicationDocumentId()); |
| 473 | 0 | builder.setApplicationDocumentStatus(contract.getApplicationDocumentStatus()); |
| 474 | 0 | builder.setInitiatorPrincipalName(contract.getInitiatorPrincipalName()); |
| 475 | 0 | builder.setViewerPrincipalName(contract.getViewerPrincipalName()); |
| 476 | 0 | builder.setViewerGroupId(contract.getViewerGroupId()); |
| 477 | 0 | builder.setApproverPrincipalName(contract.getApproverPrincipalName()); |
| 478 | 0 | builder.setRouteNodeName(contract.getRouteNodeName()); |
| 479 | 0 | builder.setRouteNodeLookupLogic(contract.getRouteNodeLookupLogic()); |
| 480 | 0 | builder.setDocumentTypeName(contract.getDocumentTypeName()); |
| 481 | 0 | if (contract.getAdditionalDocumentTypeNames() != null) { |
| 482 | 0 | builder.setAdditionalDocumentTypeNames(new ArrayList<String>(contract.getAdditionalDocumentTypeNames())); |
| 483 | |
} |
| 484 | 0 | builder.setDateCreatedFrom(contract.getDateCreatedFrom()); |
| 485 | 0 | builder.setDateCreatedTo(contract.getDateCreatedTo()); |
| 486 | 0 | builder.setDateLastModifiedFrom(contract.getDateLastModifiedFrom()); |
| 487 | 0 | builder.setDateLastModifiedTo(contract.getDateLastModifiedTo()); |
| 488 | 0 | builder.setDateApprovedFrom(contract.getDateApprovedFrom()); |
| 489 | 0 | builder.setDateApprovedTo(contract.getDateApprovedTo()); |
| 490 | 0 | builder.setDateFinalizedFrom(contract.getDateFinalizedFrom()); |
| 491 | 0 | builder.setDateFinalizedTo(contract.getDateFinalizedTo()); |
| 492 | 0 | builder.setDateApplicationDocumentStatusChangedFrom(contract.getDateApplicationDocumentStatusChangedFrom()); |
| 493 | 0 | builder.setDateApplicationDocumentStatusChangedTo(contract.getDateApplicationDocumentStatusChangedTo()); |
| 494 | 0 | if (contract.getDocumentAttributeValues() != null) { |
| 495 | 0 | builder.setDocumentAttributeValues(new HashMap<String, List<String>>(contract.getDocumentAttributeValues())); |
| 496 | |
} |
| 497 | 0 | builder.setSaveName(contract.getSaveName()); |
| 498 | 0 | builder.setStartAtIndex(contract.getStartAtIndex()); |
| 499 | 0 | builder.setMaxResults(contract.getMaxResults()); |
| 500 | 0 | return builder; |
| 501 | |
} |
| 502 | |
|
| 503 | |
@Override |
| 504 | |
public DocumentSearchCriteria build() { |
| 505 | 0 | if (StringUtils.isNotBlank(routeNodeName) && StringUtils.isBlank(documentTypeName)) { |
| 506 | 0 | throw new IllegalStateException("documentTypeName must be set if routeNodeName is set."); |
| 507 | |
} |
| 508 | 0 | return new DocumentSearchCriteria(this); |
| 509 | |
} |
| 510 | |
|
| 511 | |
@Override |
| 512 | |
public String getDocumentId() { |
| 513 | 0 | return this.documentId; |
| 514 | |
} |
| 515 | |
|
| 516 | |
@Override |
| 517 | |
public List<DocumentStatus> getDocumentStatuses() { |
| 518 | 0 | return this.documentStatuses; |
| 519 | |
} |
| 520 | |
|
| 521 | |
@Override |
| 522 | |
public List<DocumentStatusCategory> getDocumentStatusCategories() { |
| 523 | 0 | return this.documentStatusCategories; |
| 524 | |
} |
| 525 | |
|
| 526 | |
@Override |
| 527 | |
public String getTitle() { |
| 528 | 0 | return this.title; |
| 529 | |
} |
| 530 | |
|
| 531 | |
@Override |
| 532 | |
public String getApplicationDocumentId() { |
| 533 | 0 | return this.applicationDocumentId; |
| 534 | |
} |
| 535 | |
|
| 536 | |
@Override |
| 537 | |
public String getApplicationDocumentStatus() { |
| 538 | 0 | return this.applicationDocumentStatus; |
| 539 | |
} |
| 540 | |
|
| 541 | |
@Override |
| 542 | |
public String getInitiatorPrincipalName() { |
| 543 | 0 | return this.initiatorPrincipalName; |
| 544 | |
} |
| 545 | |
|
| 546 | |
@Override |
| 547 | |
public String getViewerPrincipalName() { |
| 548 | 0 | return this.viewerPrincipalName; |
| 549 | |
} |
| 550 | |
|
| 551 | |
@Override |
| 552 | |
public String getViewerGroupId() { |
| 553 | 0 | return this.viewerGroupId; |
| 554 | |
} |
| 555 | |
|
| 556 | |
@Override |
| 557 | |
public String getApproverPrincipalName() { |
| 558 | 0 | return this.approverPrincipalName; |
| 559 | |
} |
| 560 | |
|
| 561 | |
@Override |
| 562 | |
public String getRouteNodeName() { |
| 563 | 0 | return this.routeNodeName; |
| 564 | |
} |
| 565 | |
|
| 566 | |
@Override |
| 567 | |
public RouteNodeLookupLogic getRouteNodeLookupLogic() { |
| 568 | 0 | return this.routeNodeLookupLogic; |
| 569 | |
} |
| 570 | |
|
| 571 | |
@Override |
| 572 | |
public String getDocumentTypeName() { |
| 573 | 0 | return this.documentTypeName; |
| 574 | |
} |
| 575 | |
|
| 576 | |
@Override |
| 577 | |
public List<String> getAdditionalDocumentTypeNames() { |
| 578 | 0 | return additionalDocumentTypeNames; |
| 579 | |
} |
| 580 | |
|
| 581 | |
@Override |
| 582 | |
public DateTime getDateCreatedFrom() { |
| 583 | 0 | return this.dateCreatedFrom; |
| 584 | |
} |
| 585 | |
|
| 586 | |
@Override |
| 587 | |
public DateTime getDateCreatedTo() { |
| 588 | 0 | return this.dateCreatedTo; |
| 589 | |
} |
| 590 | |
|
| 591 | |
@Override |
| 592 | |
public DateTime getDateLastModifiedFrom() { |
| 593 | 0 | return this.dateLastModifiedFrom; |
| 594 | |
} |
| 595 | |
|
| 596 | |
@Override |
| 597 | |
public DateTime getDateLastModifiedTo() { |
| 598 | 0 | return this.dateLastModifiedTo; |
| 599 | |
} |
| 600 | |
|
| 601 | |
@Override |
| 602 | |
public DateTime getDateApprovedFrom() { |
| 603 | 0 | return this.dateApprovedFrom; |
| 604 | |
} |
| 605 | |
|
| 606 | |
@Override |
| 607 | |
public DateTime getDateApprovedTo() { |
| 608 | 0 | return this.dateApprovedTo; |
| 609 | |
} |
| 610 | |
|
| 611 | |
@Override |
| 612 | |
public DateTime getDateFinalizedFrom() { |
| 613 | 0 | return this.dateFinalizedFrom; |
| 614 | |
} |
| 615 | |
|
| 616 | |
@Override |
| 617 | |
public DateTime getDateFinalizedTo() { |
| 618 | 0 | return this.dateFinalizedTo; |
| 619 | |
} |
| 620 | |
|
| 621 | |
@Override |
| 622 | |
public DateTime getDateApplicationDocumentStatusChangedFrom() { |
| 623 | 0 | return dateApplicationDocumentStatusChangedFrom; |
| 624 | |
} |
| 625 | |
|
| 626 | |
@Override |
| 627 | |
public DateTime getDateApplicationDocumentStatusChangedTo() { |
| 628 | 0 | return dateApplicationDocumentStatusChangedTo; |
| 629 | |
} |
| 630 | |
|
| 631 | |
@Override |
| 632 | |
public Map<String, List<String>> getDocumentAttributeValues() { |
| 633 | 0 | return this.documentAttributeValues; |
| 634 | |
} |
| 635 | |
|
| 636 | |
@Override |
| 637 | |
public String getSaveName() { |
| 638 | 0 | return this.saveName; |
| 639 | |
} |
| 640 | |
|
| 641 | |
@Override |
| 642 | |
public Integer getStartAtIndex() { |
| 643 | 0 | return this.startAtIndex; |
| 644 | |
} |
| 645 | |
|
| 646 | |
@Override |
| 647 | |
public Integer getMaxResults() { |
| 648 | 0 | return this.maxResults; |
| 649 | |
} |
| 650 | |
|
| 651 | |
public void setDocumentId(String documentId) { |
| 652 | 0 | this.documentId = documentId; |
| 653 | 0 | } |
| 654 | |
|
| 655 | |
public void setDocumentStatuses(List<DocumentStatus> documentStatuses) { |
| 656 | 0 | this.documentStatuses = documentStatuses; |
| 657 | 0 | } |
| 658 | |
|
| 659 | |
public void setDocumentStatusCategories(List<DocumentStatusCategory> documentStatusCategories) { |
| 660 | 0 | this.documentStatusCategories = documentStatusCategories; |
| 661 | 0 | } |
| 662 | |
|
| 663 | |
public void setTitle(String title) { |
| 664 | 0 | this.title = title; |
| 665 | 0 | } |
| 666 | |
|
| 667 | |
public void setApplicationDocumentId(String applicationDocumentId) { |
| 668 | 0 | this.applicationDocumentId = applicationDocumentId; |
| 669 | 0 | } |
| 670 | |
|
| 671 | |
public void setApplicationDocumentStatus(String applicationDocumentStatus) { |
| 672 | 0 | this.applicationDocumentStatus = applicationDocumentStatus; |
| 673 | 0 | } |
| 674 | |
|
| 675 | |
public void setInitiatorPrincipalName(String initiatorPrincipalName) { |
| 676 | 0 | this.initiatorPrincipalName = initiatorPrincipalName; |
| 677 | 0 | } |
| 678 | |
|
| 679 | |
public void setViewerPrincipalName(String viewerPrincipalName) { |
| 680 | 0 | this.viewerPrincipalName = viewerPrincipalName; |
| 681 | 0 | } |
| 682 | |
|
| 683 | |
public void setViewerGroupId(String viewerGroupId) { |
| 684 | 0 | this.viewerGroupId = viewerGroupId; |
| 685 | 0 | } |
| 686 | |
|
| 687 | |
public void setApproverPrincipalName(String approverPrincipalName) { |
| 688 | 0 | this.approverPrincipalName = approverPrincipalName; |
| 689 | 0 | } |
| 690 | |
|
| 691 | |
public void setRouteNodeName(String routeNodeName) { |
| 692 | 0 | this.routeNodeName = routeNodeName; |
| 693 | 0 | } |
| 694 | |
|
| 695 | |
public void setRouteNodeLookupLogic(RouteNodeLookupLogic routeNodeLookupLogic) { |
| 696 | 0 | this.routeNodeLookupLogic = routeNodeLookupLogic; |
| 697 | 0 | } |
| 698 | |
|
| 699 | |
public void setDocumentTypeName(String documentTypeName) { |
| 700 | 0 | this.documentTypeName = documentTypeName; |
| 701 | 0 | } |
| 702 | |
|
| 703 | |
public void setAdditionalDocumentTypeNames(List<String> additionalDocumentTypeNames) { |
| 704 | 0 | this.additionalDocumentTypeNames = additionalDocumentTypeNames; |
| 705 | 0 | } |
| 706 | |
|
| 707 | |
public void setDateCreatedFrom(DateTime dateCreatedFrom) { |
| 708 | 0 | this.dateCreatedFrom = dateCreatedFrom; |
| 709 | 0 | } |
| 710 | |
|
| 711 | |
public void setDateCreatedTo(DateTime dateCreatedTo) { |
| 712 | 0 | this.dateCreatedTo = dateCreatedTo; |
| 713 | 0 | } |
| 714 | |
|
| 715 | |
public void setDateLastModifiedFrom(DateTime dateLastModifiedFrom) { |
| 716 | 0 | this.dateLastModifiedFrom = dateLastModifiedFrom; |
| 717 | 0 | } |
| 718 | |
|
| 719 | |
public void setDateLastModifiedTo(DateTime dateLastModifiedTo) { |
| 720 | 0 | this.dateLastModifiedTo = dateLastModifiedTo; |
| 721 | 0 | } |
| 722 | |
|
| 723 | |
public void setDateApprovedFrom(DateTime dateApprovedFrom) { |
| 724 | 0 | this.dateApprovedFrom = dateApprovedFrom; |
| 725 | 0 | } |
| 726 | |
|
| 727 | |
public void setDateApprovedTo(DateTime dateApprovedTo) { |
| 728 | 0 | this.dateApprovedTo = dateApprovedTo; |
| 729 | 0 | } |
| 730 | |
|
| 731 | |
public void setDateFinalizedFrom(DateTime dateFinalizedFrom) { |
| 732 | 0 | this.dateFinalizedFrom = dateFinalizedFrom; |
| 733 | 0 | } |
| 734 | |
|
| 735 | |
public void setDateFinalizedTo(DateTime dateFinalizedTo) { |
| 736 | 0 | this.dateFinalizedTo = dateFinalizedTo; |
| 737 | 0 | } |
| 738 | |
|
| 739 | |
public void setDateApplicationDocumentStatusChangedFrom(DateTime dateApplicationDocumentStatusChangedFrom) { |
| 740 | 0 | this.dateApplicationDocumentStatusChangedFrom = dateApplicationDocumentStatusChangedFrom; |
| 741 | 0 | } |
| 742 | |
|
| 743 | |
public void setDateApplicationDocumentStatusChangedTo(DateTime dateApplicationDocumentStatusChangedTo) { |
| 744 | 0 | this.dateApplicationDocumentStatusChangedTo = dateApplicationDocumentStatusChangedTo; |
| 745 | 0 | } |
| 746 | |
|
| 747 | |
public void setDocumentAttributeValues(Map<String, List<String>> documentAttributeValues) { |
| 748 | 0 | this.documentAttributeValues = documentAttributeValues; |
| 749 | 0 | } |
| 750 | |
|
| 751 | |
public void addDocumentAttributeValue(String name, String value) { |
| 752 | 0 | if (StringUtils.isBlank(value)) { |
| 753 | 0 | throw new IllegalArgumentException("value was null or blank"); |
| 754 | |
} |
| 755 | 0 | List<String> values = getDocumentAttributeValues().get(name); |
| 756 | 0 | if (values == null) { |
| 757 | 0 | values = new ArrayList<String>(); |
| 758 | 0 | getDocumentAttributeValues().put(name, values); |
| 759 | |
} |
| 760 | 0 | values.add(value); |
| 761 | 0 | } |
| 762 | |
|
| 763 | |
public void setSaveName(String saveName) { |
| 764 | 0 | this.saveName = saveName; |
| 765 | 0 | } |
| 766 | |
|
| 767 | |
public void setStartAtIndex(Integer startAtIndex) { |
| 768 | 0 | this.startAtIndex = startAtIndex; |
| 769 | 0 | } |
| 770 | |
|
| 771 | |
public void setMaxResults(Integer maxResults) { |
| 772 | 0 | this.maxResults = maxResults; |
| 773 | 0 | } |
| 774 | |
|
| 775 | |
|
| 776 | |
|
| 777 | |
|
| 778 | |
|
| 779 | |
|
| 780 | |
public void normalizeDateTimes() { |
| 781 | 0 | if (dateCreatedFrom != null) dateCreatedFrom = dateCreatedFrom.withZone(DateTimeZone.getDefault()); |
| 782 | 0 | if (dateCreatedTo != null) dateCreatedTo = dateCreatedTo.withZone(DateTimeZone.getDefault()); |
| 783 | 0 | if (dateLastModifiedFrom != null) dateLastModifiedFrom = dateLastModifiedFrom.withZone(DateTimeZone.getDefault()); |
| 784 | 0 | if (dateLastModifiedTo != null) dateLastModifiedTo = dateLastModifiedTo.withZone(DateTimeZone.getDefault()); |
| 785 | 0 | if (dateApprovedFrom != null) dateApprovedFrom = dateApprovedFrom.withZone(DateTimeZone.getDefault()); |
| 786 | 0 | if (dateApprovedTo != null) dateApprovedTo = dateApprovedTo.withZone(DateTimeZone.getDefault()); |
| 787 | 0 | if (dateFinalizedFrom != null) dateFinalizedFrom = dateFinalizedFrom.withZone(DateTimeZone.getDefault()); |
| 788 | 0 | if (dateFinalizedTo != null) dateFinalizedTo = dateFinalizedTo.withZone(DateTimeZone.getDefault()); |
| 789 | 0 | if (dateApplicationDocumentStatusChangedFrom != null) dateApplicationDocumentStatusChangedFrom = dateApplicationDocumentStatusChangedFrom.withZone(DateTimeZone.getDefault()); |
| 790 | 0 | if (dateApplicationDocumentStatusChangedTo != null) dateApplicationDocumentStatusChangedTo = dateApplicationDocumentStatusChangedTo.withZone(DateTimeZone.getDefault()); |
| 791 | 0 | } |
| 792 | |
|
| 793 | |
} |
| 794 | |
|
| 795 | |
|
| 796 | |
|
| 797 | |
|
| 798 | 0 | static class Constants { |
| 799 | |
final static String ROOT_ELEMENT_NAME = "documentSearchCriteria"; |
| 800 | |
final static String TYPE_NAME = "DocumentSearchCriteriaType"; |
| 801 | |
} |
| 802 | |
|
| 803 | |
|
| 804 | |
|
| 805 | |
|
| 806 | 0 | static class Elements { |
| 807 | |
final static String DOCUMENT_ID = "documentId"; |
| 808 | |
final static String DOCUMENT_STATUSES = "documentStatuses"; |
| 809 | |
final static String DOCUMENT_STATUS = "documentStatus"; |
| 810 | |
final static String DOCUMENT_STATUS_CATEGORIES = "documentStatusCategories"; |
| 811 | |
final static String DOCUMENT_STATUS_CATEGORY = "documentStatusCategory"; |
| 812 | |
final static String TITLE = "title"; |
| 813 | |
final static String APPLICATION_DOCUMENT_ID = "applicationDocumentId"; |
| 814 | |
final static String APPLICATION_DOCUMENT_STATUS = "applicationDocumentStatus"; |
| 815 | |
final static String INITIATOR_PRINCIPAL_NAME = "initiatorPrincipalName"; |
| 816 | |
final static String VIEWER_PRINCIPAL_NAME = "viewerPrincipalName"; |
| 817 | |
final static String VIEWER_GROUP_ID = "viewerGroupId"; |
| 818 | |
final static String APPROVER_PRINCIPAL_NAME = "approverPrincipalName"; |
| 819 | |
final static String ROUTE_NODE_NAME = "routeNodeName"; |
| 820 | |
final static String ROUTE_NODE_LOOKUP_LOGIC = "routeNodeLookupLogic"; |
| 821 | |
final static String DOCUMENT_TYPE_NAME = "documentTypeName"; |
| 822 | |
final static String ADDITIONAL_DOCUMENT_TYPE_NAMES = "additionalDocumentTypeNames"; |
| 823 | |
final static String ADDITIONAL_DOCUMENT_TYPE_NAME = "additionalDocumentTypeName"; |
| 824 | |
final static String DATE_CREATED_FROM = "dateCreatedFrom"; |
| 825 | |
final static String DATE_CREATED_TO = "dateCreatedTo"; |
| 826 | |
final static String DATE_LAST_MODIFIED_FROM = "dateLastModifiedFrom"; |
| 827 | |
final static String DATE_LAST_MODIFIED_TO = "dateLastModifiedTo"; |
| 828 | |
final static String DATE_APPROVED_FROM = "dateApprovedFrom"; |
| 829 | |
final static String DATE_APPROVED_TO = "dateApprovedTo"; |
| 830 | |
final static String DATE_FINALIZED_FROM = "dateFinalizedFrom"; |
| 831 | |
final static String DATE_FINALIZED_TO = "dateFinalizedTo"; |
| 832 | |
final static String DATE_APPLICATION_DOCUMENT_STATUS_CHANGED_FROM = "dateApplicationDocumentStatusChangedFrom"; |
| 833 | |
final static String DATE_APPLICATION_DOCUMENT_STATUS_CHANGED_TO = "dateApplicationDocumentStatusChangedTo"; |
| 834 | |
final static String DOCUMENT_ATTRIBUTE_VALUES = "documentAttributeValues"; |
| 835 | |
final static String SAVE_NAME = "saveName"; |
| 836 | |
final static String START_AT_INDEX = "startAtIndex"; |
| 837 | |
final static String MAX_RESULTS = "maxResults"; |
| 838 | |
} |
| 839 | |
|
| 840 | |
} |