Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.mlpt.bvnextgen.generatePDLGD.generateLGD.CallProcedure;
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- import org.hibernate.Query;
- import org.json.simple.JSONObject;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import com.mlpt.bvnextgen.MasterGeneralConstants;
- import com.mlpt.bvnextgen.annotation.Info;
- import com.mlpt.bvnextgen.annotation.InfoIn;
- import com.mlpt.bvnextgen.annotation.InfoOut;
- import com.mlpt.bvnextgen.dao.ConfigurationDao;
- import com.mlpt.bvnextgen.generatePDLGD.LoggingConfiguration;
- import com.mlpt.bvnextgen.procedureSQL.CallProcedure;
- @InfoIn(value = {
- })
- @InfoOut(value = {
- @Info(name = "status", description = "status", type = "String.class"),
- @Info(name = "errorMessage", description = "error Message", type = "String.class") })
- @Service
- public class CallLWOBAL {
- @Autowired
- ConfigurationDao configureDao;
- @Autowired
- LoggingConfiguration logConfig;
- @Autowired
- CallProcedure procedureCall;
- @SuppressWarnings("unchecked")
- public JSONObject processBo(JSONObject serviceInput) {
- JSONObject resultOutput = new JSONObject();
- String errorMessage = "";
- String result = "";
- List<Map<String, String>> parameter = new ArrayList<Map<String, String>>();
- Map<String, String> configure = new HashMap<String, String>();
- try {
- /*
- * --------------------------- START
- * --------------------------------------
- */
- // get break type
- List<String> queryResultFindBreak = new ArrayList<String>();
- Query findBreak = configureDao.createQuery("Select subconfig "
- + "from com.mlpt.bvnextgen.entity.Configuration "
- + "where configMenu = :configMenu and active = :active");
- findBreak.setParameter("configMenu", MasterGeneralConstants.BREAK);
- findBreak.setParameter("active", MasterGeneralConstants.ACTIVATE);
- queryResultFindBreak = findBreak.list();
- configureDao.closeSessionCreateQuery();
- System.out.println("BREAK TYPE : " + queryResultFindBreak.get(0));
- String breakType = String.valueOf(queryResultFindBreak.get(0));
- /*
- * ---------------------------- END
- * ---------------------------------------
- */
- String lwobalType = "";
- if (breakType.equals(MasterGeneralConstants.BRANCH)) {
- lwobalType = MasterGeneralConstants.LWOBAL_BRANCH;
- } else if (breakType.equals(MasterGeneralConstants.REGION)) {
- lwobalType = MasterGeneralConstants.LWOBAL_REGION;
- } else if (breakType.equals(MasterGeneralConstants.SEGMENT)) {
- lwobalType = MasterGeneralConstants.LWOBAL_SEGMENT;
- } else if (breakType.equals(MasterGeneralConstants.PLAN)) {
- lwobalType = MasterGeneralConstants.LWOBAL_PLAN;
- } else {
- lwobalType = MasterGeneralConstants.LWOBAL;
- }
- // 2. LWOBAL
- procedureCall.callProcedure(lwobalType, parameter);
- //LOG LGD
- procedureCall.callProcedure(MasterGeneralConstants.LOG_LWOBAL,parameter);
- //LOG m_config
- logConfig.processWriteToLogMConfigLGD();
- resultOutput.put("status", "S");
- } catch (Exception e) {
- e.printStackTrace();
- errorMessage = e.getCause().toString();
- errorMessage = errorMessage.substring(
- (errorMessage.indexOf(':') + 1), errorMessage.length());
- errorMessage = errorMessage.trim();
- resultOutput.put("status", "F");
- resultOutput.put("errorMessage", errorMessage);
- return resultOutput;
- }
- return resultOutput;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement