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
46  if(_iee == null) {
48  }
49  return _iee;
50  }
51 
52  @Override
54  return contact;
55  }
56 
57  @Override
58  public Object getRelatedContact() {
59  return getRelatedIContact().getContact();
60  }
61 
62  @Override
63  public String getDatesString() {
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 }
static IElephantEntity getController(String path)
Definition: Entities.java:78
static String format(Date start, Date end)