org.apache.commons.chain.Context Java Examples

The following examples show how to use org.apache.commons.chain.Context. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ObjectivesDashboardAction.java    From bamboobsc with Apache License 2.0 6 votes vote down vote up
private Context getContext() throws ControllerException, AuthorityException, ServiceException, Exception {
	this.checkFields();
	this.setDateValue();
	this.checkDateRange();
	Context context = this.getChainContext();
	SimpleChain chain = new SimpleChain();
	ChainResultObj resultObj = chain.getResultFromResource("performanceScoreChain", context);
	this.message = resultObj.getMessage();	
	if (context.get("treeObj")==null) {
		return context;
	}
	BscStructTreeObj treeObj = (BscStructTreeObj)context.get("treeObj");
	if (null != treeObj) {
		this.success = IS_YES;
	}
	this.vision = treeObj.getVisions().get(0);
	return context;
}
 
Example #2
Source File: KpisDashboardExcelCommand.java    From bamboobsc with Apache License 2.0 6 votes vote down vote up
private String createExcel(Context context) throws Exception {
	String fileName = SimpleUtils.getUUIDStr() + ".xlsx";
	String fileFullPath = Constants.getWorkTmpDir() + "/" + fileName;	
	XSSFWorkbook wb = new XSSFWorkbook();				
	XSSFSheet sh = wb.createSheet();
	
	BscReportPropertyUtils.loadData();
	
	int row = this.putDateRange(wb, sh, context);
	this.putCharts(wb, sh, context, row);
	
       FileOutputStream out = new FileOutputStream(fileFullPath);
       wb.write(out);
       out.close();
       wb = null;
       
       File file = new File(fileFullPath);
	String oid = UploadSupportUtils.create(
			Constants.getSystem(), UploadTypes.IS_TEMP, false, file, "kpis-dashboard.xlsx");
	file = null;
	return oid;
}
 
Example #3
Source File: OrganizationReportPdfCommand.java    From bamboobsc with Apache License 2.0 6 votes vote down vote up
private void putSignature(PdfPTable table, Context context) throws Exception {
	String uploadOid = (String)context.get("uploadSignatureOid");
	if ( StringUtils.isBlank(uploadOid) ) {
		return;
	}
	byte[] imageBytes = UploadSupportUtils.getDataBytes( uploadOid );
	if ( null == imageBytes ) {
		return;
	}
	Image signatureImgObj = Image.getInstance( imageBytes );
	signatureImgObj.setWidthPercentage(40f);
	PdfPCell cell = new PdfPCell();
	cell.setBorder( Rectangle.NO_BORDER );
	cell.addElement(signatureImgObj);
	table.addCell(cell);		
}
 
Example #4
Source File: ObjectivesDashboardAction.java    From bamboobsc with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
private Context getContext() throws Exception {
	List< Map<String, Object> > chartDatas = new LinkedList< Map<String, Object> >();
	Enumeration<String> paramNames = this.getHttpServletRequest().getParameterNames();
	while ( paramNames.hasMoreElements() ) {
		String paramName = paramNames.nextElement();
		String value = this.getHttpServletRequest().getParameter(paramName);
		if ( paramName.startsWith("BSC_PROG003D0005Q_meterGaugeChartDatas:") ) {		
			Map<String, Object> dataMap = (Map<String, Object>)
					new ObjectMapper().readValue(value, LinkedHashMap.class);	
			chartDatas.add( dataMap );
		}				
	}		
	Context context = new ContextBase();
	context.put("chartDatas", chartDatas);
	context.put("year", this.getHttpServletRequest().getParameter("BSC_PROG003D0005Q_year") );
	context.put("barChartsData", this.getHttpServletRequest().getParameter("BSC_PROG003D0005Q_objectivesBarChartsData") );
	return context;
}
 
