001: /*
002: * Copyright 2005-2006 The Kuali Foundation.
003: *
004: *
005: * Licensed under the Educational Community License, Version 1.0 (the "License");
006: * you may not use this file except in compliance with the License.
007: * You may obtain a copy of the License at
008: *
009: * http://www.opensource.org/licenses/ecl1.php
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package edu.iu.uis.eden.clientapp.vo;
018:
019: import java.io.Serializable;
020: import java.util.ArrayList;
021: import java.util.List;
022:
023: import edu.iu.uis.eden.EdenConstants;
024: import edu.iu.uis.eden.util.Utilities;
025:
026: /**
027: * Represents document content broken up into all it's pieces. This object is used both
028: * to hold the state of the document content returned by the server, as well as to accumulate
029: * and marshal changes made by the client application. In the former case, no attribute
030: * definitions will be supplied in this object by the server. In the latter case, the client
031: * may add attribute content to the document content by attaching attribute definitions, which
032: * will be marshaled into the document content when an action is taken by the client on the document.
033: * These definition VOs will be transient and will not be returned again when content is refreshed
034: * from the server.
035: *
036: * @author ewestfal
037: *
038: * @workflow.webservice-object
039: */
040: public class DocumentContentVO implements Serializable {
041:
042: private static final long serialVersionUID = -1008441110733007106L;
043: private String attributeContent = "";
044: private String applicationContent = "";
045: private String searchableContent = "";
046: private List<WorkflowAttributeDefinitionVO> attributeDefinitions = new ArrayList<WorkflowAttributeDefinitionVO>();
047: private List<WorkflowAttributeDefinitionVO> searchableDefinitions = new ArrayList<WorkflowAttributeDefinitionVO>();
048: private Long routeHeaderId;
049:
050: private static final WorkflowAttributeDefinitionVO[] ARRAY_TYPE = new WorkflowAttributeDefinitionVO[0];
051:
052: public DocumentContentVO() {
053: }
054:
055: public String getApplicationContent() {
056: return applicationContent;
057: }
058:
059: public void setApplicationContent(String applicationContent) {
060: this .applicationContent = applicationContent;
061: }
062:
063: public String getAttributeContent() {
064: return attributeContent;
065: }
066:
067: public void setAttributeContent(String attributeContent) {
068: this .attributeContent = attributeContent;
069: }
070:
071: public String getSearchableContent() {
072: return searchableContent;
073: }
074:
075: public void setSearchableContent(String searchableContent) {
076: this .searchableContent = searchableContent;
077: }
078:
079: public String getFullContent() {
080: StringBuffer fullContent = new StringBuffer();
081: fullContent.append("<").append(
082: EdenConstants.DOCUMENT_CONTENT_ELEMENT).append(">");
083: if (!Utilities.isEmpty(getApplicationContent())) {
084: fullContent.append("<").append(
085: EdenConstants.APPLICATION_CONTENT_ELEMENT).append(
086: ">");
087: fullContent.append(getApplicationContent());
088: fullContent.append("</").append(
089: EdenConstants.APPLICATION_CONTENT_ELEMENT).append(
090: ">");
091: }
092: fullContent.append(getAttributeContent());
093: fullContent.append(getSearchableContent());
094: fullContent.append("</").append(
095: EdenConstants.DOCUMENT_CONTENT_ELEMENT).append(">");
096: return fullContent.toString();
097: }
098:
099: public WorkflowAttributeDefinitionVO[] getAttributeDefinitions() {
100: return (WorkflowAttributeDefinitionVO[]) attributeDefinitions
101: .toArray(ARRAY_TYPE);
102: }
103:
104: public void setAttributeDefinitions(
105: WorkflowAttributeDefinitionVO[] attributeDefinitions) {
106: this .attributeDefinitions = new ArrayList<WorkflowAttributeDefinitionVO>();
107: for (int index = 0; index < attributeDefinitions.length; index++) {
108: this .attributeDefinitions.add(attributeDefinitions[index]);
109: }
110: }
111:
112: public WorkflowAttributeDefinitionVO[] getSearchableDefinitions() {
113: return (WorkflowAttributeDefinitionVO[]) searchableDefinitions
114: .toArray(ARRAY_TYPE);
115: }
116:
117: public void setSearchableDefinitions(
118: WorkflowAttributeDefinitionVO[] searchableDefinitions) {
119: this .searchableDefinitions = new ArrayList<WorkflowAttributeDefinitionVO>();
120: for (int index = 0; index < searchableDefinitions.length; index++) {
121: this .searchableDefinitions
122: .add(searchableDefinitions[index]);
123: }
124: }
125:
126: public void addAttributeDefinition(
127: WorkflowAttributeDefinitionVO definition) {
128: attributeDefinitions.add(definition);
129: }
130:
131: public void removeAttributeDefinition(
132: WorkflowAttributeDefinitionVO definition) {
133: attributeDefinitions.remove(definition);
134: }
135:
136: public void addSearchableDefinition(
137: WorkflowAttributeDefinitionVO definition) {
138: searchableDefinitions.add(definition);
139: }
140:
141: public void removeSearchableDefinition(
142: WorkflowAttributeDefinitionVO definition) {
143: searchableDefinitions.remove(definition);
144: }
145:
146: public Long getRouteHeaderId() {
147: return routeHeaderId;
148: }
149:
150: public void setRouteHeaderId(Long routeHeaderId) {
151: this.routeHeaderId = routeHeaderId;
152: }
153:
154: }
|