Search in sources :

Example 11 with Context

use of org.apache.commons.chain.Context in project bamboobsc by billchen198318.

the class PerspectivesDashboardAction method getExcel.

@SuppressWarnings("unchecked")
private void getExcel() throws ControllerException, AuthorityException, ServiceException, Exception {
    Context context = this.getContext();
    List<Map<String, Object>> chartDatas = (List<Map<String, Object>>) context.get("chartDatas");
    if (chartDatas == null || chartDatas.size() < 1) {
        super.throwMessage(this.getText("MESSAGE.BSC_PROG003D0004Q_msg1"));
    }
    SimpleChain chain = new SimpleChain();
    ChainResultObj resultObj = chain.getResultFromResource("perspectivesDashboardExcelContentChain", context);
    this.message = resultObj.getMessage();
    if (resultObj.getValue() instanceof String) {
        this.uploadOid = (String) resultObj.getValue();
        this.success = IS_YES;
    }
}
Also used : Context(org.apache.commons.chain.Context) ChainResultObj(com.netsteadfast.greenstep.base.model.ChainResultObj) SimpleChain(com.netsteadfast.greenstep.base.chain.SimpleChain) LinkedList(java.util.LinkedList) List(java.util.List) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Example 12 with Context

use of org.apache.commons.chain.Context in project bamboobsc by billchen198318.

the class RegionMapRelationKpisAction method renderTableContent.

private void renderTableContent() throws ControllerException, AuthorityException, ServiceException, Exception {
    String year = this.getFields().get("year");
    String orgId = this.getFields().get("orgId");
    List<String> visionOids = this.visionService.findForOidByKpiOrga(orgId);
    if (visionOids == null || visionOids.size() < 1) {
        this.message = SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA) + " , for KPIs.";
        return;
    }
    for (String visionOid : visionOids) {
        Context context = this.getChainContext(visionOid, year);
        SimpleChain chain = new SimpleChain();
        chain.getResultFromResource("performanceScoreChain", context);
        if (context.get("treeObj") == null) {
            continue;
        }
        BscStructTreeObj treeObj = (BscStructTreeObj) context.get("treeObj");
        this.fillRelationKpis(treeObj);
        this.fillCharts(treeObj);
    }
    this.success = IS_YES;
}
Also used : Context(org.apache.commons.chain.Context) BscStructTreeObj(com.netsteadfast.greenstep.bsc.model.BscStructTreeObj) SimpleChain(com.netsteadfast.greenstep.base.chain.SimpleChain)

Example 13 with Context

use of org.apache.commons.chain.Context in project bamboobsc by billchen198318.

the class RegionMapRelationKpisAction method getChainContext.

@SuppressWarnings("unchecked")
private Context getChainContext(String visionOid, String year) throws Exception {
    String dateStr1 = year + "0101";
    String dateStr2 = year + "1230";
    Context context = new ContextBase();
    context.put("visionOid", visionOid);
    context.put("startDate", dateStr1);
    context.put("endDate", dateStr2);
    context.put("startYearDate", year);
    context.put("endYearDate", year);
    context.put("frequency", BscMeasureDataFrequency.FREQUENCY_YEAR);
    context.put("dataFor", BscConstants.MEASURE_DATA_FOR_ORGANIZATION);
    context.put("orgId", this.getFields().get("orgId"));
    context.put("empId", BscConstants.MEASURE_DATA_EMPLOYEE_FULL);
    return context;
}
Also used : Context(org.apache.commons.chain.Context) ContextBase(org.apache.commons.chain.impl.ContextBase)

Example 14 with Context

use of org.apache.commons.chain.Context in project bamboobsc by billchen198318.

the class RegionMapViewAction method getChainContext.

@SuppressWarnings("unchecked")
private Context getChainContext(String visionOid, String year) throws Exception {
    String dateStr1 = year + "0101";
    String dateStr2 = year + "1230";
    Context context = new ContextBase();
    context.put("visionOid", visionOid);
    context.put("startDate", dateStr1);
    context.put("endDate", dateStr2);
    context.put("startYearDate", year);
    context.put("endYearDate", year);
    context.put("frequency", BscMeasureDataFrequency.FREQUENCY_YEAR);
    context.put("dataFor", BscConstants.MEASURE_DATA_FOR_ORGANIZATION);
    context.put("orgId", this.getFields().get("orgId"));
    context.put("empId", BscConstants.MEASURE_DATA_EMPLOYEE_FULL);
    return context;
}
Also used : Context(org.apache.commons.chain.Context) ContextBase(org.apache.commons.chain.impl.ContextBase)

Example 15 with Context

use of org.apache.commons.chain.Context in project bamboobsc by billchen198318.

the class PdcaReportContentQueryAction method getExcel.

@SuppressWarnings("unchecked")
private void getExcel() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields();
    List<String> bscExcelFileUploadOids = new ArrayList<String>();
    List<ChainResultObj> bscReportResults = null;
    if ("true".equals(this.getFields().get("showBscReport"))) {
        bscReportResults = this.getBscReportContent("kpiReportExcelContentChain");
    }
    for (int i = 0; bscReportResults != null && i < bscReportResults.size(); i++) {
        ChainResultObj resultObj = bscReportResults.get(i);
        if (resultObj.getValue() instanceof String) {
            bscExcelFileUploadOids.add((String) resultObj.getValue());
        }
    }
    Context pdcaContext = new ContextBase();
    pdcaContext.put("pdcaOid", this.getFields().get("pdcaOid"));
    pdcaContext.put("bscExcelFileUploadOids", bscExcelFileUploadOids);
    SimpleChain chain = new SimpleChain();
    ChainResultObj resultObj = chain.getResultFromResource("pdcaReportExcelContentChain", pdcaContext);
    this.message = resultObj.getMessage();
    if (resultObj.getValue() instanceof String) {
        this.uploadOid = (String) resultObj.getValue();
        this.success = IS_YES;
    }
}
Also used : Context(org.apache.commons.chain.Context) ChainResultObj(com.netsteadfast.greenstep.base.model.ChainResultObj) ArrayList(java.util.ArrayList) SimpleChain(com.netsteadfast.greenstep.base.chain.SimpleChain) ContextBase(org.apache.commons.chain.impl.ContextBase)

Aggregations

Context (org.apache.commons.chain.Context)49 SimpleChain (com.netsteadfast.greenstep.base.chain.SimpleChain)28 ChainResultObj (com.netsteadfast.greenstep.base.model.ChainResultObj)27 ContextBase (org.apache.commons.chain.impl.ContextBase)24 Map (java.util.Map)9 LinkedHashMap (java.util.LinkedHashMap)7 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)6 ArrayList (java.util.ArrayList)6 LinkedList (java.util.LinkedList)6 List (java.util.List)5 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4 AppContext (com.netsteadfast.greenstep.base.AppContext)4 HashMap (java.util.HashMap)4 ServletWebContext (org.apache.commons.chain.web.servlet.ServletWebContext)4 ServletActionContext (org.apache.struts.chain.contexts.ServletActionContext)4 BscStructTreeObj (com.netsteadfast.greenstep.bsc.model.BscStructTreeObj)3 StrategyMapItemsVO (com.netsteadfast.greenstep.bsc.vo.StrategyMapItemsVO)3 EmployeeVO (com.netsteadfast.greenstep.vo.EmployeeVO)3 OrganizationVO (com.netsteadfast.greenstep.vo.OrganizationVO)3 ControllerException (com.netsteadfast.greenstep.base.exception.ControllerException)2