Commit e4dc153c authored by Gianluca Filippone's avatar Gianluca Filippone
Browse files

Added Enactment Engine column into choreography list table

parent 83aa03b2
......@@ -46,6 +46,7 @@ import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulato
import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
......@@ -88,6 +89,25 @@ public class ChoreographyDirectoryPanel extends GroupDirectoryPanel {
columns.add(new AttrColumn<>("id", SchemaType.PLAIN));
columns.add(new PropertyColumn<>(new ResourceModel("name", "Name"), "name"));
columns.add(new AttrColumn<>("description", SchemaType.PLAIN));
columns.add(new AbstractColumn<GroupTO, String>(new ResourceModel("", "Enactment Engine")) {
@Override
public void populateItem(
final Item<ICellPopulator<GroupTO>> item, final String componentId, final IModel<GroupTO> model) {
String eeName = "";
try {
eeName = choreographyRestClient.getChoreographyEE(
model.getObject().getPlainAttrMap().get("id").getValues().iterator().next())
.getName();
} catch (Exception e) {
eeName = "Not found";
} finally {
Label label = new Label(componentId, eeName);
item.add(label);
}
}
});
columns.add(new AttrColumn<>("status", SchemaType.PLAIN));
columns.add(new AbstractColumn<GroupTO, String>(new ResourceModel("actions", "")) {
......
......@@ -25,6 +25,7 @@ import eu.chorevolution.idm.common.to.CoordinationDelegateTO;
import eu.chorevolution.idm.common.to.ServiceTO;
import eu.chorevolution.idm.common.types.ChoreographyAction;
import java.util.List;
import org.apache.syncope.common.lib.to.AnyObjectTO;
import org.apache.syncope.common.rest.api.service.ChoreographyService;
import org.apache.syncope.common.rest.api.service.ConsoleInterfaceService;
......@@ -120,4 +121,8 @@ public class ChoreographyRestClient extends BaseRestClient {
getService(ChoreographyService.class)
.onChoreography(choreographyId, ChoreographyAction.RESIZE, size);
}
public AnyObjectTO getChoreographyEE(final String choreographyId) {
return getService(ChoreographyService.class).getEnactmentEngine(choreographyId);
}
}
......@@ -766,6 +766,12 @@ public class ChoreographyLogic extends AbstractLogic<AbstractBaseBean> {
}
}
@PreAuthorize("hasRole('" + ChorevolutionEntitlement.CHOREOGRAPHY_LIST + "')")
public AnyObjectTO getChoreographyEnactmentEngine(final String choreographyId) {
GroupTO choreography = choreographyExists(choreographyId);
return enactmentEngineForChoreography(choreography.getKey());
}
@Override
protected AbstractBaseBean resolveReference(final Method method, final Object... args)
throws UnresolvedReferenceException {
......
......@@ -33,6 +33,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.syncope.common.lib.to.AnyObjectTO;
/**
* REST operations for acting on choreographies and / or their services.
......@@ -163,4 +164,14 @@ public interface ChoreographyService extends JAXRSService {
@NotNull @PathParam("id") String id,
@NotNull @PathParam("serviceId") String serviceId,
URL federationServerURL);
/**
* Returns the enactment engine associated to the choreography
*
* @param id choreography id
* @return Enactment engine associated to the choreography
*/
@GET
@Path("{id}/enactmentEngine")
AnyObjectTO getEnactmentEngine(@NotNull @PathParam("id") String id);
}
......@@ -23,6 +23,7 @@ import org.apache.syncope.core.logic.ChoreographyLogic;
import java.io.InputStream;
import java.net.URL;
import javax.ws.rs.core.Response;
import org.apache.syncope.common.lib.to.AnyObjectTO;
import org.apache.syncope.common.rest.api.service.ChoreographyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -90,4 +91,9 @@ public class ChoreographyServiceImpl extends AbstractServiceImpl implements Chor
logic.configureSecurityFilter(id, serviceId, federationServerURL);
}
@Override
public AnyObjectTO getEnactmentEngine(final String choreographyId) {
return logic.getChoreographyEnactmentEngine(choreographyId);
}
}
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