use of com.netsteadfast.greenstep.base.exception.ControllerException in project bamboobsc by billchen198318.
the class BaseSupportAction method checkFields.
@Deprecated
protected void checkFields(String[] fieldsName, String[] msg, Class<IActionFieldsCheckUtils>[] checkUtilsClass, String[] methodsName, List<String> fieldsId) throws ControllerException, InstantiationException, IllegalAccessException {
if (fieldsName == null || msg == null || checkUtilsClass == null || (fieldsName.length != msg.length) || (fieldsName.length != checkUtilsClass.length)) {
throw new java.lang.IllegalArgumentException("check filed args error!");
}
StringBuilder exceptionMsg = new StringBuilder();
for (int i = 0; i < fieldsName.length; i++) {
String value = this.getFields().get(fieldsName[i]);
IActionFieldsCheckUtils checkUtils = checkUtilsClass[i].newInstance();
if (methodsName != null && methodsName.length == checkUtilsClass.length) {
Method[] methods = checkUtils.getClass().getMethods();
for (Method method : methods) {
if (method.getName().equals(methodsName[i])) {
try {
if (!(Boolean) method.invoke(null, value)) {
if (fieldsId != null) {
fieldsId.add(fieldsName[i]);
}
exceptionMsg.append(msg[i]);
}
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
} else {
if (!checkUtils.check(value)) {
if (fieldsId != null) {
fieldsId.add(fieldsName[i]);
}
exceptionMsg.append(msg[i]);
}
}
}
if (exceptionMsg.length() > 0) {
throw new ControllerException(exceptionMsg.toString());
}
}
use of com.netsteadfast.greenstep.base.exception.ControllerException in project bamboobsc by billchen198318.
the class KpiReportContentQueryAction method loadContentFromUpload.
// public static void main(String args[]) throws Exception {
// //CONTENT.txt
// String jsonStr = FSUtils.readStr("/tmp/CONTENT.txt");
// Map<String, Object> dataMap = new ObjectMapper().readValue(jsonStr, Map.class);
// BscStructTreeObj treeObj = new ObjectMapper().readValue( SimpleUtils.deB64((String)dataMap.get("treeObjJsonStr")), BscStructTreeObj.class);
// ChainResultObj resultObj = new ObjectMapper().readValue( SimpleUtils.deB64((String)dataMap.get("resultObjJsonStr")), ChainResultObj.class);
//
// }
/**
* 2016-11-01
* 主要給 workspace 圖表元件載入用的
*
* @throws ControllerException
* @throws AuthorityException
* @throws ServiceException
* @throws Exception
*/
private void loadContentFromUpload() throws ControllerException, AuthorityException, ServiceException, Exception {
String uploadOid = this.getFields().get("uploadOid");
byte[] content = UploadSupportUtils.getDataBytes(uploadOid);
String jsonStr = new String(content, Constants.BASE_ENCODING);
if (StringUtils.isBlank(jsonStr)) {
throw new Exception("Report json data error.");
}
@SuppressWarnings("unchecked") Map<String, Object> dataMap = new ObjectMapper().readValue(jsonStr, Map.class);
BscStructTreeObj treeObj = new ObjectMapper().readValue(SimpleUtils.deB64((String) dataMap.get("treeObjJsonStr")), BscStructTreeObj.class);
ChainResultObj resultObj = new ObjectMapper().readValue(SimpleUtils.deB64((String) dataMap.get("resultObjJsonStr")), ChainResultObj.class);
this.body = String.valueOf(resultObj.getValue());
this.message = resultObj.getMessage();
if (!StringUtils.isBlank(this.body) && this.body.startsWith("<!-- BSC_PROG003D0001Q -->")) {
this.success = IS_YES;
}
this.fillPerspectivesPieChartData(treeObj);
this.fillPerspectivesBarChartData(treeObj);
this.fillLineChartData(treeObj);
}
use of com.netsteadfast.greenstep.base.exception.ControllerException in project bamboobsc by billchen198318.
the class StrategyMapManagementAction method loadObjectiveItem.
private void loadObjectiveItem() throws ControllerException, ServiceException, Exception {
// 這裡的 fields.oid 放的是 BB_OBJECTIVE.OBJ_ID
String objId = super.defaultString(super.getFields().get("oid")).trim();
if (StringUtils.isBlank(objId)) {
throw new ControllerException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
this.objective = new ObjectiveVO();
this.objective.setObjId(objId);
DefaultResult<ObjectiveVO> result = this.objectiveService.findByUK(this.objective);
if (result.getValue() == null) {
throw new ServiceException(result.getSystemMessage().getValue());
}
this.objective = result.getValue();
PerspectiveVO perspective = new PerspectiveVO();
perspective.setPerId(this.objective.getPerId());
DefaultResult<PerspectiveVO> pResult = this.perspectiveService.findByUK(perspective);
if (pResult.getValue() == null) {
throw new ServiceException(pResult.getSystemMessage().getValue());
}
perspective = pResult.getValue();
DefaultResult<VisionVO> vResult = this.visionService.findForSimpleByVisId(perspective.getVisId());
if (vResult.getValue() == null) {
throw new ServiceException(vResult.getSystemMessage().getValue());
}
VisionVO vision = vResult.getValue();
this.visionOid = vision.getOid();
}
use of com.netsteadfast.greenstep.base.exception.ControllerException in project bamboobsc by billchen198318.
the class AnalyticsProcessAction method doExcel.
/**
* qcharts.analyticsExcelAction.action
*
* @return
* @throws Exception
*/
@JSON(serialize = false)
@ControllerMethodAuthority(programId = "QCHARTS_PROG002D0002Q")
public String doExcel() throws Exception {
File catalogFile = null;
try {
if (!this.allowJob()) {
this.message = this.getNoAllowMessage();
return SUCCESS;
}
this.exportExcel(catalogFile);
} catch (AuthorityException | ControllerException | ServiceException e) {
this.message = e.getMessage().toString();
} catch (Exception e) {
this.message = this.logException(e);
this.success = IS_EXCEPTION;
}
catalogFile = null;
return SUCCESS;
}
use of com.netsteadfast.greenstep.base.exception.ControllerException in project bamboobsc by billchen198318.
the class AnalyticsProcessAction method doHtml.
/**
* qcharts.analyticsHtmlAction.action
*
* @return
* @throws Exception
*/
@JSON(serialize = false)
@ControllerMethodAuthority(programId = "QCHARTS_PROG002D0002Q")
public String doHtml() throws Exception {
File catalogFile = null;
try {
if (!this.allowJob()) {
this.message = this.getNoAllowMessage();
return SUCCESS;
}
this.rendererHtml(catalogFile);
} catch (AuthorityException | ControllerException | ServiceException e) {
this.message = e.getMessage().toString();
} catch (Exception e) {
this.message = this.logException(e);
this.success = IS_EXCEPTION;
}
catalogFile = null;
return SUCCESS;
}
Aggregations