Mercurial > dive4elements > river
view flys-client/src/main/java/de/intevation/flys/client/shared/model/ArtifactFilter.java @ 1292:bdc270ea6195
Edited item attributes are saved and send to the server on accept.
flys-client/trunk@2898 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 05 Oct 2011 16:29:14 +0000 |
parents | ace7e9cfbb7f |
children | 6bb6d43eeb2d |
line wrap: on
line source
package de.intevation.flys.client.shared.model; import java.io.Serializable; import java.util.HashMap; import java.util.Map; import java.util.List; public class ArtifactFilter implements Serializable { protected String factoryName; protected Map<String, OutFilter> outFilters; public ArtifactFilter() { outFilters = new HashMap<String, OutFilter>(); } public ArtifactFilter(String factoryName) { this(); this.factoryName = factoryName; } public String getFactoryName() { return factoryName; } public void setFactoryName(String factoryName) { this.factoryName = factoryName; } public void add(String out, String name, String num) { if (out == null) { out = ToLoad.uniqueKey(outFilters); } OutFilter outFilter = outFilters.get(out); if (outFilter == null) { outFilter = new OutFilter(out); outFilters.put(out, outFilter); } outFilter.add(name, num); } public String collectIds() { StringBuilder sb = new StringBuilder(); for (OutFilter outFilter: outFilters.values()) { outFilter.collectIds(sb); } return sb.toString(); } public Recommendation.Filter toFilter() { Recommendation.Filter rf = new Recommendation.Filter(); for (Map.Entry<String, OutFilter> entry: outFilters.entrySet()) { List<Recommendation.Facet> facets = entry.getValue().toFacets(); rf.add(entry.getKey(), facets); } return rf; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :