use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.
the class ReportRoleViewLogicServiceImpl method findForOrganization.
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Override
public List<BbOrganization> findForOrganization(String accountId) throws ServiceException, Exception {
if (super.isBlank(accountId)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
List<BbOrganization> searchList = new ArrayList<BbOrganization>();
List<TbUserRole> roles = this.getUserRoles(accountId);
for (int i = 0; roles != null && i < roles.size(); i++) {
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("role", roles.get(i).getRole());
paramMap.put("type", ReportRoleViewTypes.IS_ORGANIZATION);
List<BbReportRoleView> views = this.reportRoleViewService.findListByParams(paramMap);
for (int j = 0; views != null && j < views.size(); j++) {
BbOrganization organization = new BbOrganization();
organization.setOrgId(views.get(j).getIdName());
organization = this.getOrganizationService().findByEntityUK(organization);
if (organization == null) {
continue;
}
boolean isFound = false;
for (BbOrganization entity : searchList) {
if (entity.getOid().equals(organization.getOid())) {
isFound = true;
}
}
if (!isFound) {
searchList.add(organization);
}
}
}
return searchList;
}
use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.
the class ReportRoleViewLogicServiceImpl method findForOrganizationMap.
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Override
public Map<String, String> findForOrganizationMap(boolean pleaseSelect, String accountId) throws ServiceException, Exception {
if (super.isBlank(accountId)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
Map<String, String> dataMap = new LinkedHashMap<String, String>();
if (pleaseSelect) {
dataMap.put(Constants.HTML_SELECT_NO_SELECT_ID, Constants.HTML_SELECT_NO_SELECT_NAME);
}
/*
List<TbUserRole> roles = this.getUserRoles(accountId);
for (int i=0; roles!=null && i<roles.size(); i++) {
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("role", roles.get(i).getRole());
paramMap.put("type", ReportRoleViewTypes.IS_ORGANIZATION);
List<BbReportRoleView> views = this.reportRoleViewService.findListByParams(paramMap);
for (int j=0; views!=null && j<views.size(); j++) {
BbOrganization organization = new BbOrganization();
organization.setOrgId(views.get(j).getIdName());
organization = this.organizationService.findByEntityUK(organization);
if ( organization == null ) {
continue;
}
if ( dataMap.get(organization.getOid()) != null ) {
continue;
}
dataMap.put(organization.getOid(), organization.getName());
}
}
*/
List<BbOrganization> organizations = this.findForOrganization(accountId);
for (BbOrganization entity : organizations) {
if (dataMap.get(entity.getOid()) != null) {
continue;
}
dataMap.put(entity.getOid(), entity.getName());
}
return dataMap;
}
use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.
the class KpiLogicServiceImpl method createKpiAttachment.
private void createKpiAttachment(KpiVO kpi, List<String> attachment) throws ServiceException, Exception {
if (kpi == null || attachment == null || attachment.size() < 1) {
return;
}
for (String uploadOid : attachment) {
SysUploadVO upload = this.findUploadDataForNoByteContent(uploadOid);
if (!(upload.getSystem().equals(Constants.getSystem()) && upload.getType().equals(UploadTypes.IS_TEMP))) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
}
KpiAttacVO attac = new KpiAttacVO();
attac.setKpiId(kpi.getId());
attac.setUploadOid(uploadOid);
attac.setViewMode(UploadSupportUtils.getViewMode(upload.getShowName()));
DefaultResult<KpiAttacVO> result = this.kpiAttacService.saveObject(attac);
if (result.getValue() == null) {
throw new ServiceException(result.getSystemMessage().getValue());
}
//this.sysUploadService.updateTypeOnly(uploadOid, UploadTypes.IS_KPI_DOCUMENT);
UploadSupportUtils.updateType(uploadOid, UploadTypes.IS_KPI_DOCUMENT);
}
}
use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.
the class MeasureDataLogicServiceImpl method saveOrUpdate.
@ServiceMethodAuthority(type = { ServiceMethodType.INSERT, ServiceMethodType.UPDATE, ServiceMethodType.DELETE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> saveOrUpdate(String kpiOid, String date, String frequency, String dataFor, String organizationId, String employeeId, List<MeasureDataVO> measureDatas) throws ServiceException, Exception {
if (super.isBlank(kpiOid) || super.isBlank(date) || super.isBlank(frequency) || super.isBlank(dataFor) || super.isBlank(organizationId) || super.isBlank(employeeId)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
KpiVO kpi = new KpiVO();
kpi.setOid(kpiOid);
DefaultResult<KpiVO> kResult = this.kpiService.findObjectByOid(kpi);
if (kResult.getValue() == null) {
throw new ServiceException(kResult.getSystemMessage().getValue());
}
kpi = kResult.getValue();
this.getOrganizationId(organizationId);
this.getEmployeeId(employeeId);
if (BscConstants.MEASURE_DATA_FOR_ORGANIZATION.equals(dataFor) && BscConstants.MEASURE_DATA_ORGANIZATION_FULL.equals(organizationId)) {
throw new ServiceException("organization is required!");
}
if (BscConstants.MEASURE_DATA_FOR_EMPLOYEE.equals(dataFor) && BscConstants.MEASURE_DATA_EMPLOYEE_FULL.equals(employeeId)) {
throw new ServiceException("employee is required!");
}
this.fillMeasureDatas(kpi, organizationId, employeeId, measureDatas);
DefaultResult<Boolean> result = new DefaultResult<Boolean>();
result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_FAIL)));
result.setValue(Boolean.FALSE);
this.delete(kpi, date, frequency, organizationId, employeeId);
for (MeasureDataVO measureData : measureDatas) {
this.measureDataService.saveObject(measureData);
}
result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_SUCCESS)));
result.setValue(Boolean.TRUE);
return result;
}
use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.
the class ObjectiveLogicServiceImpl method create.
@ServiceMethodAuthority(type = { ServiceMethodType.INSERT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<ObjectiveVO> create(ObjectiveVO objective, String perspectiveOid) throws ServiceException, Exception {
if (null == objective || super.isBlank(perspectiveOid)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
PerspectiveVO perspective = new PerspectiveVO();
perspective.setOid(perspectiveOid);
DefaultResult<PerspectiveVO> pResult = this.perspectiveService.findObjectByOid(perspective);
if (pResult.getValue() == null) {
throw new ServiceException(pResult.getSystemMessage().getValue());
}
perspective = pResult.getValue();
objective.setPerId(perspective.getPerId());
if (!SimpleUtils.checkBeTrueOf_azAZ09(4, 14, objective.getObjId())) {
// for import-mode from csv file OBJ_ID is old(before id).
objective.setObjId(this.findForMaxObjId(SimpleUtils.getStrYMD("")));
}
this.setStringValueMaxLength(objective, "description", MAX_DESCRIPTION_LENGTH);
return this.objectiveService.saveObject(objective);
}
Aggregations