cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject [1/2] git commit: updated refs/heads/4.3 to abb95c1
Date Mon, 25 Nov 2013 23:31:55 GMT
Updated Branches:
  refs/heads/4.3 437f49cf8 -> abb95c101


Resource metadata - fixed the bug in removeResourceDetail API - when "key" parameter was passed
in, used to remove the details matching the key, for all the resources, not just the one defined
by resource_id


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/abb95c10
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/abb95c10
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/abb95c10

Branch: refs/heads/4.3
Commit: abb95c10166dcbc3f842b91a972e3ebb5570ebbc
Parents: f5c29c0
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Mon Nov 25 14:36:02 2013 -0800
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Mon Nov 25 15:30:55 2013 -0800

----------------------------------------------------------------------
 .../resourcedetail/ResourceDetailsDaoBase.java  | 26 ++++++++------------
 1 file changed, 10 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/abb95c10/engine/schema/src/org/apache/cloudstack/resourcedetail/ResourceDetailsDaoBase.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/ResourceDetailsDaoBase.java
b/engine/schema/src/org/apache/cloudstack/resourcedetail/ResourceDetailsDaoBase.java
index 4ecebf8..2d08644 100644
--- a/engine/schema/src/org/apache/cloudstack/resourcedetail/ResourceDetailsDaoBase.java
+++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/ResourceDetailsDaoBase.java
@@ -27,10 +27,9 @@ import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.db.TransactionLegacy;
 
-
-public abstract class ResourceDetailsDaoBase<R extends ResourceDetail> extends GenericDaoBase<R,
Long>{
+public abstract class ResourceDetailsDaoBase<R extends ResourceDetail> extends GenericDaoBase<R,
Long> {
     private SearchBuilder<R> AllFieldsSearch;
-    
+
     public ResourceDetailsDaoBase() {
         AllFieldsSearch = createSearchBuilder();
         AllFieldsSearch.and("resourceId", AllFieldsSearch.entity().getResourceId(), SearchCriteria.Op.EQ);
@@ -43,15 +42,14 @@ public abstract class ResourceDetailsDaoBase<R extends ResourceDetail>
extends G
         SearchCriteria<R> sc = AllFieldsSearch.create();
         sc.setParameters("resourceId", resourceId);
         sc.setParameters("name", name);
-        
+
         return findOneBy(sc);
     }
 
-
     public Map<String, String> listDetailsKeyPairs(long resourceId) {
         SearchCriteria<R> sc = AllFieldsSearch.create();
         sc.setParameters("resourceId", resourceId);
-        
+
         List<R> results = search(sc, null);
         Map<String, String> details = new HashMap<String, String>(results.size());
         for (R result : results) {
@@ -68,23 +66,21 @@ public abstract class ResourceDetailsDaoBase<R extends ResourceDetail>
extends G
         return results;
     }
 
-
     public void removeDetails(long resourceId) {
         SearchCriteria<R> sc = AllFieldsSearch.create();
         sc.setParameters("resourceId", resourceId);
         remove(sc);
     }
 
-    
     public void removeDetail(long resourceId, String key) {
-        if (key != null){
+        if (key != null) {
             SearchCriteria<R> sc = AllFieldsSearch.create();
+            sc.setParameters("resourceId", resourceId);
             sc.setParameters("name", key);
             remove(sc);
         }
     }
 
-
     public void saveDetails(List<R> details) {
         if (details.isEmpty()) {
             return;
@@ -94,14 +90,13 @@ public abstract class ResourceDetailsDaoBase<R extends ResourceDetail>
extends G
         SearchCriteria<R> sc = AllFieldsSearch.create();
         sc.setParameters("resourceId", details.get(0).getResourceId());
         expunge(sc);
-        
+
         for (R detail : details) {
             persist(detail);
         }
-        
+
         txn.commit();
     }
-    
 
     protected void addDetail(R detail) {
         if (detail == null) {
@@ -113,12 +108,12 @@ public abstract class ResourceDetailsDaoBase<R extends ResourceDetail>
extends G
         }
         persist(detail);
     }
-    
+
     public Map<String, String> listDetailsKeyPairs(long resourceId, boolean forDisplay)
{
         SearchCriteria<R> sc = AllFieldsSearch.create();
         sc.setParameters("resourceId", resourceId);
         sc.setParameters("display", forDisplay);
-        
+
         List<R> results = search(sc, null);
         Map<String, String> details = new HashMap<String, String>(results.size());
         for (R result : results) {
@@ -126,7 +121,6 @@ public abstract class ResourceDetailsDaoBase<R extends ResourceDetail>
extends G
         }
         return details;
     }
-    
 
     public List<R> listDetails(long resourceId, boolean forDisplay) {
         SearchCriteria<R> sc = AllFieldsSearch.create();


Mime
View raw message