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