001/* 002 * Copyright 2007 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.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/ecl2.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 19, 2004 018 * 019 */ 020package org.kuali.ole.pdp.businessobject; 021 022import java.sql.Timestamp; 023import java.util.HashMap; 024import java.util.Map; 025 026import org.apache.commons.lang.StringUtils; 027import org.kuali.ole.sys.businessobject.TimestampedBusinessObjectBase; 028import org.kuali.ole.sys.context.SpringContext; 029import org.kuali.rice.core.api.util.type.KualiInteger; 030import org.kuali.rice.kim.api.identity.Person; 031import org.kuali.rice.krad.service.KualiModuleService; 032import org.kuali.rice.krad.service.ModuleService; 033import org.kuali.rice.location.api.LocationConstants; 034import org.kuali.rice.location.framework.campus.CampusEbo; 035 036 037/** 038 * This class represents a Payment Process. 039 */ 040public class PaymentProcess extends TimestampedBusinessObjectBase { 041 protected KualiInteger id; 042 protected Timestamp processTimestamp; 043 protected String campusCode; 044 protected String processUserId; 045 protected Person processUser; 046 protected boolean extractedInd; 047 protected boolean formattedIndicator; 048 049 protected CampusEbo campus; 050 051 /** 052 * Constructs a PaymentProcess. 053 */ 054 public PaymentProcess() { 055 super(); 056 this.setExtractedInd(false); 057 this.setFormattedIndicator(false); 058 } 059 060 /** 061 * This method updates the user based on processUserId. 062 * 063 * @param userService 064 */ 065 public void updateUser(org.kuali.rice.kim.api.identity.PersonService userService) { 066 Person u = userService.getPerson(processUserId); 067 setProcessUser(u); 068 } 069 070 /** 071 * This method gets the campusCode. 072 * 073 * @return campusCode 074 */ 075 public String getCampusCode() { 076 return campusCode; 077 } 078 079 /** 080 * This method sets the campusCode. 081 * 082 * @param campusCode 083 */ 084 public void setCampusCode(String campusCode) { 085 this.campusCode = campusCode; 086 } 087 088 /** 089 * This method gets the Id. 090 * 091 * @return id 092 */ 093 public KualiInteger getId() { 094 return id; 095 } 096 097 /** 098 * This method sets the id. 099 * 100 * @param id 101 */ 102 public void setId(KualiInteger id) { 103 this.id = id; 104 } 105 106 /** 107 * This method gets the processTimestamp 108 * 109 * @return processTimestamp 110 */ 111 public Timestamp getProcessTimestamp() { 112 return processTimestamp; 113 } 114 115 /** 116 * This method sets the processTimestamp. 117 * 118 * @param processTimestamp 119 */ 120 public void setProcessTimestamp(Timestamp processTimestamp) { 121 this.processTimestamp = processTimestamp; 122 } 123 124 /** 125 * This method gets the processUser. 126 * 127 * @return processUser 128 */ 129 public Person getProcessUser() { 130 processUser = SpringContext.getBean(org.kuali.rice.kim.api.identity.PersonService.class).updatePersonIfNecessary(processUserId, processUser); 131 return processUser; 132 } 133 134 /** 135 * This method sets the processUser. 136 * 137 * @param processUser 138 */ 139 public void setProcessUser(Person processUser) { 140 if (processUser != null) { 141 processUserId = processUser.getPrincipalId(); 142 } 143 this.processUser = processUser; 144 } 145 146 /** 147 * This method gets the processUserId. 148 * 149 * @return processUserId 150 */ 151 public String getProcessUserId() { 152 return processUserId; 153 } 154 155 /** 156 * This method sets the processUserId. 157 * 158 * @param processUserId 159 */ 160 public void setProcessUserId(String processUserId) { 161 this.processUserId = processUserId; 162 } 163 164 165 /** 166 * This method gets the extractedInd. 167 * 168 * @return extractedInd 169 */ 170 public boolean isExtractedInd() { 171 return extractedInd; 172 } 173 174 175 /** 176 * This method sets the extractedInd. 177 * 178 * @param extractedInd 179 */ 180 public void setExtractedInd(boolean extractedInd) { 181 this.extractedInd = extractedInd; 182 } 183 184 /** 185 * This method gets the formattedIndicator. 186 * 187 * @return formattedIndicator 188 */ 189 public boolean isFormattedIndicator() { 190 return formattedIndicator; 191 } 192 193 /** 194 * This method sets the formattedIndicator. 195 * 196 * @param formattedIndicator 197 */ 198 public void setFormattedIndicator(boolean formattedIndicator) { 199 this.formattedIndicator = formattedIndicator; 200 } 201 202 /** 203 * This method gets the campus. 204 * 205 * @return campus 206 */ 207 public CampusEbo getCampus() { 208 if ( StringUtils.isBlank(campusCode) ) { 209 campus = null; 210 } else { 211 if ( campus == null || !StringUtils.equals( campus.getCode(),campusCode) ) { 212 ModuleService moduleService = SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(CampusEbo.class); 213 if ( moduleService != null ) { 214 Map<String,Object> keys = new HashMap<String, Object>(1); 215 keys.put(LocationConstants.PrimaryKeyConstants.CODE, campusCode); 216 campus = moduleService.getExternalizableBusinessObject(CampusEbo.class, keys); 217 } else { 218 throw new RuntimeException( "CONFIGURATION ERROR: No responsible module found for EBO class. Unable to proceed." ); 219 } 220 } 221 } 222 return campus; 223 } 224 225 /** 226 * This method sets the campus. 227 * 228 * @param campus 229 */ 230 public void setCampus(CampusEbo campus) { 231 this.campus = campus; 232 } 233 234}