use of com.netsteadfast.greenstep.bsc.support.ScoreCalculationCallable in project bamboobsc by billchen198318.
the class ScoreCalculationCommand method processKpisScore.
private void processKpisScore(List<VisionVO> visions) throws Exception {
//long beg = System.currentTimeMillis();
for (VisionVO vision : visions) {
for (PerspectiveVO perspective : vision.getPerspectives()) {
for (ObjectiveVO objective : perspective.getObjectives()) {
// 2015-04-11 add
ExecutorService kpiCalculationPool = Executors.newFixedThreadPool(SimpleUtils.getAvailableProcessors(objective.getKpis().size()));
for (KpiVO kpi : objective.getKpis()) {
/* 2015-04-11 rem
float score = this.calculationMeasureData(kpi);
kpi.setScore(score);
kpi.setBgColor( BscScoreColorUtils.getBackgroundColor(score) );
kpi.setFontColor( BscScoreColorUtils.getFontColor(score) );
*/
// 2015-04-11 add
ScoreCalculationCallableData data = new ScoreCalculationCallableData();
data.setDefaultMode(true);
data.setKpi(kpi);
data = kpiCalculationPool.submit(new ScoreCalculationCallable(data)).get();
}
kpiCalculationPool.shutdown();
}
}
}
//long end = System.currentTimeMillis();
//System.out.println( this.getClass().getName() + " use time(MS) = " + (end-beg) );
}
use of com.netsteadfast.greenstep.bsc.support.ScoreCalculationCallable in project bamboobsc by billchen198318.
the class KpiDateRangeScoreCommand method execute.
/*
private static final String QUARTER_1 = "Q1";
private static final String QUARTER_2 = "Q2";
private static final String QUARTER_3 = "Q3";
private static final String QUARTER_4 = "Q4";
private static final String HALF_YEAR_FIRST = "first";
private static final String HALF_YEAR_LAST = "last";
*/
@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 frequency = (String) context.get("frequency");
String startYearDate = StringUtils.defaultString((String) context.get("startYearDate")).trim();
String endYearDate = StringUtils.defaultString((String) context.get("endYearDate")).trim();
String startDate = StringUtils.defaultString((String) context.get("startDate")).trim();
String endDate = StringUtils.defaultString((String) context.get("endDate")).trim();
//long beg = System.currentTimeMillis();
for (VisionVO vision : treeObj.getVisions()) {
for (PerspectiveVO perspective : vision.getPerspectives()) {
for (ObjectiveVO objective : perspective.getObjectives()) {
// 2015-04-11 add
ExecutorService kpiCalculationPool = Executors.newFixedThreadPool(SimpleUtils.getAvailableProcessors(objective.getKpis().size()));
for (KpiVO kpi : objective.getKpis()) {
/* 2015-04-11 rem
if (BscMeasureDataFrequency.FREQUENCY_DAY.equals(frequency)
|| BscMeasureDataFrequency.FREQUENCY_WEEK.equals(frequency)
|| BscMeasureDataFrequency.FREQUENCY_MONTH.equals(frequency) ) {
this.fillDateRangeMonth(kpi, frequency, startDate, endDate);
} else {
this.fillDateRangeYear(kpi, frequency, startYearDate, endYearDate);
}
*/
// 2015-04-11 add
ScoreCalculationCallableData data = new ScoreCalculationCallableData();
data.setDefaultMode(false);
data.setKpi(kpi);
data.setFrequency(frequency);
data.setDate1(startYearDate);
data.setDate2(endYearDate);
if (BscMeasureDataFrequency.FREQUENCY_DAY.equals(frequency) || BscMeasureDataFrequency.FREQUENCY_WEEK.equals(frequency) || BscMeasureDataFrequency.FREQUENCY_MONTH.equals(frequency)) {
data.setDate1(startDate);
data.setDate2(endDate);
}
data = kpiCalculationPool.submit(new ScoreCalculationCallable(data)).get();
}
kpiCalculationPool.shutdown();
}
}
}
//System.out.println( this.getClass().getName() + " use time(MS) = " + (end-beg) );
return false;
}
Aggregations