1 package org.kuali.ole.coa.lookup;
2
3 import org.apache.commons.lang.StringUtils;
4 import org.kuali.ole.OLEConstants;
5 import org.kuali.ole.coa.businessobject.OleFundCode;
6 import org.kuali.rice.krad.lookup.LookupableImpl;
7 import org.kuali.rice.krad.uif.UifConstants;
8 import org.kuali.rice.krad.uif.UifParameters;
9 import org.kuali.rice.krad.uif.view.LookupView;
10 import org.kuali.rice.krad.util.KRADConstants;
11 import org.kuali.rice.krad.util.KRADUtils;
12 import org.kuali.rice.krad.util.UrlFactory;
13 import org.kuali.rice.krad.web.form.LookupForm;
14
15 import java.util.List;
16 import java.util.Map;
17 import java.util.Properties;
18
19
20
21
22
23
24
25
26
27 public class OleFundCodeAccountingLineLookupableImpl extends LookupableImpl {
28 private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(OleFundCodeAccountingLineLookupableImpl.class);
29
30 @Override
31 protected String getActionUrlHref(LookupForm lookupForm, Object dataObject, String methodToCall,
32 List<String> pkNames) {
33
34 LookupView lookupView = (LookupView) lookupForm.getView();
35
36 Properties props = new Properties();
37 props.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, methodToCall);
38
39 Map<String, String> primaryKeyValues = KRADUtils.getPropertyKeyValuesFromDataObject(pkNames, dataObject);
40 for (String primaryKey : primaryKeyValues.keySet()) {
41 String primaryKeyValue = primaryKeyValues.get(primaryKey);
42
43 props.put(primaryKey, primaryKeyValue);
44 }
45
46 if (StringUtils.isNotBlank(lookupForm.getReturnLocation())) {
47 props.put(KRADConstants.RETURN_LOCATION_PARAMETER, lookupForm.getReturnLocation());
48 }
49
50 props.put(UifParameters.DATA_OBJECT_CLASS_NAME, lookupForm.getDataObjectClassName());
51 props.put(UifParameters.VIEW_TYPE_NAME, UifConstants.ViewType.MAINTENANCE.name());
52
53 String maintenanceMapping = OLEConstants.OLEEResourceRecord.FUND_ACCOUNTING_LINE_MAINTENANCE_ACTION_LINK;
54
55 return UrlFactory.parameterizeUrl(maintenanceMapping, props);
56
57 }
58
59 }
60
61