001: /*
002: * Copyright 2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.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/ecl1.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: */
016: /*
017: * Created on Jul 27, 2004
018: *
019: */
020: package org.kuali.module.pdp.xml;
021:
022: import java.io.Serializable;
023: import java.text.ParseException;
024: import java.text.SimpleDateFormat;
025: import java.util.Date;
026: import java.util.Locale;
027:
028: /**
029: * @author jsissom
030: */
031: public class XmlHeader implements Serializable {
032: private String chart;
033: private String org;
034: private String subUnit;
035: private Date creationDate;
036:
037: public XmlHeader() {
038: super ();
039: }
040:
041: public void setField(String name, String value) {
042: if ("chart".equals(name)) {
043: setChart(value.toUpperCase());
044: } else if ("organization".equals(name)) {
045: setOrg(value);
046: } else if ("sub_unit".equals(name)) {
047: setSubUnit(value);
048: } else if ("creation_date".equals(name)) {
049: try {
050: StringBuffer chars = new StringBuffer(value);
051:
052: // Get rid of the T
053: chars.setCharAt(10, ' ');
054: SimpleDateFormat sdf = new SimpleDateFormat(
055: "yyyy-MM-dd HH:mm:ss", Locale.US);
056: Date d = sdf.parse(chars.toString());
057: setCreationDate(d);
058: } catch (ParseException e) {
059: // Not sure what to do
060: }
061: }
062: }
063:
064: /**
065: * @return Returns the chart.
066: */
067: public String getChart() {
068: return chart;
069: }
070:
071: /**
072: * @param chart The chart to set.
073: */
074: public void setChart(String chart) {
075: this .chart = chart;
076: }
077:
078: /**
079: * @return Returns the creationDate.
080: */
081: public Date getCreationDate() {
082: return creationDate;
083: }
084:
085: /**
086: * @param creationDate The creationDate to set.
087: */
088: public void setCreationDate(Date creationDate) {
089: this .creationDate = creationDate;
090: }
091:
092: /**
093: * @return Returns the org.
094: */
095: public String getOrg() {
096: return org;
097: }
098:
099: /**
100: * @param org The org to set.
101: */
102: public void setOrg(String org) {
103: this .org = org;
104: }
105:
106: /**
107: * @return Returns the subUnit.
108: */
109: public String getSubUnit() {
110: return subUnit;
111: }
112:
113: /**
114: * @param subUnit The subUnit to set.
115: */
116: public void setSubUnit(String subUnit) {
117: this.subUnit = subUnit;
118: }
119: }
|