Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.rahmadnet.learning.ad_callout;
- import org.openbravo.dal.service.OBDal;
- import org.openbravo.erpCommon.utility.OBError;
- import org.openbravo.model.common.businesspartner.BusinessPartner;
- import org.openbravo.model.common.enterprise.Organization;
- import org.openbravo.scheduling.ProcessBundle;
- import org.openbravo.service.db.DalBaseProcess;
- public class ExampleJavaProcess extends DalBaseProcess
- {
- public void doExecute(ProcessBundle bundle) throws Exception {
- try {
- // retrieve the parameters from the bundle
- final String bPartnerId = (String) bundle.getParams().get("cBpartnerId");
- final String organizationId = (String) bundle.getParams().get("adOrgId");
- final String tabId = (String) bundle.getParams().get("tabId");
- final String myString = (String) bundle.getParams().get("mystring");
- // implement your process here
- // Show a result
- final StringBuilder sb = new StringBuilder();
- sb.append("Read information:<br/>");
- if (bPartnerId != null) {
- final BusinessPartner bPartner = OBDal.getInstance().get(BusinessPartner.class, bPartnerId);
- sb.append("Business Partner: " + bPartner.getIdentifier() + "<br/>");
- }
- if (organizationId != null) {
- final Organization organization = OBDal.getInstance().get(Organization.class,
- organizationId);
- sb.append("Organization: " + organization.getIdentifier() + "<br/>");
- }
- sb.append("MyString: " + myString + "<br/>");
- // OBError is also used for successful results
- final OBError msg = new OBError();
- msg.setType("Success");
- msg.setTitle("Read parameters!");
- msg.setMessage(sb.toString());
- bundle.setResult(msg);
- } catch (final Exception e) {
- e.printStackTrace(System.err);
- final OBError msg = new OBError();
- msg.setType("Error");
- msg.setMessage(e.getMessage());
- msg.setTitle("Error occurred");
- bundle.setResult(msg);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment