BrightSide Workbench Full Report + Source Code
org.turro.plugin.contacts.AbstractRelations Class Referenceabstract
Inheritance diagram for org.turro.plugin.contacts.AbstractRelations:
Collaboration diagram for org.turro.plugin.contacts.AbstractRelations:

Public Member Functions

IRelations date (Date date)
 
IRelations outer ()
 
IRelations company ()
 
IRelations staff ()
 
IContact getCompany ()
 
Optional< IContactgetOptCompany ()
 
IContactRelation getCompanyRelation ()
 
Optional< IContactRelationgetOptCompanyRelation ()
 
List< IContactgetCompanies ()
 
Set< IContactRelationgetCompanyRelations ()
 
List< IContactgetCoworkers ()
 
abstract Set< IContactRelationgetCoworkerRelations ()
 
List< IContactgetWorkers ()
 
Set< IContactRelationgetWorkerRelations ()
 
List< IContactgetDocents ()
 
List< IContactRelationgetDocentRelations ()
 
List< IContactgetStudents ()
 
List< IContactRelationgetStudentRelations ()
 
boolean inStaff (IContact worker)
 
Set< IContactRelationgetCurrent ()
 
Set< IContactRelationgetOutdated ()
 

Protected Member Functions

 AbstractRelations (IContact contact, boolean asWorker)
 
abstract AbstractRelations load ()
 

Protected Attributes

final IContact contact
 
Date date
 
boolean outer
 

Detailed Description

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

Definition at line 34 of file AbstractRelations.java.

Constructor & Destructor Documentation

◆ AbstractRelations()

org.turro.plugin.contacts.AbstractRelations.AbstractRelations ( IContact  contact,
boolean  asWorker 
)
protected

Definition at line 41 of file AbstractRelations.java.

41  {
42  this.contact = contact;
43  this.date = new Date();
44  this.asWorker = asWorker;
45  }

Member Function Documentation

◆ company()

IRelations org.turro.plugin.contacts.AbstractRelations.company ( )

Implements org.turro.plugin.contacts.IRelations.

Definition at line 62 of file AbstractRelations.java.

62  {
63  asWorker = false;
64  clear();
65  return this;
66  }
Here is the caller graph for this function:

◆ date()

IRelations org.turro.plugin.contacts.AbstractRelations.date ( Date  date)

Implements org.turro.plugin.contacts.IRelations.

Definition at line 48 of file AbstractRelations.java.

48  {
49  if(date != null) this.date = date;
50  clear();
51  return this;
52  }

◆ getCompanies()

List<IContact> org.turro.plugin.contacts.AbstractRelations.getCompanies ( )

Implements org.turro.plugin.contacts.IRelations.

Definition at line 104 of file AbstractRelations.java.

104  {
105  return getCompanyRelations().stream().map(r -> r.getRelatedIContact()).toList();
106  }
Here is the call graph for this function:

◆ getCompany()

IContact org.turro.plugin.contacts.AbstractRelations.getCompany ( )

Implements org.turro.plugin.contacts.IRelations.

Definition at line 78 of file AbstractRelations.java.