Example #5
Source File: LoadStrategyMapItemsForNewCommand.java    From bamboobsc with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public boolean execute(Context context) throws Exception {
	if ( this.getResult(context)==null || !(this.getResult(context) instanceof BscStructTreeObj) ) {
		return false;
	}
	BscStructTreeObj treeObj = (BscStructTreeObj)this.getResult(context);	
	String visionOid = (String)context.get("visionOid");
	VisionVO vision = null;
	for (VisionVO obj : treeObj.getVisions()) {
		if ( obj.getOid().equals(visionOid) ) {
			vision = obj;
		}
	}
	StrategyMapItemsVO mapItems = this.fillStrategyMapItems(vision);
	int mapHeight = StrategyMapUtils.getMIN_HEIGHT();
	if (vision.getPerspectives().size() > 4) {
		mapHeight = StrategyMapUtils.getONE_HEIGHT() * vision.getPerspectives().size();
	}
	context.put("backgroundOid", StrategyMapUtils.createUpload(vision, 800, mapHeight));
	context.put("mapHeight", String.valueOf(mapHeight));
	this.setResult(context, mapItems);
	return false;
}
 
Example #6
Source File: StrategyMapManagementAction.java    From bamboobsc with Apache License 2.0 6 votes vote down vote up
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.backgroundOid = (String) context.get("backgroundOid");
	this.mapHeight = (String) context.get("mapHeight");
	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();
	}		
}
 
Example #7
Source File: SwotBodyCommand.java    From bamboobsc with Apache License 2.0 6 votes vote down vote up
@Override
public boolean execute(Context context) throws Exception {
	if (this.getResult(context)==null || !(this.getResult(context) instanceof SwotDataVO) ) {
		return false;
	}		
	SwotDataVO swotData = (SwotDataVO)this.getResult(context);
	Map<String, Object> parameter = new HashMap<String, Object>();
	parameter.put("issues", swotData.getIssues());
	parameter.put("vision", swotData.getVision());
	parameter.put("organization", swotData.getOrganization());
	parameter.put("strengthsName", String.valueOf(context.get("strengthsName")));
	parameter.put("weaknessesName", String.valueOf(context.get("weaknessesName")));
	parameter.put("opportunitiesName", String.valueOf(context.get("opportunitiesName")));
	parameter.put("threatsName", String.valueOf(context.get("threatsName")));
	String content = TemplateUtils.processTemplate(
			"resourceTemplate", 
			SwotBodyCommand.class.getClassLoader(), 
			templateResource, 
			parameter);
	this.setResult(context, content );		
	return false;
}
 
Example #8
Source File: PdcaReportContentQueryAction.java    From bamboobsc with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #9
Source File: PdcaReportBodyCommand.java    From bamboobsc with Apache License 2.0 6 votes vote down vote up
@Override
public boolean execute(Context context) throws Exception {
	if (this.getResult(context)==null || !(this.getResult(context) instanceof PdcaVO) ) {
		return false;
	}
	PdcaVO pdca = (PdcaVO)this.getResult(context);
	Map<String, Object> parameter = new HashMap<String, Object>();
	parameter.put("pdca", pdca);
	String content = TemplateUtils.processTemplate(
			"resourceTemplate",
			PdcaReportBodyCommand.class.getClassLoader(), 
			templateResource, 
			parameter);
	this.setResult(context, content);
	return false;
}
 
Example #10
Source File: RegionMapRelationKpisAction.java    From bamboobsc with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
private Context getChainContext(String visionOid, String year) throws Exception {
	String dateStr1 = year+"0101";
	String dateStr2 = year+"1230";
	Context context = new ContextBase();
	context.put("visionOid", visionOid);
	context.put("startDate", dateStr1);
	context.put("endDate", dateStr2);		
	context.put("startYearDate",  year);
	context.put("endYearDate",  year);		
	context.put("frequency", BscMeasureDataFrequency.FREQUENCY_YEAR);
	context.put("dataFor", BscConstants.MEASURE_DATA_FOR_ORGANIZATION);
	context.put("orgId", this.getFields().get("orgId"));
	context.put("empId", BscConstants.MEASURE_DATA_EMPLOYEE_FULL);
	return context;
}
 
Example #11
Source File: StrategyMapManagementAction.java    From bamboobsc with Apache License 2.0 6 votes vote down vote up
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.backgroundOid = (String) context.get("backgroundOid");
	this.mapHeight = (String) context.get("mapHeight");
	this.setPageMessage( resultObj.getMessage() );
	if ( resultObj.getValue() instanceof StrategyMapItemsVO ) {
		this.divItems = ( (StrategyMapItemsVO)resultObj.getValue() ).getDiv();
		this.cssItems = ( (StrategyMapItemsVO)resultObj.getValue() ).getCss();
	}
	
}
 
