View Javadoc
1   /**
2    * Copyright 2005-2015 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.document;
17  
18  import org.kuali.rice.core.api.CoreConstants;
19  import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
20  import org.w3c.dom.Element;
21  
22  import javax.xml.bind.annotation.XmlAccessType;
23  import javax.xml.bind.annotation.XmlAccessorType;
24  import javax.xml.bind.annotation.XmlAnyElement;
25  import javax.xml.bind.annotation.XmlElement;
26  import javax.xml.bind.annotation.XmlRootElement;
27  import javax.xml.bind.annotation.XmlType;
28  import java.util.Collection;
29  
30  //KULRICE-12283: Added two new properties to the propOrder
31  @XmlRootElement(name = DocumentProcessingOptions.Constants.ROOT_ELEMENT_NAME)
32  @XmlAccessorType(XmlAccessType.NONE)
33  @XmlType(name = DocumentProcessingOptions.Constants.TYPE_NAME, propOrder = {
34          DocumentProcessingOptions.Elements.RUN_POST_PROCESSOR,
35          DocumentProcessingOptions.Elements.INDEX_SEARCH_ATTRIBUTES,
36          DocumentProcessingOptions.Elements.SEND_NOTIFICATIONS,
37          DocumentProcessingOptions.Elements.DEACTIVATE_ACKNOWLEDGEMENTS,
38          DocumentProcessingOptions.Elements.DEACTIVATE_FYIS,
39          CoreConstants.CommonElements.FUTURE_ELEMENTS
40  })
41  public final class DocumentProcessingOptions extends AbstractDataTransferObject {
42  
43      @XmlElement(name = Elements.RUN_POST_PROCESSOR, required = true)
44      private final boolean runPostProcessor;
45  
46      @XmlElement(name = Elements.INDEX_SEARCH_ATTRIBUTES, required = true)
47      private final boolean indexSearchAttributes;
48  
49      @XmlElement(name = Elements.SEND_NOTIFICATIONS, required = true)
50      private final boolean sendNotifications;
51  
52      //KULRICE-12283: Added two new flags to indicate if acknowledgements and FYIs should be deactivated when blanket approval occurs
53      @XmlElement(name = Elements.DEACTIVATE_ACKNOWLEDGEMENTS, required = false)
54      private final Boolean deactivateAcknowledgements;
55  
56      @XmlElement(name = Elements.DEACTIVATE_FYIS, required = false)
57      private final Boolean deactivateFYIs;
58  
59      @SuppressWarnings("unused")
60      @XmlAnyElement
61      private final Collection<Element> _futureElements = null;
62  
63      //KULRICE-12283 Added a new constructor and create methods to include two new properties
64      private DocumentProcessingOptions() {
65          this(true, true, true, false, false);
66      }
67  
68      private DocumentProcessingOptions(boolean runPostProcessor, boolean indexSearchAttributes, boolean sendNotifications) {
69          this(runPostProcessor, indexSearchAttributes, sendNotifications, false, false);
70      }
71  
72      private DocumentProcessingOptions(boolean runPostProcessor, boolean indexSearchAttributes, boolean sendNotifications, boolean deactivateAcknowledgements, boolean deactivateFYIs) {
73          this.runPostProcessor = runPostProcessor;
74          this.indexSearchAttributes = indexSearchAttributes;
75          this.sendNotifications = sendNotifications;
76          this.deactivateAcknowledgements = deactivateAcknowledgements;
77          this.deactivateFYIs = deactivateFYIs;
78      }
79  
80      public static DocumentProcessingOptions create(boolean runPostProcessor, boolean indexSearchAttributes) {
81          return create(runPostProcessor, indexSearchAttributes, true);
82      }
83  
84      public static DocumentProcessingOptions create(boolean runPostProcessor, boolean indexSearchAttributes, boolean sendNotifications) {
85          return new DocumentProcessingOptions(runPostProcessor, indexSearchAttributes, sendNotifications);
86      }
87  
88      public static DocumentProcessingOptions create(boolean runPostProcessor, boolean indexSearchAttributes, boolean sendNotifications, boolean deactivateAcknowledgements, boolean deactivateFYIs) {
89          return new DocumentProcessingOptions(runPostProcessor, indexSearchAttributes, sendNotifications, deactivateAcknowledgements, deactivateFYIs);
90      }
91  
92      public static DocumentProcessingOptions createDefault() {
93          return new DocumentProcessingOptions();
94      }
95  
96      public boolean isRunPostProcessor() {
97          return runPostProcessor;
98      }
99  
100     public boolean isIndexSearchAttributes() {
101         return indexSearchAttributes;
102     }
103 
104     public boolean isSendNotifications() {
105         return sendNotifications;
106     }
107 
108     //KULRICE-12283:Added getters for two new properties
109     public boolean isDeactivateAcknowledgements() {
110         return deactivateAcknowledgements;
111     }
112 
113     public boolean isDeactivateFYIs() {
114         return deactivateFYIs;
115     }
116 
117     /**
118      * Defines some internal constants used on this class.
119      */
120     static class Constants {
121         final static String ROOT_ELEMENT_NAME = "documentProcessingOptions";
122         final static String TYPE_NAME = "DocumentProcessingOptionsType";
123     }
124 
125     /**
126      * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML.
127      */
128     static class Elements {
129         final static String RUN_POST_PROCESSOR = "runPostProcessor";
130         final static String INDEX_SEARCH_ATTRIBUTES = "indexSearchAttributes";
131         final static String SEND_NOTIFICATIONS = "sendNotifications";
132         //KULRICE-12283:Constants for two new properties
133         final static String DEACTIVATE_ACKNOWLEDGEMENTS = "deactivateAcknowledgements";
134         final static String DEACTIVATE_FYIS = "deactivateFYIs";
135     }
136 
137 }