BrightSide Workbench Full Report + Source Code
org.turro.entities.Entities Class Reference

Static Public Member Functions

static Object getObject (String path)
 
static IElephantEntity getMainEntity (Object entity)
 
static IElephantEntity emptyController ()
 
static IElephantEntity getController (String path)
 
static IElephantEntity getController (Object entity)
 
static Collection< Object > getEntities (String search, int maxResults)
 
static Collection< Object > getEntities (String root, String search, int maxResults)
 
static Collection< Object > getEntities (String search, int maxResults, KeyValueMap kvm)
 
static Collection< Object > getEntities (String root, String search, int maxResults, KeyValueMap kvm)
 
static Object getSingleRelatedByRole (EntityRole role, IContact contact)
 
static Collection< Object > getRelatedByRole (EntityRole role, IContact contact)
 
static boolean hasRelatedRole (EntityRole role, IContact contact)
 
static Set< String > getEntityPaths (Collection entitites)
 
static Set< String > getEntityPaths (Object[] entitites)
 
static Set< String > getEntityPaths (Object entity)
 
static Set< String > getAllowedRoots ()
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 37 of file Entities.java.

Member Function Documentation

◆ emptyController()

static IElephantEntity org.turro.entities.Entities.emptyController ( )
static

Definition at line 74 of file Entities.java.

74  {
75  return empty;
76  }
Here is the caller graph for this function:

◆ getAllowedRoots()

static Set<String> org.turro.entities.Entities.getAllowedRoots ( )
static

Definition at line 194 of file Entities.java.

194  {
195  HashSet<String> set = new HashSet<>();
196  for(IElephantEntity iElEntity : Instances.cached().byAnnotation(ElephantEntity.class, IElephantEntity.class)) {
197  set.addAll(iElEntity.getAllowedRoots());
198  }
199  return set;
200  }
Here is the caller graph for this function:

◆ getController() [1/2]

static IElephantEntity org.turro.entities.Entities.getController ( Object  entity)
static

Definition at line 90 of file Entities.java.

90  {
91  if(entity instanceof String) {
92  return getController((String) entity);
93  } else if(entity instanceof Path) {
94  return getController(((Path) entity).getPath());
95  } else if(entity != null) {
96  for(IElephantEntity iElEntity : Instances.cached().byAnnotation(ElephantEntity.class, IElephantEntity.class)) {
97  IElephantEntity ei = iElEntity.getController(entity);
98  if(ei != null) {
99  return ei;
100  }
101  }
102  }
103  return empty;
104  }
static IElephantEntity getController(String path)
Definition: Entities.java:78
Here is the call graph for this function:

◆ getController() [2/2]

static IElephantEntity org.turro.entities.Entities.getController ( String  path)
static

Definition at line 78 of file Entities.java.

78  {
79  if(!Strings.isBlank(path)) {
80  for(IElephantEntity iElEntity : Instances.cached().byAnnotation(ElephantEntity.class, IElephantEntity.class)) {
81  IElephantEntity ei = iElEntity.getController(path);
82  if(ei != null) {
83  return ei;
84  }
85  }
86  }
87  return empty;
88  }
Here is the call graph for this function:

◆ getEntities() [1/4]

static Collection<Object> org.turro.entities.Entities.getEntities ( String  root,
String  search,
int  maxResults 
)
static

Definition at line 110 of file Entities.java.

110  {
111  return getEntities(root, search, maxResults, null);
112  }
static Collection< Object > getEntities(String search, int maxResults)
Definition: Entities.java:106
Here is the call graph for this function:

◆ getEntities() [2/4]

static Collection<Object> org.turro.entities.Entities.getEntities ( String  root,
String  search,
int  maxResults,
KeyValueMap  kvm 
)
static

Definition at line 125 of file Entities.java.

125  {
126  if(kvm == null) { kvm = new KeyValueMap(new HashMap()); }
127  ArrayList<Object> list = new ArrayList<>();
128  if(!Strings.isBlank(search)) {
129  for(IElephantEntity iElEntity : Instances.cached().byAnnotation(ElephantEntity.class, IElephantEntity.class)) {
130  for(String entityRoot : Strings.csvToList(root)) {
131  list.addAll(iElEntity.getEntitites(entityRoot, search, maxResults, kvm));
132  }
133  }
134  }
135  return list;
136  }

◆ getEntities() [3/4]

static Collection<Object> org.turro.entities.Entities.getEntities ( String  search,
int  maxResults 
)
static

Definition at line 106 of file Entities.java.

106  {
107  return getEntities(search, maxResults, null);
108  }
Here is the caller graph for this function:

◆ getEntities() [4/4]

