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