View Javadoc
1   package org.kuali.ole.deliver.notice.lookupable;
2   
3   import org.apache.commons.lang.StringUtils;
4   import org.kuali.ole.deliver.bo.OleCirculationDesk;
5   import org.kuali.ole.deliver.notice.bo.OleNoticeContentConfigurationBo;
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   * Created by maheswarang on 10/6/15.
21   */
22  public class OleNoticeContentConfigurationLookupableImpl extends LookupableImpl {
23  
24  
25      /**
26       * This method returns action URL as oleLicenseRequest.
27       *
28       * @param lookupForm
29       * @param dataObject
30       * @param methodToCall
31       * @param pkNames
32       * @return String
33       */
34      protected String getActionUrlHref(LookupForm lookupForm, Object dataObject, String methodToCall,
35                                        List<String> pkNames) {
36          LookupView lookupView = (LookupView) lookupForm.getView();
37  
38          Properties props = new Properties();
39          props.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, methodToCall);
40          Map<String, String> primaryKeyValues = KRADUtils.getPropertyKeyValuesFromDataObject(pkNames, dataObject);
41          for (String primaryKey : primaryKeyValues.keySet()) {
42              String primaryKeyValue = primaryKeyValues.get(primaryKey);
43  
44              props.put(primaryKey, primaryKeyValue);
45          }
46  
47          if (StringUtils.isNotBlank(lookupForm.getReturnLocation())) {
48              props.put(KRADConstants.RETURN_LOCATION_PARAMETER, lookupForm.getReturnLocation());
49          }
50  
51          props.put(UifParameters.DATA_OBJECT_CLASS_NAME, OleNoticeContentConfigurationBo.class.getName());
52          props.put(UifParameters.VIEW_TYPE_NAME, UifConstants.ViewType.MAINTENANCE.name());
53  
54          String maintenanceMapping = "oleNoticeContentConfigurationMaintenance";
55  
56          return UrlFactory.parameterizeUrl(maintenanceMapping, props);
57      }
58  }