78  {
79  IContactRelation cr = getCompanyRelation();
80  return cr != null ? cr.getRelatedIContact() : null;
81  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCompanyRelation()

IContactRelation org.turro.plugin.contacts.AbstractRelations.getCompanyRelation ( )

Implements org.turro.plugin.contacts.IRelations.

Definition at line 89 of file AbstractRelations.java.

89  {
90  if(asWorker) {
91  for(IContactRelation cr : getCurrent()) {
92  return cr;
93  }
94  }
95  return null;
96  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCompanyRelations()

Set<IContactRelation> org.turro.plugin.contacts.AbstractRelations.getCompanyRelations ( )

Implements org.turro.plugin.contacts.IRelations.

Definition at line 109 of file AbstractRelations.java.

109  {
110  if(asWorker) {
111  return getCurrent();
112  }
113  return Collections.EMPTY_SET;
114  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCoworkerRelations()

abstract Set<IContactRelation> org.turro.plugin.contacts.AbstractRelations.getCoworkerRelations ( )
abstract

Implements org.turro.plugin.contacts.IRelations.

Reimplemented in org.turro.alliance.contact.Relations, and org.turro.contacts.relation.Relations.

Here is the caller graph for this function:

◆ getCoworkers()

List<IContact> org.turro.plugin.contacts.AbstractRelations.getCoworkers ( )

Implements org.turro.plugin.contacts.IRelations.

Definition at line 117 of file AbstractRelations.java.

117  {
118  return getCoworkerRelations().stream().map(r -> r.getRelatedIContact()).toList();
119  }
abstract Set< IContactRelation > getCoworkerRelations()
Here is the call graph for this function:

◆ getCurrent()

Set<IContactRelation> org.turro.plugin.contacts.AbstractRelations.getCurrent ( )

Implements org.turro.plugin.contacts.IRelations.

Definition at line 177 of file AbstractRelations.java.

177  {
178  Set<IContactRelation> set = new TreeSet<>();
179  for(IContactRelation cr : load()) {
180  if(Dates.inRange(cr.getStartDate(), cr.getEndDate(), date)) {
181  set.add(cr);
182  }
183  }
184  return set;
185  }
abstract AbstractRelations load()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDocentRelations()

List<IContactRelation> org.turro.plugin.contacts.AbstractRelations.getDocentRelations ( )

Implements org.turro.plugin.contacts.IRelations.

Definition at line 147 of file AbstractRelations.java.

147  {
148  if(contact.isCenter()) {
149  return getWorkerRelations().stream().filter(r -> r.isWorker()).toList();
150  }
151  return Collections.EMPTY_LIST;
152  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDocents()

List<IContact> org.turro.plugin.contacts.AbstractRelations.getDocents ( )

Implements org.turro.plugin.contacts.IRelations.

Definition at line 142 of file AbstractRelations.java.

142  {
143  return getDocentRelations().stream().map(r -> r.getRelatedIContact()).toList();
144  }
Here is the call graph for this function:

◆ getOptCompany()

Optional<IContact> org.turro.plugin.contacts.AbstractRelations.getOptCompany ( )

Implements org.turro.plugin.contacts.IRelations.

Definition at line 84 of file AbstractRelations.java.

84  {
85  return Optional.ofNullable(getCompany());
86  }
Here is the call graph for this function:

◆ getOptCompanyRelation()

Optional<IContactRelation> org.turro.plugin.contacts.AbstractRelations.getOptCompanyRelation ( )

Implements org.turro.plugin.contacts.IRelations.

Definition at line 99 of file AbstractRelations.java.

99  {
100  return Optional.ofNullable(getCompanyRelation());
101  }
Here is the call graph for this function:

◆ getOutdated()

Set<IContactRelation> org.turro.plugin.contacts.AbstractRelations.getOutdated ( )

Implements org.turro.plugin.contacts.IRelations.

Definition at line 188 of file AbstractRelations.java.

188  {
189  SortedSet<IContactRelation> set = new TreeSet<>();
190  for(IContactRelation cr : load()) {
191  if(!Dates.inRange(cr.getStartDate(), cr.getEndDate(), date)) {
192  set.add(cr);
193  }
194  }
195  return set;
196  }
Here is the call graph for this function:

◆ getStudentRelations()

List<IContactRelation> org.turro.plugin.contacts.AbstractRelations.getStudentRelations ( )

Implements org.turro.plugin.contacts.IRelations.

Definition at line 160 of file AbstractRelations.java.

160  {
161  if(contact.isCenter()) {
162  return getWorkerRelations().stream().filter(r -> !r.isWorker()).toList();
163  }
164  return Collections.EMPTY_LIST;
165  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getStudents()

List<IContact> org.turro.plugin.contacts.AbstractRelations.getStudents ( )

Implements org.turro.plugin.contacts.IRelations.

Definition at line 155 of file AbstractRelations.java.

155  {
156  return getStudentRelations().stream().map(r -> r.getRelatedIContact()).toList();
157  }
Here is the call graph for this function:

◆ getWorkerRelations()

Set<IContactRelation> org.turro.plugin.contacts.AbstractRelations.getWorkerRelations ( )

Implements org.turro.plugin.contacts.IRelations.

Definition at line 132 of file AbstractRelations.java.

132  {
133  if(!asWorker) {
134  return getCurrent();
135  }
136  return Collections.EMPTY_SET;
137  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getWorkers()

List<IContact> org.turro.plugin.contacts.AbstractRelations.getWorkers ( )

Implements org.turro.plugin.contacts.IRelations.

Definition at line 127 of file AbstractRelations.java.

127  {
128  return getWorkerRelations().stream().map(r -> r.getRelatedIContact()).toList();
129  }
Here is the call graph for this function:

◆ inStaff()

boolean org.turro.plugin.contacts.AbstractRelations.inStaff ( IContact  worker)

Implements org.turro.plugin.contacts.IRelations.

Definition at line 170 of file AbstractRelations.java.

170  {
171  return asWorker ?
172  getCoworkerRelations().stream().anyMatch(r -> r.getRelatedId().equals(worker.getId())) :
173  getWorkerRelations().stream().anyMatch(r -> r.getRelatedId().equals(worker.getId()));
174  }
Here is the call graph for this function:

◆ load()

abstract AbstractRelations org.turro.plugin.contacts.AbstractRelations.load ( )
abstractprotected

Reimplemented in org.turro.alliance.contact.Relations, and org.turro.contacts.relation.Relations.

Here is the caller graph for this function:

◆ outer()

IRelations org.turro.plugin.contacts.AbstractRelations.outer ( )

Implements org.turro.plugin.contacts.IRelations.

Definition at line 55 of file AbstractRelations.java.

55  {
56  outer = true;
57  clear();
58  return this;
59  }

◆ staff()

IRelations org.turro.plugin.contacts.AbstractRelations.staff ( )

Implements org.turro.plugin.contacts.IRelations.

Definition at line 69 of file AbstractRelations.java.

69  {
70  asWorker = true;
71  clear();
72  return this;
73  }

Member Data Documentation

◆ contact

final IContact org.turro.plugin.contacts.AbstractRelations.contact
protected

Definition at line 36 of file AbstractRelations.java.

◆ date

Date org.turro.plugin.contacts.AbstractRelations.date
protected

Definition at line 38 of file AbstractRelations.java.

◆ outer

boolean org.turro.plugin.contacts.AbstractRelations.outer
protected

Definition at line 39 of file AbstractRelations.java.


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