diff flys-client/src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java @ 587:53ad6dd2cb2b

The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project. flys-client/trunk@2181 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 21 Jun 2011 16:22:39 +0000
parents 78907f0fb939
children 942bd0e7e332
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java	Tue Jun 21 16:14:10 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java	Tue Jun 21 16:22:39 2011 +0000
@@ -112,16 +112,30 @@
             "art:artifact-collection/@art:uuid",
             ArtifactNamespaceContext.INSTANCE);
 
-        if (uuid == null || uuid.length() == 0) {
+        String ttlStr = XMLUtils.xpathString(
+            description,
+            "art:artifact-collection/@art:ttl",
+            ArtifactNamespaceContext.INSTANCE);
+
+        if (uuid.length() == 0 || ttlStr.length() == 0) {
             System.err.println("Found an invalid Collection!");
             return null;
         }
 
+
+        long ttl = -1;
+        try {
+            ttl = Long.valueOf(ttlStr);
+        }
+        catch (NumberFormatException nfe) {
+            // do nothing
+        }
+
         Map<String, ThemeList> themeList = parseThemeLists(description);
 
         Collection c = !themeList.isEmpty()
-            ? new DefaultCollection(uuid, themeList)
-            : new DefaultCollection(uuid);
+            ? new DefaultCollection(uuid, ttl, themeList)
+            : new DefaultCollection(uuid, ttl);
 
         NodeList items = (NodeList) XMLUtils.xpath(
             description,
@@ -260,7 +274,7 @@
         String uuid = node.getAttributeNS(uri, "uuid");
         String hash = node.getAttributeNS(uri, "hash");
 
-        if (uuid.length() == 0) {
+        if (uuid == null || uuid.length() == 0) {
             System.err.println("Found an invalid CollectionItem!");
             return null;
         }

http://dive4elements.wald.intevation.org