Search in sources :

Example 41 with Context

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

the class KpiTreeJsonAction method loadTreeItems.

@SuppressWarnings("unchecked")
private void loadTreeItems() throws ServiceException, Exception {
    Context context = new ContextBase();
    context.put("http", this.getHttpServletRequest().getScheme() + "://");
    SimpleChain chain = new SimpleChain();
    ChainResultObj result = chain.getResultFromResource("kpiTreeItemsChain", context);
    this.message = super.defaultString(result.getMessage());
    if (result.getValue() != null && result.getValue() instanceof List) {
        this.items = (List<Map<String, Object>>) result.getValue();
    }
}
Also used : Context(org.apache.commons.chain.Context) ChainResultObj(com.netsteadfast.greenstep.base.model.ChainResultObj) SimpleChain(com.netsteadfast.greenstep.base.chain.SimpleChain) List(java.util.List) Map(java.util.Map) ContextBase(org.apache.commons.chain.impl.ContextBase)

Example 42 with Context

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

the class KpisDashboardAction 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) {
        throw new ServiceException("Please first query!");
    }
    SimpleChain chain = new SimpleChain();
    ChainResultObj resultObj = chain.getResultFromResource("kpisDashboardExcelContentChain", 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) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) 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 43 with Context

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

the class PersonalReportContentQueryAction method getChainContext.

@SuppressWarnings("unchecked")
private Context getChainContext() throws Exception {
    Context context = new ContextBase();
    context.put("visionOid", this.getFields().get("visionOid"));
    context.put("frequency", this.getFields().get("frequency"));
    context.put("startYearDate", this.getFields().get("year"));
    context.put("endYearDate", this.getFields().get("year"));
    context.put("dateType", this.getFields().get("dateType"));
    context.put("dataFor", BscConstants.MEASURE_DATA_FOR_EMPLOYEE);
    EmployeeVO employee = new EmployeeVO();
    employee.setOid(this.getFields().get("employeeOid"));
    DefaultResult<EmployeeVO> result = this.employeeService.findObjectByOid(employee);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    employee = result.getValue();
    context.put("empId", employee.getEmpId());
    context.put("account", employee.getAccount());
    context.put("orgId", BscConstants.MEASURE_DATA_ORGANIZATION_FULL);
    context.put("uploadSignatureOid", this.getFields().get("uploadSignatureOid"));
    return context;
}
Also used : Context(org.apache.commons.chain.Context) EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) ContextBase(org.apache.commons.chain.impl.ContextBase)

Example 44 with Context

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

the class PersonalReportContentQueryAction method getPdf.

private void getPdf() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields();
    Context context = this.getChainContext();
    SimpleChain chain = new SimpleChain();
    ChainResultObj resultObj = chain.getResultFromResource("personalReportPdfContentChain", 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)

Example 45 with Context

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

the class PersonalReportContentQueryAction method getExcel.

private void getExcel() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields();
    Context context = this.getChainContext();
    SimpleChain chain = new SimpleChain();
    ChainResultObj resultObj = chain.getResultFromResource("personalReportExcelContentChain", 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)

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