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.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  @XmlRootElement(name = DocumentProcessingOptions.Constants.ROOT_ELEMENT_NAME)
31  @XmlAccessorType(XmlAccessType.NONE)
32  @XmlType(name = DocumentProcessingOptions.Constants.TYPE_NAME, propOrder = {
33          DocumentProcessingOptions.Elements.RUN_POST_PROCESSOR,
34          DocumentProcessingOptions.Elements.INDEX_SEARCH_ATTRIBUTES,
35          DocumentProcessingOptions.Elements.SEND_NOTIFICATIONS,
36          CoreConstants.CommonElements.FUTURE_ELEMENTS
37  })
38  public final class DocumentProcessingOptions extends AbstractDataTransferObject {
39  
40      @XmlElement(name = Elements.RUN_POST_PROCESSOR, required = true)
41      private final boolean runPostProcessor;
42  
43      @XmlElement(name = Elements.INDEX_SEARCH_ATTRIBUTES, required = true)
44      private final boolean indexSearchAttributes;
45  
46      @XmlElement(name = Elements.SEND_NOTIFICATIONS, required = true)
47      private final boolean sendNotifications;
48  
49      @SuppressWarnings("unused")
50      @XmlAnyElement
51      private final Collection<Element> _futureElements = null;
52  
53      private DocumentProcessingOptions() {
54          this(true, true, true);
55      }
56  
57      private DocumentProcessingOptions(boolean runPostProcessor, boolean indexSearchAttributes, boolean sendNotifications) {
58          this.runPostProcessor = runPostProcessor;
59          this.indexSearchAttributes = indexSearchAttributes;
60          this.sendNotifications = sendNotifications;
61      }
62  
63      public static DocumentProcessingOptions create(boolean runPostProcessor, boolean indexSearchAttributes) {
64          return create(runPostProcessor, indexSearchAttributes, true);
65      }
66  
67      public static DocumentProcessingOptions create(boolean runPostProcessor, boolean indexSearchAttributes, boolean sendNotifications) {
68          return new DocumentProcessingOptions(runPostProcessor, indexSearchAttributes, sendNotifications);
69      }
70  
71      public static DocumentProcessingOptions createDefault() {
72          return new DocumentProcessingOptions();
73      }
74  
75      public boolean isRunPostProcessor() {
76          return runPostProcessor;
77      }
78  
79      public boolean isIndexSearchAttributes() {
80          return indexSearchAttributes;
81      }
82  
83      public boolean isSendNotifications() {
84          return sendNotifications;
85      }
86  
87      /**
88       * Defines some internal constants used on this class.
89       */
90      static class Constants {
91          final static String ROOT_ELEMENT_NAME = "documentProcessingOptions";
92          final static String TYPE_NAME = "DocumentProcessingOptionsType";
93      }
94  
95      /**
96       * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML.
97       */
98      static class Elements {
99          final static String RUN_POST_PROCESSOR = "runPostProcessor";
100         final static String INDEX_SEARCH_ATTRIBUTES = "indexSearchAttributes";
101         final static String SEND_NOTIFICATIONS = "sendNotifications";
102     }
103     
104 }