001 /** 002 * Copyright 2005-2014 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.kuali.rice.kew.api.document; 017 018 import org.kuali.rice.core.api.CoreConstants; 019 import org.kuali.rice.core.api.mo.AbstractDataTransferObject; 020 import org.w3c.dom.Element; 021 022 import javax.xml.bind.annotation.XmlAccessType; 023 import javax.xml.bind.annotation.XmlAccessorType; 024 import javax.xml.bind.annotation.XmlAnyElement; 025 import javax.xml.bind.annotation.XmlElement; 026 import javax.xml.bind.annotation.XmlRootElement; 027 import javax.xml.bind.annotation.XmlType; 028 import java.util.Collection; 029 030 @XmlRootElement(name = DocumentProcessingOptions.Constants.ROOT_ELEMENT_NAME) 031 @XmlAccessorType(XmlAccessType.NONE) 032 @XmlType(name = DocumentProcessingOptions.Constants.TYPE_NAME, propOrder = { 033 DocumentProcessingOptions.Elements.RUN_POST_PROCESSOR, 034 DocumentProcessingOptions.Elements.INDEX_SEARCH_ATTRIBUTES, 035 DocumentProcessingOptions.Elements.SEND_NOTIFICATIONS, 036 CoreConstants.CommonElements.FUTURE_ELEMENTS 037 }) 038 public final class DocumentProcessingOptions extends AbstractDataTransferObject { 039 040 @XmlElement(name = Elements.RUN_POST_PROCESSOR, required = true) 041 private final boolean runPostProcessor; 042 043 @XmlElement(name = Elements.INDEX_SEARCH_ATTRIBUTES, required = true) 044 private final boolean indexSearchAttributes; 045 046 @XmlElement(name = Elements.SEND_NOTIFICATIONS, required = true) 047 private final boolean sendNotifications; 048 049 @SuppressWarnings("unused") 050 @XmlAnyElement 051 private final Collection<Element> _futureElements = null; 052 053 private DocumentProcessingOptions() { 054 this(true, true, true); 055 } 056 057 private DocumentProcessingOptions(boolean runPostProcessor, boolean indexSearchAttributes, boolean sendNotifications) { 058 this.runPostProcessor = runPostProcessor; 059 this.indexSearchAttributes = indexSearchAttributes; 060 this.sendNotifications = sendNotifications; 061 } 062 063 public static DocumentProcessingOptions create(boolean runPostProcessor, boolean indexSearchAttributes) { 064 return create(runPostProcessor, indexSearchAttributes, true); 065 } 066 067 public static DocumentProcessingOptions create(boolean runPostProcessor, boolean indexSearchAttributes, boolean sendNotifications) { 068 return new DocumentProcessingOptions(runPostProcessor, indexSearchAttributes, sendNotifications); 069 } 070 071 public static DocumentProcessingOptions createDefault() { 072 return new DocumentProcessingOptions(); 073 } 074 075 public boolean isRunPostProcessor() { 076 return runPostProcessor; 077 } 078 079 public boolean isIndexSearchAttributes() { 080 return indexSearchAttributes; 081 } 082 083 public boolean isSendNotifications() { 084 return sendNotifications; 085 } 086 087 /** 088 * Defines some internal constants used on this class. 089 */ 090 static class Constants { 091 final static String ROOT_ELEMENT_NAME = "documentProcessingOptions"; 092 final static String TYPE_NAME = "DocumentProcessingOptionsType"; 093 } 094 095 /** 096 * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML. 097 */ 098 static class Elements { 099 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 }