protected void doSetCurrentCalcPeriod(Integer calcPeriodId) { CalcPeriod calcPeriod = ServerUtils.getPersistentManager().find(CalcPeriod.class, calcPeriodId); if (calcPeriod.getStaffList() == null) throw new BusinessException( Messages.getInstance().getMessage(Messages.NOT_CHOOSE_STAFFLIST_BY_SEARCHED_CALCPERIOD)); UIProfile profile = UIProfileManagerLocator.locate().load(CalcPeriodServiceLocal.PROFILE_NAME); profile.setProperty(CalcPeriodServiceLocal.PROFILE_PROPERTY, calcPeriodId); UIProfileManagerLocator.locate().store(profile); }
protected CalcPeriod doGetCurrentCalcPeriod() { int currentCalcPeriodId = UIProfileManagerLocator.locate() .load(CalcPeriodServiceLocal.PROFILE_NAME) .getProperty(CalcPeriodServiceLocal.PROFILE_PROPERTY, 0); CalcPeriod calcPeriod = ServerUtils.getPersistentManager().find(CalcPeriod.class, currentCalcPeriodId); if (calcPeriod == null) throw new BusinessException( Messages.getInstance().getMessage(Messages.CURRENT_CALC_PERIOD_IS_NOT_SET)); else return calcPeriod; }
/** * сохранение параметров отчета * * @param report */ private void saveParamsValue(RptMain report) { try { UIProfile profile = getReportUIProfile(report); for (Map.Entry<String, ReportParameter> entry : reportParams.entrySet()) { // не сохраняем системные параметры if (!entry.getKey().startsWith("__")) profile.setProperty(entry.getKey(), DataUtils.valueToString(entry.getValue().getValue())); } UIProfileManagerLocator.locate().store(profile); } catch (Exception e) { log.error("Cann't save report parameters, report code: " + report.getCode(), e); } }
private UIProfile getReportUIProfile(RptMain report) { return UIProfileManagerLocator.locate().load("com.mg.merp.report.params." + report.getCode()); }