static Collection<Object> org.turro.entities.Entities.getEntities ( String  search,
int  maxResults,
KeyValueMap  kvm 
)
static

Definition at line 114 of file Entities.java.

114  {
115  if(kvm == null) { kvm = new KeyValueMap(new HashMap()); }
116  ArrayList<Object> list = new ArrayList<>();
117  if(!Strings.isBlank(search)) {
118  for(IElephantEntity iElEntity : Instances.cached().byAnnotation(ElephantEntity.class, IElephantEntity.class)) {
119  list.addAll(iElEntity.getEntitites(search, maxResults, kvm));
120  }
121  }
122  return list;
123  }

◆ getEntityPaths() [1/3]

static Set<String> org.turro.entities.Entities.getEntityPaths ( Collection  entitites)
static

Definition at line 163 of file Entities.java.

163  {
164  HashSet<String> set = new HashSet<>();
165  for(Object entity : entitites) {
166  String path = Entities.getController(entity).getPath();
167  if(!Strings.isBlank(path)) {
168  set.add(path);
169  }
170  }
171  return set;
172  }
Here is the call graph for this function:

◆ getEntityPaths() [2/3]

static Set<String> org.turro.entities.Entities.getEntityPaths ( Object  entity)
static

Definition at line 185 of file Entities.java.

185  {
186  HashSet<String> set = new HashSet<>();
187  String path = Entities.getController(entity).getPath();
188  if(!Strings.isBlank(path)) {
189  set.add(path);
190  }
191  return set;
192  }
Here is the call graph for this function:

◆ getEntityPaths() [3/3]

static Set<String> org.turro.entities.Entities.getEntityPaths ( Object[]  entitites)
static

Definition at line 174 of file Entities.java.

174  {
175  HashSet<String> set = new HashSet<>();
176  for(Object entity : entitites) {
177  String path = Entities.getController(entity).getPath();
178  if(!Strings.isBlank(path)) {
179  set.add(path);
180  }
181  }
182  return set;
183  }
Here is the call graph for this function:

◆ getMainEntity()

static IElephantEntity org.turro.entities.Entities.getMainEntity ( Object  entity)
static

Definition at line 60 of file Entities.java.

60  {
61  if(entity != null) {
62  for(IElephantEntity iElEntity : Instances.cached().byAnnotation(ElephantEntity.class, IElephantEntity.class)) {
63  IElephantEntity ei = iElEntity.getMain(entity);
64  if(ei != null) {
65  return ei;
66  }
67  }
68  }
69  return null;
70  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getObject()

static Object org.turro.entities.Entities.getObject ( String  path)
static

Definition at line 43 of file Entities.java.

43  {
44  if(!Strings.isBlank(path)) {
45  Path entityPath = Path.pathFrom(path);
46  for(IElephantEntity iElEntity : Instances.cached().byAnnotation(ElephantEntity.class, IElephantEntity.class)) {
47  IElephantEntity ei = iElEntity.getController(path);
48  if(ei != null) {
49  return ei.getEntity();
50  }
51  Object obj = iElEntity.getObject(entityPath);
52  if(obj != null) {
53  return obj;
54  }
55  }
56  }
57  return null;
58  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRelatedByRole()

static Collection<Object> org.turro.entities.Entities.getRelatedByRole ( EntityRole  role,
IContact  contact 
)
static

Definition at line 148 of file Entities.java.

148  {
149  ArrayList<Object> list = new ArrayList<>();
150  Instances.cached().byAnnotation(ElephantEntity.class, IElephantEntity.class).forEach((iElEntity) -> {
151  list.addAll(iElEntity.getRelatedByRole(role, contact));
152  });
153  return list;
154  }
Here is the caller graph for this function:

◆ getSingleRelatedByRole()

static Object org.turro.entities.Entities.getSingleRelatedByRole ( EntityRole  role,
IContact  contact 
)
static

Definition at line 140 of file Entities.java.

140  {
141  Collection<Object> list = Entities.getRelatedByRole(role, contact);
142  if(!list.isEmpty()) {
143  return list.stream().findFirst().get();
144  }
145  return null;
146  }
Here is the call graph for this function:

◆ hasRelatedRole()

static boolean org.turro.entities.Entities.hasRelatedRole ( EntityRole  role,
IContact  contact 
)
static

Definition at line 156 of file Entities.java.

156  {
157  return Instances.cached().byAnnotation(ElephantEntity.class, IElephantEntity.class)
158  .stream().map((iElEntity) -> iElEntity.hasRelatedRole(role, contact)).anyMatch((has) -> (has));
159  }

The documentation for this class was generated from the following file: