001package org.kuali.ole.select.lookup; 002 003import org.apache.commons.lang.StringUtils; 004import org.kuali.ole.OLEConstants; 005 006import org.kuali.ole.select.bo.OLEAccessActivationConfiguration; 007import org.kuali.rice.krad.lookup.LookupableImpl; 008import org.kuali.rice.krad.uif.UifConstants; 009import org.kuali.rice.krad.uif.UifParameters; 010import org.kuali.rice.krad.uif.view.LookupView; 011import org.kuali.rice.krad.util.KRADConstants; 012import org.kuali.rice.krad.util.KRADUtils; 013import org.kuali.rice.krad.util.UrlFactory; 014import org.kuali.rice.krad.web.form.LookupForm; 015 016import java.util.List; 017import java.util.Map; 018import java.util.Properties; 019 020/** 021 * Created by hemalathas on 12/22/14. 022 */ 023public class OLEAccessActivationConfigurationLookupableImpl extends LookupableImpl { 024 private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(OLEAccessActivationConfigurationLookupableImpl.class); 025 @Override 026 protected String getActionUrlHref(LookupForm lookupForm, Object dataObject, String methodToCall, 027 List<String> pkNames) { 028 LOG.debug("Inside getActionUrlHref()"); 029 LookupView lookupView = (LookupView) lookupForm.getView(); 030 031 Properties props = new Properties(); 032 props.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, methodToCall); 033 Map<String, String> primaryKeyValues = KRADUtils.getPropertyKeyValuesFromDataObject(pkNames, dataObject); 034 for (String primaryKey : primaryKeyValues.keySet()) { 035 String primaryKeyValue = primaryKeyValues.get(primaryKey); 036 037 props.put(primaryKey, primaryKeyValue); 038 } 039 040 if (StringUtils.isNotBlank(lookupForm.getReturnLocation())) { 041 props.put(KRADConstants.RETURN_LOCATION_PARAMETER, lookupForm.getReturnLocation()); 042 } 043 044 props.put(UifParameters.DATA_OBJECT_CLASS_NAME, OLEAccessActivationConfiguration.class.getName()); 045 props.put(UifParameters.VIEW_TYPE_NAME, UifConstants.ViewType.MAINTENANCE.name()); 046 047 String maintenanceMapping = OLEConstants.ACCESS_ACTIVATION_CONFIGURATION_CONTROLLER; 048 049 return UrlFactory.parameterizeUrl(maintenanceMapping, props); 050 } 051}