19 package org.turro.alliance.db.entities;
21 import java.io.Serializable;
22 import java.util.Date;
24 import java.util.Objects;
26 import javax.json.JsonValue;
27 import javax.persistence.CascadeType;
28 import javax.persistence.Column;
29 import javax.persistence.EmbeddedId;
30 import javax.persistence.Entity;
31 import javax.persistence.FetchType;
32 import javax.persistence.JoinColumn;
33 import javax.persistence.JoinColumns;
34 import javax.persistence.Lob;
35 import javax.persistence.OneToMany;
36 import javax.persistence.Temporal;
37 import org.hibernate.annotations.Formula;
38 import org.turro.alliance.db.AlliancePU;
39 import org.turro.contacts.relation.Relations;
40 import org.turro.elephant.context.ElephantContext;
41 import org.turro.entities.Entities;
42 import org.turro.entities.Faces;
43 import org.turro.jpa.entity.IDaoEntity;
44 import org.turro.json.IJSONizable;
45 import org.turro.member.db.entities.AxChallengeCategory;
46 import org.turro.plugin.contacts.IContact;
47 import org.turro.string.Strings;
48 import org.turro.students.entities.Challenge;
49 import org.turro.ws.WsServer;
60 @Formula(
"concat(entityId,'##',memberId)")
63 private Long categoryId;
65 private String idChallenger;
66 private String name, face, company;
68 private String question;
70 @Temporal(value = javax.persistence.TemporalType.TIMESTAMP)
71 private java.util.Date creation;
73 @Temporal(value = javax.persistence.TemporalType.DATE)
74 private java.util.Date deadline;
80 private String sourceLink;
82 @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.MERGE)
84 @JoinColumn(name=
"mainEntityId", referencedColumnName =
"entityId", insertable =
false, updatable =
false),
85 @JoinColumn(name=
"mainMemberId", referencedColumnName =
"memberId", insertable =
false, updatable =
false)
87 private Set<AxResponse> responses;
98 this.challengeId = challengeId;
106 this.categoryId = categoryId;
114 this.idChallenger = idChallenger;
138 this.company = company;
146 this.question = question;
154 this.creation = creation;
162 this.deadline = deadline;
186 this.sourceLink = sourceLink;
194 this.responses = responses;
202 id.setMemberId(memberId);
203 id.setEntityId(Long.toString(challenge.
getId()));
229 return challengeId.isEmpty() ||
230 Strings.isBlank(name);
241 public String
toJson(Map<String, Object> properties) {
242 return toJson(
this, properties);
254 hash = 79 * hash + Objects.hashCode(this.challengeId);
266 if (getClass() != obj.getClass()) {
270 return Objects.
equals(this.challengeId, other.challengeId);
void setFace(String face)
void setSourceLink(String sourceLink)
String toJson(Map< String, Object > properties)
Set< AxResponse > getResponses()
void setIdChallenger(String idChallenger)
void setCreation(Date creation)
void setName(String name)
void setQuestion(String question)
AxTalentCategory getCategory()
void setDeadline(Date deadline)
static AxChallenge fromJson(JsonValue value)
void setChallengeId(ProcedenceId challengeId)
ProcedenceId getChallengeId()
void setCategory(AxTalentCategory category)
void setCategoryId(Long categoryId)
void setCompany(String company)
void setText(String text)
void setResponses(Set< AxResponse > responses)
boolean equals(Object obj)
static AxChallenge from(long memberId, WsServer server, Challenge challenge, AxChallengeCategory pc)
static Set< AxResponse > from(long memberId, Challenge challenge)
static String getServerUrl(String scheme)
static IElephantEntity getController(String path)
static Faces of(IContact contact)