| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.rice.kew.framework.document.security; |
| 17 | |
|
| 18 | |
import org.apache.commons.collections.CollectionUtils; |
| 19 | |
import org.kuali.rice.core.api.CoreConstants; |
| 20 | |
import org.kuali.rice.core.api.mo.ModelObjectUtils; |
| 21 | |
import org.kuali.rice.kew.api.document.Document; |
| 22 | |
import org.w3c.dom.Element; |
| 23 | |
|
| 24 | |
import javax.xml.bind.annotation.XmlAccessType; |
| 25 | |
import javax.xml.bind.annotation.XmlAccessorType; |
| 26 | |
import javax.xml.bind.annotation.XmlAnyElement; |
| 27 | |
import javax.xml.bind.annotation.XmlElement; |
| 28 | |
import javax.xml.bind.annotation.XmlElementWrapper; |
| 29 | |
import javax.xml.bind.annotation.XmlRootElement; |
| 30 | |
import javax.xml.bind.annotation.XmlType; |
| 31 | |
import java.util.Collection; |
| 32 | |
import java.util.List; |
| 33 | |
|
| 34 | |
|
| 35 | |
|
| 36 | |
|
| 37 | |
|
| 38 | |
|
| 39 | |
|
| 40 | |
|
| 41 | |
|
| 42 | |
|
| 43 | |
|
| 44 | |
|
| 45 | |
|
| 46 | |
|
| 47 | |
@XmlRootElement(name = DocumentSecurityDirective.Constants.ROOT_ELEMENT_NAME) |
| 48 | |
@XmlAccessorType(XmlAccessType.NONE) |
| 49 | |
@XmlType(name = DocumentSecurityDirective.Constants.TYPE_NAME, propOrder = { |
| 50 | |
DocumentSecurityDirective.Elements.DOCUMENT_SECURITY_ATTRIBUTE_NAMES, |
| 51 | |
DocumentSecurityDirective.Elements.DOCUMENTS, |
| 52 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
| 53 | |
}) |
| 54 | |
public final class DocumentSecurityDirective { |
| 55 | |
|
| 56 | |
@XmlElementWrapper(name = Elements.DOCUMENT_SECURITY_ATTRIBUTE_NAMES, required = true) |
| 57 | |
@XmlElement(name = Elements.DOCUMENT_SECURITY_ATTRIBUTE_NAME, required = true) |
| 58 | |
private final List<String> documentSecurityAttributeNames; |
| 59 | |
|
| 60 | |
@XmlElementWrapper(name = Elements.DOCUMENTS, required = true) |
| 61 | |
@XmlElement(name = Elements.DOCUMENT, required = true) |
| 62 | |
private final List<Document> documents; |
| 63 | |
|
| 64 | 0 | @SuppressWarnings("unused") |
| 65 | |
@XmlAnyElement |
| 66 | |
private final Collection<Element> _futureElements = null; |
| 67 | |
|
| 68 | |
|
| 69 | |
|
| 70 | |
|
| 71 | |
@SuppressWarnings("unused") |
| 72 | 0 | private DocumentSecurityDirective() { |
| 73 | 0 | this.documentSecurityAttributeNames = null; |
| 74 | 0 | this.documents = null; |
| 75 | 0 | } |
| 76 | |
|
| 77 | 0 | private DocumentSecurityDirective(List<String> documentSecurityAttributeNames, List<Document> documents) { |
| 78 | 0 | if (CollectionUtils.isEmpty(documentSecurityAttributeNames)) { |
| 79 | 0 | throw new IllegalArgumentException("documentSecurityAttributeNames cannot be null or empty"); |
| 80 | |
} |
| 81 | 0 | this.documentSecurityAttributeNames = ModelObjectUtils.createImmutableCopy(documentSecurityAttributeNames); |
| 82 | 0 | this.documents = ModelObjectUtils.createImmutableCopy(documents); |
| 83 | 0 | } |
| 84 | |
|
| 85 | |
|
| 86 | |
|
| 87 | |
|
| 88 | |
|
| 89 | |
|
| 90 | |
|
| 91 | |
|
| 92 | |
|
| 93 | |
|
| 94 | |
|
| 95 | |
|
| 96 | |
public static DocumentSecurityDirective create(List<String> documentSecurityAttributeNames, |
| 97 | |
List<Document> documents) { |
| 98 | 0 | return new DocumentSecurityDirective(documentSecurityAttributeNames, documents); |
| 99 | |
} |
| 100 | |
|
| 101 | |
|
| 102 | |
|
| 103 | |
|
| 104 | |
|
| 105 | |
|
| 106 | |
|
| 107 | |
public List<String> getDocumentSecurityAttributeNames() { |
| 108 | 0 | return documentSecurityAttributeNames; |
| 109 | |
} |
| 110 | |
|
| 111 | |
|
| 112 | |
|
| 113 | |
|
| 114 | |
|
| 115 | |
|
| 116 | |
public List<Document> getDocuments() { |
| 117 | 0 | return documents; |
| 118 | |
} |
| 119 | |
|
| 120 | |
|
| 121 | |
|
| 122 | |
|
| 123 | 0 | static class Constants { |
| 124 | |
final static String ROOT_ELEMENT_NAME = "documentSecurityDirective"; |
| 125 | |
final static String TYPE_NAME = "DocumentSecurityDirectiveType"; |
| 126 | |
} |
| 127 | |
|
| 128 | |
|
| 129 | |
|
| 130 | |
|
| 131 | 0 | static class Elements { |
| 132 | |
final static String DOCUMENT_SECURITY_ATTRIBUTE_NAMES = "documentSecurityAttributeNames"; |
| 133 | |
final static String DOCUMENT_SECURITY_ATTRIBUTE_NAME = "documentSecurityAttributeName"; |
| 134 | |
final static String DOCUMENTS = "documents"; |
| 135 | |
final static String DOCUMENT = "document"; |
| 136 | |
} |
| 137 | |
|
| 138 | |
} |