rave-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfrank...@apache.org
Subject svn commit: r1199400 - in /incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model: Address.java Person.java PersonProperty.java
Date Tue, 08 Nov 2011 19:28:46 GMT
Author: mfranklin
Date: Tue Nov  8 19:28:46 2011
New Revision: 1199400

URL: http://svn.apache.org/viewvc?rev=1199400&view=rev
Log:
Added new Person classes (Supports RAVE-342)

Added:
    incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Address.java
    incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Person.java
    incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/PersonProperty.java

Added: incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Address.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Address.java?rev=1199400&view=auto
==============================================================================
--- incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Address.java
(added)
+++ incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Address.java
Tue Nov  8 19:28:46 2011
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.rave.portal.model;
+
+import org.apache.rave.persistence.BasicEntity;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+
+/**
+ */
+@Entity
+@Table(name = "address")
+public class Address {
+
+    @Id
+    @Column(name = "entity_id")
+    @GeneratedValue(strategy = GenerationType.TABLE, generator = "addressIdGenerator")
+    @TableGenerator(name = "addressIdGenerator", table = "RAVE_SHINDIG_SEQUENCES", pkColumnName
= "SEQ_NAME",
+            valueColumnName = "SEQ_COUNT", pkColumnValue = "address", allocationSize = 1,
initialValue = 1)
+    private Long entityId;
+
+    @Basic
+    @Column(name = "country", length = 255)
+    private String country;
+
+    @Basic
+    @Column(name = "latitude")
+    private Float latitude;
+
+    @Basic
+    @Column(name = "longitude")
+    private Float longitude;
+
+    @Basic
+    @Column(name = "locality", length = 255)
+    private String locality;
+
+    @Basic
+    @Column(name = "postal_code", length = 255)
+    private String postalCode;
+
+    @Basic
+    @Column(name = "region", length = 255)
+    private String region;
+
+    @Basic
+    @Column(name = "street_address", length = 255)
+    private String streetAddress;
+
+    @Basic
+    @Column(name = "qualifier", length = 255)
+    private String qualifier;
+
+    @Basic
+    @Column(name = "formatted", length = 255)
+    private String formatted;
+
+    @Basic
+    @Column(name = "primary_address")
+    private Boolean primary;
+
+    public Long getEntityId() {
+        return entityId;
+    }
+
+    public void setEntityId(Long entityId) {
+        this.entityId = entityId;
+    }
+
+    public String getCountry() {
+        return country;
+    }
+
+    public void setCountry(String country) {
+        this.country = country;
+    }
+
+    public Float getLatitude() {
+        return latitude;
+    }
+
+    public void setLatitude(Float latitude) {
+        this.latitude = latitude;
+    }
+
+    public Float getLongitude() {
+        return longitude;
+    }
+
+    public void setLongitude(Float longitude) {
+        this.longitude = longitude;
+    }
+
+    public String getLocality() {
+        return locality;
+    }
+
+    public void setLocality(String locality) {
+        this.locality = locality;
+    }
+
+    public String getPostalCode() {
+        return postalCode;
+    }
+
+    public void setPostalCode(String postalCode) {
+        this.postalCode = postalCode;
+    }
+
+    public String getRegion() {
+        return region;
+    }
+
+    public void setRegion(String region) {
+        this.region = region;
+    }
+
+    public String getStreetAddress() {
+        return streetAddress;
+    }
+
+    public void setStreetAddress(String streetAddress) {
+        this.streetAddress = streetAddress;
+    }
+
+    public String getQualifier() {
+        return qualifier;
+    }
+
+    public void setQualifier(String qualifier) {
+        this.qualifier = qualifier;
+    }
+
+    public String getFormatted() {
+        return formatted;
+    }
+
+    public void setFormatted(String formatted) {
+        this.formatted = formatted;
+    }
+
+    public Boolean getPrimary() {
+        return primary;
+    }
+
+    public void setPrimary(Boolean primary) {
+        this.primary = primary;
+    }
+}

