Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/Datacage.java @ 5867:59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Sun, 28 Apr 2013 15:23:01 +0200 |
parents | 4897a58c8746 |
children | af13ceeba52a |
comparison
equal
deleted
inserted
replaced
5866:9a6741ccf6d4 | 5867:59ff03ff48f1 |
---|---|
34 | 34 |
35 import org.dive4elements.artifacts.Artifact; | 35 import org.dive4elements.artifacts.Artifact; |
36 import org.dive4elements.artifacts.ArtifactDatabase; | 36 import org.dive4elements.artifacts.ArtifactDatabase; |
37 import org.dive4elements.artifacts.ArtifactDatabaseException; | 37 import org.dive4elements.artifacts.ArtifactDatabaseException; |
38 | 38 |
39 import org.dive4elements.river.artifacts.FLYSArtifact; | 39 import org.dive4elements.river.artifacts.D4EArtifact; |
40 | 40 |
41 import org.dive4elements.artifacts.common.utils.LRUCache; | 41 import org.dive4elements.artifacts.common.utils.LRUCache; |
42 | 42 |
43 import org.apache.log4j.Logger; | 43 import org.apache.log4j.Logger; |
44 | 44 |
120 Date collectionCreated, | 120 Date collectionCreated, |
121 String artifactId, | 121 String artifactId, |
122 Date artifactCreated, | 122 Date artifactCreated, |
123 Artifact artifact | 123 Artifact artifact |
124 ) { | 124 ) { |
125 if (!(artifact instanceof FLYSArtifact)) { | 125 if (!(artifact instanceof D4EArtifact)) { |
126 log.warn("ignoring none FLYS artifacts"); | 126 log.warn("ignoring none FLYS artifacts"); |
127 return; | 127 return; |
128 } | 128 } |
129 | 129 |
130 FLYSArtifact flysArtifact = (FLYSArtifact)artifact; | 130 D4EArtifact flysArtifact = (D4EArtifact)artifact; |
131 | 131 |
132 Integer uId = getUserId(userId); | 132 Integer uId = getUserId(userId); |
133 Integer cId = getCollectionId( | 133 Integer cId = getCollectionId( |
134 collectionId, uId, collectionName, collectionCreated); | 134 collectionId, uId, collectionName, collectionCreated); |
135 | 135 |
171 } | 171 } |
172 | 172 |
173 protected void storeArtifact( | 173 protected void storeArtifact( |
174 final String artifactId, | 174 final String artifactId, |
175 Integer collectionId, | 175 Integer collectionId, |
176 final FLYSArtifact artifact, | 176 final D4EArtifact artifact, |
177 final Date artifactCreated | 177 final Date artifactCreated |
178 ) { | 178 ) { |
179 Integer aId = getId(artifacts, artifactId, SQL_ARTIFACT_BY_GID); | 179 Integer aId = getId(artifacts, artifactId, SQL_ARTIFACT_BY_GID); |
180 | 180 |
181 if (aId != null) { | 181 if (aId != null) { |
498 if (artifact == null) { | 498 if (artifact == null) { |
499 log.warn("artifact to create is null"); | 499 log.warn("artifact to create is null"); |
500 return; | 500 return; |
501 } | 501 } |
502 | 502 |
503 if (!(artifact instanceof FLYSArtifact)) { | 503 if (!(artifact instanceof D4EArtifact)) { |
504 log.warn("need FLYSArtifact here (have " + artifact.getClass() + ")"); | 504 log.warn("need D4EArtifact here (have " + artifact.getClass() + ")"); |
505 return; | 505 return; |
506 } | 506 } |
507 | 507 |
508 final FLYSArtifact flys = (FLYSArtifact)artifact; | 508 final D4EArtifact flys = (D4EArtifact)artifact; |
509 | 509 |
510 final int [] res = new int[1]; | 510 final int [] res = new int[1]; |
511 | 511 |
512 SQLExecutor.Instance exec = sqlExecutor.new Instance() { | 512 SQLExecutor.Instance exec = sqlExecutor.new Instance() { |
513 @Override | 513 @Override |
545 Artifact artifact, | 545 Artifact artifact, |
546 Backend backend, | 546 Backend backend, |
547 GlobalContext context | 547 GlobalContext context |
548 ) { | 548 ) { |
549 log.debug("storedArtifact"); | 549 log.debug("storedArtifact"); |
550 if (!(artifact instanceof FLYSArtifact)) { | 550 if (!(artifact instanceof D4EArtifact)) { |
551 log.warn("need FLYSArtifact here but have a " + artifact.getClass()); | 551 log.warn("need D4EArtifact here but have a " + artifact.getClass()); |
552 return; | 552 return; |
553 } | 553 } |
554 | 554 |
555 final FLYSArtifact flys = (FLYSArtifact)artifact; | 555 final D4EArtifact flys = (D4EArtifact)artifact; |
556 | 556 |
557 final Integer [] res = new Integer[1]; | 557 final Integer [] res = new Integer[1]; |
558 | 558 |
559 // check first if artifact already exists | 559 // check first if artifact already exists |
560 SQLExecutor.Instance exec = sqlExecutor.new Instance() { | 560 SQLExecutor.Instance exec = sqlExecutor.new Instance() { |
884 } | 884 } |
885 } | 885 } |
886 | 886 |
887 protected void storeData( | 887 protected void storeData( |
888 final int artifactId, | 888 final int artifactId, |
889 FLYSArtifact artifact | 889 D4EArtifact artifact |
890 ) { | 890 ) { |
891 final Collection<StateData> data = artifact.getAllData(); | 891 final Collection<StateData> data = artifact.getAllData(); |
892 | 892 |
893 if (data.isEmpty()) { | 893 if (data.isEmpty()) { |
894 return; | 894 return; |
936 } | 936 } |
937 } | 937 } |
938 | 938 |
939 protected void storeOuts( | 939 protected void storeOuts( |
940 final int artifactId, | 940 final int artifactId, |
941 final FLYSArtifact artifact, | 941 final D4EArtifact artifact, |
942 GlobalContext context | 942 GlobalContext context |
943 ) { | 943 ) { |
944 final List<Output> outs = artifact.getOutputs(context); | 944 final List<Output> outs = artifact.getOutputs(context); |
945 | 945 |
946 if (outs.isEmpty()) { | 946 if (outs.isEmpty()) { |