BrightSide Workbench Full Report + Source Code
AbstractContactRelation.java
Go to the documentation of this file.
1
/*
2
* TurrĂ³ i Cutiller Foundation. License notice.
3
* Copyright (C) 2020 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU Affero General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU Affero General Public License for more details.
14
*
15
* You should have received a copy of the GNU Affero General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
package
org.turro.plugin.contacts;
20
21
import
org.turro.entities.Entities;
22
import
org.turro.entities.IElephantEntity;
23
import
org.turro.util.CompareUtil;
24
29
public
abstract
class
AbstractContactRelation
implements
IContactRelation
, Comparable<IContactRelation> {
30
31
private
final
IContact
contact;
32
33
public
AbstractContactRelation
(
IContact
_contact) {
34
this.contact = _contact;
35
}
36
37
private
IElephantEntity
_iee;
38
39
@Override
40
public
String
getRelatedId
() {
41
return
getRelatedIContact
().
getId
();
42
}
43
44
@Override
45
public
IElephantEntity
getRelatedEntity
() {
46
if
(_iee ==
null
) {
47
_iee =
Entities
.
getController
(
getRelatedContact
());
48
}
49
return
_iee;
50
}
51
52
@Override
53
public
IContact
getRelatedIContact
() {
54
return
contact;
55
}
56
57
@Override
58
public
Object
getRelatedContact
() {
59
return
getRelatedIContact
().
getContact
();
60
}
61
62
@Override
63
public
String
getDatesString
() {
64
return
PositionDates
.
format
(
getStartDate
(),
getEndDate
());
65
}
66
67
/* Comparable */
68
69
@Override
70
public
int
compareTo
(
IContactRelation
o) {
71
int
result = CompareUtil.compare(
getValidated
(), o.
getValidated
());
72
if
(result == 0) {
73
result = CompareUtil.compare(
getStrong
(), o.
getStrong
());
74
}
75
if
(result == 0) {
76
result = CompareUtil.compare(
getEndDate
(), o.
getEndDate
());
77
}
78
if
(result == 0) {
79
result = CompareUtil.compare(
getStartDate
(), o.
getStartDate
());
80
}
81
if
(result == 0) {
82
result = CompareUtil.compare(
getDue
(), o.
getDue
());
83
}
84
if
(result == 0) {
85
result = CompareUtil.compare(
getRelatedId
(), o.
getRelatedId
());
86
}
87
return
result;
88
}
89
90
}
org.turro.entities.Entities
Definition:
Entities.java:37
org.turro.entities.Entities.getController
static IElephantEntity getController(String path)
Definition:
Entities.java:78
org.turro.plugin.contacts.AbstractContactRelation
Definition:
AbstractContactRelation.java:29
org.turro.plugin.contacts.AbstractContactRelation.getRelatedId
String getRelatedId()
Definition:
AbstractContactRelation.java:40
org.turro.plugin.contacts.AbstractContactRelation.getRelatedContact
Object getRelatedContact()
Definition:
AbstractContactRelation.java:58
org.turro.plugin.contacts.AbstractContactRelation.getRelatedEntity
IElephantEntity getRelatedEntity()
Definition:
AbstractContactRelation.java:45
org.turro.plugin.contacts.AbstractContactRelation.compareTo
int compareTo(IContactRelation o)
Definition:
AbstractContactRelation.java:70
org.turro.plugin.contacts.AbstractContactRelation.getRelatedIContact
IContact getRelatedIContact()
Definition:
AbstractContactRelation.java:53
org.turro.plugin.contacts.AbstractContactRelation.AbstractContactRelation
AbstractContactRelation(IContact _contact)
Definition:
AbstractContactRelation.java:33
org.turro.plugin.contacts.AbstractContactRelation.getDatesString
String getDatesString()
Definition:
AbstractContactRelation.java:63
org.turro.plugin.contacts.PositionDates
Definition:
PositionDates.java:32
org.turro.plugin.contacts.PositionDates.format
static String format(Date start, Date end)
Definition:
PositionDates.java:34
org.turro.entities.IElephantEntity
Definition:
IElephantEntity.java:39
org.turro.plugin.contacts.IContactRelation
Definition:
IContactRelation.java:27
org.turro.plugin.contacts.IContactRelation.getValidated
boolean getValidated()
org.turro.plugin.contacts.IContactRelation.getRelatedId
String getRelatedId()
org.turro.plugin.contacts.IContactRelation.getDue
String getDue()
org.turro.plugin.contacts.IContactRelation.getStrong
boolean getStrong()
org.turro.plugin.contacts.IContactRelation.getEndDate
Date getEndDate()
org.turro.plugin.contacts.IContactRelation.getStartDate
Date getStartDate()
org.turro.plugin.contacts.IContact
Definition:
elephant/src/main/java/org/turro/plugin/contacts/IContact.java:33
org.turro.plugin.contacts.IContact.getContact
Object getContact()
org.turro.plugin.contacts.IContact.getId
String getId()
TurroProjects
Public
Elephant
elephant
src
main
java
org
turro
plugin
contacts
AbstractContactRelation.java
Generated on Tue Mar 12 2024 07:01:17 for BrightSide by
1.9.1