01: /*
02: * Copyright 2005-2006 The Kuali Foundation.
03: *
04: *
05: * Licensed under the Educational Community License, Version 1.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.opensource.org/licenses/ecl1.php
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package edu.iu.uis.eden.routeheader;
18:
19: import java.util.Iterator;
20: import java.util.List;
21:
22: import edu.iu.uis.eden.EdenConstants;
23: import edu.iu.uis.eden.exception.InvalidXmlException;
24: import edu.iu.uis.eden.plugin.attributes.WorkflowAttribute;
25: import edu.iu.uis.eden.routetemplate.web.RoutingReportAction;
26:
27: /**
28: * {@link DocumentContent} which is generated from a List of attributes.
29: * Used by the {@link RoutingReportAction} to aid in generation of
30: * document content when running routing reports.
31: *
32: * @see WorkflowAttribute
33: * @see RoutingReportAction
34: *
35: * @author ewestfal
36: */
37: public class AttributeDocumentContent extends StandardDocumentContent {
38:
39: private static final long serialVersionUID = 6789132279492877000L;
40:
41: public AttributeDocumentContent(List attributes)
42: throws InvalidXmlException {
43: super (generateDocContent(attributes));
44: }
45:
46: private static String generateDocContent(List attributes) {
47: StringBuffer buffer = new StringBuffer();
48: buffer.append("<").append(
49: EdenConstants.DOCUMENT_CONTENT_ELEMENT).append(">");
50: buffer.append("<").append(
51: EdenConstants.ATTRIBUTE_CONTENT_ELEMENT).append(">");
52: for (Iterator iterator = attributes.iterator(); iterator
53: .hasNext();) {
54: WorkflowAttribute attribute = (WorkflowAttribute) iterator
55: .next();
56: buffer.append(attribute.getDocContent());
57: }
58: buffer.append("</").append(
59: EdenConstants.ATTRIBUTE_CONTENT_ELEMENT).append(">");
60: buffer.append("</").append(
61: EdenConstants.DOCUMENT_CONTENT_ELEMENT).append(">");
62: return buffer.toString();
63: }
64:
65: }
|