1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.exoplatform.social.core.chromattic.entity;
19
20 import java.util.List;
21 import java.util.Map;
22
23 import org.chromattic.api.annotations.Create;
24 import org.chromattic.api.annotations.FormattedBy;
25 import org.chromattic.api.annotations.Id;
26 import org.chromattic.api.annotations.MappedBy;
27 import org.chromattic.api.annotations.NamingPrefix;
28 import org.chromattic.api.annotations.OneToMany;
29 import org.chromattic.api.annotations.OneToOne;
30 import org.chromattic.api.annotations.Owner;
31 import org.chromattic.api.annotations.PrimaryType;
32 import org.chromattic.api.annotations.Properties;
33 import org.chromattic.api.annotations.Property;
34 import org.chromattic.ext.format.BaseEncodingObjectFormatter;
35 import org.chromattic.ext.ntdef.NTFile;
36 import org.exoplatform.social.core.storage.query.PropertyLiteralExpression;
37
38
39
40
41
42 @PrimaryType(name = "soc:profiledefinition")
43 @FormattedBy(BaseEncodingObjectFormatter.class)
44 @NamingPrefix("soc")
45 public abstract class ProfileEntity {
46
47 @Id
48 public abstract String getId();
49
50
51
52
53 @MappedBy("soc:avatar")
54 @OneToOne
55 @Owner
56 public abstract NTFile getAvatar();
57 public abstract void setAvatar(NTFile avatar);
58
59 @MappedBy("soc:profile")
60 @OneToOne
61 public abstract IdentityEntity getIdentity();
62 public abstract void setIdentity(IdentityEntity identity);
63
64 @MappedBy("soc:activityprofile")
65 @OneToOne
66 @Owner
67 public abstract ActivityProfileEntity getActivityProfile();
68 public abstract void setActivityProfile(ActivityProfileEntity entity);
69
70
71
72
73
74
75
76 @Property(name = "soc:externalUrl")
77 public abstract String getExternalUrl();
78 public abstract void setExternalUrl(String profileUrl);
79
80
81
82
83
84
85
86 @Property(name = "soc:externalAvatarUrl")
87 public abstract String getExternalAvatarUrl();
88 public abstract void setExternalAvatarUrl(String avatarUrl);
89
90
91
92
93
94
95 @Property(name = "soc:parentId")
96 public abstract String getParentId();
97 public abstract void setParentId(String parentid);
98 public static final PropertyLiteralExpression<String> parentId =
99 new PropertyLiteralExpression<String>(String.class, "soc:parentId");
100
101
102
103
104 @Property(name = "soc:createdTime")
105 public abstract Long getCreatedTime();
106 public abstract void setCreatedTime(Long createdTime);
107 public static final PropertyLiteralExpression<Long> createdTime =
108 new PropertyLiteralExpression<Long>(Long.class, "soc:createdTime");
109
110
111
112
113 @OneToMany
114 @Owner
115 public abstract Map<String, ProfileXpEntity> getXps();
116
117 @Properties
118 public abstract Map<String, List<String>> getProperties();
119 public static final PropertyLiteralExpression<String> firstName =
120 new PropertyLiteralExpression<String>(String.class, "void-firstName");
121
122 public static final PropertyLiteralExpression<String> lastName =
123 new PropertyLiteralExpression<String>(String.class, "void-lastName");
124
125 public static final PropertyLiteralExpression<String> fullName =
126 new PropertyLiteralExpression<String>(String.class, "void-fullName");
127
128 public static final PropertyLiteralExpression<String> aboutMe =
129 new PropertyLiteralExpression<String>(String.class, "void-aboutMe");
130
131 public static final PropertyLiteralExpression<String> position =
132 new PropertyLiteralExpression<String>(String.class, "void-position");
133
134 public static final PropertyLiteralExpression<String> gender =
135 new PropertyLiteralExpression<String>(String.class, "void-gender");
136
137 public static final PropertyLiteralExpression<String> deleted =
138 new PropertyLiteralExpression<String>(String.class, "void-deleted");
139
140 public static final PropertyLiteralExpression<String> skills =
141 new PropertyLiteralExpression<String>(String.class, "index-skills");
142
143 public static final PropertyLiteralExpression<String> positions =
144 new PropertyLiteralExpression<String>(String.class, "index-position");
145
146 public static final PropertyLiteralExpression<String> organizations =
147 new PropertyLiteralExpression<String>(String.class, "index-company");
148
149 public static final PropertyLiteralExpression<String> jobsDescription =
150 new PropertyLiteralExpression<String>(String.class, "index-description");
151
152 @Create
153 public abstract NTFile createAvatar();
154
155 @Create
156 public abstract ProfileXpEntity createXp();
157
158 @Create
159 public abstract ActivityProfileEntity createActivityProfile();
160
161 public List<String> getProperty(String key) {
162 return getProperties().get(key);
163 }
164
165 public void setProperty(String key, List<String> value) {
166 getProperties().put(key, value);
167 }
168
169 public String getPropertyFirst(String key) {
170 List<String> value = getProperties().get(key);
171 return (value.size() > 0 ? value.get(0) : null);
172 }
173 }