Search in sources :

Example 16 with Context

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

the class PdcaReportContentQueryAction method getBscReportContent.

private List<ChainResultObj> getBscReportContent(String chainId) throws ControllerException, AuthorityException, ServiceException, Exception {
    List<ChainResultObj> results = new ArrayList<ChainResultObj>();
    String pdcaOid = this.getFields().get("pdcaOid");
    // 先找出 bb_pdca_kpis 的最上層 vision
    List<String> visionOids = this.visionService.findForOidByPdcaOid(pdcaOid);
    for (String visionOid : visionOids) {
        PdcaMeasureFreqVO measureFreq = new PdcaMeasureFreqVO();
        measureFreq.setPdcaOid(pdcaOid);
        DefaultResult<PdcaMeasureFreqVO> mfResult = this.pdcaMeasureFreqService.findByUK(measureFreq);
        if (mfResult.getValue() == null) {
            throw new ServiceException(mfResult.getSystemMessage().getValue());
        }
        measureFreq = mfResult.getValue();
        Context context = this.getBscReportChainContext(pdcaOid, visionOid, measureFreq);
        SimpleChain chain = new SimpleChain();
        ChainResultObj resultObj = chain.getResultFromResource(chainId, context);
        results.add(resultObj);
    }
    return results;
}
Also used : Context(org.apache.commons.chain.Context) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) ChainResultObj(com.netsteadfast.greenstep.base.model.ChainResultObj) ArrayList(java.util.ArrayList) SimpleChain(com.netsteadfast.greenstep.base.chain.SimpleChain) PdcaMeasureFreqVO(com.netsteadfast.greenstep.vo.PdcaMeasureFreqVO)

Example 17 with Context

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

the class PersonalReportContentQueryAction method getContent.

private void getContent() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields();
    Context context = this.getChainContext();
    SimpleChain chain = new SimpleChain();
    ChainResultObj resultObj = chain.getResultFromResource("personalReportHtmlContentChain", context);
    this.body = String.valueOf(resultObj.getValue());
    this.message = resultObj.getMessage();
    if (!StringUtils.isBlank(this.body) && this.body.startsWith("<!-- BSC_PROG003D0002Q -->")) {
        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)

Example 18 with Context

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

the class WeightContentQueryAction method renderBody.

@SuppressWarnings("unchecked")
private void renderBody() throws ControllerException, ServiceException, Exception {
    this.getCheckFieldHandler().single("visionOid", (super.isNoSelectId(this.getFields().get("visionOid"))), this.getText("MESSAGE.BSC_PROG002D0006Q_visionOid")).throwMessage();
    SimpleChain simpleChanin = new SimpleChain();
    Context context = new ContextBase();
    context.put("visionOid", this.getFields().get("visionOid"));
    if (YesNo.YES.equals(this.getFields().get("autoAllocation"))) {
        context.put("autoAllocation", this.getFields().get("autoAllocation"));
    }
    context.put("weightName", this.getText("TPL.BSC_PROG002D0006Q_weightName"));
    ChainResultObj resultObj = simpleChanin.getResultFromResource("weightItemsChain", context);
    this.body = String.valueOf(resultObj.getValue());
    this.message = resultObj.getMessage();
    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 19 with Context

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

the class StrategyMapManagementAction method getChainContext.

@SuppressWarnings("unchecked")
private Context getChainContext() throws Exception {
    Context context = new ContextBase();
    context.put("visionOid", this.visionOid);
    return context;
}
Also used : Context(org.apache.commons.chain.Context) ContextBase(org.apache.commons.chain.impl.ContextBase)

Example 20 with Context

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

the class SwotContentQueryAction method getChainContext.

@SuppressWarnings("unchecked")
private Context getChainContext() throws Exception {
    Context context = new ContextBase();
    context.put("visionOid", this.getFields().get("visionOid"));
    context.put("organizationOid", this.getFields().get("organizationOid"));
    context.put("strengthsName", this.getText("TPL.BSC_PROG002D0008Q_s"));
    context.put("weaknessesName", this.getText("TPL.BSC_PROG002D0008Q_w"));
    context.put("opportunitiesName", this.getText("TPL.BSC_PROG002D0008Q_o"));
    context.put("threatsName", this.getText("TPL.BSC_PROG002D0008Q_t"));
    return context;
}
Also used : Context(org.apache.commons.chain.Context) 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