aboutsummaryrefslogtreecommitdiff
path: root/id/server/moa-id-commons
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/moa-id-commons')
-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;
+ }
/**
*