@Override public SRole updateRole(final SRole role, final EntityUpdateDescriptor descriptor, EntityUpdateDescriptor iconUpdater) throws SIdentityException { final String methodName = "updateRole"; final SRoleLogBuilder logBuilder = getRoleLog(ActionType.UPDATED, "Updating the role with name " + role.getName()); try { if (iconUpdater != null && iconUpdater.getFields().containsKey("content")) { updateIcon(descriptor, iconUpdater, role); } recorder.recordUpdate(UpdateRecord.buildSetFields(role, descriptor), ROLE); log(role.getId(), SQueriableLog.STATUS_FAIL, logBuilder, methodName); } catch (final SRecorderException | SBonitaReadException e) { log(role.getId(), SQueriableLog.STATUS_FAIL, logBuilder, methodName); throw new SIdentityException("Can't update role " + role, e); } return role; }
@Override public SRole updateRole(final SRole role, final EntityUpdateDescriptor descriptor, EntityUpdateDescriptor iconUpdater) throws SIdentityException { final String methodName = "updateRole"; final SRoleLogBuilder logBuilder = getRoleLog(ActionType.UPDATED, "Updating the role with name " + role.getName()); try { if (iconUpdater != null && iconUpdater.getFields().containsKey("content")) { updateIcon(descriptor, iconUpdater, role); } recorder.recordUpdate(UpdateRecord.buildSetFields(role, descriptor), ROLE); log(role.getId(), SQueriableLog.STATUS_FAIL, logBuilder, methodName); } catch (final SRecorderException | SBonitaReadException e) { log(role.getId(), SQueriableLog.STATUS_FAIL, logBuilder, methodName); throw new SIdentityException("Can't update role " + role, e); } return role; }
@Override public void deleteRole(final SRole role) throws SRoleDeletionException { final String methodName = "deleteRole"; final SRoleLogBuilder logBuilder = getRoleLog(ActionType.DELETED, "Deleting role with name " + role.getName()); try { if (role.getIconId() != null) { deleteIcon(role.getIconId()); } recorder.recordDelete(new DeleteRecord(role), ROLE); log(role.getId(), SQueriableLog.STATUS_OK, logBuilder, methodName); } catch (final SRecorderException | SBonitaReadException re) { log(role.getId(), SQueriableLog.STATUS_FAIL, logBuilder, methodName); throw new SRoleDeletionException(re); } }
@Override public void deleteRole(final SRole role) throws SRoleDeletionException { final String methodName = "deleteRole"; final SRoleLogBuilder logBuilder = getRoleLog(ActionType.DELETED, "Deleting role with name " + role.getName()); try { if (role.getIconId() != null) { deleteIcon(role.getIconId()); } recorder.recordDelete(new DeleteRecord(role), ROLE); log(role.getId(), SQueriableLog.STATUS_OK, logBuilder, methodName); } catch (final SRecorderException | SBonitaReadException re) { log(role.getId(), SQueriableLog.STATUS_FAIL, logBuilder, methodName); throw new SRoleDeletionException(re); } }
@Override public void createRole(final SRole role, String iconFilename, byte[] iconContent) throws SIdentityException { final String methodName = "createRole"; final SRoleLogBuilder logBuilder = getRoleLog(ActionType.CREATED, "Adding a new role with name " + role.getName()); try { if (iconFilename != null && iconContent != null) { SIcon icon = createIcon(iconFilename, iconContent); (((SRoleImpl) role)).setIconId(icon.getId()); } recorder.recordInsert(new InsertRecord(role), ROLE); log(role.getId(), SQueriableLog.STATUS_OK, logBuilder, methodName); } catch (final SRecorderException e) { log(role.getId(), SQueriableLog.STATUS_FAIL, logBuilder, methodName); throw new SIdentityException("Can't add role " + role, e); } }
@Override public void createRole(final SRole role, String iconFilename, byte[] iconContent) throws SIdentityException { final String methodName = "createRole"; final SRoleLogBuilder logBuilder = getRoleLog(ActionType.CREATED, "Adding a new role with name " + role.getName()); try { if (iconFilename != null && iconContent != null) { SIcon icon = createIcon(iconFilename, iconContent); (((SRoleImpl) role)).setIconId(icon.getId()); } recorder.recordInsert(new InsertRecord(role), ROLE); log(role.getId(), SQueriableLog.STATUS_OK, logBuilder, methodName); } catch (final SRecorderException e) { log(role.getId(), SQueriableLog.STATUS_FAIL, logBuilder, methodName); throw new SIdentityException("Can't add role " + role, e); } }