Example #12
Source File: ObjectivesDashboardAction.java    From bamboobsc with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
private void getExcel() throws ControllerException, AuthorityException, ServiceException, Exception {
	String dateRangeChartPngData = this.defaultString( this.getFields().get("dateRangeChartPngData") ).trim();
	String gaugeDatasJsonStr = this.defaultString( this.getFields().get("gaugeDatas") );
	Map<String, Object> gaugeDatas = (Map<String, Object>) new ObjectMapper().readValue(gaugeDatasJsonStr, LinkedHashMap.class);
	Context context = this.getChainContext();
	context.put("dateRangeChartPngData", dateRangeChartPngData);
	context.put("gaugeDatas", gaugeDatas);
	if ( gaugeDatas == null || gaugeDatas.size() < 1 ) {
		super.throwMessage( this.getText("MESSAGE.BSC_PROG003D0005Q_msg1") );
	}
	SimpleChain chain = new SimpleChain();
	ChainResultObj resultObj = chain.getResultFromResource("objectivesDashboardExcelContentChain", context);
	this.message = resultObj.getMessage();
	if ( resultObj.getValue() instanceof String ) {
		this.uploadOid = (String)resultObj.getValue();
		this.success = IS_YES;
	}			
}
 
Example #13
Source File: KpisDashboardExcelCommand.java    From bamboobsc with Apache License 2.0 6 votes vote down vote up
private String createExcel(Context context) throws Exception {
	String fileName = SimpleUtils.getUUIDStr() + ".xlsx";
	String fileFullPath = Constants.getWorkTmpDir() + "/" + fileName;	
	XSSFWorkbook wb = new XSSFWorkbook();				
	XSSFSheet sh = wb.createSheet();
	
	int row = this.putTables(wb, sh, context);
	row = this.putCharts(wb, sh, context, row);
	
       FileOutputStream out = new FileOutputStream(fileFullPath);
       wb.write(out);
       out.close();
       wb = null;
       
       File file = new File(fileFullPath);
	String oid = UploadSupportUtils.create(
			Constants.getSystem(), UploadTypes.IS_TEMP, false, file, "kpis-dashboard.xlsx");
	file = null;
	return oid;
}
 
Example #14
Source File: DashboardNewAction.java    From bamboobsc with Apache License 2.0 6 votes vote down vote up
private Context getContext() throws ControllerException, AuthorityException, ServiceException, Exception {
	this.checkFields();
	this.setDateValue();
	this.checkDateRange();
	Context context = this.getChainContext();
	SimpleChain chain = new SimpleChain();
	ChainResultObj resultObj = chain.getResultFromResource("performanceScoreChain", context);
	this.message = resultObj.getMessage();	
	if (context.get("treeObj")==null) {
		return context;
	}
	BscStructTreeObj treeObj = (BscStructTreeObj)context.get("treeObj");
	if (null != treeObj) {
		this.success = IS_YES;
	}
	this.vision = treeObj.getVisions().get(0);
	return context;
}
 
Example #15
Source File: TimeSeriesAnalysisExcelCommand.java    From bamboobsc with Apache License 2.0 6 votes vote down vote up
private String createExcel(Context context) throws Exception {
	String fileName = SimpleUtils.getUUIDStr() + ".xlsx";
	String fileFullPath = Constants.getWorkTmpDir() + "/" + fileName;	
	XSSFWorkbook wb = new XSSFWorkbook();				
	XSSFSheet sh = wb.createSheet();
	
	this.putTables(wb, sh, context);
	
       FileOutputStream out = new FileOutputStream(fileFullPath);
       wb.write(out);
       out.close();
       wb = null;
       
       File file = new File(fileFullPath);
	String oid = UploadSupportUtils.create(
			Constants.getSystem(), UploadTypes.IS_TEMP, false, file, "forecast-analysis.xlsx");
	file = null;
	return oid;
}
 
