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 Aug 24, 2004
018: */
019: package org.kuali.module.pdp.form.paymentmaintenance;
020:
021: import javax.servlet.http.HttpServletRequest;
022:
023: import org.apache.struts.action.ActionErrors;
024: import org.apache.struts.action.ActionForm;
025: import org.apache.struts.action.ActionMapping;
026: import org.apache.struts.action.ActionMessage;
027: import org.kuali.module.pdp.utilities.GeneralUtilities;
028:
029: /**
030: * @author delyea
031: */
032:
033: public class PaymentMaintenanceForm extends ActionForm {
034: private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
035: .getLogger(PaymentMaintenanceForm.class);
036:
037: private String changeText;
038: private Integer changeId;
039: private Integer paymentDetailId; // used for cancelling disbursements from EPIC
040: private String action;
041:
042: public ActionErrors validate(ActionMapping mapping,
043: HttpServletRequest request) {
044: LOG.debug("Entered validate().");
045: // create instance of ActionErrors to send errors to user
046: ActionErrors actionErrors = new ActionErrors();
047: String buttonPressed = GeneralUtilities
048: .whichButtonWasPressed(request);
049:
050: if (buttonPressed.startsWith("btnUpdateSave")) {
051: if (GeneralUtilities.isStringEmpty(this .changeText)) {
052: actionErrors.add("errors", new ActionMessage(
053: "paymentMaintenanceForm.changeText.empty"));
054: }
055: if (GeneralUtilities.isStringFieldAtMostNLength(
056: this .changeText, 250)) {
057: actionErrors.add("errors", new ActionMessage(
058: "paymentMaintenanceForm.changeText.over250"));
059: }
060: }
061: LOG.debug("Exiting validate() There were "
062: + actionErrors.size() + " ActionMessages found.");
063: return actionErrors;
064: }
065:
066: /**
067: * @return Returns the action.
068: */
069: public String getAction() {
070: return action;
071: }
072:
073: /**
074: * @return Returns the changeText.
075: */
076: public String getChangeText() {
077: return changeText;
078: }
079:
080: /**
081: * @return Returns the changeId.
082: */
083: public Integer getChangeId() {
084: return changeId;
085: }
086:
087: /**
088: * @param action The action to set.
089: */
090: public void setAction(String action) {
091: this .action = action;
092: }
093:
094: /**
095: * @param changeText The changeText to set.
096: */
097: public void setChangeText(String changeText) {
098: this .changeText = changeText;
099: }
100:
101: /**
102: * @param detailId The detailId to set.
103: */
104: public void setChangeId(Integer changeId) {
105: this .changeId = changeId;
106: }
107:
108: /**
109: * @return Returns the paymentDetailId.
110: */
111: public Integer getPaymentDetailId() {
112: return paymentDetailId;
113: }
114:
115: /**
116: * @param paymentDetailId The paymentDetailId to set.
117: */
118: public void setPaymentDetailId(Integer paymentDetailId) {
119: this.paymentDetailId = paymentDetailId;
120: }
121: }
|