comparison artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java @ 199:face2302387c

Insert collection attribute into database, too. Fixed broken SQL schema. artifacts/trunk@1437 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 09 Mar 2011 11:14:21 +0000
parents fde2f193e846
children 33f58a847fc4
comparison
equal deleted inserted replaced
198:6370369412e9 199:face2302387c
935 935
936 public ArtifactCollection createCollection( 936 public ArtifactCollection createCollection(
937 final String ownerIdentifier, 937 final String ownerIdentifier,
938 final String name, 938 final String name,
939 final ArtifactCollectionFactory factory, 939 final ArtifactCollectionFactory factory,
940 final Document data, 940 final Document attribute,
941 final Object context 941 final Object context
942 ) { 942 ) {
943 if (name == null) { 943 if (name == null) {
944 logger.debug("Name is null"); 944 logger.debug("Name is null");
945 return null; 945 return null;
995 } 995 }
996 else { 996 else {
997 stmnt.setLong(5, ttl); 997 stmnt.setLong(5, ttl);
998 } 998 }
999 999
1000 byte [] data = XMLUtils.toByteArray(attribute);
1001
1002 if (data == null) {
1003 stmnt.setNull(6, Types.BINARY);
1004 }
1005 else {
1006 stmnt.setBytes(6, data);
1007 }
1008
1000 stmnt.execute(); 1009 stmnt.execute();
1001 conn.commit(); 1010 conn.commit();
1002 1011
1003 reset(); 1012 reset();
1004 1013
1017 Timestamp timestamp = result.getTimestamp(1); 1026 Timestamp timestamp = result.getTimestamp(1);
1018 creationTime = new Date(timestamp.getTime()); 1027 creationTime = new Date(timestamp.getTime());
1019 } 1028 }
1020 1029
1021 collection[0] = factory.createCollection( 1030 collection[0] = factory.createCollection(
1022 identifier, name, creationTime, data, context); 1031 identifier, name, creationTime, attribute, context);
1023 1032
1024 return true; 1033 return true;
1025 } 1034 }
1026 }; 1035 };
1027 1036

http://dive4elements.wald.intevation.org