Commit 70cd56ec authored by Francesco Chicchiricco's avatar Francesco Chicchiricco
Browse files

[CRV-227] Done

parent ef6f093d
......@@ -582,8 +582,12 @@ we are happy to inform you that the password request was execute successfully fo
<PlainSchema id="isChoreography" mandatoryCondition="false"
multivalue="0" readonly="1" type="Boolean" uniqueConstraint="0" anyTypeClass_id="Choreography"/>
<SyncopeSchema id="Endpoint"/>
<PlainSchema id="Endpoint" mandatoryCondition="false"
<SyncopeSchema id="GlobalSecurityFilterEndpoint"/>
<PlainSchema id="SecurityFilterEndpoint" mandatoryCondition="false"
multivalue="0" readonly="0" type="String" uniqueConstraint="1" anyTypeClass_id="Choreography"/>
<SyncopeSchema id="SecurityFilterEndpoint"/>
<PlainSchema id="SecurityFilterEndpoint" mandatoryCondition="false"
multivalue="0" readonly="0" type="String" uniqueConstraint="1" anyTypeClass_id="Deployed"/>
<SyncopeSchema id="enactmentEngineBaseURL"/>
......
......@@ -582,9 +582,13 @@ we are happy to inform you that the password request was execute successfully fo
<SyncopeSchema id="isChoreography"/>
<PlainSchema id="isChoreography" mandatoryCondition="false"
multivalue="0" readonly="1" type="Boolean" uniqueConstraint="0" anyTypeClass_id="Choreography"/>
<SyncopeSchema id="GlobalSecurityFilterEndpoint"/>
<PlainSchema id="SecurityFilterEndpoint" mandatoryCondition="false"
multivalue="0" readonly="0" type="String" uniqueConstraint="1" anyTypeClass_id="Choreography"/>
<SyncopeSchema id="Endpoint"/>
<PlainSchema id="Endpoint" mandatoryCondition="false"
<SyncopeSchema id="SecurityFilterEndpoint"/>
<PlainSchema id="SecurityFilterEndpoint" mandatoryCondition="false"
multivalue="0" readonly="0" type="String" uniqueConstraint="1" anyTypeClass_id="Deployed"/>
 
<SyncopeSchema id="enactmentEngineBaseURL"/>
......@@ -94,7 +94,9 @@ public class ChoreographyLogic extends AbstractLogic<AbstractBaseBean> {
private static final String CHOREOGRAPHY_ID_SCHEMA = "id";
private static final String SECURITY_FILTER_ENDPOINT_SCHEMA = "Endpoint";
private static final String GLOBAL_SECURITY_FILTER_ENDPOINT_SCHEMA = "GlobalSecurityFilterEndpoint";
private static final String SECURITY_FILTER_ENDPOINT_SCHEMA = "SecurityFilterEndpoint";
private static String SECRET_KEY;
......@@ -354,6 +356,7 @@ public class ChoreographyLogic extends AbstractLogic<AbstractBaseBean> {
byte[] chorSpecXML = null;
Choreography chorSpec = null;
List<String> globalSecurityFilterURLs = Collections.emptyList();
if (operation != ChoreographyOperation.DELETE) {
if (enactedChorSpec != null) {
try {
......@@ -366,6 +369,8 @@ public class ChoreographyLogic extends AbstractLogic<AbstractBaseBean> {
if (chorSpec == null) {
throw new BadRequestException("Cloud not parse enacted chorSpec for choreography " + id);
}
globalSecurityFilterURLs = ChorSpecUtils.findGlobalSecurityFilterURLs(chorSpec);
}
GroupTO choreography;
......@@ -379,6 +384,11 @@ public class ChoreographyLogic extends AbstractLogic<AbstractBaseBean> {
choreography.getAuxClasses().add("Choreography");
choreography.getPlainAttrs().add(new AttrTO.Builder().schema(CHOREOGRAPHY_ID_SCHEMA).value(id).build());
choreography.getPlainAttrs().add(new AttrTO.Builder().schema("status").value("STARTED").build());
if (!globalSecurityFilterURLs.isEmpty()) {
choreography.getPlainAttrs().add(new AttrTO.Builder().
schema(GLOBAL_SECURITY_FILTER_ENDPOINT_SCHEMA).value(globalSecurityFilterURLs.get(0)).
build());
}
choreography.getPlainAttrs().add(
new AttrTO.Builder().schema("chorSpec").value(Base64Utility.encode(chorSpecXML)).build());
......@@ -421,6 +431,15 @@ public class ChoreographyLogic extends AbstractLogic<AbstractBaseBean> {
if (!oldName.equals(name)) {
groupPatch.setName(new StringReplacePatchItem.Builder().value(name).build());
}
if (globalSecurityFilterURLs.isEmpty()) {
groupPatch.getPlainAttrs().add(new AttrPatch.Builder().attrTO(new AttrTO.Builder().
schema(GLOBAL_SECURITY_FILTER_ENDPOINT_SCHEMA).build()).
operation(PatchOperation.DELETE).build());
} else {
groupPatch.getPlainAttrs().add(new AttrPatch.Builder().attrTO(new AttrTO.Builder().
schema(GLOBAL_SECURITY_FILTER_ENDPOINT_SCHEMA).value(globalSecurityFilterURLs.get(0)).
build()).build());
}
groupPatch.getPlainAttrs().add(new AttrPatch.Builder().attrTO(
new AttrTO.Builder().schema("chorSpec").value(Base64Utility.encode(chorSpecXML)).build()).
build());
......@@ -579,7 +598,7 @@ public class ChoreographyLogic extends AbstractLogic<AbstractBaseBean> {
if (response != null && response.getStatus() != Response.Status.OK.getStatusCode()) {
throw new WebApplicationException(response);
}
} catch (Exception e) {
} catch (WebApplicationException e) {
throw new RuntimeException(
"While requesting " + action + " on security filter for " + service.getName()
+ " in choreography " + choreography.getName(), e);
......@@ -611,7 +630,7 @@ public class ChoreographyLogic extends AbstractLogic<AbstractBaseBean> {
throw new WebApplicationException(response);
}
return response.readEntity(SecurityFilterInfo.class);
} catch (Exception e) {
} catch (WebApplicationException e) {
throw new RuntimeException("While reading security filter information for " + service.getName()
+ " in choreography " + choreography.getName(), e);
}
......
Supports Markdown
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