001: /*
002: * Copyright 2006-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: package org.kuali.module.gl.bo;
018:
019: import java.util.LinkedHashMap;
020:
021: import org.apache.commons.lang.StringUtils;
022: import org.kuali.core.bo.PersistableBusinessObjectBase;
023: import org.kuali.kfs.KFSPropertyConstants;
024:
025: /**
026: * A class that represents a change to any origin entry that was altered within a GLCP Document
027: */
028: public class CorrectionChange extends PersistableBusinessObjectBase
029: implements Comparable {
030:
031: private String documentNumber;
032: private Integer correctionChangeGroupLineNumber;
033: private Integer correctionChangeLineNumber;
034: private Integer correctionStartPosition;
035: private Integer correctionEndPosition;
036: private String correctionFieldValue;
037: private String correctionFieldName;
038:
039: public CorrectionChange() {
040: super ();
041:
042: }
043:
044: public CorrectionChange(String documentNumber,
045: Integer correctionChangeGroupLineNumber,
046: Integer correctionChangeLineNumber) {
047: super ();
048: this .documentNumber = documentNumber;
049: this .correctionChangeGroupLineNumber = correctionChangeGroupLineNumber;
050: this .correctionChangeLineNumber = correctionChangeLineNumber;
051: }
052:
053: public boolean isEmpty() {
054: return (versionNumber == null)
055: && StringUtils.isEmpty(correctionFieldValue);
056: }
057:
058: public String getDocumentNumber() {
059: return documentNumber;
060: }
061:
062: public void setDocumentNumber(String documentNumber) {
063: this .documentNumber = documentNumber;
064: }
065:
066: public Integer getCorrectionChangeGroupLineNumber() {
067: return correctionChangeGroupLineNumber;
068: }
069:
070: public void setCorrectionChangeGroupLineNumber(
071: Integer correctionChangeGroupLineNumber) {
072: this .correctionChangeGroupLineNumber = correctionChangeGroupLineNumber;
073: }
074:
075: public Integer getCorrectionChangeLineNumber() {
076: return correctionChangeLineNumber;
077: }
078:
079: public void setCorrectionChangeLineNumber(
080: Integer correctionChangeLineNumber) {
081: this .correctionChangeLineNumber = correctionChangeLineNumber;
082: }
083:
084: public String getCorrectionFieldValue() {
085: return correctionFieldValue;
086: }
087:
088: public void setCorrectionFieldValue(String correctionFieldValue) {
089: this .correctionFieldValue = correctionFieldValue;
090: }
091:
092: public String getCorrectionFieldName() {
093: return correctionFieldName;
094: }
095:
096: public void setCorrectionFieldName(String correctionFieldName) {
097: this .correctionFieldName = correctionFieldName;
098: }
099:
100: public int compareTo(Object o) {
101: CorrectionChange cc = (CorrectionChange) o;
102:
103: String this FdocNbr = documentNumber == null ? ""
104: : documentNumber;
105: String thatFdocNbr = cc.documentNumber == null ? ""
106: : cc.documentNumber;
107: int c = this FdocNbr.compareTo(thatFdocNbr);
108:
109: if (c == 0) {
110: Integer this Gn = correctionChangeGroupLineNumber == null ? 0
111: : correctionChangeGroupLineNumber;
112: Integer thatGn = cc.correctionChangeGroupLineNumber == null ? 0
113: : cc.correctionChangeGroupLineNumber;
114: c = this Gn.compareTo(thatGn);
115: if (c == 0) {
116: Integer this Cln = correctionChangeLineNumber == null ? 0
117: : correctionChangeLineNumber;
118: Integer thatCln = correctionChangeLineNumber == null ? 0
119: : cc.correctionChangeLineNumber;
120: return c = this Cln.compareTo(thatCln);
121: } else {
122: return c;
123: }
124: } else {
125: return c;
126: }
127: }
128:
129: /**
130: * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
131: */
132: protected LinkedHashMap toStringMapper() {
133: LinkedHashMap m = new LinkedHashMap();
134: m
135: .put(KFSPropertyConstants.DOCUMENT_NUMBER,
136: this .documentNumber);
137: if (this .correctionChangeGroupLineNumber != null) {
138: m.put("correctionChangeGroupLineNumber",
139: this .correctionChangeGroupLineNumber.toString());
140: }
141: if (this .correctionChangeLineNumber != null) {
142: m.put("correctionChangeLineNumber",
143: this.correctionChangeLineNumber.toString());
144: }
145: return m;
146: }
147:
148: }
|