19 package org.turro.alliance.db.entities;
21 import java.io.Serializable;
23 import java.util.Objects;
24 import javax.json.JsonValue;
25 import javax.persistence.EmbeddedId;
26 import javax.persistence.Entity;
27 import org.hibernate.annotations.Formula;
28 import org.turro.action.Contacts;
29 import org.turro.alliance.db.AlliancePU;
30 import org.turro.elephant.context.ElephantContext;
31 import org.turro.jpa.entity.IDaoEntity;
32 import org.turro.json.IJSONizable;
33 import org.turro.plugin.contacts.IContact;
34 import org.turro.sql.SqlClause;
35 import org.turro.string.Strings;
46 @Formula(
"concat(entityId,'##',memberId)")
49 private String name, email;
52 private boolean active;
59 this.centerId = centerId;
101 return SqlClause.select(
"c").from(
"AxStudent c")
102 .where().equal(
"c.center", name)
103 .and().equal(
"c.studentId.memberId", centerId.getMemberId())
109 return SqlClause.select(
"distinct c.course").from(
"AxStudent c")
110 .where().equal(
"c.center", name)
111 .and().equal(
"c.studentId.memberId", centerId.getMemberId())
113 .stream(String.class)
114 .filter(s -> !Strings.isBlank(s))
121 if(!Strings.isBlank(contactId)) {
131 id.setMemberId(memberId);
132 id.setEntityId(contact.
getId());
153 return centerId.isEmpty() ||
154 Strings.isBlank(name);
165 public String
toJson(Map<String, Object> properties) {
166 return toJson(
this, properties);
178 hash = 83 * hash + Objects.hashCode(this.centerId);
190 if (getClass() != obj.getClass()) {
194 return Objects.
equals(this.centerId, other.centerId);
static AxCenter fromJson(JsonValue value)
static AxCenter from(long memberId, String contactId)
void setName(String name)
static AxCenter from(long memberId, IContact contact)
Iterable< String > getCourses()
void setEmail(String email)
void setCenterId(ProcedenceId centerId)
void setActive(boolean active)
ProcedenceId getCenterId()
boolean equals(Object obj)
String toJson(Map< String, Object > properties)
void setFace(String face)
Iterable< AxStudent > getStudents()
static String getServerUrl(String scheme)