View Javadoc

1   package org.kuali.ole.deliver.fixedduedate.lookup;
2   
3   import org.apache.commons.lang.StringUtils;
4   import org.kuali.ole.OLEConstants;
5   
6   import org.kuali.ole.deliver.fixedduedate.bo.OleFixedDueDate;
7   import org.kuali.rice.krad.lookup.LookupableImpl;
8   import org.kuali.rice.krad.uif.UifConstants;
9   import org.kuali.rice.krad.uif.UifParameters;
10  import org.kuali.rice.krad.uif.view.LookupView;
11  import org.kuali.rice.krad.util.KRADConstants;
12  import org.kuali.rice.krad.util.KRADUtils;
13  import org.kuali.rice.krad.util.UrlFactory;
14  import org.kuali.rice.krad.web.form.LookupForm;
15  
16  import java.util.List;
17  import java.util.Map;
18  import java.util.Properties;
19  
20  /**
21   * Created with IntelliJ IDEA.
22   * User: ?
23   * Date: 12/19/12
24   * Time: 6:35 PM
25   * To change this template use File | Settings | File Templates.
26   */
27  public class OleFixedDueDateLookupableImpl extends LookupableImpl {
28      private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(OleFixedDueDateLookupableImpl.class);
29      @Override
30      protected String getActionUrlHref(LookupForm lookupForm, Object dataObject, String methodToCall,
31                                        List<String> pkNames) {
32          LOG.debug("Inside getActionUrlHref()");
33          LookupView lookupView = (LookupView) lookupForm.getView();
34  
35          Properties props = new Properties();
36          props.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, methodToCall);
37          Map<String, String> primaryKeyValues = KRADUtils.getPropertyKeyValuesFromDataObject(pkNames, dataObject);
38          for (String primaryKey : primaryKeyValues.keySet()) {
39              String primaryKeyValue = primaryKeyValues.get(primaryKey);
40  
41              props.put(primaryKey, primaryKeyValue);
42          }
43  
44          if (StringUtils.isNotBlank(lookupForm.getReturnLocation())) {
45              props.put(KRADConstants.RETURN_LOCATION_PARAMETER, lookupForm.getReturnLocation());
46          }
47  
48          props.put(UifParameters.DATA_OBJECT_CLASS_NAME, OleFixedDueDate.class.getName());
49          props.put(UifParameters.VIEW_TYPE_NAME, UifConstants.ViewType.MAINTENANCE.name());
50  
51          String maintenanceMapping = OLEConstants.FIXED_DUE_DATE_CONTROLLER;
52  
53          return UrlFactory.parameterizeUrl(maintenanceMapping, props);
54      }
55  
56  
57  }