Rename StatisticsQuery to BackupQuery

The helper class wll be used in a subsequent request in
ProjectBackupResource to specify time periods for partial
backups, so StatisticsQuery would no longer be appropriate.

Change-Id: I2f24e0932df7cf4ffd53f606fe6078ef2696eb53
Signed-off-by: Michael Ochmann <michael.ochmann@sap.com>
diff --git a/org.eclipse.skalli.core.test/src/main/java/org/eclipse/skalli/core/rest/admin/StatisticsQueryTest.java b/org.eclipse.skalli.core.test/src/main/java/org/eclipse/skalli/core/rest/admin/BackupQueryTest.java
similarity index 82%
rename from org.eclipse.skalli.core.test/src/main/java/org/eclipse/skalli/core/rest/admin/StatisticsQueryTest.java
rename to org.eclipse.skalli.core.test/src/main/java/org/eclipse/skalli/core/rest/admin/BackupQueryTest.java
index 675f8ff..c1b5ddd 100644
--- a/org.eclipse.skalli.core.test/src/main/java/org/eclipse/skalli/core/rest/admin/StatisticsQueryTest.java
+++ b/org.eclipse.skalli.core.test/src/main/java/org/eclipse/skalli/core/rest/admin/BackupQueryTest.java
@@ -24,7 +24,7 @@
 import org.junit.Test;
 
 @SuppressWarnings("nls")
-public class StatisticsQueryTest {
+public class BackupQueryTest {
 
     @Test
     public void testPeriod() throws Exception {
@@ -71,7 +71,7 @@
 
     private void assertPeriodQuery(String period, int value, TimeUnit unit) {
         long now = System.currentTimeMillis();
-        StatisticsQuery query = new StatisticsQuery(getParams(null, null, period), now);
+        BackupQuery query = new BackupQuery(getParams(null, null, period), now);
         Assert.assertEquals(now - TimeUnit.MILLISECONDS.convert(value, unit), query.getFrom());
         Assert.assertEquals(now, query.getTo());
     }
@@ -83,7 +83,7 @@
         long fromMillis = now - TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS);
         cal.setTimeInMillis(fromMillis);
         String fromStr = DatatypeConverter.printDateTime(cal);
-        StatisticsQuery query = new StatisticsQuery(getParams(fromStr, null, null), now);
+        BackupQuery query = new BackupQuery(getParams(fromStr, null, null), now);
         Assert.assertEquals(fromMillis, query.getFrom());
         Assert.assertEquals(now, query.getTo());
     }
@@ -95,7 +95,7 @@
         long toMillis = now - TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS);
         cal.setTimeInMillis(toMillis);
         String toStr = DatatypeConverter.printDateTime(cal);
-        StatisticsQuery query = new StatisticsQuery(getParams(null, toStr, null), now);
+        BackupQuery query = new BackupQuery(getParams(null, toStr, null), now);
         Assert.assertEquals(0, query.getFrom());
         Assert.assertEquals(toMillis, query.getTo());
     }
@@ -116,22 +116,22 @@
         String fromStr = DatatypeConverter.printDateTime(cal);
         cal.setTimeInMillis(toMillis);
         String toStr = DatatypeConverter.printDateTime(cal);
-        StatisticsQuery query = new StatisticsQuery(getParams(fromStr, toStr, null), now);
+        BackupQuery query = new BackupQuery(getParams(fromStr, toStr, null), now);
         Assert.assertEquals(fromMillis, query.getFrom());
         Assert.assertEquals(toMillis, query.getTo());
 
         // period is ignored, if both from and to are specified
-        query = new StatisticsQuery(getParams(fromStr, toStr, "3d"), now);
+        query = new BackupQuery(getParams(fromStr, toStr, "3d"), now);
         Assert.assertEquals(fromMillis, query.getFrom());
         Assert.assertEquals(toMillis, query.getTo());
 
         // from == to
-        query = new StatisticsQuery(getParams(fromStr, fromStr, null), now);
+        query = new BackupQuery(getParams(fromStr, fromStr, null), now);
         Assert.assertEquals(fromMillis, query.getFrom());
         Assert.assertEquals(fromMillis, query.getTo());
 
         // from > to
