Commit e5ec03c8 authored by Francesco Chicchiricco's avatar Francesco Chicchiricco
Browse files

[CRV-225] Put choreography on status PENDING DELETE when deletion is request...

[CRV-225] Put choreography on status PENDING DELETE when deletion is request via admin console and forwarded to EE
parent dbb87b90
......@@ -555,7 +555,7 @@ we are happy to inform you that the password request was execute successfully fo
<SyncopeSchema id="status"/>
<PlainSchema id="status" mandatoryCondition="true"
multivalue="0" readonly="0" type="Enum" uniqueConstraint="0" enumerationValues="STARTED;FROZEN;STOPPED"
multivalue="0" readonly="0" type="Enum" uniqueConstraint="0" enumerationValues="STARTED;FROZEN;STOPPED;PENDING DELETE"
anyTypeClass_id="Choreography"/>
<SyncopeSchema id="description"/>
......
......@@ -556,7 +556,7 @@ we are happy to inform you that the password request was execute successfully fo
 
<SyncopeSchema id="status"/>
<PlainSchema id="status" mandatoryCondition="true"
multivalue="0" readonly="0" type="Enum" uniqueConstraint="0" enumerationValues="STARTED;FROZEN;STOPPED"
multivalue="0" readonly="0" type="Enum" uniqueConstraint="0" enumerationValues="STARTED;FROZEN;STOPPED;PENDING DELETE"
anyTypeClass_id="Choreography"/>
 
<SyncopeSchema id="chorSpec"/>
......@@ -641,7 +641,8 @@ we are happy to inform you that the password request was execute successfully fo
creator="admin" lastModifier="admin"
creationDate="2016-07-20 11:00:00" lastChangeDate="2016-07-20 11:00:00"/>
<SyncopeGroup_AnyTypeClass group_id="80b8ba87-842d-481a-b8ba-87842d681a70" anyTypeClass_id="Choreography"/>
<AMembership id="b9f97d8d-f41e-4fe0-a7cd-ae5504fbe14a" group_id="80b8ba87-842d-481a-b8ba-87842d681a70" anyObject_id="ef028fc9-23bb-491b-828f-c923bb791bf5"/>
<TypeExtension id="5014b45c-d915-41bb-94b4-5cd91591bb8d" group_id="80b8ba87-842d-481a-b8ba-87842d681a70" anyType_id="SERVICE"/>
<TypeExtension_AnyTypeClass typeExtension_id="5014b45c-d915-41bb-94b4-5cd91591bb8d" anyTypeClass_id="Deployed"/>
......@@ -256,6 +256,16 @@ public class ChoreographyLogic extends AbstractLogic<AbstractBaseBean> {
return candidates.get(0);
}
private void updateChoreographyStatus(final String choreographyKey, final String newStatus) {
GroupPatch patch = new GroupPatch();
patch.setKey(choreographyKey);
patch.getPlainAttrs().add(new AttrPatch.Builder().attrTO(
new AttrTO.Builder().schema("status").value(newStatus).build()
).build());
groupLogic.update(patch, false);
}
@PreAuthorize("hasRole('" + ChorevolutionEntitlement.CHOREOGRAPHY_CREATE + "')")
public String create(final String name, final String enactmentEngineKey, final InputStream chorSpec) {
String generatedChoreographyId = null;
......@@ -319,6 +329,9 @@ public class ChoreographyLogic extends AbstractLogic<AbstractBaseBean> {
} catch (Exception e) {
throw new RuntimeException("While deleting " + id, e);
}
// finally update the choreograpy status
updateChoreographyStatus(choreography.getKey(), "PENDING DELETE");
}
private String getUSERTypeExtensionKey(final String name) {
......@@ -629,13 +642,7 @@ public class ChoreographyLogic extends AbstractLogic<AbstractBaseBean> {
}
if (newStatus != null) {
GroupPatch patch = new GroupPatch();
patch.setKey(choreography.getKey());
patch.getPlainAttrs().add(new AttrPatch.Builder().attrTO(
new AttrTO.Builder().schema("status").value("newStatus").build()
).build());
groupLogic.update(patch, false);
updateChoreographyStatus(choreography.getKey(), newStatus);
}
} catch (Exception e) {
throw new RuntimeException("While acting on " + id, 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