comparison artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultCollectionItem.java @ 186:15c7638511dc

Added an interface for CollectionItems and renamed the CollectionItem class from the artifact-database package to DefaultCollectionItem - because this is the default implementation of the interface. artifacts/trunk@1416 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 07 Mar 2011 15:13:36 +0000
parents
children 946e2245a6c0
comparison
equal deleted inserted replaced
185:afd5945ff8d1 186:15c7638511dc
1 /*
2 * Copyright (c) 2011 by Intevation GmbH
3 *
4 * This program is free software under the LGPL (>=v2.1)
5 * Read the file LGPL.txt coming with the software for details
6 * or visit http://www.gnu.org/licenses/ if it does not exist.
7 */
8 package de.intevation.artifactdatabase;
9
10 import de.intevation.artifacts.CollectionItem;
11
12 import de.intevation.artifacts.common.utils.XMLUtils;
13
14 import org.w3c.dom.Document;
15
16 public class DefaultCollectionItem
17 implements CollectionItem
18 {
19 protected String artifactIdentifier;
20
21 protected byte [] data;
22
23 protected Document document;
24
25 public DefaultCollectionItem() {
26 }
27
28 public DefaultCollectionItem(String artifactIdentifier, byte [] attribute) {
29 this.artifactIdentifier = artifactIdentifier;
30 this.data = data;
31 }
32
33 public String getArtifactIdentifier() {
34 return artifactIdentifier;
35 }
36
37 public synchronized Document getAttribute() {
38 if (document == null) {
39 if (data != null) {
40 document = XMLUtils.fromByteArray(data);
41 }
42 }
43 return document;
44 }
45 }
46 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org