-        query = new StatisticsQuery(getParams(toStr, fromStr, null), now);
+        query = new BackupQuery(getParams(toStr, fromStr, null), now);
         Assert.assertEquals(fromMillis, query.getFrom());
         Assert.assertEquals(fromMillis, query.getTo());
     }
@@ -139,50 +139,50 @@
     @Test
     public void testFromToIntervals() throws Exception {
         long now = System.currentTimeMillis();
-        StatisticsQuery query = new StatisticsQuery(getParams("-1d", null, null), now);
+        BackupQuery query = new BackupQuery(getParams("-1d", null, null), now);
         Assert.assertEquals(now - TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS), query.getFrom());
         Assert.assertEquals(now, query.getTo());
 
-        query = new StatisticsQuery(getParams(null, "-1d", null), now);
+        query = new BackupQuery(getParams(null, "-1d", null), now);
         Assert.assertEquals(0, query.getFrom());
         Assert.assertEquals(now - TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS), query.getTo());
 
-        query = new StatisticsQuery(getParams("-2d", "-1d", null), now);
+        query = new BackupQuery(getParams("-2d", "-1d", null), now);
         Assert.assertEquals(now - TimeUnit.MILLISECONDS.convert(2, TimeUnit.DAYS), query.getFrom());
         Assert.assertEquals(now - TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS), query.getTo());
 
-        query = new StatisticsQuery(getParams("-1d", null, "1h"), now);
+        query = new BackupQuery(getParams("-1d", null, "1h"), now);
         Assert.assertEquals(now - TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS), query.getFrom());
         Assert.assertEquals(now - TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS) +
                 TimeUnit.MILLISECONDS.convert(1, TimeUnit.HOURS), query.getTo());
 
-        query = new StatisticsQuery(getParams(null, "-1d", "1h"), now);
+        query = new BackupQuery(getParams(null, "-1d", "1h"), now);
         Assert.assertEquals(now - TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS) -
                 TimeUnit.MILLISECONDS.convert(1, TimeUnit.HOURS), query.getFrom());
         Assert.assertEquals(now - TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS), query.getTo());
 
         // from + period > now => to = now
-        query = new StatisticsQuery(getParams("-1d", null, "2d"), now);
+        query = new BackupQuery(getParams("-1d", null, "2d"), now);
         Assert.assertEquals(now - TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS), query.getFrom());
         Assert.assertEquals(now, query.getTo());
 
         // period is ignored, if from and to are specified
-        query = new StatisticsQuery(getParams("-2d", "-1d", "1h"), now);
+        query = new BackupQuery(getParams("-2d", "-1d", "1h"), now);
         Assert.assertEquals(now - TimeUnit.MILLISECONDS.convert(2, TimeUnit.DAYS), query.getFrom());
         Assert.assertEquals(now - TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS), query.getTo());
 
         // positive to interval is treated as not specified => to = now
-        query = new StatisticsQuery(getParams("-1d", "4711d", null), now);
+        query = new BackupQuery(getParams("-1d", "4711d", null), now);
         Assert.assertEquals(now - TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS), query.getFrom());
         Assert.assertEquals(now, query.getTo());
 
         // positive from interval is treated as not specified => from = 0
-        query = new StatisticsQuery(getParams("4711d", "-1d", null), now);
+        query = new BackupQuery(getParams("4711d", "-1d", null), now);
         Assert.assertEquals(0, query.getFrom());
         Assert.assertEquals(now - TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS), query.getTo());
 
         // positive from interval are treated as not specified => show 1 day
-        query = new StatisticsQuery(getParams("4711d", "4711d", null), now);
+        query = new BackupQuery(getParams("4711d", "4711d", null), now);
         Assert.assertEquals(now - TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS), query.getFrom());
         Assert.assertEquals(now, query.getTo());
     }
@@ -192,31 +192,31 @@
         Calendar cal = Calendar.getInstance();
         long now = cal.getTimeInMillis();
 
