Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.wirabumi.gen.oez.callout;
- import java.util.Enumeration;
- import java.util.HashMap;
- import org.openbravo.erpCommon.ad_callouts.SimpleCallout;
- import org.openbravo.erpCommon.utility.Utility;
- public class CallGenerateAutoSearchKey extends SimpleCallout {
- @Override
- protected void execute(CalloutInfo info) {
- try {
- //get parameter
- String generateProductSearchKeyClassName = Utility.getPreference(info.vars, "ProductSearchKeyClassName", null);
- HashMap<String, String> CalloutInfoHashmap = new HashMap<>();
- Enumeration<String> Params = info.vars.getEnumerationString(); // hasil dari get
- while(Params.hasMoreElements())
- {
- String paramsKey = Params.nextElement();
- String value = info.getStringParameter(paramsKey);
- CalloutInfoHashmap.put(paramsKey, value);
- }
- boolean strValid = generateProductSearchKeyClassName != null && !generateProductSearchKeyClassName.isEmpty();
- if (strValid) {
- Class<?> cls = Class.forName(generateProductSearchKeyClassName);
- Object clsInstance = (Object) cls.newInstance();
- GenerateProductSearchKey generateProductSearchKey = null;
- generateProductSearchKey = (GenerateProductSearchKey) clsInstance;
- String searchKey = generateProductSearchKey.getProductSearchKey(CalloutInfoHashmap); // info diganti hashmap
- info.addResult("inpvalue", searchKey);
- }
- else {
- return;
- }
- } catch (ClassNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (InstantiationException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement