21 import java.io.Serializable;
22 import java.net.UnknownHostException;
24 import java.util.logging.Level;
25 import java.util.logging.Logger;
26 import javax.persistence.Entity;
27 import javax.persistence.GeneratedValue;
28 import javax.persistence.GenerationType;
29 import javax.persistence.Id;
30 import org.turro.string.Phrases;
31 import org.turro.string.Strings;
32 import org.turro.url.URIs;
33 import org.turro.action.Contacts;
34 import org.turro.elephant.context.ElephantContext;
35 import org.turro.elephant.db.ElephantPU;
36 import org.turro.elephant.db.IdUtils;
37 import org.turro.jpa.entity.IDaoEntity;
38 import org.turro.json.IJSONizable;
39 import org.turro.math.Zero;
40 import org.turro.plugin.contacts.IContact;
41 import org.turro.util.Chars;
50 @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
51 private Long memberId;
53 private String contactId;
55 private String memberDomain;
57 private String service;
64 this.memberId = memberId;
72 this.contactId = contactId;
80 this.memberDomain = memberDomain;
88 this.service = service;
95 String[] parts = memberDomain.split(
"[\\:\\/]");
96 return URIs.validIP(parts[0], ip);
97 }
catch (UnknownHostException ex) {
104 if(memberDomain.contains(
"localhost")) {
105 return "http://" + memberDomain;
107 return "https://" + memberDomain;
120 return serviceName ==
null ?
new ServiceNamePair(service, service) : serviceName;
124 this.serviceName = serviceName;
135 contactId = contact ==
null ? null : contact.
getId();
147 return Strings.isBlank(contactId) || Strings.isBlank(memberDomain);
166 public String
toJson(Map<String, Object> properties) {
167 return toJson(
this, properties);
static String logMsg(String msg)
static long getNewLongIdFromLong(Dao dao, String table, String field)
static boolean orNull(Number value)
void setServiceName(ServiceNamePair serviceName)
boolean isValidIP(String ip)
String toJson(Map< String, Object > properties)
ServiceNamePair getServiceName()
void setMemberDomain(String memberDomain)
void setContactId(String contactId)
void setService(String service)
void setContact(IContact contact)
static WsMember from(String memberDomain, String service)
void setMemberId(Long memberId)
default void prepareSave()