-        StatisticsQuery query = new StatisticsQuery(getParams(null, "now", null), now);
+        BackupQuery query = new BackupQuery(getParams(null, "now", null), now);
         Assert.assertEquals(0, query.getFrom());
         Assert.assertEquals(now, query.getTo());
 
-        query = new StatisticsQuery(getParams("-1h", "now", null), now);
+        query = new BackupQuery(getParams("-1h", "now", null), now);
         Assert.assertEquals(now - TimeUnit.MILLISECONDS.convert(1, TimeUnit.HOURS), query.getFrom());
         Assert.assertEquals(now, query.getTo());
 
         long fromMillis = now - TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS);
         cal.setTimeInMillis(fromMillis);
         String fromStr = DatatypeConverter.printDateTime(cal);
-        query = new StatisticsQuery(getParams(fromStr, "now", null), now);
+        query = new BackupQuery(getParams(fromStr, "now", null), now);
         Assert.assertEquals(fromMillis, query.getFrom());
         Assert.assertEquals(now, query.getTo());
 
-        query = new StatisticsQuery(getParams("now", null, null), now);
+        query = new BackupQuery(getParams("now", null, null), now);
         Assert.assertEquals(now, query.getFrom());
         Assert.assertEquals(now, query.getTo());
 
-        query = new StatisticsQuery(getParams("now", "now", null), now);
+        query = new BackupQuery(getParams("now", "now", null), now);
         Assert.assertEquals(now, query.getFrom());
         Assert.assertEquals(now, query.getTo());
 
         // period is ignored, if from and to are specified
-        query = new StatisticsQuery(getParams("now", "now", "1d"), now);
+        query = new BackupQuery(getParams("now", "now", "1d"), now);
         Assert.assertEquals(now, query.getFrom());
         Assert.assertEquals(now, query.getTo());
     }
@@ -232,7 +232,7 @@
     public void testAllQuery() throws Exception {
         HashMap<String, String> params = new HashMap<String, String>();
         params.put("all", null);
-        StatisticsQuery query = new StatisticsQuery(params, System.currentTimeMillis());
+        BackupQuery query = new BackupQuery(params, System.currentTimeMillis());
         Assert.assertEquals(0, query.getFrom());
         Assert.assertEquals(0, query.getTo());
     }
@@ -242,7 +242,7 @@
         HashMap<String, String> params = new HashMap<String, String>();
         params.put("include", "a,b");
         params.put("exclude", "c");
-        StatisticsQuery query = new StatisticsQuery(params, System.currentTimeMillis());
+        BackupQuery query = new BackupQuery(params, System.currentTimeMillis());
         query.setSection("foobar");
         Assert.assertTrue(query.showSection("foobar"));
         Assert.assertFalse(query.showSection("a"));
