19 package org.turro.alliance.db.entities;
21 import java.io.Serializable;
23 import java.util.Objects;
25 import java.util.TreeSet;
26 import javax.json.JsonValue;
27 import javax.persistence.Column;
28 import javax.persistence.Entity;
29 import javax.persistence.Id;
30 import javax.persistence.Lob;
31 import org.turro.dossier.entity.DescriptorType;
32 import org.turro.dossier.entity.Dossier;
33 import org.turro.jpa.entity.IDaoEntity;
34 import org.turro.json.IJSONizable;
35 import org.turro.string.Strings;
36 import org.turro.util.Comparison;
45 @Id
private Long memberId;
46 @Id
private String entityId;
47 @Id
private String grouping, title;
48 @Id
private int orderNumber;
59 this.memberId = memberId;
67 this.entityId = entityId;
75 this.grouping = grouping;
91 this.orderNumber = orderNumber;
105 TreeSet<AxDescriptor> descriptors =
new TreeSet<>();
108 .filter(d -> d.getDescriptorDefinition().isRequired())
109 .forEach(descriptor -> {
113 axDescriptor.
setGrouping(descriptor.getDescriptorDefinition().getGrouping());
114 axDescriptor.
setOrderNumber(descriptor.getDescriptorDefinition().getOrderNumber());
115 axDescriptor.
setTitle(descriptor.getDescriptorDefinition().getTitle());
116 axDescriptor.
setText(descriptor.getText());
117 if(!axDescriptor.
isEmpty()) descriptors.add(axDescriptor);
126 return memberId + entityId + grouping + title;
131 return memberId ==
null || Strings.anyBlank(entityId, grouping, title, text);
138 return toJsonExcluding(
this,
AxProject.class);
142 public String
toJson(Map<String, Object> properties) {
143 return toJsonExcluding(
this, properties,
AxProject.class);
152 return Comparison.ascendant()
153 .compare(memberId, o.memberId)
154 .compare(entityId, o.entityId)
155 .compare(grouping, o.grouping)
156 .compare(orderNumber, o.orderNumber)
157 .compare(title, o.title)
164 hash = 59 * hash + Objects.hashCode(this.memberId);
165 hash = 59 * hash + Objects.hashCode(this.entityId);
166 hash = 59 * hash + Objects.hashCode(this.grouping);
167 hash = 59 * hash + Objects.hashCode(this.title);
168 hash = 59 * hash + this.orderNumber;
180 if (getClass() != obj.getClass()) {
184 if (this.orderNumber != other.orderNumber) {
187 if (!Objects.equals(
this.entityId, other.entityId)) {
190 if (!Objects.equals(
this.grouping, other.grouping)) {
193 if (!Objects.equals(
this.title, other.title)) {
196 return Objects.
equals(this.memberId, other.memberId);
static Set< AxDescriptor > from(AxProject project, Dossier dossier)
void setText(String text)
void setMemberId(Long memberId)
void setGrouping(String grouping)
void setEntityId(String entityId)
static AxDescriptor fromJson(JsonValue value)
void setTitle(String title)
int compareTo(AxDescriptor o)
boolean equals(Object obj)
String toJson(Map< String, Object > properties)
void setOrderNumber(int orderNumber)
ProcedenceId getProjectId()
Set< DescriptorValue > getDescriptors()