19 package org.turro.plugin.contacts;
21 import java.util.ArrayList;
22 import java.util.List;
23 import org.turro.reflection.Instances;
24 import org.turro.util.CompareUtil;
32 public static final int MODE_ALL = 0, MODE_DIRECT = 1, MODE_OUTER = 2;
38 public static List<IContactRelation>
getBusiness(String idContact,
int mode) {
39 List<IContactRelation> list =
new ArrayList<>();
41 if(checkMode(mode, process)) list.addAll(process.getBusiness(idContact));
50 public static List<IContactRelation>
getWorkers(String idContact,
int mode) {
51 List<IContactRelation> list =
new ArrayList<>();
53 if(checkMode(mode, process)) list.addAll(process.getWorkers(idContact));
62 public static List<IContactRelation>
getRelations(String idContact,
int mode) {
63 List<IContactRelation> list =
new ArrayList<>();
65 if(checkMode(mode, process)) list.addAll(process.getRelations(idContact));
70 public static boolean checkBusiness(String businessId, String workerId) {
71 return CompareUtil.compare(businessId, workerId) != 0 &&
72 getWorkers(businessId,
MODE_ALL).stream().noneMatch(b -> b.getRelatedId().equals(workerId));
77 if(mode == MODE_DIRECT && process.
isDirect())
return true;
78 if(mode == MODE_OUTER && !process.
isDirect())
return true;
82 private ContactRelations() {