Search in sources :

Example 11 with ControllerException

use of com.netsteadfast.greenstep.base.exception.ControllerException in project bamboobsc by billchen198318.

the class CommonUploadFileAction method loadNames.

private void loadNames() throws ControllerException, AuthorityException, ServiceException, IOException, Exception {
    if (StringUtils.isBlank(this.uploadOid)) {
        throw new ControllerException("Upload oid is required!");
    }
    DefaultResult<SysUploadVO> result = this.sysUploadService.findForNoByteContent(this.uploadOid);
    if (result.getValue() == null) {
        this.message = result.getSystemMessage().getValue();
        return;
    }
    SysUploadVO uploadData = result.getValue();
    this.fileName = super.defaultString(uploadData.getFileName()).trim();
    this.showName = super.defaultString(uploadData.getShowName()).trim();
    //this.showName = StringEscapeUtils.escapeEcmaScript( this.showName );
    //this.showName = StringEscapeUtils.escapeHtml4( this.showName );
    this.showName = this.showName.replaceAll("'", "’").replaceAll("\"", """).replaceAll("<", "<").replaceAll(">", ">");
    this.success = IS_YES;
    this.message = "load success!";
    if (YesNo.YES.equals(uploadData.getIsFile())) {
        @SuppressWarnings("unused") File dataFile = UploadSupportUtils.getRealFile(uploadData.getOid());
        this.fileExist = YesNo.YES;
        dataFile = null;
    } else {
        this.fileExist = YesNo.YES;
    }
}
Also used : ControllerException(com.netsteadfast.greenstep.base.exception.ControllerException) SysUploadVO(com.netsteadfast.greenstep.vo.SysUploadVO) File(java.io.File)

Example 12 with ControllerException

use of com.netsteadfast.greenstep.base.exception.ControllerException in project bamboobsc by billchen198318.

the class CommonOrgChartAction method loadOrgChartData.

@SuppressWarnings("unchecked")
private void loadOrgChartData(String selfOid) throws ControllerException, AuthorityException, ServiceException, Exception {
    String oid = super.defaultString(this.getFields().get("oid")).trim();
    if (!StringUtils.isBlank(selfOid)) {
        oid = selfOid;
    }
    if (StringUtils.isBlank(oid)) {
        throw new ControllerException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    String jsonData = new String(UploadSupportUtils.getDataBytes(oid));
    ObjectMapper mapper = new ObjectMapper();
    this.rootData = mapper.readValue(jsonData, HashMap.class);
}
Also used : ControllerException(com.netsteadfast.greenstep.base.exception.ControllerException) HashMap(java.util.HashMap) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 13 with ControllerException

use of com.netsteadfast.greenstep.base.exception.ControllerException in project bamboobsc by billchen198318.

the class StrategyMapManagementAction method loadRecord.

private void loadRecord() throws ControllerException, ServiceException, Exception {
    if (StringUtils.isBlank(this.visionOid) || super.isNoSelectId(this.visionOid)) {
        throw new ControllerException(this.getText("MESSAGE.BSC_PROG002D0007Q_vision"));
    }
    Context context = this.getChainContext();
    SimpleChain chain = new SimpleChain();
    ChainResultObj resultObj = chain.getResultFromResource("strategyMapItemsForRecChain", context);
    this.setPageMessage(resultObj.getMessage());
    if (resultObj.getValue() instanceof StrategyMapItemsVO) {
        this.divItems = ((StrategyMapItemsVO) resultObj.getValue()).getDiv();
        this.cssItems = ((StrategyMapItemsVO) resultObj.getValue()).getCss();
        this.conItems = ((StrategyMapItemsVO) resultObj.getValue()).getCon();
    }
}
Also used : Context(org.apache.commons.chain.Context) ControllerException(com.netsteadfast.greenstep.base.exception.ControllerException) StrategyMapItemsVO(com.netsteadfast.greenstep.bsc.vo.StrategyMapItemsVO) ChainResultObj(com.netsteadfast.greenstep.base.model.ChainResultObj) SimpleChain(com.netsteadfast.greenstep.base.chain.SimpleChain)

Example 14 with ControllerException

use of com.netsteadfast.greenstep.base.exception.ControllerException in project bamboobsc by billchen198318.

the class StrategyMapManagementAction method loadNew.

private void loadNew() throws ControllerException, ServiceException, Exception {
    if (StringUtils.isBlank(this.visionOid) || super.isNoSelectId(this.visionOid)) {
        throw new ControllerException(this.getText("MESSAGE.BSC_PROG002D0007Q_vision"));
    }
    Context context = this.getChainContext();
    SimpleChain chain = new SimpleChain();
    ChainResultObj resultObj = chain.getResultFromResource("strategyMapItemsForNewChain", context);
    this.setPageMessage(resultObj.getMessage());
    if (resultObj.getValue() instanceof StrategyMapItemsVO) {
        this.divItems = ((StrategyMapItemsVO) resultObj.getValue()).getDiv();
        this.cssItems = ((StrategyMapItemsVO) resultObj.getValue()).getCss();
    }
}
Also used : Context(org.apache.commons.chain.Context) ControllerException(com.netsteadfast.greenstep.base.exception.ControllerException) StrategyMapItemsVO(com.netsteadfast.greenstep.bsc.vo.StrategyMapItemsVO) ChainResultObj(com.netsteadfast.greenstep.base.model.ChainResultObj) SimpleChain(com.netsteadfast.greenstep.base.chain.SimpleChain)

Example 15 with ControllerException

use of com.netsteadfast.greenstep.base.exception.ControllerException in project bamboobsc by billchen198318.

the class AnalyticsProcessAction method exportExcel.

private void exportExcel(File catalogFile) throws ControllerException, AuthorityException, ServiceException, Exception {
    this.oid = "";
    this.checkFields("query");
    boolean showDimensionTitle = true;
    boolean showParentMembers = true;
    if (!"true".equals(this.getFields().get("showDimensionTitle"))) {
        showDimensionTitle = false;
    }
    if (!"true".equals(this.getFields().get("showParentMembers"))) {
        showParentMembers = false;
    }
    OlapCatalogVO catalog = this.loadOlapCatalog(this.getFields().get("catalogOid"));
    OlapConfVO config = this.loadOlapConfig(this.getFields().get("configOid"));
    catalogFile = OlapUtils.writeCatalogContentToFile(catalog.getId() + "_" + super.getAccountOid(), new String(catalog.getContent(), Constants.BASE_ENCODING));
    String mondrianUrl = OlapUtils.getMondrianUrl(config.getJdbcUrl(), config.getJdbcDrivers(), catalogFile.getPath());
    File file = null;
    try {
        file = Pivot4JUtils.exportExcelFile(mondrianUrl, this.getFields().get("expression"), showDimensionTitle, showParentMembers);
        this.oid = UploadSupportUtils.create(Constants.getSystem(), UploadTypes.IS_TEMP, true, file, "analytics-export.xlsx");
    } catch (Exception e) {
        throw e;
    } finally {
        file = null;
    }
    this.message = this.getText("MESSAGE.QCHARTS_PROG002D0002Q_msg1") + super.getHtmlBr();
    this.success = IS_YES;
}
Also used : OlapConfVO(com.netsteadfast.greenstep.vo.OlapConfVO) OlapCatalogVO(com.netsteadfast.greenstep.vo.OlapCatalogVO) File(java.io.File) ControllerException(com.netsteadfast.greenstep.base.exception.ControllerException) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) AuthorityException(com.netsteadfast.greenstep.base.exception.AuthorityException)

Aggregations

ControllerException (com.netsteadfast.greenstep.base.exception.ControllerException)17 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)10 AuthorityException (com.netsteadfast.greenstep.base.exception.AuthorityException)8 File (java.io.File)6 JSON (org.apache.struts2.json.annotations.JSON)4 ChainResultObj (com.netsteadfast.greenstep.base.model.ChainResultObj)3 ControllerMethodAuthority (com.netsteadfast.greenstep.base.model.ControllerMethodAuthority)3 SysUploadVO (com.netsteadfast.greenstep.vo.SysUploadVO)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 SimpleChain (com.netsteadfast.greenstep.base.chain.SimpleChain)2 StrategyMapItemsVO (com.netsteadfast.greenstep.bsc.vo.StrategyMapItemsVO)2 HashMap (java.util.HashMap)2 Context (org.apache.commons.chain.Context)2 IActionFieldsCheckUtils (com.netsteadfast.greenstep.base.model.IActionFieldsCheckUtils)1 SystemForm (com.netsteadfast.greenstep.base.model.SystemForm)1 BscStructTreeObj (com.netsteadfast.greenstep.bsc.model.BscStructTreeObj)1 ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)1 OlapCatalogVO (com.netsteadfast.greenstep.vo.OlapCatalogVO)1 OlapConfVO (com.netsteadfast.greenstep.vo.OlapConfVO)1 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)1