aboutsummaryrefslogtreecommitdiff
path: root/id/server/moa-id-commons/src/main/java/at/gv
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2016-03-24 13:25:04 +0100
committerThomas Lenz <tlenz@iaik.tugraz.at>2016-03-24 13:25:04 +0100
commitb819b1f8cd82383fd2b2ed63dc71f6ac23fa9731 (patch)
treee5cc15a66e0ac60efeb98257f81c6852bd337476 /id/server/moa-id-commons/src/main/java/at/gv
parentd8afdada80249cc2d944b120343fdc22c22ba707 (diff)
downloadmoa-id-spss-b819b1f8cd82383fd2b2ed63dc71f6ac23fa9731.tar.gz
moa-id-spss-b819b1f8cd82383fd2b2ed63dc71f6ac23fa9731.tar.bz2
moa-id-spss-b819b1f8cd82383fd2b2ed63dc71f6ac23fa9731.zip
fix problem in moa-id-configuration with duplicate entries and delete operation
Diffstat (limited to 'id/server/moa-id-commons/src/main/java/at/gv')
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java43
1 files changed, 31 insertions, 12 deletions
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java
index 28c705c71..e2f793edf 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java
@@ -248,30 +248,49 @@ public class NewConfigurationDBRead {
* @param id
* @return
*/
- public OnlineApplication getOnlineApplication(String id) {
+ public List<OnlineApplication> getOnlineApplications(String id) {
Logger.trace("Getting OnlineApplication with ID " + id + " from database.");
// select onlineapplication from OnlineApplication onlineapplication
// where onlineapplication.publicURLPrefix = SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix))
- OnlineApplication result = null;
+ List<OnlineApplication> result = new ArrayList<OnlineApplication>();
List<OnlineApplication> allOAs = getAllOnlineApplications();
for (OnlineApplication oa : nullGuard(allOAs)) {
- String publicUrlPrefix = oa.getPublicURLPrefix();
- if (publicUrlPrefix != null && publicUrlPrefix.length() <= id.length()) {
- if (id.substring(0, publicUrlPrefix.length()).equals(publicUrlPrefix)) {
- if (result != null) {
- Logger.warn("OAIdentifier match to more then one DB-entry!");
- return null;
- } else {
- result = oa;
- }
- }
+ String publicUrlPrefix = oa.getPublicURLPrefix();
+ if (publicUrlPrefix != null && publicUrlPrefix.length() <= id.length()) {
+ if (id.substring(0, publicUrlPrefix.length()).equals(publicUrlPrefix))
+ result.add(oa);
+
}
}
return result;
}
+
+ /**
+ *
+ * @param id
+ * @return
+ */
+ public OnlineApplication getOnlineApplication(String id) {
+ Logger.trace("Getting OnlineApplication with ID " + id + " from database.");
+
+ // select onlineapplication from OnlineApplication onlineapplication
+ // where onlineapplication.publicURLPrefix = SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix))
+ List<OnlineApplication> result = getOnlineApplications(id);
+
+ if (result != null && result.size() == 1)
+ return result.get(0);
+
+ else if (result != null && result.size() > 1)
+ Logger.warn("OAIdentifier match to more then one DB-entry!");
+
+ else
+ Logger.warn("no OA with OAIdentifier: "+ id);
+
+ return null;
+ }
/**
*