@@ -253,14 +253,14 @@
     @Test
     public void testNoFilters() throws Exception {
         HashMap<String, String> params = new HashMap<String, String>();
-        StatisticsQuery query = new StatisticsQuery(params, System.currentTimeMillis());
+        BackupQuery query = new BackupQuery(params, System.currentTimeMillis());
         Assert.assertTrue(query.showByFilter("byDate"));
     }
 
     @Test
     public void testSetFilter() throws Exception {
         HashMap<String, String> params = new HashMap<String, String>();
-        StatisticsQuery query = new StatisticsQuery(params, System.currentTimeMillis());
+        BackupQuery query = new BackupQuery(params, System.currentTimeMillis());
         query.setFilter("byDate");
         Assert.assertTrue(query.showByFilter("byDate"));
         Assert.assertFalse(query.showByFilter("foobar"));
@@ -270,7 +270,7 @@
     public void testFiltersAttribute() throws Exception {
         HashMap<String, String> params = new HashMap<String, String>();
         params.put("filters", "byDate,byRole");
-        StatisticsQuery query = new StatisticsQuery(params, System.currentTimeMillis());
+        BackupQuery query = new BackupQuery(params, System.currentTimeMillis());
         Assert.assertTrue(query.showByFilter("byDate"));
         Assert.assertTrue(query.showByFilter("byRole"));
         Assert.assertFalse(query.showByFilter("foobar"));
@@ -280,7 +280,7 @@
     public void testSetFilterOverwritesFiltersAttribute() throws Exception {
         HashMap<String, String> params = new HashMap<String, String>();
         params.put("filters", "byDate,byRole");
-        StatisticsQuery query = new StatisticsQuery(params, System.currentTimeMillis());
+        BackupQuery query = new BackupQuery(params, System.currentTimeMillis());
         query.setFilter("byDate");
         Assert.assertTrue(query.showByFilter("byDate"));
         Assert.assertFalse(query.showByFilter("byRole"));
@@ -291,7 +291,7 @@
     public void testSummaryFilter() throws Exception {
         HashMap<String, String> params = new HashMap<String, String>();
         params.put("filters", "byDate,byRole,summary");
-        StatisticsQuery query = new StatisticsQuery(params, System.currentTimeMillis());
+        BackupQuery query = new BackupQuery(params, System.currentTimeMillis());
         Assert.assertFalse(query.showByFilter("byDate"));
         Assert.assertFalse(query.showByFilter("byRole"));
         Assert.assertTrue(query.showByFilter("summary"));
@@ -314,7 +314,7 @@
     public void testIncluded() throws Exception {
         HashMap<String, String> params = new HashMap<String, String>();
         params.put("include", "a,b,c");
-        StatisticsQuery query = new StatisticsQuery(params, System.currentTimeMillis());
+        BackupQuery query = new BackupQuery(params, System.currentTimeMillis());
         AssertUtils.assertEqualsAnyOrder("includes", CollectionUtils.asSet("a", "b", "c"), query.getIncluded());
     }
 
@@ -322,7 +322,7 @@
     public void testExcluded() throws Exception {
         HashMap<String, String> params = new HashMap<String, String>();
         params.put("exclude", "foo,bar");
-        StatisticsQuery query = new StatisticsQuery(params, System.currentTimeMillis());
+        BackupQuery query = new BackupQuery(params, System.currentTimeMillis());
         AssertUtils.assertEqualsAnyOrder("includes", CollectionUtils.asSet("foo", "bar"), query.getExcluded());
     }
 
@@ -330,7 +330,7 @@
         HashMap<String, String> params = new HashMap<String, String>();
         params.put("include", include);
         params.put("exclude", exclude);
-        StatisticsQuery query = new StatisticsQuery(params, System.currentTimeMillis());
+        BackupQuery query = new BackupQuery(params, System.currentTimeMillis());
         for (String s: included) {
             Assert.assertTrue(query.showSection(s));
         }
@@ -345,7 +345,7 @@
         long fromMillis = now - TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS);
         cal.setTimeInMillis(fromMillis);
         String fromStr = DatatypeConverter.printDateTime(cal);
-        StatisticsQuery query = new StatisticsQuery(getParams(fromStr, null, period), now);
+        BackupQuery query = new BackupQuery(getParams(fromStr, null, period), now);
         Assert.assertEquals(fromMillis, query.getFrom());
         Assert.assertEquals(fromMillis + TimeUnit.MILLISECONDS.convert(value, unit), query.getTo());
     }
@@ -356,7 +356,7 @@
         long toMillis = now - TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS);
         cal.setTimeInMillis(toMillis);
         String toStr = DatatypeConverter.printDateTime(cal);
-        StatisticsQuery query = new StatisticsQuery(getParams(null, toStr, period), now);
+        BackupQuery query = new BackupQuery(getParams(null, toStr, period), now);
         Assert.assertEquals(toMillis - TimeUnit.MILLISECONDS.convert(value, unit), query.getFrom());
         Assert.assertEquals(toMillis, query.getTo());
     }
@@ -364,13 +364,13 @@
     private Map<String, String> getParams(String from, String to, String period) {
         HashMap<String, String> params = new HashMap<String, String>();
         if (StringUtils.isNotBlank(from)) {
-            params.put(StatisticsQuery.PARAM_FROM, from);
+            params.put(BackupQuery.PARAM_FROM, from);
         }
         if (StringUtils.isNotBlank(to)) {
-            params.put(StatisticsQuery.PARAM_TO, to);
+            params.put(BackupQuery.PARAM_TO, to);
         }
         if (StringUtils.isNotBlank(period)) {
-            params.put(StatisticsQuery.PARAM_PERIOD, period);
+            params.put(BackupQuery.PARAM_PERIOD, period);
         }
         return params;
     }
