|
|
@@ -407,451 +407,6 @@ public class Business {
|
|
|
return file;
|
|
|
}
|
|
|
|
|
|
- // public Control getControlOfWorkComplex(EffectivePerson effectivePerson,
|
|
|
- // Work work) throws Exception {
|
|
|
- // Control control = new Control();
|
|
|
- // Activity activity = this.getActivity(work);
|
|
|
- // List<Task> taskList = task().listWithWorkObject(work);
|
|
|
- // Task task = null;
|
|
|
- // for (int i = 0; i < taskList.size(); i++) {
|
|
|
- // Task o = taskList.get(i);
|
|
|
- // if (StringUtils.equals(o.getPerson(),
|
|
|
- // effectivePerson.getDistinguishedName())) {
|
|
|
- // task = o;
|
|
|
- // break;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // List<Read> readList = read().listWithWorkObject(work);
|
|
|
- // Read read = null;
|
|
|
- // for (int i = 0; i < readList.size(); i++) {
|
|
|
- // Read o = readList.get(i);
|
|
|
- // if (StringUtils.equals(o.getPerson(),
|
|
|
- // effectivePerson.getDistinguishedName())) {
|
|
|
- // read = o;
|
|
|
- // break;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // Application application = application().pick(work.getApplication());
|
|
|
- // Process process = process().pick(work.getProcess());
|
|
|
- // Long taskCompletedCount =
|
|
|
- // taskCompleted().countWithPersonWithWork(effectivePerson.getDistinguishedName(),
|
|
|
- // work);
|
|
|
- // Long readCompletedCount =
|
|
|
- // readCompleted().countWithPersonWithWork(effectivePerson.getDistinguishedName(),
|
|
|
- // work);
|
|
|
- // Long reviewCount =
|
|
|
- // review().countWithPersonWithWork(effectivePerson.getDistinguishedName(),
|
|
|
- // work);
|
|
|
- // /* 工作是否可以打开(管理员 或 有task,taskCompleted,read,readCompleted,review的人) */
|
|
|
- // control.setAllowVisit(false);
|
|
|
- // /* 工作是否可以流转(有task的人) */
|
|
|
- // control.setAllowProcessing(false);
|
|
|
- // /* 工作是否可以处理待阅(有read的人) */
|
|
|
- // control.setAllowReadProcessing(false);
|
|
|
- // /* 工作是否可保存(管理员 或者 有本人的task) */
|
|
|
- // control.setAllowSave(false);
|
|
|
- // /* 工作是否可重置(有本人待办 并且 活动设置允许重置 */
|
|
|
- // control.setAllowReset(false);
|
|
|
- // /* 工作是否可以撤回(当前人是上一个处理人 并且 还没有其他人处理过) */
|
|
|
- // control.setAllowRetract(false);
|
|
|
- // /* 工作是否可调度(管理员 并且 此活动在流程设计中允许调度) */
|
|
|
- // control.setAllowReroute(false);
|
|
|
- // /* 工作是否可删除(管理员 或者 此活动在流程设计中允许删除且当前待办人是文件的创建者) */
|
|
|
- // control.setAllowDelete(false);
|
|
|
- // /* 设置allowVisit */
|
|
|
- // if ((null != task) || (null != read) || (taskCompletedCount > 0) ||
|
|
|
- // (readCompletedCount > 0)
|
|
|
- // || (reviewCount > 0)) {
|
|
|
- // control.setAllowVisit(true);
|
|
|
- // } else if (effectivePerson.isUser(work.getCreatorPerson())) {
|
|
|
- // control.setAllowVisit(true);
|
|
|
- // } else if (this.canManageApplicationOrProcess(effectivePerson,
|
|
|
- // application, process)) {
|
|
|
- // control.setAllowVisit(true);
|
|
|
- // }
|
|
|
- // /* 设置allowProcessing */
|
|
|
- // if (null != task) {
|
|
|
- // control.setAllowProcessing(true);
|
|
|
- // }
|
|
|
- // /* 设置allowReadProcessing */
|
|
|
- // if (null != read) {
|
|
|
- // control.setAllowReadProcessing(true);
|
|
|
- // }
|
|
|
- // /* 设置 allowSave */
|
|
|
- // if (null != task) {
|
|
|
- // control.setAllowSave(true);
|
|
|
- // } else if (this.canManageApplicationOrProcess(effectivePerson,
|
|
|
- // application, process)) {
|
|
|
- // control.setAllowSave(true);
|
|
|
- // }
|
|
|
- // /* 设置 allowReset */
|
|
|
- // if (Objects.equals(activity.getActivityType(), ActivityType.manual)
|
|
|
- // && BooleanUtils.isTrue(((Manual) activity).getAllowReset()) && null !=
|
|
|
- // task) {
|
|
|
- // control.setAllowReset(true);
|
|
|
- // }
|
|
|
- // /* 设置 allowRetract */
|
|
|
- // if (Objects.equals(activity.getActivityType(), ActivityType.manual)
|
|
|
- // && BooleanUtils.isTrue(((Manual) activity).getAllowRetract())) {
|
|
|
- // /* 标志文件还没有处理过 */
|
|
|
- // if (0 ==
|
|
|
- // taskCompleted().countWithPersonWithActivityToken(effectivePerson.getDistinguishedName(),
|
|
|
- // work.getActivityToken())) {
|
|
|
- // /* 找到到达当前活动的workLog */
|
|
|
- // WorkLog workLog =
|
|
|
- // workLog().getWithArrivedActivityTokenObject(work.getActivityToken());
|
|
|
- // if (null != workLog) {
|
|
|
- // /* 查找上一个环节的已办,如果只有一个,且正好是当前人的,那么可以召回 */
|
|
|
- // List<TaskCompleted> taskCompletedList = taskCompleted()
|
|
|
- // .listWithActivityTokenObject(workLog.getFromActivityToken());
|
|
|
- // if (taskCompletedList.size() == 1 &&
|
|
|
- // StringUtils.equals(effectivePerson.getDistinguishedName(),
|
|
|
- // taskCompletedList.get(0).getPerson())) {
|
|
|
- // control.setAllowRetract(true);
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // /* 设置 allowReroute */
|
|
|
- // if (effectivePerson.isManager()) {
|
|
|
- // /** 管理员可以调度 */
|
|
|
- // control.setAllowReroute(true);
|
|
|
- // } else if (organization().person().hasRole(effectivePerson,
|
|
|
- // RoleDefinition.ProcessPlatformManager)) {
|
|
|
- // /** 有流程管理角色的可以 */
|
|
|
- // control.setAllowReroute(true);
|
|
|
- // } else if (BooleanUtils.isTrue(activity.getAllowReroute())) {
|
|
|
- // /** 如果活动设置了可以调度 */
|
|
|
- // if ((null != process) &&
|
|
|
- // effectivePerson.isUser(process.getControllerList())) {
|
|
|
- // /** 如果是流程的管理员那么可以调度 */
|
|
|
- // control.setAllowReroute(true);
|
|
|
- // } else if ((null != application) &&
|
|
|
- // effectivePerson.isUser(application.getControllerList())) {
|
|
|
- // /** 如果是应用的管理员那么可以调度 */
|
|
|
- // control.setAllowReroute(true);
|
|
|
- // }
|
|
|
- // }
|
|
|
- // /* 设置 allowDelete */
|
|
|
- // if (this.canManageApplicationOrProcess(effectivePerson, application,
|
|
|
- // process)) {
|
|
|
- // control.setAllowDelete(true);
|
|
|
- // } else if (Objects.equals(activity.getActivityType(),
|
|
|
- // ActivityType.manual)
|
|
|
- // && BooleanUtils.isTrue(((Manual) activity).getAllowDeleteWork())) {
|
|
|
- // if (null != task && StringUtils.equals(work.getCreatorPerson(),
|
|
|
- // effectivePerson.getDistinguishedName())) {
|
|
|
- // control.setAllowDelete(true);
|
|
|
- // }
|
|
|
- // }
|
|
|
- // return control;
|
|
|
- // }
|
|
|
- //
|
|
|
- // /* 列表中简式权限 */
|
|
|
- // public Control geatControlOfWorkList(EffectivePerson effectivePerson,
|
|
|
- // Work work) throws Exception {
|
|
|
- // Control control = new Control();
|
|
|
- // /* 工作是否可以打开 */
|
|
|
- // control.setAllowVisit(false);
|
|
|
- // /* 工作是否可以直接流转work(是管理员,并且没有任何task) */
|
|
|
- // control.setAllowProcessing(false);
|
|
|
- // /* 是否可调度(管理员 并且 此活动在流程设计中允许调度) */
|
|
|
- // control.setAllowReroute(false);
|
|
|
- // /* 是否可删除(管理员 或者(此活动在流程设计中允许删除 并且 拟稿人是待办人)) */
|
|
|
- // control.setAllowDelete(false);
|
|
|
- // /* 活动节点可能为空 */
|
|
|
- // Activity activity = this.getActivity(work);
|
|
|
- // List<Task> taskList = task().listWithWorkObject(work);
|
|
|
- // Task task = null;
|
|
|
- // for (int i = 0; i < taskList.size(); i++) {
|
|
|
- // Task o = taskList.get(i);
|
|
|
- // if (StringUtils.equals(o.getPerson(),
|
|
|
- // effectivePerson.getDistinguishedName())) {
|
|
|
- // task = o;
|
|
|
- // break;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // List<Read> readList = read().listWithWorkObject(work);
|
|
|
- // Read read = null;
|
|
|
- // for (int i = 0; i < readList.size(); i++) {
|
|
|
- // Read o = readList.get(i);
|
|
|
- // if (StringUtils.equals(o.getPerson(),
|
|
|
- // effectivePerson.getDistinguishedName())) {
|
|
|
- // read = o;
|
|
|
- // break;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // Application application = application().pick(work.getApplication());
|
|
|
- // Process process = process().pick(work.getProcess());
|
|
|
- // Long taskCompletedCount =
|
|
|
- // taskCompleted().countWithPersonWithWork(effectivePerson.getDistinguishedName(),
|
|
|
- // work);
|
|
|
- // Long readCompletedCount =
|
|
|
- // readCompleted().countWithPersonWithWork(effectivePerson.getDistinguishedName(),
|
|
|
- // work);
|
|
|
- // Long reviewCount =
|
|
|
- // review().countWithPersonWithWork(effectivePerson.getDistinguishedName(),
|
|
|
- // work);
|
|
|
- // /* 设置 allowVisit */
|
|
|
- // if ((null != task) || (null != read) || (taskCompletedCount > 0) ||
|
|
|
- // (readCompletedCount > 0)
|
|
|
- // || (reviewCount > 0) ||
|
|
|
- // this.canManageApplicationOrProcess(effectivePerson, application, process)
|
|
|
- // || effectivePerson.isUser(work.getCreatorPerson())) {
|
|
|
- // control.setAllowVisit(true);
|
|
|
- // }
|
|
|
- // /* 设置 allowProcessing */
|
|
|
- // if (this.canManageApplicationOrProcess(effectivePerson, application,
|
|
|
- // process)) {
|
|
|
- // if (ListTools.isEmpty(taskList)) {
|
|
|
- // control.setAllowProcessing(true);
|
|
|
- // }
|
|
|
- // }
|
|
|
- // /* 设置 allowReroute */
|
|
|
- // if (effectivePerson.isManager()) {
|
|
|
- // /** 管理员可以调度 */
|
|
|
- // control.setAllowReroute(true);
|
|
|
- // } else if (organization().person().hasRole(effectivePerson,
|
|
|
- // RoleDefinition.ProcessPlatformManager)) {
|
|
|
- // /** 有流程管理角色的可以 */
|
|
|
- // control.setAllowReroute(true);
|
|
|
- // } else if (BooleanUtils.isTrue(activity.getAllowReroute())) {
|
|
|
- // /** 如果活动设置了可以调度 */
|
|
|
- // if ((null != process) &&
|
|
|
- // effectivePerson.isUser(process.getControllerList())) {
|
|
|
- // /** 如果是流程的管理员那么可以调度 */
|
|
|
- // control.setAllowReroute(true);
|
|
|
- // } else if ((null != application) &&
|
|
|
- // effectivePerson.isUser(application.getControllerList())) {
|
|
|
- // /** 如果是应用的管理员那么可以调度 */
|
|
|
- // control.setAllowReroute(true);
|
|
|
- // }
|
|
|
- // }
|
|
|
- // /* 设置 allowDelete */
|
|
|
- // if (this.canManageApplicationOrProcess(effectivePerson, application,
|
|
|
- // process)) {
|
|
|
- // control.setAllowDelete(true);
|
|
|
- // } else if ((null != activity) &&
|
|
|
- // Objects.equals(activity.getActivityType(), ActivityType.manual)
|
|
|
- // && BooleanUtils.isTrue(((Manual) activity).getAllowDeleteWork())) {
|
|
|
- // if (null != task && StringUtils.equals(work.getCreatorPerson(),
|
|
|
- // effectivePerson.getDistinguishedName())) {
|
|
|
- // control.setAllowDelete(true);
|
|
|
- // }
|
|
|
- // }
|
|
|
- // return control;
|
|
|
- // }
|
|
|
-
|
|
|
- // public Control getControlOfTask(EffectivePerson effectivePerson, Task
|
|
|
- // task) throws Exception {
|
|
|
- // Control control = new Control();
|
|
|
- // /* 是否可以直接流转(管理员),正常处理必须到complex界面. */
|
|
|
- // control.setAllowProcessing(false);
|
|
|
- // /* 是否可以重置处理人(管理员 或(本人待办并且活动设置允许重置)) */
|
|
|
- // control.setAllowReset(false);
|
|
|
- // /* 是否可删除(管理员) */
|
|
|
- // control.setAllowDelete(false);
|
|
|
- // Activity activity = this.getActivity(task.getActivity(),
|
|
|
- // task.getActivityType());
|
|
|
- // Application application = application().pick(task.getApplication());
|
|
|
- // Process process = process().pick(task.getProcess());
|
|
|
- // /* 设置allowProcessing */
|
|
|
- // if (this.canManageApplicationOrProcess(effectivePerson, application,
|
|
|
- // process)) {
|
|
|
- // control.setAllowProcessing(true);
|
|
|
- // }
|
|
|
- // /* 设置 allowReset */
|
|
|
- // if (this.canManageApplicationOrProcess(effectivePerson, application,
|
|
|
- // process)) {
|
|
|
- // control.setAllowReset(true);
|
|
|
- // } else if (effectivePerson.isUser(task.getPerson())) {
|
|
|
- // if (Objects.equals(activity.getActivityType(), ActivityType.manual)
|
|
|
- // && BooleanUtils.isTrue(((Manual) activity).getAllowReset()) && null !=
|
|
|
- // task) {
|
|
|
- // control.setAllowReset(true);
|
|
|
- // }
|
|
|
- // }
|
|
|
- // /* 设置 allowDelete */
|
|
|
- // if (this.canManageApplicationOrProcess(effectivePerson, application,
|
|
|
- // process)) {
|
|
|
- // control.setAllowDelete(true);
|
|
|
- // }
|
|
|
- // return control;
|
|
|
- // }
|
|
|
-
|
|
|
- // public Control getControlOfTaskCompleted(EffectivePerson effectivePerson,
|
|
|
- // TaskCompleted taskCompleted)
|
|
|
- // throws Exception {
|
|
|
- // Control control = new Control();
|
|
|
- // /* 是否可删除(管理员) */
|
|
|
- // control.setAllowDelete(false);
|
|
|
- // Application application =
|
|
|
- // application().pick(taskCompleted.getApplication());
|
|
|
- // Process process = process().pick(taskCompleted.getProcess());
|
|
|
- // /* 设置 allowDelete */
|
|
|
- // if (this.canManageApplicationOrProcess(effectivePerson, application,
|
|
|
- // process)) {
|
|
|
- // control.setAllowDelete(true);
|
|
|
- // }
|
|
|
- // return control;
|
|
|
- // }
|
|
|
-
|
|
|
- // public Control getControlOfRead(EffectivePerson effectivePerson, Read
|
|
|
- // read) throws Exception {
|
|
|
- // Control control = new Control();
|
|
|
- // /* 是否允许标志为已阅(管理员 或 待阅人本人) */
|
|
|
- // control.setAllowProcessing(false);
|
|
|
- // /* 是否允许重置待阅的处理人,只有管理员可以 */
|
|
|
- // control.setAllowReadReset(false);
|
|
|
- // /* 是否可删除(管理员) */
|
|
|
- // control.setAllowDelete(false);
|
|
|
- // Application application = application().pick(read.getApplication());
|
|
|
- // Process process = process().pick(read.getProcess());
|
|
|
- // /* 设置allowProcessing */
|
|
|
- // if (this.canManageApplicationOrProcess(effectivePerson, application,
|
|
|
- // process)) {
|
|
|
- // control.setAllowProcessing(true);
|
|
|
- // } else if (effectivePerson.isUser(read.getPerson())) {
|
|
|
- // control.setAllowProcessing(true);
|
|
|
- // }
|
|
|
- // /* 设置 allowReadReset */
|
|
|
- // if (this.canManageApplicationOrProcess(effectivePerson, application,
|
|
|
- // process)) {
|
|
|
- // control.setAllowReadReset(true);
|
|
|
- // }
|
|
|
- // /* 设置 allowDelete */
|
|
|
- // if (this.canManageApplicationOrProcess(effectivePerson, application,
|
|
|
- // process)) {
|
|
|
- // control.setAllowDelete(true);
|
|
|
- // }
|
|
|
- // return control;
|
|
|
- //
|
|
|
- // }
|
|
|
-
|
|
|
- // public Control getControlOfReadCompleted(EffectivePerson effectivePerson,
|
|
|
- // ReadCompleted readCompleted)
|
|
|
- // throws Exception {
|
|
|
- // Control control = new Control();
|
|
|
- // // 是否可删除(管理员)
|
|
|
- // control.setAllowDelete(false);
|
|
|
- // Application application =
|
|
|
- // application().pick(readCompleted.getApplication());
|
|
|
- // Process process = process().pick(readCompleted.getProcess());
|
|
|
- // /* 设置 allowDelete */
|
|
|
- // if (this.canManageApplicationOrProcess(effectivePerson, application,
|
|
|
- // process)) {
|
|
|
- // control.setAllowDelete(true);
|
|
|
- // }
|
|
|
- // return control;
|
|
|
- // }
|
|
|
-
|
|
|
- // public Control getControlOfReview(EffectivePerson effectivePerson, Review
|
|
|
- // review) throws Exception {
|
|
|
- // Control control = new Control();
|
|
|
- // // 是否可删除(管理员)
|
|
|
- // control.setAllowDelete(false);
|
|
|
- // Application application = application().pick(review.getApplication());
|
|
|
- // Process process = process().pick(review.getProcess());
|
|
|
- // /* 设置 allowDelete */
|
|
|
- // if (this.canManageApplicationOrProcess(effectivePerson, application,
|
|
|
- // process)) {
|
|
|
- // control.setAllowDelete(true);
|
|
|
- // }
|
|
|
- // return control;
|
|
|
- // }
|
|
|
-
|
|
|
- // public Control getControlOfWorkCompleted(EffectivePerson effectivePerson,
|
|
|
- // WorkCompleted workCompleted)
|
|
|
- // throws Exception {
|
|
|
- // Control control = new Control();
|
|
|
- // /* 完成工作是否可见:管理员或者有taskCompleted,或者有read,或者有readCompleted或者有review */
|
|
|
- // control.setAllowVisit(false);
|
|
|
- // /* 完成工作是否有待阅需要处理:当前人是否有待阅 */
|
|
|
- // control.setAllowReadProcessing(false);
|
|
|
- // /* 完成工作是否可以删除:管理员 */
|
|
|
- // control.setAllowDelete(false);
|
|
|
- // Application application =
|
|
|
- // application().pick(workCompleted.getApplication());
|
|
|
- // Process process = process().pick(workCompleted.getProcess());
|
|
|
- // /* 设置 allowViist */
|
|
|
- // if (this.canManageApplicationOrProcess(effectivePerson, application,
|
|
|
- // process)) {
|
|
|
- // control.setAllowVisit(true);
|
|
|
- // } else if (effectivePerson.isUser(workCompleted.getCreatorPerson())) {
|
|
|
- // control.setAllowVisit(true);
|
|
|
- // } else if
|
|
|
- // (taskCompleted().countWithPersonWithWorkCompleted(effectivePerson.getDistinguishedName(),
|
|
|
- // workCompleted) > 0) {
|
|
|
- // control.setAllowVisit(true);
|
|
|
- // } else if
|
|
|
- // (read().countWithPersonWithWorkCompleted(effectivePerson.getDistinguishedName(),
|
|
|
- // workCompleted) > 0) {
|
|
|
- // control.setAllowVisit(true);
|
|
|
- // } else if
|
|
|
- // (readCompleted().countWithPersonWithWorkCompleted(effectivePerson.getDistinguishedName(),
|
|
|
- // workCompleted) > 0) {
|
|
|
- // control.setAllowVisit(true);
|
|
|
- // } else if
|
|
|
- // (review().countWithPersonWithWorkCompleted(effectivePerson.getDistinguishedName(),
|
|
|
- // workCompleted) > 0) {
|
|
|
- // control.setAllowVisit(true);
|
|
|
- // }
|
|
|
- // /* 设置 allowReadProcessing */
|
|
|
- // if
|
|
|
- // (read().countWithPersonWithWorkCompleted(effectivePerson.getDistinguishedName(),
|
|
|
- // workCompleted) > 0) {
|
|
|
- // control.setAllowReadProcessing(true);
|
|
|
- // }
|
|
|
- // /* 设置 allowDelete */
|
|
|
- // if (this.canManageApplicationOrProcess(effectivePerson, application,
|
|
|
- // process)) {
|
|
|
- // control.setAllowDelete(true);
|
|
|
- // }
|
|
|
- // return control;
|
|
|
- // }
|
|
|
-
|
|
|
- // public Control getControlOfWorkCompletedList(EffectivePerson
|
|
|
- // effectivePerson, WorkCompleted workCompleted)
|
|
|
- // throws Exception {
|
|
|
- // Control control = new Control();
|
|
|
- // /* 完成工作是否可见:管理员或者有taskCompleted,或者有read,或者有readCompleted或者有review */
|
|
|
- // control.setAllowVisit(false);
|
|
|
- // /* 完成工作是否可以删除:管理员 */
|
|
|
- // control.setAllowDelete(false);
|
|
|
- // Application application =
|
|
|
- // application().pick(workCompleted.getApplication());
|
|
|
- // Process process = process().pick(workCompleted.getProcess());
|
|
|
- // /* 设置 allowViist */
|
|
|
- // if (this.canManageApplicationOrProcess(effectivePerson, application,
|
|
|
- // process)) {
|
|
|
- // control.setAllowVisit(true);
|
|
|
- // } else if (effectivePerson.isUser(workCompleted.getCreatorPerson())) {
|
|
|
- // control.setAllowVisit(true);
|
|
|
- // } else if
|
|
|
- // (taskCompleted().countWithPersonWithWorkCompleted(effectivePerson.getDistinguishedName(),
|
|
|
- // workCompleted) > 0) {
|
|
|
- // control.setAllowVisit(true);
|
|
|
- // } else if
|
|
|
- // (read().countWithPersonWithWorkCompleted(effectivePerson.getDistinguishedName(),
|
|
|
- // workCompleted) > 0) {
|
|
|
- // control.setAllowVisit(true);
|
|
|
- // } else if
|
|
|
- // (readCompleted().countWithPersonWithWorkCompleted(effectivePerson.getDistinguishedName(),
|
|
|
- // workCompleted) > 0) {
|
|
|
- // control.setAllowVisit(true);
|
|
|
- // } else if
|
|
|
- // (review().countWithPersonWithWorkCompleted(effectivePerson.getDistinguishedName(),
|
|
|
- // workCompleted) > 0) {
|
|
|
- // control.setAllowVisit(true);
|
|
|
- // }
|
|
|
- // /* 设置 allowDelete */
|
|
|
- // if (this.canManageApplicationOrProcess(effectivePerson, application,
|
|
|
- // process)) {
|
|
|
- // control.setAllowDelete(true);
|
|
|
- // }
|
|
|
- // return control;
|
|
|
- // }
|
|
|
-
|
|
|
public Activity getActivity(Work work) throws Exception {
|
|
|
return this.getActivity(work.getActivity(), work.getActivityType());
|
|
|
}
|
|
|
@@ -923,6 +478,13 @@ public class Business {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ public Boolean canManageApplicationOrProcess(EffectivePerson effectivePerson, String applicationId,
|
|
|
+ String processId) throws Exception {
|
|
|
+ Application application = this.application().pick(applicationId);
|
|
|
+ Process process = this.process().pick(processId);
|
|
|
+ return this.canManageApplicationOrProcess(effectivePerson, application, process);
|
|
|
+ }
|
|
|
+
|
|
|
public Boolean canManageApplicationOrProcess(EffectivePerson effectivePerson, Application application,
|
|
|
Process process) throws Exception {
|
|
|
if (effectivePerson.isManager()) {
|
|
|
@@ -1347,6 +909,212 @@ public class Business {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ public boolean readable(EffectivePerson effectivePerson, Work work) throws Exception {
|
|
|
+ if (null == work) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (effectivePerson.isUser(work.getCreatorPerson())) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if (effectivePerson.isManager()) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if (emc.countEqualAndEqual(TaskCompleted.class, TaskCompleted.person_FIELDNAME,
|
|
|
+ effectivePerson.getDistinguishedName(), TaskCompleted.job_FIELDNAME, work.getJob()) > 0) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if (emc.countEqualAndEqual(ReadCompleted.class, ReadCompleted.person_FIELDNAME,
|
|
|
+ effectivePerson.getDistinguishedName(), ReadCompleted.job_FIELDNAME, work.getJob()) > 0) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if (emc.countEqualAndEqual(Task.class, Task.person_FIELDNAME, effectivePerson.getDistinguishedName(),
|
|
|
+ Task.job_FIELDNAME, work.getJob()) > 0) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if (emc.countEqualAndEqual(Read.class, Read.person_FIELDNAME, effectivePerson.getDistinguishedName(),
|
|
|
+ Read.job_FIELDNAME, work.getJob()) > 0) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if (emc.countEqualAndEqual(Review.class, Review.person_FIELDNAME, effectivePerson.getDistinguishedName(),
|
|
|
+ Review.job_FIELDNAME, work.getJob()) > 0) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if (organization().person().hasRole(effectivePerson, OrganizationDefinition.Manager,
|
|
|
+ OrganizationDefinition.ProcessPlatformManager)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ Application application = this.application().pick(work.getApplication());
|
|
|
+ if (null != application) {
|
|
|
+ if (effectivePerson.isUser(application.getControllerList())) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Process process = this.process().pick(work.getProcess());
|
|
|
+ if (null != process) {
|
|
|
+ if (effectivePerson.isUser(process.getControllerList())) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean readable(EffectivePerson effectivePerson, WorkCompleted workCompleted) throws Exception {
|
|
|
+ if (null == workCompleted) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (effectivePerson.isUser(workCompleted.getCreatorPerson())) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if (effectivePerson.isManager()) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if (emc.countEqualAndEqual(TaskCompleted.class, TaskCompleted.person_FIELDNAME,
|
|
|
+ effectivePerson.getDistinguishedName(), TaskCompleted.job_FIELDNAME, workCompleted.getJob()) > 0) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if (emc.countEqualAndEqual(ReadCompleted.class, ReadCompleted.person_FIELDNAME,
|
|
|
+ effectivePerson.getDistinguishedName(), ReadCompleted.job_FIELDNAME, workCompleted.getJob()) > 0) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if (emc.countEqualAndEqual(Read.class, Read.person_FIELDNAME, effectivePerson.getDistinguishedName(),
|
|
|
+ Read.job_FIELDNAME, workCompleted.getJob()) > 0) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if (emc.countEqualAndEqual(Review.class, Review.person_FIELDNAME, effectivePerson.getDistinguishedName(),
|
|
|
+ Review.job_FIELDNAME, workCompleted.getJob()) > 0) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if (organization().person().hasRole(effectivePerson, OrganizationDefinition.Manager,
|
|
|
+ OrganizationDefinition.ProcessPlatformManager)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ Application application = this.application().pick(workCompleted.getApplication());
|
|
|
+ if (null != application) {
|
|
|
+ if (effectivePerson.isUser(application.getControllerList())) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Process process = this.process().pick(workCompleted.getProcess());
|
|
|
+ if (null != process) {
|
|
|
+ if (effectivePerson.isUser(process.getControllerList())) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean readableWithWorkOrWorkCompleted(EffectivePerson effectivePerson, String workOrWorkCompleted)
|
|
|
+ throws Exception {
|
|
|
+ Work work = emc.fetch(workOrWorkCompleted, Work.class, ListTools.toList(Work.job_FIELDNAME,
|
|
|
+ Work.application_FIELDNAME, Work.process_FIELDNAME, Work.creatorPerson_FIELDNAME));
|
|
|
+ WorkCompleted workCompleted = null;
|
|
|
+ String job = null;
|
|
|
+ String creatorPerson = null;
|
|
|
+ String applicationId = null;
|
|
|
+ String processId = null;
|
|
|
+ if (null == work) {
|
|
|
+ workCompleted = emc.fetch(workOrWorkCompleted, WorkCompleted.class, ListTools.toList(Work.job_FIELDNAME,
|
|
|
+ Work.application_FIELDNAME, Work.process_FIELDNAME, Work.creatorPerson_FIELDNAME));
|
|
|
+ if (null == workCompleted) {
|
|
|
+ List<WorkCompleted> os = emc.fetchEqual(WorkCompleted.class,
|
|
|
+ ListTools.toList(WorkCompleted.job_FIELDNAME, WorkCompleted.application_FIELDNAME,
|
|
|
+ WorkCompleted.process_FIELDNAME, WorkCompleted.creatorPerson_FIELDNAME),
|
|
|
+ WorkCompleted.work_FIELDNAME, workOrWorkCompleted);
|
|
|
+ if (os.size() == 1) {
|
|
|
+ workCompleted = os.get(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (null != workCompleted) {
|
|
|
+ job = workCompleted.getJob();
|
|
|
+ creatorPerson = workCompleted.getCreatorPerson();
|
|
|
+ applicationId = workCompleted.getApplication();
|
|
|
+ processId = workCompleted.getProcess();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ job = work.getJob();
|
|
|
+ creatorPerson = work.getCreatorPerson();
|
|
|
+ applicationId = work.getApplication();
|
|
|
+ processId = work.getProcess();
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(job)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (effectivePerson.isUser(creatorPerson)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if (emc.countEqualAndEqual(TaskCompleted.class, TaskCompleted.person_FIELDNAME,
|
|
|
+ effectivePerson.getDistinguishedName(), TaskCompleted.job_FIELDNAME, job) == 0) {
|
|
|
+ if (emc.countEqualAndEqual(ReadCompleted.class, ReadCompleted.person_FIELDNAME,
|
|
|
+ effectivePerson.getDistinguishedName(), ReadCompleted.job_FIELDNAME, job) == 0) {
|
|
|
+ if (emc.countEqualAndEqual(Task.class, Task.person_FIELDNAME, effectivePerson.getDistinguishedName(),
|
|
|
+ Task.job_FIELDNAME, job) == 0) {
|
|
|
+ if (emc.countEqualAndEqual(Read.class, Read.person_FIELDNAME,
|
|
|
+ effectivePerson.getDistinguishedName(), Read.job_FIELDNAME, job) == 0) {
|
|
|
+ if (emc.countEqualAndEqual(Review.class, Review.person_FIELDNAME,
|
|
|
+ effectivePerson.getDistinguishedName(), Review.job_FIELDNAME, job) == 0) {
|
|
|
+ Application application = application().pick(applicationId);
|
|
|
+ Process process = process().pick(processId);
|
|
|
+ if (!canManageApplicationOrProcess(effectivePerson, application, process)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean readableWithJob(EffectivePerson effectivePerson, String job) throws Exception {
|
|
|
+ String creatorPerson = null;
|
|
|
+ String applicationId = null;
|
|
|
+ String processId = null;
|
|
|
+ List<Work> works = emc.fetchEqual(Work.class,
|
|
|
+ ListTools.toList(Work.application_FIELDNAME, Work.process_FIELDNAME, Work.creatorPerson_FIELDNAME),
|
|
|
+ Work.job_FIELDNAME, job);
|
|
|
+ if (works.isEmpty()) {
|
|
|
+ List<WorkCompleted> workCompleteds = emc.fetchEqual(
|
|
|
+ WorkCompleted.class, ListTools.toList(WorkCompleted.application_FIELDNAME,
|
|
|
+ WorkCompleted.process_FIELDNAME, WorkCompleted.creatorPerson_FIELDNAME),
|
|
|
+ WorkCompleted.job_FIELDNAME, job);
|
|
|
+ if (workCompleteds.isEmpty()) {
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ creatorPerson = workCompleteds.get(0).getCreatorPerson();
|
|
|
+ applicationId = workCompleteds.get(0).getApplication();
|
|
|
+ processId = workCompleteds.get(0).getProcess();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ creatorPerson = works.get(0).getCreatorPerson();
|
|
|
+ applicationId = works.get(0).getApplication();
|
|
|
+ processId = works.get(0).getProcess();
|
|
|
+ }
|
|
|
+ if (effectivePerson.isUser(creatorPerson)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if (emc.countEqualAndEqual(TaskCompleted.class, TaskCompleted.person_FIELDNAME,
|
|
|
+ effectivePerson.getDistinguishedName(), TaskCompleted.job_FIELDNAME, job) == 0) {
|
|
|
+ if (emc.countEqualAndEqual(ReadCompleted.class, ReadCompleted.person_FIELDNAME,
|
|
|
+ effectivePerson.getDistinguishedName(), ReadCompleted.job_FIELDNAME, job) == 0) {
|
|
|
+ if (emc.countEqualAndEqual(Task.class, Task.person_FIELDNAME, effectivePerson.getDistinguishedName(),
|
|
|
+ Task.job_FIELDNAME, job) == 0) {
|
|
|
+ if (emc.countEqualAndEqual(Read.class, Read.person_FIELDNAME,
|
|
|
+ effectivePerson.getDistinguishedName(), Read.job_FIELDNAME, job) == 0) {
|
|
|
+ if (emc.countEqualAndEqual(Review.class, Review.person_FIELDNAME,
|
|
|
+ effectivePerson.getDistinguishedName(), Review.job_FIELDNAME, job) == 0) {
|
|
|
+ Application application = application().pick(applicationId);
|
|
|
+ Process process = process().pick(processId);
|
|
|
+ if (!canManageApplicationOrProcess(effectivePerson, application, process)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
public boolean controllerable(Business business, EffectivePerson effectivePerson, Application application,
|
|
|
Process process, Attachment attachment) throws Exception {
|
|
|
if (ListTools.isEmpty(attachment.getControllerIdentityList(), attachment.getControllerUnitList())) {
|