001/** 002 * Copyright 2005-2016 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 */ 016package org.kuali.rice.kew.api.document; 017 018import org.kuali.rice.core.api.CoreConstants; 019import org.kuali.rice.core.api.mo.AbstractDataTransferObject; 020import org.w3c.dom.Element; 021 022import javax.xml.bind.annotation.XmlAccessType; 023import javax.xml.bind.annotation.XmlAccessorType; 024import javax.xml.bind.annotation.XmlAnyElement; 025import javax.xml.bind.annotation.XmlElement; 026import javax.xml.bind.annotation.XmlRootElement; 027import javax.xml.bind.annotation.XmlType; 028import java.util.Collection; 029 030//KULRICE-12283: Added two new properties to the propOrder 031@XmlRootElement(name = DocumentProcessingOptions.Constants.ROOT_ELEMENT_NAME) 032@XmlAccessorType(XmlAccessType.NONE) 033@XmlType(name = DocumentProcessingOptions.Constants.TYPE_NAME, propOrder = { 034 DocumentProcessingOptions.Elements.RUN_POST_PROCESSOR, 035 DocumentProcessingOptions.Elements.INDEX_SEARCH_ATTRIBUTES, 036 DocumentProcessingOptions.Elements.SEND_NOTIFICATIONS, 037 DocumentProcessingOptions.Elements.DEACTIVATE_ACKNOWLEDGEMENTS, 038 DocumentProcessingOptions.Elements.DEACTIVATE_FYIS, 039 CoreConstants.CommonElements.FUTURE_ELEMENTS 040}) 041public final class DocumentProcessingOptions extends AbstractDataTransferObject { 042 043 @XmlElement(name = Elements.RUN_POST_PROCESSOR, required = true) 044 private final boolean runPostProcessor; 045 046 @XmlElement(name = Elements.INDEX_SEARCH_ATTRIBUTES, required = true) 047 private final boolean indexSearchAttributes; 048 049 @XmlElement(name = Elements.SEND_NOTIFICATIONS, required = true) 050 private final boolean sendNotifications; 051 052 //KULRICE-12283: Added two new flags to indicate if acknowledgements and FYIs should be deactivated when blanket approval occurs 053 @XmlElement(name = Elements.DEACTIVATE_ACKNOWLEDGEMENTS, required = false) 054 private final Boolean deactivateAcknowledgements; 055 056 @XmlElement(name = Elements.DEACTIVATE_FYIS, required = false) 057 private final Boolean deactivateFYIs; 058 059 @SuppressWarnings("unused") 060 @XmlAnyElement 061 private final Collection<Element> _futureElements = null; 062 063 //KULRICE-12283 Added a new constructor and create methods to include two new properties 064 private DocumentProcessingOptions() { 065 this(true, true, true, false, false); 066 } 067 068 private DocumentProcessingOptions(boolean runPostProcessor, boolean indexSearchAttributes, boolean sendNotifications) { 069 this(runPostProcessor, indexSearchAttributes, sendNotifications, false, false); 070 } 071 072 private DocumentProcessingOptions(boolean runPostProcessor, boolean indexSearchAttributes, boolean sendNotifications, boolean deactivateAcknowledgements, boolean deactivateFYIs) { 073 this.runPostProcessor = runPostProcessor; 074 this.indexSearchAttributes = indexSearchAttributes; 075 this.sendNotifications = sendNotifications; 076 this.deactivateAcknowledgements = deactivateAcknowledgements; 077 this.deactivateFYIs = deactivateFYIs; 078 } 079 080 public static DocumentProcessingOptions create(boolean runPostProcessor, boolean indexSearchAttributes) { 081 return create(runPostProcessor, indexSearchAttributes, true); 082 } 083 084 public static DocumentProcessingOptions create(boolean runPostProcessor, boolean indexSearchAttributes, boolean sendNotifications) { 085 return new DocumentProcessingOptions(runPostProcessor, indexSearchAttributes, sendNotifications); 086 } 087 088 public static DocumentProcessingOptions create(boolean runPostProcessor, boolean indexSearchAttributes, boolean sendNotifications, boolean deactivateAcknowledgements, boolean deactivateFYIs) { 089 return new DocumentProcessingOptions(runPostProcessor, indexSearchAttributes, sendNotifications, deactivateAcknowledgements, deactivateFYIs); 090 } 091 092 public static DocumentProcessingOptions createDefault() { 093 return new DocumentProcessingOptions(); 094 } 095 096 public boolean isRunPostProcessor() { 097 return runPostProcessor; 098 } 099 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}