diff --git a/org.eclipse.skalli.core.test/src/main/java/org/eclipse/skalli/core/rest/admin/StatisticsConverterTest.java b/org.eclipse.skalli.core.test/src/main/java/org/eclipse/skalli/core/rest/admin/StatisticsConverterTest.java
index 10a2eaa..91fcf68 100644
--- a/org.eclipse.skalli.core.test/src/main/java/org/eclipse/skalli/core/rest/admin/StatisticsConverterTest.java
+++ b/org.eclipse.skalli.core.test/src/main/java/org/eclipse/skalli/core/rest/admin/StatisticsConverterTest.java
@@ -37,7 +37,7 @@
     @Before
     public void setup() throws Exception {
         writer = new StringBufferHierarchicalStreamWriter();
-        converter = new StatisticsConverter("http://localhost", new StatisticsQuery(new HashMap<String,String>()));
+        converter = new StatisticsConverter("http://localhost", new BackupQuery(new HashMap<String,String>()));
     }
 
     @Test
diff --git a/org.eclipse.skalli.core/src/main/java/org/eclipse/skalli/core/rest/admin/StatisticsQuery.java b/org.eclipse.skalli.core/src/main/java/org/eclipse/skalli/core/rest/admin/BackupQuery.java
similarity index 93%
rename from org.eclipse.skalli.core/src/main/java/org/eclipse/skalli/core/rest/admin/StatisticsQuery.java
rename to org.eclipse.skalli.core/src/main/java/org/eclipse/skalli/core/rest/admin/BackupQuery.java
index 785a3fd..1008439 100644
--- a/org.eclipse.skalli.core/src/main/java/org/eclipse/skalli/core/rest/admin/StatisticsQuery.java
+++ b/org.eclipse.skalli.core/src/main/java/org/eclipse/skalli/core/rest/admin/BackupQuery.java
@@ -21,7 +21,7 @@
 import org.apache.commons.lang.math.NumberUtils;
 import org.eclipse.skalli.commons.CollectionUtils;
 
