directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cp...@apache.org
Subject [04/10] directory-fortress-core git commit: implemented update method
Date Mon, 28 Nov 2016 21:13:31 GMT
implemented update method


Project: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/commit/ea5f0231
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/tree/ea5f0231
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/diff/ea5f0231

Branch: refs/heads/master
Commit: ea5f0231e469178da91d83271304351e6b60272c
Parents: 8aff1cc
Author: clp207 <clp207@psu.edu>
Authored: Thu Oct 27 12:25:08 2016 -0400
Committer: clp207 <clp207@psu.edu>
Committed: Thu Oct 27 12:25:08 2016 -0400

----------------------------------------------------------------------
 .../fortress/core/impl/PropertyDAO.java         | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/ea5f0231/src/main/java/org/apache/directory/fortress/core/impl/PropertyDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/PropertyDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/PropertyDAO.java
index 051717b..15dcf16 100644
--- a/src/main/java/org/apache/directory/fortress/core/impl/PropertyDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/PropertyDAO.java
@@ -73,7 +73,25 @@ public class PropertyDAO extends LdapDataProvider
     }
     
     public FortEntity updateProperties( FortEntity entity, Properties properties, PropertyProvider
propProvider ) throws UpdateException, FinderException{ 
-        return null;
+        //ftProps all have same name, so will need to delete proprs first, then readd ones
that are approprirate
+        
+        //get current properties
+        Properties currentProps = this.getProperties( entity, propProvider );
+        Properties toDeleteProps = new Properties();
+        
+        //look for proeprties (ftProp=key:value) that are being updated and add to delete
list
+        for(Object key : properties.keySet()){
+            String value = currentProps.getProperty( (String)key );
+            toDeleteProps.put( (String)key, value );   
+        }
+        
+        //delete exising properties
+        this.deleteProperties( entity, toDeleteProps, propProvider );
+        
+        //add the udpates back
+        this.addProperties( entity, properties, propProvider );        
+        
+        return propProvider.getEntity( entity );
     }
     
     public void deleteProperties( FortEntity entity, Properties properties, PropertyProvider
propProvider ) throws UpdateException, FinderException{


Mime
View raw message