-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#431: better error handling for PPQ-2
- Loading branch information
Showing
14 changed files
with
192 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
.../xacml20/impl/src/main/java/org/openehealth/ipf/commons/ihe/xacml20/Xacml20Exception.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright 2023 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.openehealth.ipf.commons.ihe.xacml20; | ||
|
||
import lombok.Getter; | ||
|
||
import java.util.Objects; | ||
|
||
public class Xacml20Exception extends Exception { | ||
|
||
@Getter | ||
private final Xacml20Status status; | ||
|
||
public Xacml20Exception(Xacml20Status status, String message, Throwable cause) { | ||
super(message, cause); | ||
this.status = Objects.requireNonNull(status, "Status code shall be provided"); | ||
} | ||
|
||
public Xacml20Exception(Xacml20Status status) { | ||
this(status, null, null); | ||
} | ||
|
||
public Xacml20Exception(Xacml20Status status, String message) { | ||
this(status, message, null); | ||
} | ||
|
||
public Xacml20Exception(Xacml20Status status, Throwable cause) { | ||
this(status, cause.getMessage(), cause); | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
...ihe/xacml20/impl/src/main/java/org/openehealth/ipf/commons/ihe/xacml20/Xacml20Status.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright 2023 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.openehealth.ipf.commons.ihe.xacml20; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@RequiredArgsConstructor | ||
public enum Xacml20Status { | ||
|
||
SUCCESS("urn:oasis:names:tc:SAML:2.0:status:Success"), | ||
REQUESTER_ERROR("urn:oasis:names:tc:SAML:2.0:status:Requester"), | ||
RESPONDER_ERROR("urn:oasis:names:tc:SAML:2.0:status:Responder"), | ||
VERSION_MISMATCH("urn:oasis:names:tc:SAML:2.0:status:VersionMismatch"), | ||
; | ||
|
||
@Getter | ||
private final String code; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...0/src/main/java/org/openehealth/ipf/platform/camel/ihe/xacml20/chppq2/ChPpq2Endpoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright 2023 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.openehealth.ipf.platform.camel.ihe.xacml20.chppq2; | ||
|
||
import org.openehealth.ipf.commons.ihe.ws.JaxWsClientFactory; | ||
import org.openehealth.ipf.commons.ihe.ws.WsInteractionId; | ||
import org.openehealth.ipf.commons.ihe.ws.WsTransactionConfiguration; | ||
import org.openehealth.ipf.commons.ihe.xacml20.audit.ChPpqAuditDataset; | ||
import org.openehealth.ipf.commons.ihe.xacml20.stub.saml20.protocol.ResponseType; | ||
import org.openehealth.ipf.commons.ihe.xacml20.stub.xacml20.saml.protocol.XACMLPolicyQueryType; | ||
import org.openehealth.ipf.platform.camel.ihe.ws.*; | ||
import org.openehealth.ipf.platform.camel.ihe.xacml20.Xacml20Endpoint; | ||
|
||
import java.util.Map; | ||
|
||
public class ChPpq2Endpoint extends Xacml20Endpoint { | ||
|
||
public ChPpq2Endpoint( | ||
String endpointUri, | ||
String address, | ||
AbstractWsComponent<ChPpqAuditDataset, WsTransactionConfiguration<ChPpqAuditDataset>, ? extends WsInteractionId<WsTransactionConfiguration<ChPpqAuditDataset>>> component, | ||
Map<String, Object> parameters) | ||
{ | ||
super(endpointUri, address, component, parameters, ChPpq2Service.class); | ||
} | ||
|
||
@Override | ||
protected AbstractWebService getCustomServiceInstance(AbstractWsEndpoint<ChPpqAuditDataset, WsTransactionConfiguration<ChPpqAuditDataset>> endpoint) { | ||
return new ChPpq2Service(endpoint.getHomeCommunityId()); | ||
} | ||
|
||
@Override | ||
public AbstractWsProducer<ChPpqAuditDataset, WsTransactionConfiguration<ChPpqAuditDataset>, ?, ?> getProducer(AbstractWsEndpoint<ChPpqAuditDataset, WsTransactionConfiguration<ChPpqAuditDataset>> endpoint, JaxWsClientFactory<ChPpqAuditDataset> clientFactory) { | ||
return new SimpleWsProducer<>(this, clientFactory, XACMLPolicyQueryType.class, ResponseType.class); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.