Author: mfranklin
Date: Wed May 30 19:50:25 2012
New Revision: 1344431

URL: http://svn.apache.org/viewvc?rev=1344431&view=rev
Log:
Updated organizations (RAVE-630)

Added:
    
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/JpaOrganization.java
      - copied, changed from r1344358, 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Organization.java
    
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Organization.java
    
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/JpaConverter.java
    
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/JpaOrganizationConverter.java
      - copied, changed from r1344358, 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/JpaAddressConverter.java
Modified:
    
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Address.java
    
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/JpaPerson.java
    
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Person.java
    
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/User.java
    
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/ConvertingListProxyFactory.java
    
rave/branches/model_interfaces/rave-components/rave-core/src/test/java/org/apache/rave/portal/model/conversion/ConvertingListProxyFactoryTest.java
    
rave/branches/model_interfaces/rave-providers/rave-opensocial-provider/rave-opensocial-core/src/main/java/org/apache/rave/opensocial/service/impl/FieldRestrictingPerson.java
    
rave/branches/model_interfaces/rave-providers/rave-opensocial-provider/rave-opensocial-core/src/main/resources/META-INF/persistence.xml

Modified: 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Address.java
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Address.java?rev=1344431&r1=1344430&r2=1344431&view=diff
==============================================================================
--- 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Address.java
 (original)
+++ 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Address.java
 Wed May 30 19:50:25 2012
