Search in sources :

Example 21 with ContextBase

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

the class PdcaReportContentQueryAction method getContent.

@SuppressWarnings("unchecked")
private void getContent() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields();
    Context pdcaContext = new ContextBase();
    pdcaContext.put("pdcaOid", this.getFields().get("pdcaOid"));
    SimpleChain chain = new SimpleChain();
    ChainResultObj pdcaReportObj = chain.getResultFromResource("pdcaReportHtmlContentChain", pdcaContext);
    List<ChainResultObj> bscReportResults = null;
    if ("true".equals(this.getFields().get("showBscReport"))) {
        bscReportResults = this.getBscReportContent("kpiReportHtmlContentChain");
    }
    if (pdcaReportObj.getValue() instanceof String) {
        this.body = String.valueOf(pdcaReportObj.getValue());
        this.pdca = (PdcaVO) pdcaContext.get("pdca");
    }
    this.message = super.defaultString(pdcaReportObj.getMessage()).trim();
    for (int i = 0; bscReportResults != null && i < bscReportResults.size(); i++) {
        ChainResultObj bscReportObj = bscReportResults.get(i);
        if (bscReportObj.getValue() instanceof String) {
            this.body += String.valueOf(bscReportObj.getValue());
        }
        if (!this.message.equals(bscReportObj.getMessage())) {
            if (!"".equals(this.message)) {
                this.message += super.getHtmlBr();
            }
            this.message += bscReportObj.getMessage();
        }
    }
    if (!StringUtils.isBlank(this.body)) {
        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) ContextBase(org.apache.commons.chain.impl.ContextBase)

Example 22 with ContextBase

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

the class PdcaReportContentQueryAction method getBscReportChainContext.

@SuppressWarnings("unchecked")
private Context getBscReportChainContext(String pdcaOid, String visionOid, PdcaMeasureFreqVO measureFreq) throws Exception {
    Context context = new ContextBase();
    context.put("visionOid", visionOid);
    context.put("startDate", SimpleUtils.getStrYMD(measureFreq.getStartDate(), "/"));
    context.put("endDate", SimpleUtils.getStrYMD(measureFreq.getEndDate(), "/"));
    context.put("startYearDate", SimpleUtils.getStrYMD(measureFreq.getStartDate(), "/"));
    context.put("endYearDate", SimpleUtils.getStrYMD(measureFreq.getEndDate(), "/"));
    context.put("frequency", measureFreq.getFreq());
    context.put("dataFor", measureFreq.getDataType());
    context.put("orgId", measureFreq.getOrgId());
    context.put("empId", measureFreq.getEmpId());
    context.put("account", "");
    context.put("ngVer", YesNo.NO);
    List<String> kpiIds = new ArrayList<String>();
    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("pdcaOid", pdcaOid);
    List<BbPdcaKpis> pdcaKpisList = this.pdcaKpisService.findListByParams(paramMap);
    for (BbPdcaKpis pdcaKpi : pdcaKpisList) {
        kpiIds.add(pdcaKpi.getKpiId());
    }
    // 只顯示,要顯示的KPI
    context.put("kpiIds", kpiIds);
    return context;
}
Also used : Context(org.apache.commons.chain.Context) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) BbPdcaKpis(com.netsteadfast.greenstep.po.hbm.BbPdcaKpis) ContextBase(org.apache.commons.chain.impl.ContextBase)

Aggregations

Context (org.apache.commons.chain.Context)22 ContextBase (org.apache.commons.chain.impl.ContextBase)22 SimpleChain (com.netsteadfast.greenstep.base.chain.SimpleChain)8 ChainResultObj (com.netsteadfast.greenstep.base.model.ChainResultObj)8 Map (java.util.Map)5 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)4 ArrayList (java.util.ArrayList)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 AppContext (com.netsteadfast.greenstep.base.AppContext)3 EmployeeVO (com.netsteadfast.greenstep.vo.EmployeeVO)3 OrganizationVO (com.netsteadfast.greenstep.vo.OrganizationVO)3 LinkedHashMap (java.util.LinkedHashMap)3 LinkedList (java.util.LinkedList)3 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)2 HashMap (java.util.HashMap)2 List (java.util.List)2 BscStructTreeObj (com.netsteadfast.greenstep.bsc.model.BscStructTreeObj)1 TimeSeriesAnalysisResult (com.netsteadfast.greenstep.bsc.model.TimeSeriesAnalysisResult)1 StrategyMapItemsVO (com.netsteadfast.greenstep.bsc.vo.StrategyMapItemsVO)1 BbPdcaKpis (com.netsteadfast.greenstep.po.hbm.BbPdcaKpis)1