Added: incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Person.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Person.java?rev=1199400&view=auto
==============================================================================
--- incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Person.java
(added)
+++ incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Person.java
Tue Nov  8 19:28:46 2011
@@ -0,0 +1,243 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.rave.portal.model;
+
+import org.apache.rave.persistence.BasicEntity;
+
+import javax.persistence.*;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Represents a person in the persistence context
+ */
+@Entity
+@Table(name = "raveuser")
+@NamedQueries(value = {
+    @NamedQuery(name = Person.FIND_BY_USERNAME, query = "select p from Person p where p.username
like :username"),
+    @NamedQuery(name = Person.FIND_FRIENDS_BY_USERNAME, query = "select a.followed from PersonAssociation
a where a.follower.username = :username"),
+    @NamedQuery(name = Person.FIND_BY_GROUP_MEMBERSHIP, query = "select m from Group g join
g.members m where exists " +
+            "(select 'found' from g.members b where b.username = :username) and m.username
<> :username")
+})
+public class Person implements BasicEntity {
+
+    public static final String FIND_BY_USERNAME = "Person.findByUsername";
+    public static final String FIND_FRIENDS_BY_USERNAME = "Person.findFriendsByUsername";
+    public static final String FIND_BY_GROUP_MEMBERSHIP = "Person.findByGroupMembership";
+    public static final String USERNAME_PARAM = "username";
+
+    @Id
+    @Column(name = "entity_id")
+    @GeneratedValue(strategy = GenerationType.TABLE, generator = "personIdGenerator")
+    @TableGenerator(name = "personIdGenerator", table = "RAVE_PORTAL_SEQUENCES", pkColumnName
= "SEQ_NAME",
+            valueColumnName = "SEQ_COUNT", pkColumnValue = "raveuser", allocationSize = 1,
initialValue = 1)
+    private Long entityId;
+
+    @Basic
+    @Column(name = "username", unique = true)
+    private String username;
+
+    @Basic
+    @Column(name = "email", unique = true)
+    private String email;
+
+    @Basic
+    @Column(name = "display_name")
+    private String displayName;
+
+    @Basic
+    @Column(name = "additional_name", length = 255)
+    private String additionalName;
+
+    @Basic
+    @Column(name = "family_name", length = 255)
+    private String familyName;
+
+    @Basic
+    @Column(name = "given_name", length = 255)
+    private String givenName;
+
+    @Basic
+    @Column(name = "honorific_prefix", length = 255)
+    private String honorificPrefix;
+
+    @Basic
+    @Column(name = "honorific_suffix", length = 255)
+    private String honorificSuffix;
+
+    @Basic
+    @Column(name = "preferred_name")
+    private String preferredName;
+
+    @Basic
+    @Column(name = "about_me")
+    private String aboutMe;
+
+    @Basic
+    @Column(name = "status")
+    private String status;
+
+    @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true)
+    @JoinTable(name = "person_address_join",
+            joinColumns = @JoinColumn(name = "address_id", referencedColumnName = "entity_id"),
+            inverseJoinColumns = @JoinColumn(name="person_id", referencedColumnName = "entity_id"))
+    private List<Address> addresses;
+
+    @OneToMany(targetEntity = PersonProperty.class)
+    @JoinColumn(name = "person_id", referencedColumnName = "entity_id")
+    private List<PersonProperty> properties;
+
+    @ManyToMany(fetch = FetchType.LAZY)
+    @JoinTable(name = "person_friends_jn",
+            joinColumns = @JoinColumn(name = "follower_id", referencedColumnName = "entity_id"),
+            inverseJoinColumns = @JoinColumn(name = "followed_id", referencedColumnName =
"entity_id"))
+    private List<Person> friends;
+
+    @Transient
+    private Map<String, List<PersonProperty>> mappedProperties;
+
+    public Long getEntityId() {
+        return entityId;
+    }
+
+    public void setEntityId(Long entityId) {
+        this.entityId = entityId;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public String getDisplayName() {
+        return displayName;
+    }
+
+    public void setDisplayName(String displayName) {
+        this.displayName = displayName;
+    }
+
+    public String getAboutMe() {
+        return aboutMe;
+    }
+
+    public void setAboutMe(String aboutMe) {
+        this.aboutMe = aboutMe;
+    }
+
+    public String getPreferredName() {
+        return preferredName;
+    }
+
+    public void setPreferredName(String preferredName) {
+        this.preferredName = preferredName;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getAdditionalName() {
+        return additionalName;
+    }
+
+    public void setAdditionalName(String additionalName) {
+        this.additionalName = additionalName;
+    }
+
+    public String getFamilyName() {
+        return familyName;
+    }
+
+    public void setFamilyName(String familyName) {
+        this.familyName = familyName;
+    }
+
+    public String getGivenName() {
+        return givenName;
+    }
+
+    public void setGivenName(String givenName) {
+        this.givenName = givenName;
+    }
+
+    public String getHonorificPrefix() {
+        return honorificPrefix;
+    }
+
+    public void setHonorificPrefix(String honorificPrefix) {
+        this.honorificPrefix = honorificPrefix;
+    }
+
+    public String getHonorificSuffix() {
+        return honorificSuffix;
+    }
+
+    public void setHonorificSuffix(String honorificSuffix) {
+        this.honorificSuffix = honorificSuffix;
+    }
+
+    public List<Address> getAddresses() {
+        return addresses;
+    }
+
+    public void setAddresses(List<Address> addresses) {
+        this.addresses = addresses;
+    }
+
+    public List<PersonProperty> getProperties() {
+        return properties;
+    }
+
+    public void setProperties(List<PersonProperty> properties) {
+        this.properties = properties;
+    }
+
+    public List<Person> getFriends() {
+        return friends;
+    }
+
+    public void setFriends(List<Person> friends) {
+        this.friends = friends;
+    }
+
+    public Map<String, List<PersonProperty>> getMappedProperties() {
+        return mappedProperties;
+    }
+
+    public void setMappedProperties(Map<String, List<PersonProperty>> mappedProperties)
{
+        this.mappedProperties = mappedProperties;
+    }
+}
+

Added: incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/PersonProperty.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/PersonProperty.java?rev=1199400&view=auto
==============================================================================
--- incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/PersonProperty.java
(added)
+++ incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/PersonProperty.java
Tue Nov  8 19:28:46 2011
@@ -0,0 +1,73 @@
+package org.apache.rave.portal.model;
+
+import org.apache.rave.persistence.BasicEntity;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "person_property")
+public class PersonProperty implements BasicEntity {
+
+    @Id
+    @Column(name = "entity_id")
+    @GeneratedValue(strategy = GenerationType.TABLE, generator = "personPropertyIdGenerator")
+    @TableGenerator(name = "personPropertyIdGenerator", table = "RAVE_PORTAL_SEQUENCES",
pkColumnName = "SEQ_NAME",
+            valueColumnName = "SEQ_COUNT", pkColumnValue = "person_property", allocationSize
= 1, initialValue = 1)
+    private Long entityId;
+
+    @Basic
+    @Column(name = "type")
+    private String type;
+
+    @Basic
+    @Column(name = "value")
+    private String value;
+
+    @Basic
+    @Column(name = "qualifier")
+    private String qualifier;
+
+    @Basic
+    @Column(name = "primary_value")
+    private Boolean primary;
+
+    public Long getEntityId() {
+        return entityId;
+    }
+
+    public void setEntityId(Long entityId) {
+        this.entityId = entityId;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public String getQualifier() {
+        return qualifier;
+    }
+
+    public void setQualifier(String qualifier) {
+        this.qualifier = qualifier;
+    }
+
+    public Boolean getPrimary() {
+        return primary;
+    }
+
+    public void setPrimary(Boolean primary) {
+        this.primary = primary;
+    }
+}
\ No newline at end of file



Mime
View raw message