/* * The Kuali Financial System, a comprehensive financial management system for higher education. * * Copyright 2005-2014 The Kuali Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.kuali.kfs.gl.businessobject; import java.util.LinkedHashMap; import org.apache.commons.lang.StringUtils; import org.kuali.kfs.sys.KFSPropertyConstants; import org.kuali.rice.krad.bo.PersistableBusinessObjectBase; /** * A class that represents a change to any origin entry that was altered within a GLCP Document */ public class CorrectionChange extends PersistableBusinessObjectBase implements Comparable { private String documentNumber; private Integer correctionChangeGroupLineNumber; private Integer correctionChangeLineNumber; private Integer correctionStartPosition; private Integer correctionEndPosition; private String correctionFieldValue; private String correctionFieldName; public CorrectionChange() { super(); } public CorrectionChange(String documentNumber, Integer correctionChangeGroupLineNumber, Integer correctionChangeLineNumber) { super(); this.documentNumber = documentNumber; this.correctionChangeGroupLineNumber = correctionChangeGroupLineNumber; this.correctionChangeLineNumber = correctionChangeLineNumber; } public boolean isEmpty() { return (versionNumber == null) && StringUtils.isEmpty(correctionFieldValue); } public String getDocumentNumber() { return documentNumber; } public void setDocumentNumber(String documentNumber) { this.documentNumber = documentNumber; } public Integer getCorrectionChangeGroupLineNumber() { return correctionChangeGroupLineNumber; } public void setCorrectionChangeGroupLineNumber(Integer correctionChangeGroupLineNumber) { this.correctionChangeGroupLineNumber = correctionChangeGroupLineNumber; } public Integer getCorrectionChangeLineNumber() { return correctionChangeLineNumber; } public void setCorrectionChangeLineNumber(Integer correctionChangeLineNumber) { this.correctionChangeLineNumber = correctionChangeLineNumber; } public String getCorrectionFieldValue() { return correctionFieldValue; } public void setCorrectionFieldValue(String correctionFieldValue) { this.correctionFieldValue = correctionFieldValue; } public String getCorrectionFieldName() { return correctionFieldName; } public void setCorrectionFieldName(String correctionFieldName) { this.correctionFieldName = correctionFieldName; } public int compareTo(Object o) { CorrectionChange cc = (CorrectionChange) o; String thisFdocNbr = documentNumber == null ? "" : documentNumber; String thatFdocNbr = cc.documentNumber == null ? "" : cc.documentNumber; int c = thisFdocNbr.compareTo(thatFdocNbr); if (c == 0) { Integer thisGn = correctionChangeGroupLineNumber == null ? 0 : correctionChangeGroupLineNumber; Integer thatGn = cc.correctionChangeGroupLineNumber == null ? 0 : cc.correctionChangeGroupLineNumber; c = thisGn.compareTo(thatGn); if (c == 0) { Integer thisCln = correctionChangeLineNumber == null ? 0 : correctionChangeLineNumber; Integer thatCln = correctionChangeLineNumber == null ? 0 : cc.correctionChangeLineNumber; return c = thisCln.compareTo(thatCln); } else { return c; } } else { return c; } } /** * @see org.kuali.rice.krad.bo.BusinessObjectBase#toStringMapper() */ protected LinkedHashMap toStringMapper_RICE20_REFACTORME() { LinkedHashMap m = new LinkedHashMap(); m.put(KFSPropertyConstants.DOCUMENT_NUMBER, this.documentNumber); if (this.correctionChangeGroupLineNumber != null) { m.put("correctionChangeGroupLineNumber", this.correctionChangeGroupLineNumber.toString()); } if (this.correctionChangeLineNumber != null) { m.put("correctionChangeLineNumber", this.correctionChangeLineNumber.toString()); } return m; } }