Example #16
Source File: ObjectivesDashboardExcelCommand.java    From bamboobsc with Apache License 2.0 6 votes vote down vote up
private String createExcel(Context context) throws Exception {
	String fileName = SimpleUtils.getUUIDStr() + ".xlsx";
	String fileFullPath = Constants.getWorkTmpDir() + "/" + fileName;	
	XSSFWorkbook wb = new XSSFWorkbook();				
	XSSFSheet sh = wb.createSheet();
	
	BscReportPropertyUtils.loadData();
	
	int row = this.putDateRange(wb, sh, context);
	this.putCharts(wb, sh, context, row);
	
       FileOutputStream out = new FileOutputStream(fileFullPath);
       wb.write(out);
       out.close();
       wb = null;
       
       File file = new File(fileFullPath);
	String oid = UploadSupportUtils.create(
			Constants.getSystem(), UploadTypes.IS_TEMP, false, file, "objectives-dashboard.xlsx");
	file = null;
	return oid;
}
 
Example #17
Source File: PeriodTrendsCalUtils.java    From bamboobsc with Apache License 2.0 6 votes vote down vote up
public static List<PeriodTrendsData<KpiVO>> getKpiScoreChange(String visionOid1, String startDate1, String endDate1, 
		String startYearDate1, String endYearDate1, String frequency1, String dataFor1, 
		String measureDataOrganizationOid1, String measureDataEmployeeOid1,
		String visionOid2, String startDate2, String endDate2, 
		String startYearDate2, String endYearDate2, String frequency2, String dataFor2, 
		String measureDataOrganizationOid2, String measureDataEmployeeOid2) throws ServiceException, Exception {
	
	List<PeriodTrendsData<KpiVO>> result = new ArrayList<PeriodTrendsData<KpiVO>>();
	Context context1 = PerformanceScoreChainUtils.getContext(visionOid1, startDate1, endDate1, startYearDate1, endYearDate1, frequency1, dataFor1,  
			measureDataOrganizationOid1, measureDataEmployeeOid1);
	Context context2 = PerformanceScoreChainUtils.getContext(visionOid2, startDate2, endDate2, startYearDate2, endYearDate2, frequency2, dataFor2, 
			measureDataOrganizationOid2, measureDataEmployeeOid2);
	/*
	SimpleChain chain1 = new SimpleChain();
	SimpleChain chain2 = new SimpleChain();
	ChainResultObj resultObj1 = chain1.getResultFromResource("performanceScoreChain", context1);
	ChainResultObj resultObj2 = chain2.getResultFromResource("performanceScoreChain", context2);
	*/
	fillKpiPeriodTrends(
			result, 
			PerformanceScoreChainUtils.getResult(context1), 
			PerformanceScoreChainUtils.getResult(context2), 
			frequency1.equals(frequency2));		
	return result;
}
 
Example #18
Source File: PersonalReportPdfCommand.java    From bamboobsc with Apache License 2.0 6 votes vote down vote up
private void putSignature(PdfPTable table, Context context) throws Exception {
	String uploadOid = (String)context.get("uploadSignatureOid");
	if ( StringUtils.isBlank(uploadOid) ) {
		return;
	}
	byte[] imageBytes = UploadSupportUtils.getDataBytes( uploadOid );
	if ( null == imageBytes ) {
		return;
	}
	Image signatureImgObj = Image.getInstance( imageBytes );
	signatureImgObj.setWidthPercentage(40f);
	PdfPCell cell = new PdfPCell();
	cell.setBorder( Rectangle.NO_BORDER );
	cell.addElement(signatureImgObj);
	table.addCell(cell);		
}
 
Example #19
Source File: PerspectivesDashboardExcelCommand.java    From bamboobsc with Apache License 2.0 6 votes vote down vote up
private String createExcel(Context context) throws Exception {
	String fileName = SimpleUtils.getUUIDStr() + ".xlsx";
	String fileFullPath = Constants.getWorkTmpDir() + "/" + fileName;	
	XSSFWorkbook wb = new XSSFWorkbook();				
	XSSFSheet sh = wb.createSheet();
	
	this.putCharts(wb, sh, context);
	
       FileOutputStream out = new FileOutputStream(fileFullPath);
       wb.write(out);
       out.close();
       wb = null;
       
       File file = new File(fileFullPath);
	String oid = UploadSupportUtils.create(
			Constants.getSystem(), UploadTypes.IS_TEMP, false, file, "perspectives-dashboard.xlsx");
	file = null;
	return oid;
}
 