@@ -1,11 +1,6 @@
 package org.apache.rave.portal.model;
 
 /**
- * Created with IntelliJ IDEA.
- * User: mfranklin
- * Date: 5/30/12
- * Time: 8:28 AM
- * To change this template use File | Settings | File Templates.
  */
 public interface Address {
     String getCountry();

Copied: 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/JpaOrganization.java
 (from r1344358, 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Organization.java)
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/JpaOrganization.java?p2=rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/JpaOrganization.java&p1=rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Organization.java&r1=1344358&r2=1344431&rev=1344431&view=diff
==============================================================================
--- 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Organization.java
 (original)
+++ 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/JpaOrganization.java
 Wed May 30 19:50:25 2012
@@ -26,8 +26,14 @@ import java.util.Date;
 /**
  */
 @Entity
+@NamedQueries(value = {
+        @NamedQuery(name = JpaOrganization.FIND_BY_NAME, query = "select o 
from JpaOrganization o where o.name like :name")
+})
 @Table(name = "organization")
-public class Organization implements BasicEntity {
+public class JpaOrganization implements BasicEntity, Organization {
+
+    public static final String FIND_BY_NAME = "findByName";
+    public static final String NAME_PARAM = "name";
 
     /**
      * The internal object ID used for references to this object. Should be 
generated by the
@@ -41,7 +47,7 @@ public class Organization implements Bas
     private Long entityId;
 
     @OneToOne
-    private Address address;
+    private JpaAddress address;
 
     @Basic
     @Column(name = "description", length = 255)
@@ -96,90 +102,116 @@ public class Organization implements Bas
         this.entityId = entityId;
     }
 
+    @Override
     public Address getAddress() {
         return address;
     }
 
+    @Override
     public void setAddress(Address address) {
-        this.address = address;
+        if(address instanceof JpaAddress) {
+            this.address = (JpaAddress)address;
+        } else {
+            throw new IllegalArgumentException("Setting non JPA Entities is 
currently not supported");
+        }
     }
 
+    @Override
     public String getDescription() {
         return description;
     }
 
+    @Override
     public void setDescription(String description) {
         this.description = description;
     }
 
+    @Override
     public Date getEndDate() {
         return endDate;
     }
 
+    @Override
     public void setEndDate(Date endDate) {
         this.endDate = endDate;
     }
 
+    @Override
     public String getField() {
         return field;
     }
 
+    @Override
     public void setField(String field) {
         this.field = field;
     }
 
+    @Override
     public String getName() {
         return name;
     }
 
+    @Override
     public void setName(String name) {
         this.name = name;
     }
 
+    @Override
     public Date getStartDate() {
         return startDate;
     }
 
+    @Override
     public void setStartDate(Date startDate) {
         this.startDate = startDate;
     }
 
+    @Override
     public String getSubField() {
         return subField;
     }
 
+    @Override
     public void setSubField(String subField) {
         this.subField = subField;
     }
 
+    @Override
     public String getTitle() {
         return title;
     }
 
+    @Override
     public void setTitle(String title) {
         this.title = title;
     }
 
+    @Override
     public String getWebpage() {
         return webpage;
     }
 
+    @Override
     public void setWebpage(String webpage) {
         this.webpage = webpage;
     }
 
+    @Override
     public String getQualifier() {
         return qualifier;
     }
 
+    @Override
     public void setQualifier(String qualifier) {
         this.qualifier = qualifier;
     }
 
+    @Override
     public Boolean getPrimary() {
         return primary;
     }
 
+    @Override
     public void setPrimary(Boolean primary) {
         this.primary = primary;
     }
@@ -189,7 +221,7 @@ public class Organization implements Bas
         if (this == o) return true;
         if (o == null || getClass() != o.getClass()) return false;
 
-        Organization that = (Organization) o;
+        JpaOrganization that = (JpaOrganization) o;
 
         if (entityId != null ? !entityId.equals(that.entityId) : that.entityId 
!= null) return false;
 

Modified: 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/JpaPerson.java
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/JpaPerson.java?rev=1344431&r1=1344430&r2=1344431&view=diff
==============================================================================
--- 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/JpaPerson.java
 (original)
+++ 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/JpaPerson.java
 Wed May 30 19:50:25 2012
@@ -104,7 +104,7 @@ public class JpaPerson implements BasicE
 
     @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, 
orphanRemoval = true)
     @JoinColumn(name="person_id", referencedColumnName = "entity_id")
-    protected List<Organization> organizations;
+    protected List<JpaOrganization> organizations;
 
     @OneToMany(targetEntity = PersonProperty.class)
     @JoinColumn(name = "person_id", referencedColumnName = "entity_id")
@@ -238,7 +238,7 @@ public class JpaPerson implements BasicE
     @Override
     @SuppressWarnings("unchecked")
     public List<Address> getAddresses() {
-        return 
ConvertingListProxyFactory.getInstance().createProxyList(Address.class, 
addresses);
+        return ConvertingListProxyFactory.createProxyList(Address.class, 
addresses);
     }
 
     @Override
@@ -263,7 +263,7 @@ public class JpaPerson implements BasicE
     @Override
     @SuppressWarnings("unchecked")
     public List<Person> getFriends() {
-        return 
ConvertingListProxyFactory.getInstance().createProxyList(Person.class, friends);
+        return ConvertingListProxyFactory.createProxyList(Person.class, 
friends);
     }
 
     @Override
@@ -277,20 +277,24 @@ public class JpaPerson implements BasicE
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     public List<Organization> getOrganizations() {
-        return organizations;
+        return ConvertingListProxyFactory.createProxyList(Organization.class, 
organizations);
     }
 
     @Override
     public void setOrganizations(List<Organization> organizations) {
-        this.organizations = organizations;
+        if(this.organizations == null) {
+            this.organizations = new ArrayList<JpaOrganization>();
+        }
+        this.getOrganizations().clear();
+        this.getOrganizations().addAll(organizations);
     }
 
     @Override
     public boolean equals(Object o) {
         if (this == o) return true;
         if (o == null || getClass() != o.getClass()) return false;
-
         JpaPerson person = (JpaPerson) o;
 
         if (entityId != null ? !entityId.equals(person.entityId) : 
person.entityId != null) return false;

Added: 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Organization.java
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Organization.java?rev=1344431&view=auto
==============================================================================
--- 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Organization.java
 (added)
+++ 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Organization.java
 Wed May 30 19:50:25 2012
@@ -0,0 +1,51 @@
+package org.apache.rave.portal.model;
+
+import java.util.Date;
+
+/**
+ */
+public interface Organization {
+    Address getAddress();
+
+    void setAddress(Address address);
+
+    String getDescription();
+
+    void setDescription(String description);
+
+    Date getEndDate();
+
+    void setEndDate(Date endDate);
+
+    String getField();
+
+    void setField(String field);
+
+    String getName();
+
+    void setName(String name);
+
+    Date getStartDate();
+
+    void setStartDate(Date startDate);
+
+    String getSubField();
+
+    void setSubField(String subField);
+
+    String getTitle();
+
+    void setTitle(String title);
+
+    String getWebpage();
+
+    void setWebpage(String webpage);
+
+    String getQualifier();
+
+    void setQualifier(String qualifier);
+
+    Boolean getPrimary();
+
+    void setPrimary(Boolean primary);
+}

Modified: 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Person.java
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Person.java?rev=1344431&r1=1344430&r2=1344431&view=diff
==============================================================================
--- 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Person.java
 (original)
+++ 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Person.java
 Wed May 30 19:50:25 2012
@@ -3,11 +3,6 @@ package org.apache.rave.portal.model;
 import java.util.List;
 
 /**
- * Created with IntelliJ IDEA.
- * User: mfranklin
- * Date: 5/29/12
- * Time: 1:53 PM
- * To change this template use File | Settings | File Templates.
  */
 public interface Person {
     String getUsername();

Modified: 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/User.java
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/User.java?rev=1344431&r1=1344430&r2=1344431&view=diff
==============================================================================
--- 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/User.java
 (original)
+++ 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/User.java
 Wed May 30 19:50:25 2012
@@ -365,7 +365,7 @@ public class User extends JpaPerson impl
         p.setGivenName(this.getGivenName());
         p.setHonorificPrefix(this.getHonorificPrefix());
         p.setHonorificSuffix(this.getHonorificSuffix());
-        p.setOrganizations(this.getOrganizations());
+        //p.setOrganizations(this.getOrganizations());
         p.setPreferredName(this.getPreferredName());
         p.setProperties(this.getProperties());
         p.setStatus(this.getStatus());

Modified: 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/ConvertingListProxyFactory.java
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/ConvertingListProxyFactory.java?rev=1344431&r1=1344430&r2=1344431&view=diff
==============================================================================
--- 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/ConvertingListProxyFactory.java
 (original)
+++ 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/ConvertingListProxyFactory.java
 Wed May 30 19:50:25 2012
@@ -1,16 +1,11 @@
 package org.apache.rave.portal.model.conversion;
 
-import org.apache.rave.model.ModelConverter;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.convert.converter.Converter;
 import org.springframework.stereotype.Component;
 
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 /**
  * Creates a {@link java.util.List} proxy that converts the added object to an 
entity
@@ -18,48 +13,25 @@ import java.util.Map;
 @Component
 public class ConvertingListProxyFactory {
 
-    //Workaround for inability to access spring context without a lot of 
machinery
-    //Will allow for a getInstance method to be called.  this is needed 
because the
-    //Converters are all Spring beans with their own dependencies.
-    private static ConvertingListProxyFactory instance;
-
-    Map<Class<?>, Converter> converterMap;
-
-    @Autowired
-    public ConvertingListProxyFactory(List<ModelConverter> converters) {
-        converterMap = new HashMap<Class<?>, Converter>();
-        for(ModelConverter converter : converters) {
-            converterMap.put(converter.getSourceType(), converter);
-        }
-        instance = this;
-    }
-
     @SuppressWarnings("unchecked")
-    public <E, T extends E> List createProxyList(Class<E> targetType, List<T> 
underlyingList) {
-        return (List) Proxy.newProxyInstance(this.getClass().getClassLoader(),
+    public static <E, T extends E> List createProxyList(Class<E> targetType, 
List<T> underlyingList) {
+        return (List) 
Proxy.newProxyInstance(ConvertingListProxyFactory.class.getClassLoader(),
                 new Class<?>[]{List.class},
-                new ConvertingListInvocationHandler<E, 
T>(converterMap.get(targetType), underlyingList));
-    }
-
-    public static ConvertingListProxyFactory getInstance() {
-        if(instance == null) {
-            throw new IllegalStateException("Proxy factory not yet set by the 
Spring context");
-        }
-        return instance;
+                new ConvertingListInvocationHandler<E, T>(underlyingList, 
targetType));
     }
 
-
     public static class ConvertingListInvocationHandler<S,T> implements 
InvocationHandler {
 
         public static final String ADD_METHOD = "add";
         public static final String SET_METHOD = "set";
         public static final String ADD_ALL_METHOD = "addAll";
 
-        private Converter<S, T> converter;
         private List<T> underlying;
-        public ConvertingListInvocationHandler(Converter<S, T> converter, 
List<T> underlying) {
-            this.converter = converter;
+        private Class<S> targetClass;
+
+        public ConvertingListInvocationHandler(List<T> underlying, Class<S> 
targetClass) {
             this.underlying = underlying;
+            this.targetClass = targetClass;
         }
 
         @Override
@@ -68,7 +40,7 @@ public class ConvertingListProxyFactory 
             String methodName = method.getName();
             int convertIndex = method.getParameterTypes().length == 1 ? 0 : 1;
             if(ADD_METHOD.equals(methodName) || SET_METHOD.equals(methodName)) 
{
-                parameters[convertIndex] = 
converter.convert((S)parameters[convertIndex]);
+                parameters[convertIndex] = 
JpaConverter.getInstance().convert((S)parameters[convertIndex], targetClass);
             } else if(ADD_ALL_METHOD.equals(methodName)) {
                 convertAll((List)parameters[convertIndex]);
             }
@@ -78,7 +50,7 @@ public class ConvertingListProxyFactory 
         @SuppressWarnings("unchecked")
         private void convertAll(List<S> parameter) {
             for(int i=0; i<parameter.size(); i++) {
-                parameter.set(i, (S)converter.convert(parameter.get(i)));
+                parameter.set(i, 
(S)JpaConverter.getInstance().convert(parameter.get(i), targetClass));
             }
         }
     }

Added: 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/JpaConverter.java
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/JpaConverter.java?rev=1344431&view=auto
==============================================================================
--- 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/JpaConverter.java
 (added)
+++ 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/JpaConverter.java
 Wed May 30 19:50:25 2012
@@ -0,0 +1,50 @@
+package org.apache.rave.portal.model.conversion;
+
+import org.apache.rave.model.ModelConverter;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.convert.converter.Converter;
+import org.springframework.stereotype.Component;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Converts objects into their JPA representations by delegating to wired in 
components
+ */
+@Component
+public class JpaConverter {
+    //Workaround for inability to access spring context without a lot of 
machinery
+    //Will allow for a getInstance method to be called.  this is needed 
because the
+    //Converters are all Spring beans with their own dependencies.
+    private static JpaConverter instance;
+
+    Map<Class<?>, Converter> converterMap;
+
+    @Autowired
+    public JpaConverter(List<ModelConverter> converters) {
+        converterMap = new HashMap<Class<?>, Converter>();
+        for(ModelConverter converter : converters) {
+            converterMap.put(converter.getSourceType(), converter);
+        }
+        instance = this;
+    }
+
+    @SuppressWarnings("unchecked")
+    public <S, T> T convert(S source, Class<S> clazz) {
+        return (T)converterMap.get(clazz).convert(source);
+    }
+
+    @SuppressWarnings("unchecked")
+    public <S,T> Converter<S, T> getConverter(Class<S> clazz) {
+        return converterMap.get(clazz);
+    }
+
+    public static JpaConverter getInstance() {
+        if(instance == null) {
+            throw new IllegalStateException("Conversion factory not set by the 
Spring context");
+        }
+        return instance;
+    }
+
+}

Copied: 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/JpaOrganizationConverter.java
 (from r1344358, 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/JpaAddressConverter.java)
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/JpaOrganizationConverter.java?p2=rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/JpaOrganizationConverter.java&p1=rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/JpaAddressConverter.java&r1=1344358&r2=1344431&rev=1344431&view=diff
==============================================================================
--- 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/JpaAddressConverter.java
 (original)
+++ 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/JpaOrganizationConverter.java
 Wed May 30 19:50:25 2012
@@ -1,8 +1,8 @@
 package org.apache.rave.portal.model.conversion;
 
 import org.apache.rave.model.ModelConverter;
-import org.apache.rave.portal.model.Address;
-import org.apache.rave.portal.model.JpaAddress;
+import org.apache.rave.portal.model.JpaOrganization;
+import org.apache.rave.portal.model.Organization;
 import org.springframework.stereotype.Component;
 
 import javax.persistence.EntityManager;
@@ -15,46 +15,45 @@ import static org.apache.rave.persistenc
  * Converts an Address to a JpaAddress
  */
 @Component
-public class JpaAddressConverter implements ModelConverter<Address, 
JpaAddress> {
+public class JpaOrganizationConverter implements ModelConverter<Organization, 
JpaOrganization> {
 
     @PersistenceContext
     private EntityManager manager;
 
     @Override
-    public Class<Address> getSourceType() {
-        return Address.class;
+    public Class<Organization> getSourceType() {
+        return Organization.class;
     }
 
     @Override
-    public JpaAddress convert(Address source) {
-        return source instanceof JpaAddress ? (JpaAddress)source : 
createEntity(source);
+    public JpaOrganization convert(Organization source) {
+        return source instanceof JpaOrganization ? (JpaOrganization)source : 
createEntity(source);
     }
 
-    private JpaAddress createEntity(Address source) {
-        JpaAddress converted;
-        TypedQuery<JpaAddress> query = 
manager.createNamedQuery(JpaAddress.FIND_BY_STREET_CITY_COUNTRY, 
JpaAddress.class);
-        query.setParameter(JpaAddress.STREET_PARAM, source.getStreetAddress());
-        query.setParameter(JpaAddress.CITY_PARAM, source.getLocality());
-        query.setParameter(JpaAddress.COUNTRY_PARAM, source.getCountry());
+    private JpaOrganization createEntity(Organization source) {
+        JpaOrganization converted;
+        TypedQuery<JpaOrganization> query = 
manager.createNamedQuery(JpaOrganization.FIND_BY_NAME, JpaOrganization.class);
+        query.setParameter(JpaOrganization.NAME_PARAM, source.getName());
         converted = getSingleResult(query.getResultList());
 
         if(converted == null) {
-            converted = new JpaAddress();
+            converted = new JpaOrganization();
         }
         updateProperties(source, converted);
         return converted;
     }
 
-    private void updateProperties(Address source, JpaAddress converted) {
-        converted.setCountry(source.getCountry());
-        converted.setLatitude(source.getLatitude());
-        converted.setLongitude(source.getLongitude());
-        converted.setLocality(source.getLocality());
-        converted.setPostalCode(source.getPostalCode());
-        converted.setRegion(source.getRegion());
-        converted.setStreetAddress(source.getStreetAddress());
+    private void updateProperties(Organization source, JpaOrganization 
converted) {
+        converted.setAddress(source.getAddress());
+        converted.setDescription(source.getDescription());
+        converted.setEndDate(source.getEndDate());
+        converted.setField(source.getField());
+        converted.setName(source.getName());
+        converted.setStartDate(source.getStartDate());
+        converted.setSubField(source.getSubField());
+        converted.setTitle(source.getTitle());
+        converted.setWebpage(source.getWebpage());
         converted.setQualifier(source.getQualifier());
-        converted.setFormatted(source.getFormatted());
         converted.setPrimary(source.getPrimary());
     }
 }

Modified: 
rave/branches/model_interfaces/rave-components/rave-core/src/test/java/org/apache/rave/portal/model/conversion/ConvertingListProxyFactoryTest.java
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-components/rave-core/src/test/java/org/apache/rave/portal/model/conversion/ConvertingListProxyFactoryTest.java?rev=1344431&r1=1344430&r2=1344431&view=diff
==============================================================================
--- 
rave/branches/model_interfaces/rave-components/rave-core/src/test/java/org/apache/rave/portal/model/conversion/ConvertingListProxyFactoryTest.java
 (original)
+++ 
rave/branches/model_interfaces/rave-components/rave-core/src/test/java/org/apache/rave/portal/model/conversion/ConvertingListProxyFactoryTest.java
 Wed May 30 19:50:25 2012
@@ -17,10 +17,6 @@ import static org.junit.Assert.assertTha
  */
 public class ConvertingListProxyFactoryTest {
 
-    @Test(expected = IllegalStateException.class)
-    public void unsetInstance() {
-        ConvertingListProxyFactory.getInstance();
-    }
 
     @Test
     public void createProxy() {
@@ -29,10 +25,10 @@ public class ConvertingListProxyFactoryT
         
expect(converterMock.getSourceType()).andReturn(Person.class).anyTimes();
         converters.add(converterMock);
         replay(converterMock);
+        new JpaConverter(converters);
         List<PersonImpl> underlying = new ArrayList<PersonImpl>();
-        new ConvertingListProxyFactory(converters);
 
-        List<Person> personProxy = 
ConvertingListProxyFactory.getInstance().createProxyList(Person.class, 
underlying);
+        List<Person> personProxy = 
ConvertingListProxyFactory.createProxyList(Person.class, underlying);
         assertThat(Proxy.isProxyClass(personProxy.getClass()), is(true));
     }
 
@@ -49,10 +45,10 @@ public class ConvertingListProxyFactoryT
         List<PersonImpl> underlying = createMock(List.class);
         expect(underlying.add(personImpl2)).andReturn(true);
         replay(underlying);
-        new ConvertingListProxyFactory(converters);
+        new JpaConverter(converters);
 
 
-        List<Person> personProxy = 
ConvertingListProxyFactory.getInstance().createProxyList(Person.class, 
underlying);
+        List<Person> personProxy = 
ConvertingListProxyFactory.createProxyList(Person.class, underlying);
         Boolean good = personProxy.add(personImpl1);
         assertThat(good, is(true));
         verify(converterMock);
@@ -72,9 +68,9 @@ public class ConvertingListProxyFactoryT
         List<PersonImpl> underlying = createMock(List.class);
         expect(underlying.set(0, 
(PersonImpl)personImpl2)).andReturn((PersonImpl) personImpl2);
         replay(underlying);
-        new ConvertingListProxyFactory(converters);
+        new JpaConverter(converters);
 
-        List<Person> personProxy = 
ConvertingListProxyFactory.getInstance().createProxyList(Person.class, 
underlying);
+        List<Person> personProxy = 
ConvertingListProxyFactory.createProxyList(Person.class, underlying);
         Person good = personProxy.set(0, personImpl1);
         assertThat(good, is(sameInstance(personImpl2)));
         verify(converterMock);
@@ -104,9 +100,9 @@ public class ConvertingListProxyFactoryT
         List<PersonImpl> underlying = createMock(List.class);
         expect(underlying.addAll(isA(List.class))).andReturn(true);
         replay(underlying);
-        new ConvertingListProxyFactory(converters);
+        new JpaConverter(converters);
 
-        List<Person> personProxy = 
ConvertingListProxyFactory.getInstance().createProxyList(Person.class, 
underlying);
+        List<Person> personProxy = 
ConvertingListProxyFactory.createProxyList(Person.class, underlying);
         Boolean good = personProxy.addAll(toAdd);
         assertThat(good, is(true));
         verify(converterMock);

Modified: 
rave/branches/model_interfaces/rave-providers/rave-opensocial-provider/rave-opensocial-core/src/main/java/org/apache/rave/opensocial/service/impl/FieldRestrictingPerson.java
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-providers/rave-opensocial-provider/rave-opensocial-core/src/main/java/org/apache/rave/opensocial/service/impl/FieldRestrictingPerson.java?rev=1344431&r1=1344430&r2=1344431&view=diff
==============================================================================
--- 
rave/branches/model_interfaces/rave-providers/rave-opensocial-provider/rave-opensocial-core/src/main/java/org/apache/rave/opensocial/service/impl/FieldRestrictingPerson.java
 (original)
+++ 
rave/branches/model_interfaces/rave-providers/rave-opensocial-provider/rave-opensocial-core/src/main/java/org/apache/rave/opensocial/service/impl/FieldRestrictingPerson.java
 Wed May 30 19:50:25 2012
@@ -27,6 +27,7 @@ import org.apache.rave.util.CollectionUt
 import org.apache.shindig.protocol.model.Enum;
 import org.apache.shindig.protocol.model.EnumImpl;
 import org.apache.shindig.social.core.model.*;
+import org.apache.shindig.social.core.model.AddressImpl;
 import org.apache.shindig.social.opensocial.model.*;
 import org.apache.shindig.social.opensocial.model.Address;
 import org.apache.shindig.social.opensocial.model.Organization;

Modified: 
rave/branches/model_interfaces/rave-providers/rave-opensocial-provider/rave-opensocial-core/src/main/resources/META-INF/persistence.xml
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-providers/rave-opensocial-provider/rave-opensocial-core/src/main/resources/META-INF/persistence.xml?rev=1344431&r1=1344430&r2=1344431&view=diff
==============================================================================
--- 
rave/branches/model_interfaces/rave-providers/rave-opensocial-provider/rave-opensocial-core/src/main/resources/META-INF/persistence.xml
 (original)
+++ 
rave/branches/model_interfaces/rave-providers/rave-opensocial-provider/rave-opensocial-core/src/main/resources/META-INF/persistence.xml
 Wed May 30 19:50:25 2012
@@ -28,7 +28,7 @@
       <class>org.apache.rave.portal.model.PersonAssociation</class>
       <class>org.apache.rave.portal.model.PersonProperty</class>
       <class>org.apache.rave.portal.model.JpaAddress</class>
-      <class>org.apache.rave.portal.model.Organization</class>
+      <class>org.apache.rave.portal.model.JpaOrganization</class>
       <class>org.apache.rave.opensocial.model.ApplicationData</class>
       
<class>org.apache.rave.opensocial.repository.impl.JpaApplicationDataRepository$JpaSerializableApplicationData</class>
       <class>org.apache.rave.gadgets.oauth.model.OAuthTokenInfo</class>


Reply via email to