use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.
the class SystemTwitterSaveOrUpdateAction method update.
private void update() throws ControllerException, AuthorityException, ServiceException, Exception {
this.checkFields();
SysTwitterVO oldSysTwitter = new SysTwitterVO();
oldSysTwitter.setOid(this.getFields().get("oid"));
DefaultResult<SysTwitterVO> oldResult = this.sysTwitterService.findObjectByOid(oldSysTwitter);
if (oldResult.getValue() == null) {
throw new ServiceException(oldResult.getSystemMessage().getValue());
}
oldSysTwitter = oldResult.getValue();
SysTwitterVO sysTwitter = new SysTwitterVO();
sysTwitter.setOid(oldSysTwitter.getOid());
sysTwitter.setSystem(oldSysTwitter.getSystem());
sysTwitter.setTitle(this.getFields().get("title"));
sysTwitter.setEnableFlag(("true".equals(this.getFields().get("enableFlag")) ? YesNo.YES : YesNo.NO));
// 先清除之前的blob資料
sysTwitter.setContent(null);
// 先清除之前的blob資料
this.sysTwitterService.updateObject(sysTwitter);
String content = StringEscapeUtils.unescapeEcmaScript(this.getFields().get("content"));
sysTwitter.setContent(content.getBytes());
DefaultResult<SysTwitterVO> result = this.sysTwitterService.updateObject(sysTwitter);
this.message = result.getSystemMessage().getValue();
if (result.getValue() != null) {
this.success = IS_YES;
}
}
use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.
the class BscBaseLogicServiceCommonSupport method findOrganizationDataByUK.
public static OrganizationVO findOrganizationDataByUK(IOrganizationService<OrganizationVO, BbOrganization, String> service, String orgId) throws ServiceException, Exception {
if (StringUtils.isBlank(orgId)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
OrganizationVO organization = new OrganizationVO();
organization.setOrgId(orgId);
DefaultResult<OrganizationVO> orgResult = service.findByUK(organization);
if (orgResult.getValue() == null) {
throw new ServiceException(orgResult.getSystemMessage().getValue());
}
organization = orgResult.getValue();
return organization;
}
use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.
the class ObjectiveLogicServiceImpl method update.
@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<ObjectiveVO> update(ObjectiveVO objective, String perspectiveOid) throws ServiceException, Exception {
if (null == objective || super.isBlank(objective.getOid()) || super.isBlank(perspectiveOid)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
DefaultResult<ObjectiveVO> oldResult = this.objectiveService.findObjectByOid(objective);
if (oldResult.getValue() == null) {
throw new ServiceException(oldResult.getSystemMessage().getValue());
}
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.setObjId(oldResult.getValue().getObjId());
objective.setPerId(perspective.getPerId());
this.setStringValueMaxLength(objective, "description", MAX_DESCRIPTION_LENGTH);
return this.objectiveService.updateObject(objective);
}
use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.
the class OrganizationLogicServiceImpl method updateParent.
@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> updateParent(OrganizationVO organization, String parentOid) throws ServiceException, Exception {
if (organization == null || super.isBlank(organization.getOid()) || super.isBlank(parentOid)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
DefaultResult<Boolean> result = new DefaultResult<Boolean>();
result.setValue(Boolean.FALSE);
result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_FAIL)));
organization = this.findOrganizationData(organization.getOid());
this.deleteParent(organization);
if ("root".equals(parentOid) || "r".equals(parentOid)) {
this.createParent(organization, BscConstants.ORGANIZATION_ZERO_ID);
} else {
OrganizationVO newParOrganization = this.findOrganizationData(parentOid);
// 找當前部門的子部門中的資料, 不因該存在要update的新父部門
if (this.foundChild(organization.getOrgId(), newParOrganization.getOrgId())) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
}
this.createParent(organization, newParOrganization.getOrgId());
}
result.setValue(Boolean.TRUE);
result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_SUCCESS)));
return result;
}
use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.
the class OrganizationLogicServiceImpl method update.
@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<OrganizationVO> update(OrganizationVO organization) throws ServiceException, Exception {
if (organization == null || super.isBlank(organization.getOid())) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
this.checkOrganizationIdIsZero(organization);
OrganizationVO dbOrganization = this.findOrganizationData(organization.getOid());
organization.setOrgId(dbOrganization.getOrgId());
this.setStringValueMaxLength(organization, "description", MAX_DESCRIPTION_LENGTH);
this.handlerLongitudeAndLatitude(organization);
return this.getOrganizationService().updateObject(organization);
}
Aggregations