BrightSide Workbench Full Report + Source Code
Related.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2022 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.elephant.entities.db;
20 
21 import java.util.Date;
22 import javax.persistence.Entity;
23 import javax.persistence.Id;
24 import javax.persistence.IdClass;
25 import javax.persistence.Temporal;
26 import org.turro.entities.Entities;
27 import org.turro.entities.IElephantEntity;
28 import org.turro.string.Strings;
29 
34 @Entity
35 @IdClass(RelatedPK.class)
36 public class Related implements java.io.Serializable {
37 
38  @Id private String origin;
39  @Id private String destination;
40 
41  private String description;
42 
43  private boolean unbreakable;
44 
45  @Temporal(value = javax.persistence.TemporalType.TIMESTAMP)
46  private java.util.Date creation;
47 
48  public Date getCreation() {
49  return creation;
50  }
51 
52  public void setCreation(Date creation) {
53  this.creation = creation;
54  }
55 
56  public String getDescription() {
57  return description;
58  }
59 
60  public void setDescription(String description) {
61  this.description = description;
62  }
63 
64  public String getDestination() {
65  return destination;
66  }
67 
68  public void setDestination(String destination) {
69  this.destination = destination;
70  }
71 
72  public String getOrigin() {
73  return origin;
74  }
75 
76  public void setOrigin(String origin) {
77  this.origin = origin;
78  }
79 
80  public boolean isUnbreakable() {
81  return unbreakable;
82  }
83 
84  public void setUnbreakable(boolean unbreakable) {
85  this.unbreakable = unbreakable;
86  }
87 
88  /* Helpers */
89 
90  public boolean isEmpty() {
91  return Strings.isBlank(origin) || Strings.isBlank(destination);
92  }
93 
94  /* Entities */
95 
97  return Entities.getController(origin);
98  }
99 
101  return Entities.getController(destination);
102  }
103 
104 }
IElephantEntity getDestinationEntity()
Definition: Related.java:100
void setDestination(String destination)
Definition: Related.java:68
void setUnbreakable(boolean unbreakable)
Definition: Related.java:84
void setDescription(String description)
Definition: Related.java:60
static IElephantEntity getController(String path)
Definition: Entities.java:78