001 /**
002 * Copyright 2004-2012 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 package org.kuali.hr.time.web;
017
018 import java.util.HashMap;
019 import java.util.Map;
020
021 import org.apache.commons.lang.StringUtils;
022 import org.kuali.rice.kim.api.KimConstants;
023 import org.kuali.rice.kim.api.identity.Person;
024 import org.kuali.rice.kns.web.struts.form.KualiMaintenanceForm;
025 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
026 import org.kuali.rice.krad.service.ModuleService;
027
028 /**
029 * This is set up in the kr/struts-config.xml, so that our maintenance docs
030 * have some modified header information.
031 */
032 public class TimeMaintenanceForm extends KualiMaintenanceForm {
033
034 /**
035 *
036 */
037 private static final long serialVersionUID = 1L;
038
039 /*
040 * This was cut and pasted from the parent, with some modification.
041 */
042 @Override
043 protected String getPersonInquiryUrlLink(Person user, String linkBody) {
044 StringBuffer urlBuffer = new StringBuffer();
045
046 if(user != null && StringUtils.isNotEmpty(linkBody) ) {
047 ModuleService moduleService = KRADServiceLocatorWeb.getKualiModuleService().getResponsibleModuleService(Person.class);
048 Map<String, String[]> parameters = new HashMap<String, String[]>();
049 parameters.put(KimConstants.AttributeConstants.PRINCIPAL_ID, new String[] { user.getPrincipalId() });
050 String inquiryUrl = moduleService.getExternalizableBusinessObjectInquiryUrl(Person.class, parameters);
051 if(!StringUtils.equals(KimConstants.EntityTypes.SYSTEM, user.getEntityTypeCode())){
052 urlBuffer.append("<a href='");
053 urlBuffer.append(inquiryUrl);
054 urlBuffer.append("' ");
055 urlBuffer.append("target='_blank'");
056 urlBuffer.append("title='Person Inquiry'>");
057 urlBuffer.append(linkBody);
058 urlBuffer.append("</a>");
059
060 // Added re: KPME-207 (https://jira.kuali.org/browse/KPME-207)
061 urlBuffer.append(" (");
062 urlBuffer.append(user.getName());
063 urlBuffer.append(")");
064 } else{
065 urlBuffer.append(linkBody);
066 }
067 }
068
069 return urlBuffer.toString();
070 }
071
072 }