# HG changeset patch # User Ingo Weinzierl # Date 1315295235 0 # Node ID ec5c75da5c7a2940210641ed203d013f10b63838 # Parent 2c48d75c4ab755eef4400ec9bcea1e059c8dc638 Bugfix flys/issue166: Parse Collection names from DESCRIBE. flys-client/trunk@2648 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 2c48d75c4ab7 -r ec5c75da5c7a flys-client/ChangeLog --- a/flys-client/ChangeLog Tue Sep 06 07:14:17 2011 +0000 +++ b/flys-client/ChangeLog Tue Sep 06 07:47:15 2011 +0000 @@ -1,3 +1,18 @@ +2011-09-06 Ingo Weinzierl + + flys/issue166 (Projektname in die Fensterleiste übernehmen) + + * src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java: + Read the name from Collection's DESCRIBE document and create new + Collection objects with this information. + + * src/main/java/de/intevation/flys/client/shared/model/DefaultCollection.java: + Adapted constructors which now require a name. + + * src/main/java/de/intevation/flys/client/server/CreateCollectionServiceImpl.java: + Use the UUID as Collection name after a Collection has been created - at + that time no user defined name is existing. + 2011-09-06 Felix Wolfsteller Minor cosmetics. diff -r 2c48d75c4ab7 -r ec5c75da5c7a flys-client/src/main/java/de/intevation/flys/client/server/CreateCollectionServiceImpl.java --- a/flys-client/src/main/java/de/intevation/flys/client/server/CreateCollectionServiceImpl.java Tue Sep 06 07:14:17 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/CreateCollectionServiceImpl.java Tue Sep 06 07:47:15 2011 +0000 @@ -66,7 +66,7 @@ throw new ServerException(ERROR_CREATE_COLLECTION); } - return new DefaultCollection(uuid, Long.valueOf(ttlStr)); + return new DefaultCollection(uuid, Long.valueOf(ttlStr), uuid); } catch (ConnectionException ce) { System.err.println(ce.getLocalizedMessage()); diff -r 2c48d75c4ab7 -r ec5c75da5c7a flys-client/src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java --- a/flys-client/src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java Tue Sep 06 07:14:17 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java Tue Sep 06 07:47:15 2011 +0000 @@ -125,6 +125,11 @@ "art:artifact-collection/@art:ttl", ArtifactNamespaceContext.INSTANCE); + String name = XMLUtils.xpathString( + description, + "art:artifact-collection/@art:name", + ArtifactNamespaceContext.INSTANCE); + if (uuid.length() == 0 || ttlStr.length() == 0) { System.err.println("Found an invalid Collection!"); return null; @@ -142,9 +147,11 @@ Map themeList = parseThemeLists(description); List recommended = parseRecommendations(description); + name = (name != null && name.length() > 0) ? name : uuid; + Collection c = !themeList.isEmpty() - ? new DefaultCollection(uuid, ttl, recommended, themeList) - : new DefaultCollection(uuid, ttl, recommended); + ? new DefaultCollection(uuid, ttl, name, recommended, themeList) + : new DefaultCollection(uuid, ttl, name, recommended); NodeList items = (NodeList) XMLUtils.xpath( description, diff -r 2c48d75c4ab7 -r ec5c75da5c7a flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultCollection.java --- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultCollection.java Tue Sep 06 07:14:17 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultCollection.java Tue Sep 06 07:47:15 2011 +0000 @@ -42,9 +42,10 @@ } - public DefaultCollection(String uuid, long ttl) { + public DefaultCollection(String uuid, long ttl, String name) { this.uuid = uuid; this.ttl = ttl; + this.name = name; this.items = new ArrayList(); this.themeLists = new HashMap(); this.recommendations = new ArrayList(); @@ -56,8 +57,13 @@ * * @param uuid The UUID. */ - public DefaultCollection(String uuid, long ttl, List recs) { - this(uuid, ttl); + public DefaultCollection( + String uuid, + long ttl, + String name, + List recs + ) { + this(uuid, ttl, name); this.recommendations = recs; } @@ -66,10 +72,11 @@ public DefaultCollection( String uuid, long ttl, + String name, List recommendations, Map themeLists) { - this(uuid, ttl, recommendations); + this(uuid, ttl, name, recommendations); this.themeLists = themeLists; } @@ -79,19 +86,6 @@ * * @param uuid The identifier of this collection. * @param name The name of this collection. - */ - public DefaultCollection(String uuid, long ttl, String name) { - this(uuid, ttl, new ArrayList()); - - this.name = name; - } - - - /** - * Creates a new DefaultCollection with uuid and name. - * - * @param uuid The identifier of this collection. - * @param name The name of this collection. * @param creation The creation time. */ public DefaultCollection(String uuid, long ttl, String name, Date creation){