Example #20
Source File: PersonalAndOrganizationReportDateRangeScoreCommand.java    From bamboobsc with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public boolean execute(Context context) throws Exception {
	if (this.getResult(context)==null || !(this.getResult(context) instanceof BscStructTreeObj) ) {
		return false;
	}		
	float total = 0.0f;
	BscStructTreeObj treeObj = (BscStructTreeObj)this.getResult(context);
	String year = StringUtils.defaultString( (String)context.get("startYearDate") ).trim();
	String dateType = StringUtils.defaultString( (String)context.get("dateType") ).trim();
	for (VisionVO vision : treeObj.getVisions()) {
		for (PerspectiveVO perspective : vision.getPerspectives()) {
			for (ObjectiveVO objective : perspective.getObjectives()) {
				for (KpiVO kpi : objective.getKpis()) {
					this.setDateRangeScore(kpi, dateType, year);
					total = total + kpi.getDateRangeScores().get(0).getScore(); // 只有一筆資料
				}
			}
		}
	}		
	context.put("total", total);
	return false;
}
 
Example #21
Source File: KpiPeriodTrendsExcelCommand.java    From bamboobsc with Apache License 2.0 6 votes vote down vote up
private String createExcel(Context context) throws Exception {
	String fileName = SimpleUtils.getUUIDStr() + ".xlsx";
	String fileFullPath = Constants.getWorkTmpDir() + "/" + fileName;	
	XSSFWorkbook wb = new XSSFWorkbook();				
	XSSFSheet sh = wb.createSheet();
	
	this.putTables(wb, sh, context);
	
       FileOutputStream out = new FileOutputStream(fileFullPath);
       wb.write(out);
       out.close();
       wb = null;
       
       File file = new File(fileFullPath);
	String oid = UploadSupportUtils.create(
			Constants.getSystem(), UploadTypes.IS_TEMP, false, file, "kpis-period-trends.xlsx");
	file = null;
	return oid;
}
 
Example #22
Source File: PersonalReportContentQueryAction.java    From bamboobsc with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example #23
Source File: DepartmentReportContentQueryAction.java    From bamboobsc with Apache License 2.0 5 votes vote down vote up
private void getPdf() throws ControllerException, AuthorityException, ServiceException, Exception {
	this.checkFields();
	Context context = this.getChainContext();
	SimpleChain chain = new SimpleChain();
	ChainResultObj resultObj = chain.getResultFromResource("organizationReportPdfContentChain", context);
	this.message = resultObj.getMessage();
	if ( resultObj.getValue() instanceof String ) {
		this.uploadOid = (String)resultObj.getValue();
		this.success = IS_YES;
	}		
}
 
Example #24
Source File: PersonalReportContentQueryAction.java    From bamboobsc with Apache License 2.0 5 votes vote down vote up
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;
	}				
}
 
Example #25
Source File: KpiReportContentQueryAction.java    From bamboobsc with Apache License 2.0 5 votes vote down vote up
private void getCoffeeChartJsonData() throws ControllerException, AuthorityException, ServiceException, Exception {
	this.checkFields();
	this.setDateValue();
	this.checkDateRange();
	Context context = this.getChainContext();
	SimpleChain chain = new SimpleChain();
	ChainResultObj resultObj = chain.getResultFromResource("kpiReportCoffeeChartJsonDataContentChain", context);
	this.message = resultObj.getMessage();
	if ( resultObj.getValue() instanceof String ) {
		this.body = String.valueOf(resultObj.getValue());
		this.inputStream = new ByteArrayInputStream(this.body.getBytes(Constants.BASE_ENCODING));
		this.success = IS_YES;
	}		
}
 
