Commit 9f20c112 authored by Gianluca Filippone's avatar Gianluca Filippone
Browse files

Now choreography list shows also the associated synthesis processor

parent bd522623
......@@ -701,6 +701,7 @@ we are happy to inform you that the password request was execute successfully fo
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"/>
<AMembership id="0c2b2b0b-9414-40eb-9f10-73d27fd07a5b" group_id="80b8ba87-842d-481a-b8ba-87842d681a70" anyObject_id="467a4bfb-d9eb-42b1-bbe8-0246e665e47f"/>
 
<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"/>
......@@ -117,6 +117,27 @@ public class ChoreographyDirectoryPanel extends GroupDirectoryPanel {
}
}
});
columns.add(new AbstractColumn<GroupTO, String>(new ResourceModel("", "Synthesis Processor")) {
private static final long serialVersionUID = 2054811145491901166L;
@Override
public void populateItem(
final Item<ICellPopulator<GroupTO>> item, final String componentId, final IModel<GroupTO> model) {
String spName = StringUtils.EMPTY;
try {
spName = choreographyRestClient.getChoreographySynthesisProcessor(
model.getObject().getKey()).getName();
} catch (Exception e) {
spName = "Not assigned";
} finally {
Label label = new Label(componentId, spName);
item.add(label);
}
}
});
columns.add(new AttrColumn<>("status", SchemaType.PLAIN));
......@@ -143,7 +164,7 @@ public class ChoreographyDirectoryPanel extends GroupDirectoryPanel {
@Override
public void onClick(final AjaxRequestTarget target) {
try {
String eeKey = choreographyRestClient
.getChoreographyEE(model.getObject().getKey()).getKey();
......
......@@ -65,4 +65,8 @@ public class ChoreographyRestClient extends BaseRestClient {
public AnyObjectTO getChoreographyEE(final String choreographyKey) {
return getService(ChoreographyService.class).getEnactmentEngine(choreographyKey);
}
public AnyObjectTO getChoreographySynthesisProcessor(final String choreographyKey) {
return getService(ChoreographyService.class).getSynthesisProcessor(choreographyKey);
}
}
......@@ -250,6 +250,23 @@ public class ChoreographyLogic extends AbstractLogic<AbstractBaseBean> {
return candidates.get(0);
}
private AnyObjectTO synthesisProcessorForChoreography(final String choreographyKey) {
MembershipCond membershipCond = new MembershipCond();
membershipCond.setGroup(choreographyKey);
AnyTypeCond anyTypeCond = new AnyTypeCond();
anyTypeCond.setAnyTypeKey(SYNTHESIS_PROCESSOR_TYPE);
SearchCond serviceCond = SearchCond.getAndCond(
SearchCond.getLeafCond(anyTypeCond), SearchCond.getLeafCond(membershipCond));
List<AnyObjectTO> candidates =
anyObjectLogic.search(serviceCond, 1, 1, Collections.emptyList(), SyncopeConstants.ROOT_REALM, false);
if (candidates.isEmpty()) {
throw new NotFoundException("Synthesis Processor for choreography " + choreographyKey);
}
return candidates.get(0);
}
private void updateChoreographyStatus(final GroupTO choreography, final String newStatus) {
GroupPatch choreographyPatch = new GroupPatch();
choreographyPatch.setKey(choreography.getKey());
......@@ -989,6 +1006,12 @@ public class ChoreographyLogic extends AbstractLogic<AbstractBaseBean> {
return enactmentEngineForChoreography(choreographyKey);
}
@PreAuthorize("hasRole('" + ChorevolutionEntitlement.CHOREOGRAPHY_LIST + "')")
public AnyObjectTO getChoreographySynthesisProcessor(final String choreographyKey) {
groupLogic.read(choreographyKey);
return synthesisProcessorForChoreography(choreographyKey);
}
@Override
protected AbstractBaseBean resolveReference(final Method method, final Object... args)
throws UnresolvedReferenceException {
......
......@@ -199,4 +199,15 @@ public interface ChoreographyService extends JAXRSService {
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
AnyObjectTO getEnactmentEngine(@NotNull @PathParam("key") String choreographyKey);
/**
* Returns the synthesis processor associated with the choreography.
*
* @param choreographyKey choreography key
* @return Enactment engine associated to the choreography
*/
@GET
@Path("{key}/synthesisProcessor")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
AnyObjectTO getSynthesisProcessor(@NotNull @PathParam("key") String choreographyKey);
}
......@@ -120,4 +120,9 @@ public class ChoreographyServiceImpl extends AbstractServiceImpl implements Chor
return logic.getChoreographyEnactmentEngine(choreographyKey);
}
@Override
public AnyObjectTO getSynthesisProcessor(final String choreographyKey) {
return logic.getChoreographySynthesisProcessor(choreographyKey);
}
}
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