-public class StatisticsQuery {
+public class BackupQuery {
 
     public static final String PARAM_ALL = "all"; //$NON-NLS-1$
     public static final String PARAM_PERIOD = "period"; //$NON-NLS-1$
@@ -40,15 +40,12 @@
     private Set<String> excluded;
     private Set<String> filters;
 
-    public StatisticsQuery(Map<String, String> params)  {
+    public BackupQuery(Map<String, String> params)  {
         this(params, System.currentTimeMillis());
     }
 
-    StatisticsQuery(Map<String, String> params, long now)  {
-        if (params.containsKey(PARAM_ALL)) {
-            from = 0;
-            to = 0;
-        } else {
+    BackupQuery(Map<String, String> params, long now)  {
+        if (!params.containsKey(PARAM_ALL)) {
             period = Math.abs(getTimeInterval(params.get(PARAM_PERIOD)));
             from = parseDateTime(params.get(PARAM_FROM), now);
             to = parseDateTime(params.get(PARAM_TO), now);
@@ -67,6 +64,9 @@
             if (from > to) {
                 from = to;
             }
+        } else { // all
+            from = 0;
+            to = 0;
         }
 
         included =  CollectionUtils.asSet(StringUtils.split(params.get(PARAM_INCLUDE), ','));
@@ -156,4 +156,8 @@
     public boolean showByFilter(String filterName) {
         return filters.isEmpty() || filters.contains(filterName);
     }
+
+    public boolean inRange(long timestamp) {
+        return (from <= 0 || from <=  timestamp) && (to <= 0 || timestamp <= to);
+    }
 }
diff --git a/org.eclipse.skalli.core/src/main/java/org/eclipse/skalli/core/rest/admin/StatisticsBackupResource.java b/org.eclipse.skalli.core/src/main/java/org/eclipse/skalli/core/rest/admin/StatisticsBackupResource.java
index 13d6870..4cf4376 100644
--- a/org.eclipse.skalli.core/src/main/java/org/eclipse/skalli/core/rest/admin/StatisticsBackupResource.java
+++ b/org.eclipse.skalli.core/src/main/java/org/eclipse/skalli/core/rest/admin/StatisticsBackupResource.java
@@ -55,7 +55,7 @@
         if (!Permits.isAllowed(getAction(), getPath())) {
             return createUnauthorizedRepresentation();
         }
-        StatisticsQuery query = new StatisticsQuery(getQueryAttributes());
+        BackupQuery query = new BackupQuery(getQueryAttributes());
         Statistics statistics = new Statistics(Statistics.getDefault(), query.getFrom(), query.getTo());
         ZipOutputRepresentation zipRepresentation = new ZipOutputRepresentation(statistics);
         Disposition disposition = new Disposition(Disposition.TYPE_ATTACHMENT);
diff --git a/org.eclipse.skalli.core/src/main/java/org/eclipse/skalli/core/rest/admin/StatisticsConverter.java b/org.eclipse.skalli.core/src/main/java/org/eclipse/skalli/core/rest/admin/StatisticsConverter.java
index af22620..59ce19d 100644
--- a/org.eclipse.skalli.core/src/main/java/org/eclipse/skalli/core/rest/admin/StatisticsConverter.java
+++ b/org.eclipse.skalli.core/src/main/java/org/eclipse/skalli/core/rest/admin/StatisticsConverter.java
@@ -45,9 +45,9 @@
     public static final String API_VERSION = "1.0"; //$NON-NLS-1$
     public static final String NAMESPACE = "http://www.eclipse.org/skalli/2010/API/Admin"; //$NON-NLS-1$
 
-    private final StatisticsQuery query;
+    private final BackupQuery query;
 
-    public StatisticsConverter(StatisticsQuery query) {
+    public StatisticsConverter(BackupQuery query) {
         super(Statistics.class);
         this.query = query;
     }
@@ -434,7 +434,7 @@
     }
 
     @Deprecated
-    public StatisticsConverter(String host, StatisticsQuery query) {
+    public StatisticsConverter(String host, BackupQuery query) {
         super(Statistics.class, "statistics", host); //$NON-NLS-1$
         this.query = query;
     }
diff --git a/org.eclipse.skalli.core/src/main/java/org/eclipse/skalli/core/rest/admin/StatisticsResource.java b/org.eclipse.skalli.core/src/main/java/org/eclipse/skalli/core/rest/admin/StatisticsResource.java
index 863628d..685eb71 100644
--- a/org.eclipse.skalli.core/src/main/java/org/eclipse/skalli/core/rest/admin/StatisticsResource.java
+++ b/org.eclipse.skalli.core/src/main/java/org/eclipse/skalli/core/rest/admin/StatisticsResource.java
@@ -38,7 +38,7 @@
             return null;
         }
 
-        StatisticsQuery query = new StatisticsQuery(getQueryAttributes());
+        BackupQuery query = new BackupQuery(getQueryAttributes());
         String section = (String) getRequestAttributes().get(PARAM_SECTION);
         if (StringUtils.isNotBlank(section)) {
             query.setSection(section);
@@ -62,11 +62,11 @@
         if (!Permits.isAllowed(getAction(), getPath())) {
             return createUnauthorizedRepresentation();
         }
-        if (!hasQueryAttribute(StatisticsQuery.PARAM_TO)) {
+        if (!hasQueryAttribute(BackupQuery.PARAM_TO)) {
             return createErrorRepresentation(Status.CLIENT_ERROR_BAD_REQUEST, ERROR_ID_INVALID_QUERY,
                     "Query attribute \"to\" is mandatory");
         }
-        StatisticsQuery query = new StatisticsQuery(getQueryAttributes());
+        BackupQuery query = new BackupQuery(getQueryAttributes());
         Statistics statistics = Statistics.getDefault();
         statistics.clear(query.getFrom(), query.getTo());
         setStatus(Status.SUCCESS_NO_CONTENT);