Commit ae3392f9 authored by Tony Schaller's avatar Tony Schaller

Refactorings in order to get DemoXua running on .Net. DemoXua finally works...

Refactorings in order to get DemoXua running on .Net. DemoXua finally works (produces the same output under .Net as in Java).

git-svn-id: https://svn.code.sf.net/p/ehealthconnector/code/trunk@1687 e99adb7c-5e35-42fd-8d1b-cdb378af05e8
parent 1997de77
......@@ -1136,7 +1136,7 @@ namespace eHealthConnectorDemo
txtLog.AppendText("----------------------------\n");
txtLog.AppendText("Response content:\n");
txtLog.AppendText("Status: " + response.getStatus() + "\n");
if (PrivacyPolicyFeedResponse.FAILURE.Equals(response.getStatus()))
if (!response.isStatusSuccess().equals(java.lang.Boolean.TRUE))
{
List exceptions = response.getExceptions();
foreach (Exception e in EnumerableCollection.toEnumerable(exceptions))
......
......@@ -1038,7 +1038,7 @@ public class DemoXua {
System.out.print("----------------------------\n");
System.out.print("Response content:\n");
System.out.print("Status: " + response.getStatus() + "\n");
if (PrivacyPolicyFeedResponse.FAILURE.equals(response.getStatus())) {
if (!response.isStatusSuccess()) {
final List<Exception> exceptions = response.getExceptions();
for (Exception e : exceptions) {
System.out.print("\tError: " + e.getMessage() + "\n");
......
......@@ -59,4 +59,10 @@ public interface EprPolicyRepositoryResponse extends BasePolicyAdministration {
*/
String getStatus();
/**
* Checks whether the response contains a successful status.
*
* @return True in case of success. False in case of failure
*/
Boolean isStatusSuccess();
}
......@@ -31,9 +31,6 @@ import org.ehealth_connector.security.ch.ppq.PrivacyPolicyFeed.PpfMethod;
*/
public interface PrivacyPolicyFeedResponse {
public static final String FAILURE = "urn:e-health-suisse:2015:response-status:failure";
public static final String SUCCESS = "urn:e-health-suisse:2015:response-status:success";
/**
* <!-- @formatter:off -->
* <div class="en">Method to get the list of errors if available.</div>
......@@ -82,4 +79,10 @@ public interface PrivacyPolicyFeedResponse {
*/
String getStatus();
/**
* Checks whether the response contains a successful status.
*
* @return True in case of success. False in case of failure
*/
Boolean isStatusSuccess();
}
......@@ -20,6 +20,7 @@ package org.ehealth_connector.security.ch.epr.policyadmin.impl;
import java.util.List;
import org.ehealth_connector.security.ch.epr.policyadmin.OpenSamlEprPolicyRepositoryResponse;
import org.ehealth_connector.security.ch.ppq.impl.PrivacyPolicyFeedResponseImpl;
import org.opensaml.core.xml.XMLObject;
/**
......@@ -50,9 +51,13 @@ public class EprPolicyRepositoryResponseImpl extends AbstractAssertionBasedReque
return status;
}
@Override
public Boolean isStatusSuccess() {
return PrivacyPolicyFeedResponseImpl.SUCCESS.equals(status);
}
@Override
public void setStatus(String aStatus) {
status = aStatus;
}
}
......@@ -33,6 +33,9 @@ import org.ehealth_connector.security.ch.ppq.PrivacyPolicyFeedResponse;
*/
public class PrivacyPolicyFeedResponseImpl implements PrivacyPolicyFeedResponse {
public static final String FAILURE = "urn:e-health-suisse:2015:response-status:failure";
public static final String SUCCESS = "urn:e-health-suisse:2015:response-status:success";
private List<Exception> mExceptions;
private PpfMethod mMethod;
......@@ -73,6 +76,11 @@ public class PrivacyPolicyFeedResponseImpl implements PrivacyPolicyFeedResponse
return mStatus;
}
@Override
public Boolean isStatusSuccess() {
return PrivacyPolicyFeedResponseImpl.SUCCESS.equals(mStatus);
}
/**
* <!-- @formatter:off -->
* <div class="en">Method to set the method.</div>
......
......@@ -141,7 +141,7 @@ public class SimplePpfClient extends AbstractSoapClient<PrivacyPolicyFeedRespons
final EprPolicyRepositoryResponse response = (EprPolicyRepositoryResponse) unmarshaller
.unmarshall(reponseElement);
if (PrivacyPolicyFeedResponse.FAILURE.equals(response.getStatus())) {
if (!response.isStatusSuccess()) {
return parseResponseError(httpResponse);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment