# HG changeset patch # User Sascha L. Teichmann # Date 1311764515 0 # Node ID 799c7108ea6db1d127a12715178be344c2ad49a1 # Parent f9a6a9cd918e2ff363c7e2b90d3f8a219cd4b3fc datacage: prepared access to outs of artifacts. flys-artifacts/trunk@2409 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r f9a6a9cd918e -r 799c7108ea6d flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Wed Jul 27 08:20:55 2011 +0000 +++ b/flys-artifacts/ChangeLog Wed Jul 27 11:01:55 2011 +0000 @@ -1,3 +1,12 @@ +2011-07-27 Sascha L. Teichmann + + * doc/conf/datacage.sql: Added an explicit table for the outs + of an artifact. + + * src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java: + Make the current outs of an artifact accessible only with + the global context. + 2011-07-27 Sascha L. Teichmann * doc/conf/datacage.sql: Added ON DELETE CASCADE constraints. diff -r f9a6a9cd918e -r 799c7108ea6d flys-artifacts/doc/conf/datacage.sql --- a/flys-artifacts/doc/conf/datacage.sql Wed Jul 27 08:20:55 2011 +0000 +++ b/flys-artifacts/doc/conf/datacage.sql Wed Jul 27 11:01:55 2011 +0000 @@ -32,18 +32,27 @@ UNIQUE (artifact_id, k) ); +CREATE TABLE outs ( + id IDENTITY PRIMARY KEY NOT NULL, + artifact_id INT NOT NULL REFERENCES artifacts(id) ON DELETE CASCADE, + name VARCHAR(256) NOT NULL, + description VARCHAR(256), + out_type VARCHAR(256) +); + CREATE TABLE facets ( id IDENTITY PRIMARY KEY NOT NULL, artifact_id INT NOT NULL REFERENCES artifacts(id) ON DELETE CASCADE, + out_id INT NOT NULL REFERENCES outs(id) ON DELETE CASCADE, name VARCHAR(256) NOT NULL, num INT NOT NULL, state VARCHAR(256) NOT NULL, - output VARCHAR(256) NOT NULL, description VARCHAR(256), UNIQUE (artifact_id, output, num, name) ); -- DROP TABLE facets; +-- DROP TABLE outs; -- DROP TABLE artifact_data; -- DROP TABLE collection_items; -- DROP TABLE collections; diff -r f9a6a9cd918e -r 799c7108ea6d flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java Wed Jul 27 08:20:55 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java Wed Jul 27 11:01:55 2011 +0000 @@ -1131,7 +1131,7 @@ for (String stateId: stateIds) { DefaultState state = (DefaultState) engine.getState(stateId); - generated.addAll(getOutputForState(context, state)); + generated.addAll(getOutputForState(state)); } generated.addAll(getCurrentOutputs(context)); @@ -1145,7 +1145,7 @@ try { if (cur.validate(this, context)) { - return getOutputForState(context, cur); + return getOutputForState(cur); } } catch (IllegalArgumentException iae) { } @@ -1153,11 +1153,11 @@ return new ArrayList(); } + public List getCurrentOutputs(Object context) { + return getOutputForState((DefaultState)getCurrentState(context)); + } - protected List getOutputForState( - CallContext context, - DefaultState state) - { + protected List getOutputForState(DefaultState state) { List list = state.getOutputs(); if (list == null || list.size() == 0) { logger.debug("-> No output modes for this state.");