Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/Datacage.java @ 1037:75cf1b11c97e
Improved CustomAnnotation rendering.
flys-artifacts/trunk@2498 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 17 Aug 2011 12:32:26 +0000 |
parents | 02c327ffbad7 |
children | eccf966fb677 |
rev | line source |
---|---|
982
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.datacage; |
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
990
e573c4715d81
Add artifacts data into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
989
diff
changeset
|
3 import java.util.Collection; |
991
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
4 import java.util.List; |
1024
ba88157c6aa3
Make it compilable again (BackendListener interface changed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1010
diff
changeset
|
5 import java.util.Date; |
990
e573c4715d81
Add artifacts data into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
989
diff
changeset
|
6 |
984
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
7 import java.sql.SQLException; |
991
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
8 import java.sql.PreparedStatement; |
990
e573c4715d81
Add artifacts data into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
989
diff
changeset
|
9 import java.sql.Types; |
1025
02c327ffbad7
Datacage: Extended schema for artifacts and collections
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1024
diff
changeset
|
10 import java.sql.Timestamp; |
984
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
11 |
982
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.artifacts.GlobalContext; |
999
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
13 import de.intevation.artifacts.ArtifactCollection; |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
14 import de.intevation.artifacts.User; |
982
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 |
983
4ea5f5a2284e
Ajusted datacage to use the SQL infrastructure from the artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
982
diff
changeset
|
16 import de.intevation.artifactdatabase.db.SQL; |
4ea5f5a2284e
Ajusted datacage to use the SQL infrastructure from the artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
982
diff
changeset
|
17 import de.intevation.artifactdatabase.db.SQLExecutor; |
4ea5f5a2284e
Ajusted datacage to use the SQL infrastructure from the artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
982
diff
changeset
|
18 |
982
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.artifactdatabase.LifetimeListener; |
999
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
20 import de.intevation.artifactdatabase.Backend; |
982
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 |
990
e573c4715d81
Add artifacts data into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
989
diff
changeset
|
22 import de.intevation.artifactdatabase.data.StateData; |
e573c4715d81
Add artifacts data into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
989
diff
changeset
|
23 |
991
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
24 import de.intevation.artifactdatabase.state.Output; |
992
5b467bc27eda
Datacage: Store
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
991
diff
changeset
|
25 import de.intevation.artifactdatabase.state.Facet; |
991
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
26 |
984
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
27 import de.intevation.artifacts.Artifact; |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
28 import de.intevation.artifacts.ArtifactDatabase; |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
29 import de.intevation.artifacts.ArtifactDatabaseException; |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
30 |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
31 import de.intevation.flys.artifacts.FLYSArtifact; |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
32 |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
33 import de.intevation.artifacts.common.utils.LRUCache; |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
34 |
982
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 import org.apache.log4j.Logger; |
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 |
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 import org.w3c.dom.Document; |
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 |
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 public class Datacage |
1002
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
40 implements LifetimeListener |
982
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 { |
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 private static Logger log = Logger.getLogger(Datacage.class); |
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 |
999
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
44 public static final String DATACAGE_KEY = |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
45 "global.datacage.instance"; |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
46 |
984
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
47 public static final String ARTEFACT_DATABASE_KEY = |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
48 "global.artifact.database"; |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
49 |
987
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
50 private String SQL_DELETE_ALL_USERS = "delete.all.users"; |
996
f61fe8b561d2
Datacage: delete artifacts at initial scan, too. Fixed problem with writing content of state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
995
diff
changeset
|
51 private String SQL_DELETE_ALL_ARTIFACTS = "delete.all.artifacts"; |
987
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
52 private String SQL_USER_ID_NEXTVAL = "user.id.nextval"; |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
53 private String SQL_USER_BY_GID = "user.by.gid"; |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
54 private String SQL_INSERT_USER = "insert.user"; |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
55 private String SQL_COLLECTION_BY_GID = "collection.by.gid"; |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
56 private String SQL_COLLECTION_ID_NEXTVAL = "collection.id.nextval"; |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
57 private String SQL_INSERT_COLLECTION = "insert.collection"; |
988
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
58 private String SQL_ARTIFACT_BY_GID = "artifact.by.gid"; |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
59 private String SQL_COLLECTION_ITEM_ID_NEXTVAL = |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
60 "collection.item.id.nextval"; |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
61 private String SQL_INSERT_COLLECTION_ITEM = "insert.collection.item"; |
989
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
62 private String SQL_ARTIFACT_ID_NEXTVAL = "artifact.id.nextval"; |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
63 private String SQL_INSERT_ARTIFACT = "insert.artifact"; |
991
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
64 private String SQL_ARTIFACT_DATA_ID_NEXTVAL = "artifact.data.id.nextval"; |
990
e573c4715d81
Add artifacts data into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
989
diff
changeset
|
65 private String SQL_INSERT_ARTIFACT_DATA = "insert.artifact.data"; |
991
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
66 private String SQL_OUT_ID_NEXTVALUE = "out.id.nextval"; |
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
67 private String SQL_INSERT_OUT = "insert.out"; |
992
5b467bc27eda
Datacage: Store
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
991
diff
changeset
|
68 private String SQL_FACET_ID_NEXTVAL = "facet.id.nextval"; |
5b467bc27eda
Datacage: Store
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
991
diff
changeset
|
69 private String SQL_INSERT_FACET = "insert.facet"; |
1003
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
70 private String SQL_UPDATE_COLLECTION_NAME = "update.collection.name"; |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
71 private String SQL_DELETE_ARTIFACT_FROM_COLLECTION = |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
72 "delete.artifact.from.collection"; |
1004
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
73 private String SQL_DELETE_COLLECTION_BY_GID = |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
74 "delete.collection.by.gid"; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
75 private String SQL_DELETE_USER_BY_GID = "delete.user.by.gid"; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
76 private String SQL_DELETE_ARTIFACT_DATA_BY_ARTIFACT_ID = |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
77 "delete.artifact.data.by.artifact.id"; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
78 private String SQL_DELETE_OUTS_BY_ARTIFACT_ID = |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
79 "delete.outs.by.artifact.id"; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
80 private String SQL_DELETE_FACETS_BY_ARTIFACT_ID = |
1008
6268009e177d
Datacage: fixed wrong SQL references
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1007
diff
changeset
|
81 "delete.facets.by.artifact.id"; |
1006
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
82 private String SQL_DELETE_ARTIFACT_BY_GID = |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
83 "delete.artifact.by.gid"; |
984
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
84 |
983
4ea5f5a2284e
Ajusted datacage to use the SQL infrastructure from the artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
982
diff
changeset
|
85 protected SQLExecutor sqlExecutor; |
4ea5f5a2284e
Ajusted datacage to use the SQL infrastructure from the artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
982
diff
changeset
|
86 |
984
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
87 public class InitialScan |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
88 implements ArtifactDatabase.ArtifactLoadedCallback |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
89 { |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
90 protected LRUCache<String, Integer> users; |
986
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
91 protected LRUCache<String, Integer> collections; |
988
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
92 protected LRUCache<String, Integer> artifacts; |
984
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
93 |
991
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
94 protected GlobalContext context; |
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
95 |
984
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
96 public InitialScan() { |
986
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
97 users = new LRUCache<String, Integer>(); |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
98 collections = new LRUCache<String, Integer>(); |
988
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
99 artifacts = new LRUCache<String, Integer>(); |
984
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
100 } |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
101 |
991
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
102 public InitialScan(GlobalContext context) { |
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
103 this(); |
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
104 this.context = context; |
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
105 } |
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
106 |
984
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
107 @Override |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
108 public void artifactLoaded( |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
109 String userId, |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
110 String collectionId, |
1009
fc5fca0c33b3
Datacage: Set the name of the collections at initial scan, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1008
diff
changeset
|
111 String collectionName, |
1024
ba88157c6aa3
Make it compilable again (BackendListener interface changed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1010
diff
changeset
|
112 Date collectionCreated, |
984
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
113 String artifactId, |
1024
ba88157c6aa3
Make it compilable again (BackendListener interface changed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1010
diff
changeset
|
114 Date artifactCreated, |
984
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
115 Artifact artifact |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
116 ) { |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
117 if (!(artifact instanceof FLYSArtifact)) { |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
118 log.warn("ignoring none FLYS artifacts"); |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
119 return; |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
120 } |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
121 |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
122 FLYSArtifact flysArtifact = (FLYSArtifact)artifact; |
986
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
123 |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
124 Integer uId = getUserId(userId); |
1025
02c327ffbad7
Datacage: Extended schema for artifacts and collections
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1024
diff
changeset
|
125 Integer cId = getCollectionId( |
02c327ffbad7
Datacage: Extended schema for artifacts and collections
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1024
diff
changeset
|
126 collectionId, uId, collectionName, collectionCreated); |
987
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
127 |
1025
02c327ffbad7
Datacage: Extended schema for artifacts and collections
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1024
diff
changeset
|
128 storeArtifact(artifactId, cId, flysArtifact, artifactCreated); |
984
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
129 } |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
130 |
987
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
131 protected Integer getId( |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
132 LRUCache<String, Integer> cache, |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
133 final String idString, |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
134 final String selectById |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
135 ) { |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
136 Integer id = cache.get(idString); |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
137 if (id != null) { |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
138 return id; |
986
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
139 } |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
140 |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
141 final Integer [] res = new Integer[1]; |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
142 |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
143 SQLExecutor.Instance exec = sqlExecutor.new Instance() { |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
144 @Override |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
145 public boolean doIt() throws SQLException { |
987
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
146 prepareStatement(selectById); |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
147 stmnt.setString(1, idString); |
986
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
148 result = stmnt.executeQuery(); |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
149 if (!result.next()) { |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
150 return false; |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
151 } |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
152 res[0] = result.getInt(1); |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
153 return true; |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
154 } |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
155 }; |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
156 |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
157 if (exec.runRead()) { |
987
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
158 cache.put(idString, res[0]); |
986
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
159 return res[0]; |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
160 } |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
161 |
987
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
162 return null; |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
163 } |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
164 |
988
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
165 protected void storeArtifact( |
989
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
166 final String artifactId, |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
167 Integer collectionId, |
1025
02c327ffbad7
Datacage: Extended schema for artifacts and collections
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1024
diff
changeset
|
168 final FLYSArtifact artifact, |
02c327ffbad7
Datacage: Extended schema for artifacts and collections
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1024
diff
changeset
|
169 final Date artifactCreated |
988
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
170 ) { |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
171 Integer aId = getId(artifacts, artifactId, SQL_ARTIFACT_BY_GID); |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
172 |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
173 if (aId != null) { |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
174 // We've already stored it. Just create the collection item. |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
175 storeCollectionItem(collectionId, aId); |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
176 return; |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
177 } |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
178 // We need to write it to database |
989
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
179 |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
180 final Integer [] res = new Integer[1]; |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
181 |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
182 SQLExecutor.Instance exec = sqlExecutor.new Instance() { |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
183 @Override |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
184 public boolean doIt() throws SQLException { |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
185 prepareStatement(SQL_ARTIFACT_ID_NEXTVAL); |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
186 result = stmnt.executeQuery(); |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
187 if (!result.next()) { |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
188 return false; |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
189 } |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
190 res[0] = result.getInt(1); |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
191 reset(); |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
192 prepareStatement(SQL_INSERT_ARTIFACT); |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
193 stmnt.setInt (1, res[0]); |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
194 stmnt.setString(2, artifactId); |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
195 stmnt.setString(3, artifact.getCurrentStateId()); |
1025
02c327ffbad7
Datacage: Extended schema for artifacts and collections
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1024
diff
changeset
|
196 Timestamp timestamp = new Timestamp(artifactCreated != null |
02c327ffbad7
Datacage: Extended schema for artifacts and collections
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1024
diff
changeset
|
197 ? artifactCreated.getTime() |
02c327ffbad7
Datacage: Extended schema for artifacts and collections
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1024
diff
changeset
|
198 : System.currentTimeMillis()); |
02c327ffbad7
Datacage: Extended schema for artifacts and collections
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1024
diff
changeset
|
199 stmnt.setTimestamp(4, timestamp); |
989
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
200 stmnt.execute(); |
990
e573c4715d81
Add artifacts data into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
989
diff
changeset
|
201 conn.commit(); |
989
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
202 return true; |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
203 } |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
204 }; |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
205 |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
206 if (!exec.runWrite()) { |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
207 log.error("storing of artifact failed."); |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
208 return; |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
209 } |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
210 |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
211 artifacts.put(artifactId, aId = res[0]); |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
212 |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
213 storeCollectionItem(collectionId, aId); |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
214 |
990
e573c4715d81
Add artifacts data into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
989
diff
changeset
|
215 storeData(aId, artifact); |
e573c4715d81
Add artifacts data into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
989
diff
changeset
|
216 |
1002
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
217 storeOuts(aId, artifact, context); |
991
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
218 } |
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
219 |
990
e573c4715d81
Add artifacts data into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
989
diff
changeset
|
220 |
988
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
221 protected void storeCollectionItem( |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
222 final Integer collectionId, |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
223 final Integer artifactId |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
224 ) { |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
225 SQLExecutor.Instance exec = sqlExecutor.new Instance() { |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
226 @Override |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
227 public boolean doIt() throws SQLException { |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
228 prepareStatement(SQL_COLLECTION_ITEM_ID_NEXTVAL); |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
229 result = stmnt.executeQuery(); |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
230 if (!result.next()) { |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
231 return false; |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
232 } |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
233 int ciId = result.getInt(1); |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
234 reset(); |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
235 prepareStatement(SQL_INSERT_COLLECTION_ITEM); |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
236 stmnt.setInt(1, ciId); |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
237 stmnt.setInt(2, collectionId); |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
238 stmnt.setInt(3, artifactId); |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
239 stmnt.execute(); |
990
e573c4715d81
Add artifacts data into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
989
diff
changeset
|
240 conn.commit(); |
988
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
241 return true; |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
242 } |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
243 }; |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
244 |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
245 if (!exec.runWrite()) { |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
246 log.error("storing of collection item failed."); |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
247 } |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
248 } |
987
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
249 |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
250 protected Integer getCollectionId( |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
251 final String collectionId, |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
252 final Integer ownerId, |
1025
02c327ffbad7
Datacage: Extended schema for artifacts and collections
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1024
diff
changeset
|
253 final String collectionName, |
02c327ffbad7
Datacage: Extended schema for artifacts and collections
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1024
diff
changeset
|
254 final Date collectionCreated |
987
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
255 ) { |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
256 Integer c = getId(collections, collectionId, SQL_COLLECTION_BY_GID); |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
257 |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
258 if (c != null) { |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
259 return c; |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
260 } |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
261 |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
262 final Integer [] res = new Integer[1]; |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
263 |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
264 SQLExecutor.Instance exec = sqlExecutor.new Instance() { |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
265 @Override |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
266 public boolean doIt() throws SQLException { |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
267 prepareStatement(SQL_COLLECTION_ID_NEXTVAL); |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
268 result = stmnt.executeQuery(); |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
269 if (!result.next()) { |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
270 return false; |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
271 } |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
272 res[0] = result.getInt(1); |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
273 reset(); |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
274 prepareStatement(SQL_INSERT_COLLECTION); |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
275 stmnt.setInt (1, res[0]); |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
276 stmnt.setString(2, collectionId); |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
277 stmnt.setInt (3, ownerId); |
1009
fc5fca0c33b3
Datacage: Set the name of the collections at initial scan, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1008
diff
changeset
|
278 setString(stmnt, 4, collectionName); |
1025
02c327ffbad7
Datacage: Extended schema for artifacts and collections
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1024
diff
changeset
|
279 Timestamp timestamp = new Timestamp(collectionCreated != null |
02c327ffbad7
Datacage: Extended schema for artifacts and collections
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1024
diff
changeset
|
280 ? collectionCreated.getTime() |
02c327ffbad7
Datacage: Extended schema for artifacts and collections
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1024
diff
changeset
|
281 : System.currentTimeMillis()); |
02c327ffbad7
Datacage: Extended schema for artifacts and collections
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1024
diff
changeset
|
282 stmnt.setTimestamp(5, timestamp); |
987
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
283 stmnt.execute(); |
990
e573c4715d81
Add artifacts data into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
989
diff
changeset
|
284 conn.commit(); |
987
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
285 return true; |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
286 } |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
287 }; |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
288 |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
289 if (exec.runWrite()) { |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
290 collections.put(collectionId, res[0]); |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
291 return res[0]; |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
292 } |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
293 |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
294 return null; |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
295 } |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
296 |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
297 protected Integer getUserId(final String userId) { |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
298 |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
299 Integer u = getId(users, userId, SQL_USER_BY_GID); |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
300 |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
301 if (u != null) { |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
302 return u; |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
303 } |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
304 |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
305 final Integer [] res = new Integer[1]; |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
306 |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
307 SQLExecutor.Instance exec = sqlExecutor.new Instance() { |
986
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
308 @Override |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
309 public boolean doIt() throws SQLException { |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
310 prepareStatement(SQL_USER_ID_NEXTVAL); |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
311 result = stmnt.executeQuery(); |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
312 if (!result.next()) { |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
313 return false; |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
314 } |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
315 res[0] = result.getInt(1); |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
316 reset(); |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
317 prepareStatement(SQL_INSERT_USER); |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
318 stmnt.setInt (1, res[0]); |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
319 stmnt.setString(2, userId); |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
320 stmnt.execute(); |
990
e573c4715d81
Add artifacts data into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
989
diff
changeset
|
321 conn.commit(); |
986
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
322 return true; |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
323 } |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
324 }; |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
325 |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
326 if (exec.runWrite()) { |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
327 users.put(userId, res[0]); |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
328 return res[0]; |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
329 } |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
330 |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
331 return null; |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
332 } |
70545233f8ee
Datacage: Add users at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
984
diff
changeset
|
333 |
984
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
334 public boolean scan(ArtifactDatabase adb) { |
993
aabcca7aeb6c
Fixed datacage db scheme. add some debug output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
992
diff
changeset
|
335 log.debug("scan"); |
984
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
336 try { |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
337 adb.loadAllArtifacts(this); |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
338 } |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
339 catch (ArtifactDatabaseException ade) { |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
340 log.error(ade); |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
341 return false; |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
342 } |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
343 return true; |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
344 } |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
345 } // class InitialScan |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
346 |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
347 |
982
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
348 public Datacage() { |
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
349 } |
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
350 |
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
351 @Override |
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
352 public void setup(Document document) { |
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
353 log.debug("setup"); |
983
4ea5f5a2284e
Ajusted datacage to use the SQL infrastructure from the artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
982
diff
changeset
|
354 DBConfig config = DBConfig.getInstance(); |
4ea5f5a2284e
Ajusted datacage to use the SQL infrastructure from the artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
982
diff
changeset
|
355 setupSQL(config.getSQL()); |
4ea5f5a2284e
Ajusted datacage to use the SQL infrastructure from the artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
982
diff
changeset
|
356 sqlExecutor = new SQLExecutor(config.getDBConnection()); |
4ea5f5a2284e
Ajusted datacage to use the SQL infrastructure from the artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
982
diff
changeset
|
357 } |
4ea5f5a2284e
Ajusted datacage to use the SQL infrastructure from the artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
982
diff
changeset
|
358 |
4ea5f5a2284e
Ajusted datacage to use the SQL infrastructure from the artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
982
diff
changeset
|
359 protected void setupSQL(SQL sql) { |
987
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
360 SQL_DELETE_ALL_USERS = sql.get(SQL_DELETE_ALL_USERS); |
996
f61fe8b561d2
Datacage: delete artifacts at initial scan, too. Fixed problem with writing content of state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
995
diff
changeset
|
361 SQL_DELETE_ALL_ARTIFACTS = sql.get(SQL_DELETE_ALL_ARTIFACTS); |
987
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
362 SQL_USER_ID_NEXTVAL = sql.get(SQL_USER_ID_NEXTVAL); |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
363 SQL_USER_BY_GID = sql.get(SQL_USER_BY_GID); |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
364 SQL_INSERT_USER = sql.get(SQL_INSERT_USER); |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
365 SQL_COLLECTION_BY_GID = sql.get(SQL_COLLECTION_BY_GID); |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
366 SQL_COLLECTION_ID_NEXTVAL = sql.get(SQL_COLLECTION_ID_NEXTVAL); |
82ef338fee91
Datacage: Add collections at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
986
diff
changeset
|
367 SQL_INSERT_COLLECTION = sql.get(SQL_INSERT_COLLECTION); |
988
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
368 SQL_ARTIFACT_BY_GID = sql.get(SQL_ARTIFACT_BY_GID); |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
369 SQL_COLLECTION_ITEM_ID_NEXTVAL = |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
370 sql.get(SQL_COLLECTION_ITEM_ID_NEXTVAL); |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
371 SQL_INSERT_COLLECTION_ITEM = |
dbe39e1fb5e7
Datacage: Add collection items at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
987
diff
changeset
|
372 sql.get(SQL_INSERT_COLLECTION_ITEM); |
989
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
373 SQL_ARTIFACT_ID_NEXTVAL = sql.get(SQL_ARTIFACT_ID_NEXTVAL); |
f3be883325ce
Add artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
988
diff
changeset
|
374 SQL_INSERT_ARTIFACT = sql.get(SQL_INSERT_ARTIFACT); |
991
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
375 SQL_ARTIFACT_DATA_ID_NEXTVAL = sql.get(SQL_ARTIFACT_DATA_ID_NEXTVAL); |
990
e573c4715d81
Add artifacts data into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
989
diff
changeset
|
376 SQL_INSERT_ARTIFACT_DATA = sql.get(SQL_INSERT_ARTIFACT_DATA); |
991
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
377 SQL_OUT_ID_NEXTVALUE = sql.get(SQL_OUT_ID_NEXTVALUE); |
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
378 SQL_INSERT_OUT = sql.get(SQL_INSERT_OUT); |
992
5b467bc27eda
Datacage: Store
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
991
diff
changeset
|
379 SQL_FACET_ID_NEXTVAL = sql.get(SQL_FACET_ID_NEXTVAL); |
5b467bc27eda
Datacage: Store
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
991
diff
changeset
|
380 SQL_INSERT_FACET = sql.get(SQL_INSERT_FACET); |
1003
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
381 SQL_UPDATE_COLLECTION_NAME = sql.get(SQL_UPDATE_COLLECTION_NAME); |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
382 SQL_DELETE_ARTIFACT_FROM_COLLECTION = |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
383 sql.get(SQL_DELETE_ARTIFACT_FROM_COLLECTION); |
1004
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
384 SQL_DELETE_COLLECTION_BY_GID = sql.get(SQL_DELETE_COLLECTION_BY_GID); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
385 SQL_DELETE_USER_BY_GID = sql.get(SQL_DELETE_USER_BY_GID); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
386 SQL_DELETE_ARTIFACT_DATA_BY_ARTIFACT_ID = |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
387 sql.get(SQL_DELETE_ARTIFACT_DATA_BY_ARTIFACT_ID); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
388 SQL_DELETE_OUTS_BY_ARTIFACT_ID = |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
389 sql.get(SQL_DELETE_OUTS_BY_ARTIFACT_ID); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
390 SQL_DELETE_FACETS_BY_ARTIFACT_ID = |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
391 sql.get(SQL_DELETE_FACETS_BY_ARTIFACT_ID); |
1010
d419c9904825
Datacage: Forgot to fetch dialect dependent SQL statement for deleting artifacts by uuid.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1009
diff
changeset
|
392 SQL_DELETE_ARTIFACT_BY_GID = |
d419c9904825
Datacage: Forgot to fetch dialect dependent SQL statement for deleting artifacts by uuid.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1009
diff
changeset
|
393 sql.get(SQL_DELETE_ARTIFACT_BY_GID); |
991
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
394 } |
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
395 |
992
5b467bc27eda
Datacage: Store
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
991
diff
changeset
|
396 protected static final int numFacets(List<Output> outs) { |
5b467bc27eda
Datacage: Store
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
991
diff
changeset
|
397 int sum = 0; |
5b467bc27eda
Datacage: Store
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
991
diff
changeset
|
398 for (Output out: outs) { |
5b467bc27eda
Datacage: Store
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
991
diff
changeset
|
399 sum += out.getFacets().size(); |
5b467bc27eda
Datacage: Store
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
991
diff
changeset
|
400 } |
5b467bc27eda
Datacage: Store
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
991
diff
changeset
|
401 return sum; |
5b467bc27eda
Datacage: Store
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
991
diff
changeset
|
402 } |
5b467bc27eda
Datacage: Store
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
991
diff
changeset
|
403 |
5b467bc27eda
Datacage: Store
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
991
diff
changeset
|
404 protected static final void setString( |
991
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
405 PreparedStatement stmnt, |
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
406 int index, |
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
407 Object value |
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
408 ) |
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
409 throws SQLException |
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
410 { |
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
411 if (value == null) { |
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
412 stmnt.setNull(index, Types.VARCHAR); |
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
413 } |
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
414 else { |
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
415 stmnt.setString(index, value.toString()); |
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
416 } |
982
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
417 } |
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
418 |
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
419 @Override |
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
420 public void systemUp(GlobalContext context) { |
993
aabcca7aeb6c
Fixed datacage db scheme. add some debug output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
992
diff
changeset
|
421 log.debug("systemUp entered"); |
984
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
422 initialScan(context); |
999
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
423 context.put(DATACAGE_KEY, this); |
993
aabcca7aeb6c
Fixed datacage db scheme. add some debug output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
992
diff
changeset
|
424 log.debug("systemUp leaved"); |
982
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
425 } |
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
426 |
984
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
427 protected void initialScan(GlobalContext context) { |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
428 log.debug("initialScan"); |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
429 |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
430 Object adbObject = context.get(ARTEFACT_DATABASE_KEY); |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
431 |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
432 if (!(adbObject instanceof ArtifactDatabase)) { |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
433 log.error("missing artefact database. Cannot scan"); |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
434 return; |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
435 } |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
436 |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
437 ArtifactDatabase adb = (ArtifactDatabase)adbObject; |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
438 |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
439 if (!cleanDatabase()) { |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
440 log.error("cleaning database failed"); |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
441 return; |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
442 } |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
443 |
991
c675b4a87201
Store outs of artifacts into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
990
diff
changeset
|
444 InitialScan is = new InitialScan(context); |
984
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
445 |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
446 if (!is.scan(adb)) { |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
447 log.error("initial scan failed"); |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
448 return; |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
449 } |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
450 |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
451 } |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
452 |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
453 protected boolean cleanDatabase() { |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
454 |
993
aabcca7aeb6c
Fixed datacage db scheme. add some debug output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
992
diff
changeset
|
455 log.debug("cleanDatabase"); |
aabcca7aeb6c
Fixed datacage db scheme. add some debug output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
992
diff
changeset
|
456 |
aabcca7aeb6c
Fixed datacage db scheme. add some debug output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
992
diff
changeset
|
457 boolean success = sqlExecutor.new Instance() { |
984
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
458 @Override |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
459 public boolean doIt() throws SQLException { |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
460 prepareStatement(SQL_DELETE_ALL_USERS); |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
461 stmnt.execute(); |
996
f61fe8b561d2
Datacage: delete artifacts at initial scan, too. Fixed problem with writing content of state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
995
diff
changeset
|
462 prepareStatement(SQL_DELETE_ALL_ARTIFACTS); |
f61fe8b561d2
Datacage: delete artifacts at initial scan, too. Fixed problem with writing content of state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
995
diff
changeset
|
463 stmnt.execute(); |
990
e573c4715d81
Add artifacts data into datacage db at initial scan.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
989
diff
changeset
|
464 conn.commit(); |
984
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
465 return true; |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
466 } |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
467 }.runWrite(); |
993
aabcca7aeb6c
Fixed datacage db scheme. add some debug output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
992
diff
changeset
|
468 |
aabcca7aeb6c
Fixed datacage db scheme. add some debug output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
992
diff
changeset
|
469 log.debug("after runWrite(): " + success); |
aabcca7aeb6c
Fixed datacage db scheme. add some debug output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
992
diff
changeset
|
470 |
aabcca7aeb6c
Fixed datacage db scheme. add some debug output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
992
diff
changeset
|
471 return success; |
984
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
472 } |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
473 |
2b05c4a0c6fd
Datacage: clear database before initial scan
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
983
diff
changeset
|
474 |
982
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
475 @Override |
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
476 public void systemDown(GlobalContext context) { |
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
477 log.debug("systemDown"); |
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
478 } |
999
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
479 |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
480 public void setup(GlobalContext globalContext) { |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
481 log.debug("setup"); |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
482 } |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
483 |
1002
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
484 public void createdArtifact( |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
485 Artifact artifact, |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
486 Backend backend, |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
487 GlobalContext context |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
488 ) { |
999
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
489 log.debug("createdArtifact"); |
1002
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
490 |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
491 if (!(artifact instanceof FLYSArtifact)) { |
1004
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
492 log.warn("need FLYSArtifact here"); |
1002
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
493 return; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
494 } |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
495 |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
496 final FLYSArtifact flys = (FLYSArtifact)artifact; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
497 |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
498 final int [] res = new int[1]; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
499 |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
500 SQLExecutor.Instance exec = sqlExecutor.new Instance() { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
501 @Override |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
502 public boolean doIt() throws SQLException { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
503 prepareStatement(SQL_ARTIFACT_ID_NEXTVAL); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
504 result = stmnt.executeQuery(); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
505 if (!result.next()) { |
1004
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
506 log.error("id generation for artifact failed"); |
1002
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
507 return false; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
508 } |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
509 res[0] = result.getInt(1); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
510 reset(); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
511 prepareStatement(SQL_INSERT_ARTIFACT); |
1025
02c327ffbad7
Datacage: Extended schema for artifacts and collections
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1024
diff
changeset
|
512 stmnt.setInt (1, res[0]); |
02c327ffbad7
Datacage: Extended schema for artifacts and collections
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1024
diff
changeset
|
513 stmnt.setString (2, flys.identifier()); |
02c327ffbad7
Datacage: Extended schema for artifacts and collections
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1024
diff
changeset
|
514 stmnt.setString (3, flys.getCurrentStateId()); |
02c327ffbad7
Datacage: Extended schema for artifacts and collections
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1024
diff
changeset
|
515 stmnt.setTimestamp(4, |
02c327ffbad7
Datacage: Extended schema for artifacts and collections
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1024
diff
changeset
|
516 new Timestamp(System.currentTimeMillis())); |
1002
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
517 stmnt.execute(); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
518 conn.commit(); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
519 return true; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
520 } |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
521 }; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
522 |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
523 if (!exec.runWrite()) { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
524 log.error("storing of artifact failed."); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
525 return; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
526 } |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
527 |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
528 storeData(res[0], flys); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
529 storeOuts(res[0], flys, context); |
999
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
530 } |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
531 |
1002
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
532 public void storedArtifact( |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
533 Artifact artifact, |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
534 Backend backend, |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
535 GlobalContext context |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
536 ) { |
999
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
537 log.debug("storedArtifact"); |
1004
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
538 if (!(artifact instanceof FLYSArtifact)) { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
539 log.warn("need FLYSArtifact here"); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
540 return; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
541 } |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
542 |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
543 final FLYSArtifact flys = (FLYSArtifact)artifact; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
544 |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
545 final Integer [] res = new Integer[1]; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
546 |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
547 // check first if artifact already exists |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
548 SQLExecutor.Instance exec = sqlExecutor.new Instance() { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
549 @Override |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
550 public boolean doIt() throws SQLException { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
551 prepareStatement(SQL_ARTIFACT_BY_GID); |
1007
ed918497873b
Datacage: Fixed two NPEs
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1006
diff
changeset
|
552 stmnt.setString(1, flys.identifier()); |
1004
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
553 result = stmnt.executeQuery(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
554 if (!result.next()) { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
555 // new artifact |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
556 return true; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
557 } |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
558 res[0] = result.getInt(1); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
559 return true; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
560 } |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
561 }; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
562 |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
563 if (!exec.runRead()) { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
564 log.error("querying artifact failed"); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
565 return; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
566 } |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
567 |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
568 if (res[0] == null) { // new artifact |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
569 createdArtifact(artifact, backend, context); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
570 return; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
571 } |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
572 |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
573 // artifact already exists -> delete old data |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
574 exec = sqlExecutor.new Instance() { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
575 @Override |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
576 public boolean doIt() throws SQLException { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
577 prepareStatement(SQL_DELETE_ARTIFACT_DATA_BY_ARTIFACT_ID); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
578 stmnt.setInt(1, res[0]); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
579 stmnt.execute(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
580 prepareStatement(SQL_DELETE_FACETS_BY_ARTIFACT_ID); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
581 stmnt.setInt(1, res[0]); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
582 stmnt.execute(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
583 prepareStatement(SQL_DELETE_OUTS_BY_ARTIFACT_ID); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
584 stmnt.setInt(1, res[0]); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
585 stmnt.execute(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
586 conn.commit(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
587 return true; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
588 } |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
589 }; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
590 |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
591 if (!exec.runWrite()) { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
592 log.error("deleting old artifact data failed"); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
593 return; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
594 } |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
595 |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
596 // write new data |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
597 storeData(res[0], flys); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
598 storeOuts(res[0], flys, context); |
999
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
599 } |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
600 |
1002
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
601 public void createdUser( |
1004
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
602 final User user, |
1002
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
603 Backend backend, |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
604 GlobalContext context |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
605 ) { |
999
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
606 log.debug("createdUser"); |
1004
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
607 SQLExecutor.Instance exec = sqlExecutor.new Instance() { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
608 @Override |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
609 public boolean doIt() throws SQLException { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
610 prepareStatement(SQL_USER_ID_NEXTVAL); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
611 result = stmnt.executeQuery(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
612 if (!result.next()) { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
613 log.error("id generation for user failed"); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
614 return false; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
615 } |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
616 int uId = result.getInt(1); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
617 reset(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
618 prepareStatement(SQL_INSERT_USER); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
619 stmnt.setInt(1, uId); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
620 stmnt.setString(2, user.identifier()); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
621 stmnt.execute(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
622 conn.commit(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
623 return true; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
624 } |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
625 }; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
626 |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
627 if (!exec.runWrite()) { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
628 log.error("create user failed"); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
629 } |
999
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
630 } |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
631 |
1002
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
632 public void deletedUser( |
1004
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
633 final String identifier, |
1002
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
634 Backend backend, |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
635 GlobalContext context |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
636 ) { |
999
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
637 log.debug("deletedUser"); |
1004
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
638 SQLExecutor.Instance exec = sqlExecutor.new Instance() { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
639 @Override |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
640 public boolean doIt() throws SQLException { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
641 prepareStatement(SQL_DELETE_USER_BY_GID); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
642 stmnt.setString(1, identifier); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
643 stmnt.execute(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
644 conn.commit(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
645 return true; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
646 } |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
647 }; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
648 |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
649 if (!exec.runWrite()) { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
650 log.error("delete user failed"); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
651 } |
999
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
652 } |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
653 |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
654 public void createdCollection( |
1004
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
655 final ArtifactCollection collection, |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
656 Backend backend, |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
657 GlobalContext context |
999
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
658 ) { |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
659 log.debug("createdCollection"); |
1004
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
660 SQLExecutor.Instance exec = sqlExecutor.new Instance() { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
661 @Override |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
662 public boolean doIt() throws SQLException { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
663 String userId = collection.getUser().identifier(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
664 prepareStatement(SQL_USER_BY_GID); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
665 stmnt.setString(1, userId); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
666 result = stmnt.executeQuery(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
667 int uId; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
668 if (result.next()) { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
669 uId = result.getInt(1); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
670 reset(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
671 } |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
672 else { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
673 // need to create user first |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
674 reset(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
675 prepareStatement(SQL_USER_ID_NEXTVAL); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
676 result = stmnt.executeQuery(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
677 if (!result.next()) { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
678 log.error("id generation for user failed"); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
679 return false; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
680 } |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
681 uId = result.getInt(1); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
682 reset(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
683 prepareStatement(SQL_INSERT_USER); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
684 stmnt.setInt(1, uId); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
685 stmnt.setString(2, userId); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
686 stmnt.execute(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
687 conn.commit(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
688 reset(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
689 } |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
690 |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
691 prepareStatement(SQL_COLLECTION_ID_NEXTVAL); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
692 result = stmnt.executeQuery(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
693 if (!result.next()) { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
694 log.error("id generation for collection failed"); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
695 return false; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
696 } |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
697 int cId = result.getInt(1); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
698 reset(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
699 |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
700 String identifier = collection.identifier(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
701 String name = collection.getName(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
702 |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
703 prepareStatement(SQL_INSERT_COLLECTION); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
704 stmnt.setInt(1, cId); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
705 stmnt.setString(2, identifier); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
706 stmnt.setInt(3, uId); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
707 setString(stmnt, 4, name); |
1025
02c327ffbad7
Datacage: Extended schema for artifacts and collections
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1024
diff
changeset
|
708 stmnt.setTimestamp(5, |
02c327ffbad7
Datacage: Extended schema for artifacts and collections
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1024
diff
changeset
|
709 new Timestamp(System.currentTimeMillis())); |
1004
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
710 stmnt.execute(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
711 |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
712 conn.commit(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
713 return true; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
714 } |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
715 }; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
716 |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
717 if (!exec.runWrite()) { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
718 log.error("create collection failed"); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
719 } |
999
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
720 } |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
721 |
1002
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
722 public void deletedCollection( |
1004
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
723 final String identifier, |
1002
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
724 Backend backend, |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
725 GlobalContext context |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
726 ) { |
999
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
727 log.debug("deletedCollection"); |
1004
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
728 SQLExecutor.Instance exec = sqlExecutor.new Instance() { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
729 @Override |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
730 public boolean doIt() throws SQLException { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
731 prepareStatement(SQL_DELETE_COLLECTION_BY_GID); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
732 stmnt.setString(1, identifier); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
733 stmnt.execute(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
734 conn.commit(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
735 return true; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
736 } |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
737 }; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
738 |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
739 if (!exec.runWrite()) { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
740 log.error("delete collection failed"); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
741 } |
999
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
742 } |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
743 |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
744 public void changedCollectionAttribute( |
1002
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
745 String identifier, |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
746 Document document, |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
747 Backend backend, |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
748 GlobalContext context |
999
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
749 ) { |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
750 log.debug("changedCollectionAttribute"); |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
751 } |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
752 |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
753 public void changedCollectionItemAttribute( |
1002
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
754 String collectionId, |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
755 String artifactId, |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
756 Document document, |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
757 Backend backend, |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
758 GlobalContext context |
999
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
759 ) { |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
760 log.debug("changedCollectionItemAttribute"); |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
761 } |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
762 |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
763 public void addedArtifactToCollection( |
1004
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
764 final String artifactId, |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
765 final String collectionId, |
1002
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
766 Backend backend, |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
767 GlobalContext context |
999
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
768 ) { |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
769 log.debug("addedArtifactToCollection"); |
1004
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
770 SQLExecutor.Instance exec = sqlExecutor.new Instance() { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
771 @Override |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
772 public boolean doIt() throws SQLException { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
773 prepareStatement(SQL_ARTIFACT_BY_GID); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
774 stmnt.setString(1, artifactId); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
775 result = stmnt.executeQuery(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
776 if (!result.next()) { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
777 return false; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
778 } |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
779 int aId = result.getInt(1); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
780 reset(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
781 |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
782 prepareStatement(SQL_COLLECTION_BY_GID); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
783 stmnt.setString(1, collectionId); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
784 result = stmnt.executeQuery(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
785 if (!result.next()) { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
786 return false; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
787 } |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
788 int cId = result.getInt(1); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
789 reset(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
790 |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
791 prepareStatement(SQL_COLLECTION_ITEM_ID_NEXTVAL); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
792 result = stmnt.executeQuery(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
793 if (!result.next()) { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
794 return false; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
795 } |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
796 int ciId = result.getInt(1); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
797 reset(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
798 |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
799 prepareStatement(SQL_INSERT_COLLECTION_ITEM); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
800 stmnt.setInt(1, ciId); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
801 stmnt.setInt(2, cId); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
802 stmnt.setInt(3, aId); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
803 stmnt.execute(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
804 |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
805 conn.commit(); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
806 return true; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
807 } |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
808 }; |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
809 if (!exec.runWrite()) { |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
810 log.error("added artifact to collection failed"); |
0e8c03b69627
Datacage: completed backend listener stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1003
diff
changeset
|
811 } |
999
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
812 } |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
813 |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
814 public void removedArtifactFromCollection( |
1003
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
815 final String artifactId, |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
816 final String collectionId, |
1002
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
817 Backend backend, |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
818 GlobalContext context |
999
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
819 ) { |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
820 log.debug("removedArtifactFromCollection"); |
1003
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
821 SQLExecutor.Instance exec = sqlExecutor.new Instance() { |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
822 @Override |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
823 public boolean doIt() throws SQLException { |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
824 prepareStatement(SQL_ARTIFACT_BY_GID); |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
825 stmnt.setString(1, artifactId); |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
826 result = stmnt.executeQuery(); |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
827 if (!result.next()) { |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
828 return false; |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
829 } |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
830 int aId = result.getInt(1); |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
831 reset(); |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
832 prepareStatement(SQL_COLLECTION_BY_GID); |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
833 stmnt.setString(1, collectionId); |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
834 result = stmnt.executeQuery(); |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
835 if (!result.next()) { |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
836 return false; |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
837 } |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
838 int cId = result.getInt(1); |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
839 reset(); |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
840 prepareStatement(SQL_DELETE_ARTIFACT_FROM_COLLECTION); |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
841 stmnt.setInt(1, cId); |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
842 stmnt.setInt(2, aId); |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
843 stmnt.execute(); |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
844 conn.commit(); |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
845 return true; |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
846 } |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
847 }; |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
848 if (!exec.runWrite()) { |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
849 log.error("removing artifact from collection failed"); |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
850 } |
999
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
851 } |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
852 |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
853 public void setCollectionName( |
1003
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
854 final String collectionId, |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
855 final String name, |
1002
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
856 GlobalContext context |
999
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
857 ) { |
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
858 log.debug("setCollectionName"); |
1003
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
859 SQLExecutor.Instance exec = sqlExecutor.new Instance() { |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
860 @Override |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
861 public boolean doIt() throws SQLException { |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
862 prepareStatement(SQL_UPDATE_COLLECTION_NAME); |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
863 stmnt.setString(1, name); |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
864 stmnt.setString(2, collectionId); |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
865 stmnt.execute(); |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
866 conn.commit(); |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
867 return true; |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
868 } |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
869 }; |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
870 if (!exec.runWrite()) { |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
871 log.error("changing name failed"); |
c58da6dd15ed
Datacage: Update collection names on change. Remove artifacts from collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1002
diff
changeset
|
872 } |
999
b0218f21c664
Wire datacage with backend of artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
996
diff
changeset
|
873 } |
1002
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
874 |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
875 protected void storeData( |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
876 final int artifactId, |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
877 FLYSArtifact artifact |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
878 ) { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
879 final Collection<StateData> data = artifact.getAllData(); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
880 |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
881 if (data.isEmpty()) { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
882 return; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
883 } |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
884 |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
885 SQLExecutor.Instance exec = sqlExecutor.new Instance() { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
886 @Override |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
887 public boolean doIt() throws SQLException { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
888 int [] ids = new int[data.size()]; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
889 prepareStatement(SQL_ARTIFACT_DATA_ID_NEXTVAL); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
890 |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
891 for (int i = 0; i < ids.length; ++i) { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
892 result = stmnt.executeQuery(); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
893 if (!result.next()) { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
894 log.error("generating id for artifact data failed"); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
895 return false; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
896 } |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
897 ids[i] = result.getInt(1); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
898 result.close(); result = null; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
899 } |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
900 reset(); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
901 prepareStatement(SQL_INSERT_ARTIFACT_DATA); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
902 |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
903 int i = 0; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
904 for (StateData sd: data) { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
905 int id = ids[i++]; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
906 stmnt.setInt(1, id); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
907 stmnt.setInt(2, artifactId); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
908 // XXX: Where come the nulls from? |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
909 String type = sd.getType(); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
910 if (type == null) type = "String"; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
911 stmnt.setString(3, type); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
912 stmnt.setString(4, sd.getName()); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
913 setString(stmnt, 5, sd.getValue()); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
914 stmnt.execute(); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
915 } |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
916 |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
917 conn.commit(); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
918 return true; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
919 } |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
920 }; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
921 |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
922 if (!exec.runWrite()) { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
923 log.error("storing artifact data failed"); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
924 } |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
925 } |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
926 |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
927 protected void storeOuts( |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
928 final int artifactId, |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
929 final FLYSArtifact artifact, |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
930 GlobalContext context |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
931 ) { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
932 final List<Output> outs = artifact.getCurrentOutputs(context); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
933 |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
934 if (outs.isEmpty()) { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
935 return; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
936 } |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
937 |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
938 final int [] outIds = new int[outs.size()]; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
939 |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
940 SQLExecutor.Instance exec = sqlExecutor.new Instance() { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
941 @Override |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
942 public boolean doIt() throws SQLException { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
943 prepareStatement(SQL_OUT_ID_NEXTVALUE); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
944 for (int i = 0; i < outIds.length; ++i) { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
945 result = stmnt.executeQuery(); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
946 if (!result.next()) { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
947 log.error("generation of out ids failed"); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
948 return false; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
949 } |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
950 outIds[i] = result.getInt(1); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
951 result.close(); result = null; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
952 } |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
953 reset(); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
954 prepareStatement(SQL_INSERT_OUT); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
955 for (int i = 0; i < outIds.length; ++i) { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
956 Output out = outs.get(i); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
957 stmnt.setInt(1, outIds[i]); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
958 stmnt.setInt(2, artifactId); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
959 stmnt.setString(3, out.getName()); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
960 setString(stmnt, 4, out.getDescription()); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
961 setString(stmnt, 5, out.getType()); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
962 stmnt.execute(); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
963 } |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
964 conn.commit(); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
965 return true; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
966 } |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
967 }; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
968 |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
969 if (!exec.runWrite()) { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
970 log.error("storing artifact outs failed"); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
971 return; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
972 } |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
973 |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
974 final int FACETS = numFacets(outs); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
975 |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
976 if (FACETS == 0) { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
977 return; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
978 } |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
979 |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
980 exec = sqlExecutor.new Instance() { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
981 @Override |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
982 public boolean doIt() throws SQLException { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
983 int [] facetIds = new int[FACETS]; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
984 prepareStatement(SQL_FACET_ID_NEXTVAL); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
985 for (int i = 0; i < facetIds.length; ++i) { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
986 result = stmnt.executeQuery(); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
987 if (!result.next()) { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
988 log.error("generation of facet ids failed"); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
989 return false; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
990 } |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
991 facetIds[i] = result.getInt(1); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
992 result.close(); result = null; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
993 } |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
994 reset(); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
995 prepareStatement(SQL_INSERT_FACET); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
996 int index = 0; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
997 for (int i = 0, N = outs.size(); i < N; ++i) { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
998 Output out = outs.get(i); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
999 int outId = outIds[i]; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
1000 for (Facet facet: out.getFacets()) { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
1001 stmnt.setInt(1, facetIds[index]); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
1002 stmnt.setInt(2, outId); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
1003 stmnt.setString(3, facet.getName()); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
1004 stmnt.setInt(4, facet.getIndex()); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
1005 stmnt.setString(5, "XXX"); // TODO: handle states |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
1006 setString(stmnt, 6, facet.getDescription()); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
1007 stmnt.execute(); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
1008 ++index; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
1009 } |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
1010 } |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
1011 conn.commit(); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
1012 return true; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
1013 } |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
1014 }; |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
1015 |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
1016 if (!exec.runWrite()) { |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
1017 log.error("storing facets failed"); |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
1018 } |
db86c665ab6e
Datacage: Pass global context to datacage if calls come from backend listener.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
999
diff
changeset
|
1019 } |
1006
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1020 |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1021 public void killedCollections( |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1022 final List<String> identifiers, |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1023 GlobalContext context |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1024 ) { |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1025 log.debug("killedCollections"); |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1026 |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1027 SQLExecutor.Instance exec = sqlExecutor.new Instance() { |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1028 @Override |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1029 public boolean doIt() throws SQLException { |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1030 prepareStatement(SQL_DELETE_COLLECTION_BY_GID); |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1031 for (String identifier: identifiers) { |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1032 stmnt.setString(1, identifier); |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1033 stmnt.execute(); |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1034 } |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1035 conn.commit(); |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1036 return true; |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1037 } |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1038 }; |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1039 |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1040 if (!exec.runWrite()) { |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1041 log.error("killing collections failed"); |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1042 } |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1043 } |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1044 |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1045 public void killedArtifacts( |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1046 final List<String> identifiers, |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1047 GlobalContext context |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1048 ) { |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1049 log.debug("killedArtifacts"); |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1050 |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1051 SQLExecutor.Instance exec = sqlExecutor.new Instance() { |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1052 @Override |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1053 public boolean doIt() throws SQLException { |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1054 prepareStatement(SQL_DELETE_ARTIFACT_BY_GID); |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1055 for (String identifier: identifiers) { |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1056 stmnt.setString(1, identifier); |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1057 stmnt.execute(); |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1058 } |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1059 conn.commit(); |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1060 return true; |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1061 } |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1062 }; |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1063 |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1064 if (!exec.runWrite()) { |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1065 log.error("killing artifacts failed"); |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1066 } |
1917f32701dc
Forwarded kill collections and artifacts events to datacage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1004
diff
changeset
|
1067 } |
982
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1068 } |
66b3f2f064de
Added the datacage as lifetime listener to the artifact database to create the initial index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1069 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |