You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by de...@apache.org on 2013/05/20 08:42:47 UTC
git commit: updated refs/heads/master to e7332b7
Updated Branches:
refs/heads/master 63e92a4ea -> e7332b7c0
CLOUDSTACK-1901 : API:MS: DeleteEvents deletes Archived events as well
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e7332b7c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e7332b7c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e7332b7c
Branch: refs/heads/master
Commit: e7332b7c0447c8fc9bde157e4f639fde453790cd
Parents: 63e92a4
Author: Sanjay Tripathi <sa...@citrix.com>
Authored: Fri May 10 12:10:56 2013 +0530
Committer: Devdeep Singh <de...@gmail.com>
Committed: Mon May 20 11:58:19 2013 +0530
----------------------------------------------------------------------
.../src/com/cloud/alert/dao/AlertDaoImpl.java | 8 ++++++++
.../src/com/cloud/event/dao/EventDaoImpl.java | 5 +++++
2 files changed, 13 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e7332b7c/engine/schema/src/com/cloud/alert/dao/AlertDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/alert/dao/AlertDaoImpl.java b/engine/schema/src/com/cloud/alert/dao/AlertDaoImpl.java
index 4b9bc6a..01a560a 100755
--- a/engine/schema/src/com/cloud/alert/dao/AlertDaoImpl.java
+++ b/engine/schema/src/com/cloud/alert/dao/AlertDaoImpl.java
@@ -43,6 +43,7 @@ public class AlertDaoImpl extends GenericDaoBase<AlertVO, Long> implements Alert
AlertSearchByIdsAndType.and("type", AlertSearchByIdsAndType.entity().getType(), Op.EQ);
AlertSearchByIdsAndType.and("createdDateL", AlertSearchByIdsAndType.entity().getCreatedDate(), Op.LT);
AlertSearchByIdsAndType.and("data_center_id", AlertSearchByIdsAndType.entity().getDataCenterId(), Op.EQ);
+ AlertSearchByIdsAndType.and("archived", AlertSearchByIdsAndType.entity().getArchived(), Op.EQ);
AlertSearchByIdsAndType.done();
}
@@ -53,6 +54,7 @@ public class AlertDaoImpl extends GenericDaoBase<AlertVO, Long> implements Alert
sc.addAnd("type", SearchCriteria.Op.EQ, Short.valueOf(type));
sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, Long.valueOf(dataCenterId));
+ sc.addAnd("archived", SearchCriteria.Op.EQ, false);
if (podId != null) {
sc.addAnd("podId", SearchCriteria.Op.EQ, podId);
}
@@ -74,6 +76,7 @@ public class AlertDaoImpl extends GenericDaoBase<AlertVO, Long> implements Alert
sc.addAnd("type", SearchCriteria.Op.EQ, Short.valueOf(type));
sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, Long.valueOf(dataCenterId));
+ sc.addAnd("archived", SearchCriteria.Op.EQ, false);
if (podId != null) {
sc.addAnd("podId", SearchCriteria.Op.EQ, podId);
}
@@ -101,6 +104,8 @@ public class AlertDaoImpl extends GenericDaoBase<AlertVO, Long> implements Alert
if(olderThan != null) {
sc.setParameters("createdDateL", olderThan);
}
+ sc.setParameters("archived", false);
+
boolean result = true;;
List<AlertVO> alerts = listBy(sc);
if (Ids != null && alerts.size() < Ids.size()) {
@@ -135,6 +140,8 @@ public class AlertDaoImpl extends GenericDaoBase<AlertVO, Long> implements Alert
if(olderThan != null) {
sc.setParameters("createdDateL", olderThan);
}
+ sc.setParameters("archived", false);
+
boolean result = true;
List<AlertVO> alerts = listBy(sc);
if (ids != null && alerts.size() < ids.size()) {
@@ -150,6 +157,7 @@ public class AlertDaoImpl extends GenericDaoBase<AlertVO, Long> implements Alert
if (oldTime == null) return null;
SearchCriteria<AlertVO> sc = createSearchCriteria();
sc.addAnd("createDate", SearchCriteria.Op.LT, oldTime);
+ sc.addAnd("archived", SearchCriteria.Op.EQ, false);
return listIncludingRemovedBy(sc, null);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e7332b7c/engine/schema/src/com/cloud/event/dao/EventDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/event/dao/EventDaoImpl.java b/engine/schema/src/com/cloud/event/dao/EventDaoImpl.java
index 0d3d38a..cefe107 100644
--- a/engine/schema/src/com/cloud/event/dao/EventDaoImpl.java
+++ b/engine/schema/src/com/cloud/event/dao/EventDaoImpl.java
@@ -44,6 +44,7 @@ public class EventDaoImpl extends GenericDaoBase<EventVO, Long> implements Event
CompletedEventSearch = createSearchBuilder();
CompletedEventSearch.and("state",CompletedEventSearch.entity().getState(),SearchCriteria.Op.EQ);
CompletedEventSearch.and("startId", CompletedEventSearch.entity().getStartId(), SearchCriteria.Op.EQ);
+ CompletedEventSearch.and("archived", CompletedEventSearch.entity().getArchived(), Op.EQ);
CompletedEventSearch.done();
ToArchiveOrDeleteEventSearch = createSearchBuilder();
@@ -51,6 +52,7 @@ public class EventDaoImpl extends GenericDaoBase<EventVO, Long> implements Event
ToArchiveOrDeleteEventSearch.and("type", ToArchiveOrDeleteEventSearch.entity().getType(), Op.EQ);
ToArchiveOrDeleteEventSearch.and("accountIds", ToArchiveOrDeleteEventSearch.entity().getAccountId(), Op.IN);
ToArchiveOrDeleteEventSearch.and("createDateL", ToArchiveOrDeleteEventSearch.entity().getCreateDate(), Op.LT);
+ ToArchiveOrDeleteEventSearch.and("archived", ToArchiveOrDeleteEventSearch.entity().getArchived(), Op.EQ);
ToArchiveOrDeleteEventSearch.done();
}
@@ -64,6 +66,7 @@ public class EventDaoImpl extends GenericDaoBase<EventVO, Long> implements Event
if (oldTime == null) return null;
SearchCriteria<EventVO> sc = createSearchCriteria();
sc.addAnd("createDate", SearchCriteria.Op.LT, oldTime);
+ sc.addAnd("archived", SearchCriteria.Op.EQ, false);
return listIncludingRemovedBy(sc, null);
}
@@ -72,6 +75,7 @@ public class EventDaoImpl extends GenericDaoBase<EventVO, Long> implements Event
SearchCriteria<EventVO> sc = CompletedEventSearch.create();
sc.setParameters("state", State.Completed);
sc.setParameters("startId", startId);
+ sc.setParameters("archived", false);
return findOneIncludingRemovedBy(sc);
}
@@ -90,6 +94,7 @@ public class EventDaoImpl extends GenericDaoBase<EventVO, Long> implements Event
if (accountIds != null && !accountIds.isEmpty()) {
sc.setParameters("accountIds", accountIds.toArray(new Object[accountIds.size()]));
}
+ sc.setParameters("archived", false);
return search(sc, null);
}