Example #26
Source File: SwotDataProvideCommand.java    From bamboobsc with Apache License 2.0 5 votes vote down vote up
@Override
public boolean execute(Context context) throws Exception {
	String visionOid = (String)context.get("visionOid");
	String organizationOid = (String)context.get("organizationOid");
	VisionVO vision = this.findVision(visionOid);
	OrganizationVO organization = this.findOrganization(organizationOid);
	if ( StringUtils.isBlank(vision.getVisId()) || StringUtils.isBlank(organization.getOrgId()) ) {
		this.setMessage(context, SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA));
		return false;
	}		
	Map<String, Object> params = new HashMap<String, Object>();
	Map<String, String> orderParams = new HashMap<String, String>();
	params.put("visId", vision.getVisId());
	orderParams.put("perId", "asc");
	List<BbPerspective> perspectives = this.perspectiveService.findListByParams(params, null, orderParams);
	if (perspectives==null || perspectives.size()<1) {
		this.setMessage(context, SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA));
		return false;
	}		
	params.put("orgId", organization.getOrgId());		
	List<BbSwot> swots = this.swotService.findListByParams(params, null, orderParams);
	SwotDataVO swotData = new SwotDataVO();
	swotData.setVision(vision);
	swotData.setOrganization(organization);
	swotData.setContents(swots);
	swotData.setPerspectives(perspectives);
	this.initIssues(swotData, vision.getVisId(), organization.getOrgId());
	this.setResult(context, swotData);
	return false;
}
 
Example #27
Source File: LoadPdcaDataCommand.java    From bamboobsc with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public boolean execute(Context context) throws Exception {
	pdcaService = (IPdcaService<PdcaVO, BbPdca, String>) AppContext.getBean("bsc.service.PdcaService");
	pdcaDocService = (IPdcaDocService<PdcaDocVO, BbPdcaDoc, String>) AppContext.getBean("bsc.service.PdcaDocService");
	pdcaItemService = (IPdcaItemService<PdcaItemVO, BbPdcaItem, String>) AppContext.getBean("bsc.service.PdcaItemService");
	pdcaItemDocService = (IPdcaItemDocService<PdcaItemDocVO, BbPdcaItemDoc, String>) AppContext.getBean("bsc.service.PdcaItemDocService");
	pdcaAuditService = (IPdcaAuditService<PdcaAuditVO, BbPdcaAudit, String>) AppContext.getBean("bsc.service.PdcaAuditService");
	employeeService = (IEmployeeService<EmployeeVO, BbEmployee, String>) AppContext.getBean("bsc.service.EmployeeService");
	organizationService = (IOrganizationService<OrganizationVO, BbOrganization, String>) AppContext.getBean("bsc.service.OrganizationService");
	kpiService = (IKpiService<KpiVO, BbKpi, String>) AppContext.getBean("bsc.service.KpiService");
	String pdcaOid = (String)context.get("pdcaOid");
	PdcaVO pdca = new PdcaVO();
	pdca.setOid(pdcaOid);
	DefaultResult<PdcaVO> result = pdcaService.findObjectByOid(pdca);
	if (result.getValue() == null) {
		this.setMessage(context, result.getSystemMessage().getValue());
	} else {
		pdca = result.getValue();
		this.loadDetail(pdca);
		this.loadPdcaItems(pdca);
		this.loadAudit(pdca);
		this.setResult(context, pdca);
		context.put("pdca", pdca); // Action 輸出可能會要用到
	}
	return false;
}
 
Example #28
Source File: KpiReportExcelCommand.java    From bamboobsc with Apache License 2.0 5 votes vote down vote up
@Override
public boolean execute(Context context) throws Exception {
	if (this.getResult(context)==null || !(this.getResult(context) instanceof BscStructTreeObj) ) {
		return false;
	}
	String uploadOid = this.createExcel(context);
	this.setResult(context, uploadOid);
	return false;
}
 
Example #29
Source File: AbortTranscodeCommand.java    From poor-man-transcoder with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean execute(Context context) throws Exception {
	// TODO Auto-generated method stub
	TranscoderContext ctx = (TranscoderContext) context;
	TranscodeSessionPool pool =  ctx.getPool();
	IConnection connnection = Red5.getConnectionLocal();
	
	String signature = (String) connnection.getAttribute(Constants.TRANSCODER_SESSION_ATTR);
	ISession session = pool.getSession(signature);
	session.stop();
	
	return true;
}
 
Example #30
Source File: OrganizationReportExcelCommand.java    From bamboobsc with Apache License 2.0 5 votes vote down vote up
@Override
public boolean execute(Context context) throws Exception {
	if (this.getResult(context)==null || !(this.getResult(context) instanceof BscStructTreeObj) ) {
		return false;
	}
	String uploadOid = this.createExcel(context);
	this.setResult(context, uploadOid);		
	return false;
}