| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
package org.kuali.rice.kew.dto; |
| 18 | |
|
| 19 | |
import java.io.Serializable; |
| 20 | |
import java.util.ArrayList; |
| 21 | |
import java.util.List; |
| 22 | |
|
| 23 | |
import org.kuali.rice.kew.util.KEWConstants; |
| 24 | |
|
| 25 | |
|
| 26 | |
|
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | |
|
| 34 | |
|
| 35 | |
|
| 36 | |
|
| 37 | |
|
| 38 | |
public class DocumentContentDTO implements Serializable { |
| 39 | |
|
| 40 | |
private static final long serialVersionUID = -1008441110733007106L; |
| 41 | 0 | private String attributeContent = ""; |
| 42 | 0 | private String applicationContent = ""; |
| 43 | 0 | private String searchableContent = ""; |
| 44 | 0 | private List<WorkflowAttributeDefinitionDTO> attributeDefinitions = new ArrayList<WorkflowAttributeDefinitionDTO>(); |
| 45 | 0 | private List<WorkflowAttributeDefinitionDTO> searchableDefinitions = new ArrayList<WorkflowAttributeDefinitionDTO>(); |
| 46 | |
private String documentId; |
| 47 | |
|
| 48 | 0 | private static final WorkflowAttributeDefinitionDTO[] ARRAY_TYPE = new WorkflowAttributeDefinitionDTO[0]; |
| 49 | |
|
| 50 | 0 | public DocumentContentDTO() {} |
| 51 | |
|
| 52 | |
public String getApplicationContent() { |
| 53 | 0 | return applicationContent; |
| 54 | |
} |
| 55 | |
public void setApplicationContent(String applicationContent) { |
| 56 | 0 | this.applicationContent = applicationContent; |
| 57 | 0 | } |
| 58 | |
public String getAttributeContent() { |
| 59 | 0 | return attributeContent; |
| 60 | |
} |
| 61 | |
public void setAttributeContent(String attributeContent) { |
| 62 | 0 | this.attributeContent = attributeContent; |
| 63 | 0 | } |
| 64 | |
public String getSearchableContent() { |
| 65 | 0 | return searchableContent; |
| 66 | |
} |
| 67 | |
public void setSearchableContent(String searchableContent) { |
| 68 | 0 | this.searchableContent = searchableContent; |
| 69 | 0 | } |
| 70 | |
public String getFullContent() { |
| 71 | 0 | StringBuffer fullContent = new StringBuffer(); |
| 72 | 0 | fullContent.append("<").append(KEWConstants.DOCUMENT_CONTENT_ELEMENT).append(">"); |
| 73 | 0 | if (!isEmpty(getApplicationContent())) { |
| 74 | 0 | fullContent.append("<").append(KEWConstants.APPLICATION_CONTENT_ELEMENT).append(">"); |
| 75 | 0 | fullContent.append(getApplicationContent()); |
| 76 | 0 | fullContent.append("</").append(KEWConstants.APPLICATION_CONTENT_ELEMENT).append(">"); |
| 77 | |
} |
| 78 | 0 | fullContent.append(getAttributeContent()); |
| 79 | 0 | fullContent.append(getSearchableContent()); |
| 80 | 0 | fullContent.append("</").append(KEWConstants.DOCUMENT_CONTENT_ELEMENT).append(">"); |
| 81 | 0 | return fullContent.toString(); |
| 82 | |
} |
| 83 | |
|
| 84 | |
public WorkflowAttributeDefinitionDTO[] getAttributeDefinitions() { |
| 85 | 0 | return (WorkflowAttributeDefinitionDTO[])attributeDefinitions.toArray(ARRAY_TYPE); |
| 86 | |
} |
| 87 | |
public void setAttributeDefinitions(WorkflowAttributeDefinitionDTO[] attributeDefinitions) { |
| 88 | 0 | this.attributeDefinitions = new ArrayList<WorkflowAttributeDefinitionDTO>(); |
| 89 | 0 | for (int index = 0; index < attributeDefinitions.length; index++) { |
| 90 | 0 | this.attributeDefinitions.add(attributeDefinitions[index]); |
| 91 | |
} |
| 92 | 0 | } |
| 93 | |
public WorkflowAttributeDefinitionDTO[] getSearchableDefinitions() { |
| 94 | 0 | return (WorkflowAttributeDefinitionDTO[])searchableDefinitions.toArray(ARRAY_TYPE); |
| 95 | |
} |
| 96 | |
public void setSearchableDefinitions(WorkflowAttributeDefinitionDTO[] searchableDefinitions) { |
| 97 | 0 | this.searchableDefinitions = new ArrayList<WorkflowAttributeDefinitionDTO>(); |
| 98 | 0 | for (int index = 0; index < searchableDefinitions.length; index++) { |
| 99 | 0 | this.searchableDefinitions.add(searchableDefinitions[index]); |
| 100 | |
} |
| 101 | 0 | } |
| 102 | |
|
| 103 | |
public void addAttributeDefinition(WorkflowAttributeDefinitionDTO definition) { |
| 104 | 0 | attributeDefinitions.add(definition); |
| 105 | 0 | } |
| 106 | |
|
| 107 | |
public void removeAttributeDefinition(WorkflowAttributeDefinitionDTO definition) { |
| 108 | 0 | attributeDefinitions.remove(definition); |
| 109 | 0 | } |
| 110 | |
|
| 111 | |
public void addSearchableDefinition(WorkflowAttributeDefinitionDTO definition) { |
| 112 | 0 | searchableDefinitions.add(definition); |
| 113 | 0 | } |
| 114 | |
|
| 115 | |
public void removeSearchableDefinition(WorkflowAttributeDefinitionDTO definition) { |
| 116 | 0 | searchableDefinitions.remove(definition); |
| 117 | 0 | } |
| 118 | |
|
| 119 | |
public String getDocumentId() { |
| 120 | 0 | return documentId; |
| 121 | |
} |
| 122 | |
public void setDocumentId(String documentId) { |
| 123 | 0 | this.documentId = documentId; |
| 124 | 0 | } |
| 125 | |
|
| 126 | |
private boolean isEmpty(String value) { |
| 127 | 0 | return value == null || value.trim().equals(""); |
| 128 | |
} |
| 129 | |
|
| 130 | |
} |