Commit 22436d83 authored by Gianluca Filippone's avatar Gianluca Filippone
Browse files

Revert "[CRV-302] Created new REST method for listing choreographies and...

Revert "[CRV-302] Created new REST method for listing choreographies and adapted methods  to store methods and choreography diagram"

This reverts commit e652703e.
parent e652703e
...@@ -33,8 +33,6 @@ public class ChoreographyTO extends AbstractBaseBean { ...@@ -33,8 +33,6 @@ public class ChoreographyTO extends AbstractBaseBean {
private String description; private String description;
private byte[] chorSpec;
private byte[] diagram; private byte[] diagram;
private byte[] messages; private byte[] messages;
...@@ -75,14 +73,6 @@ public class ChoreographyTO extends AbstractBaseBean { ...@@ -75,14 +73,6 @@ public class ChoreographyTO extends AbstractBaseBean {
this.description = description; this.description = description;
} }
public byte[] getChorSpec() {
return chorSpec;
}
public void setChorSpec(final byte[] chorSpec) {
this.chorSpec = chorSpec;
}
public byte[] getDiagram() { public byte[] getDiagram() {
return diagram; return diagram;
} }
......
...@@ -36,7 +36,6 @@ import java.lang.reflect.Method; ...@@ -36,7 +36,6 @@ import java.lang.reflect.Method;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
...@@ -72,7 +71,6 @@ import org.apache.syncope.common.lib.types.AttrSchemaType; ...@@ -72,7 +71,6 @@ import org.apache.syncope.common.lib.types.AttrSchemaType;
import org.apache.syncope.common.lib.types.CipherAlgorithm; import org.apache.syncope.common.lib.types.CipherAlgorithm;
import org.apache.syncope.common.lib.types.PatchOperation; import org.apache.syncope.common.lib.types.PatchOperation;
import org.apache.syncope.common.lib.types.SchemaType; import org.apache.syncope.common.lib.types.SchemaType;
import org.apache.syncope.core.persistence.api.dao.ChoreographyDAO;
import org.apache.syncope.core.persistence.api.dao.ChoreographyInstanceDAO; import org.apache.syncope.core.persistence.api.dao.ChoreographyInstanceDAO;
import org.apache.syncope.core.persistence.api.dao.NotFoundException; import org.apache.syncope.core.persistence.api.dao.NotFoundException;
import org.apache.syncope.core.persistence.api.dao.search.AnyTypeCond; import org.apache.syncope.core.persistence.api.dao.search.AnyTypeCond;
...@@ -80,8 +78,6 @@ import org.apache.syncope.core.persistence.api.dao.search.AttributeCond; ...@@ -80,8 +78,6 @@ import org.apache.syncope.core.persistence.api.dao.search.AttributeCond;
import org.apache.syncope.core.persistence.api.dao.search.MembershipCond; import org.apache.syncope.core.persistence.api.dao.search.MembershipCond;
import org.apache.syncope.core.persistence.api.dao.search.OrderByClause; import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
import org.apache.syncope.core.persistence.api.dao.search.SearchCond; import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
import org.apache.syncope.core.persistence.api.entity.group.GPlainAttr;
import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.spring.security.Encryptor; import org.apache.syncope.core.spring.security.Encryptor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
...@@ -136,9 +132,6 @@ public class ChoreographyLogic extends AbstractLogic<AbstractBaseBean> { ...@@ -136,9 +132,6 @@ public class ChoreographyLogic extends AbstractLogic<AbstractBaseBean> {
} }
@Autowired
private ChoreographyDAO choreographyDAO;
@Autowired @Autowired
private GroupLogic groupLogic; private GroupLogic groupLogic;
...@@ -298,31 +291,8 @@ public class ChoreographyLogic extends AbstractLogic<AbstractBaseBean> { ...@@ -298,31 +291,8 @@ public class ChoreographyLogic extends AbstractLogic<AbstractBaseBean> {
return getChoreography(choreography, true); return getChoreography(choreography, true);
} }
@PreAuthorize("hasRole('" + ChorevolutionEntitlement.CHOREOGRAPHY_LIST + "')")
public List<ChoreographyTO> getChoreographyList() {
List<ChoreographyTO> result = new LinkedList<>();
for (Group choreography : choreographyDAO.findAll()) {
ChoreographyTO choreographyTO = new ChoreographyTO();
choreographyTO.setKey(choreography.getKey());
choreographyTO.setName(choreography.getName());
GPlainAttr description = choreography.getPlainAttr("description");
if (description != null && !description.getValues().isEmpty()) {
choreographyTO.setDescription(description.getValues().get(0).getStringValue());
}
result.add(choreographyTO);
}
return result;
}
@PreAuthorize("hasRole('" + ChorevolutionEntitlement.CHOREOGRAPHY_CREATE + "')") @PreAuthorize("hasRole('" + ChorevolutionEntitlement.CHOREOGRAPHY_CREATE + "')")
public String create( public String create(final String name, final String synthesisProcessorKey, final InputStream chorSpec) {
final String name,
final String synthesisProcessorKey,
final InputStream chorSpec,
final InputStream diagram,
final InputStream messages) {
AnyObjectTO synthesisProcessor = synthesisProcessorExists(synthesisProcessorKey); AnyObjectTO synthesisProcessor = synthesisProcessorExists(synthesisProcessorKey);
GroupTO choreography = new GroupTO(); GroupTO choreography = new GroupTO();
...@@ -336,12 +306,6 @@ public class ChoreographyLogic extends AbstractLogic<AbstractBaseBean> { ...@@ -336,12 +306,6 @@ public class ChoreographyLogic extends AbstractLogic<AbstractBaseBean> {
choreography.getPlainAttrs().add( choreography.getPlainAttrs().add(
new AttrTO.Builder().schema("chorSpec"). new AttrTO.Builder().schema("chorSpec").
value(Base64Utility.encode(IOUtils.readBytesFromStream(chorSpec))).build()); value(Base64Utility.encode(IOUtils.readBytesFromStream(chorSpec))).build());
choreography.getPlainAttrs().add(
new AttrTO.Builder().schema("diagram").
value(Base64Utility.encode(IOUtils.readBytesFromStream(diagram))).build());
choreography.getPlainAttrs().add(
new AttrTO.Builder().schema("messages").
value(Base64Utility.encode(IOUtils.readBytesFromStream(messages))).build());
TypeExtensionTO serviceTE = new TypeExtensionTO(); TypeExtensionTO serviceTE = new TypeExtensionTO();
serviceTE.setAnyType(SERVICE_TYPE); serviceTE.setAnyType(SERVICE_TYPE);
...@@ -364,12 +328,7 @@ public class ChoreographyLogic extends AbstractLogic<AbstractBaseBean> { ...@@ -364,12 +328,7 @@ public class ChoreographyLogic extends AbstractLogic<AbstractBaseBean> {
} }
@PreAuthorize("hasRole('" + ChorevolutionEntitlement.CHOREOGRAPHY_UPDATE + "')") @PreAuthorize("hasRole('" + ChorevolutionEntitlement.CHOREOGRAPHY_UPDATE + "')")
public void update( public void update(final String key, final String name, final InputStream chorSpec) {
final String key,
final String name,
final InputStream chorSpec,
final InputStream diagram,
final InputStream messages) {
GroupTO choreography = groupLogic.read(key); GroupTO choreography = groupLogic.read(key);
GroupPatch choreographyPatch = new GroupPatch(); GroupPatch choreographyPatch = new GroupPatch();
...@@ -390,13 +349,8 @@ public class ChoreographyLogic extends AbstractLogic<AbstractBaseBean> { ...@@ -390,13 +349,8 @@ public class ChoreographyLogic extends AbstractLogic<AbstractBaseBean> {
} }
choreographyPatch.getPlainAttrs().add(new AttrPatch.Builder().attrTO( choreographyPatch.getPlainAttrs().add(new AttrPatch.Builder().attrTO(
new AttrTO.Builder().schema("chorSpec"). new AttrTO.Builder().schema("chorSpec").
value(Base64Utility.encode(IOUtils.readBytesFromStream(chorSpec))).build()).build()); value(Base64Utility.encode(IOUtils.readBytesFromStream(chorSpec))).build()).
choreographyPatch.getPlainAttrs().add(new AttrPatch.Builder().attrTO( build());
new AttrTO.Builder().schema("diagram").
value(Base64Utility.encode(IOUtils.readBytesFromStream(diagram))).build()).build());
choreographyPatch.getPlainAttrs().add(new AttrPatch.Builder().attrTO(
new AttrTO.Builder().schema("messages").
value(Base64Utility.encode(IOUtils.readBytesFromStream(messages))).build()).build());
groupLogic.update(choreographyPatch, false); groupLogic.update(choreographyPatch, false);
} catch (Exception e) { } catch (Exception e) {
...@@ -969,11 +923,6 @@ public class ChoreographyLogic extends AbstractLogic<AbstractBaseBean> { ...@@ -969,11 +923,6 @@ public class ChoreographyLogic extends AbstractLogic<AbstractBaseBean> {
} }
if (details) { if (details) {
AttrTO chorspec = choreography.getPlainAttrMap().get("chorSpec");
if (chorspec != null && !chorspec.getValues().isEmpty()) {
choreographyTO.setMessages(DatatypeConverter.parseBase64Binary(chorspec.getValues().get(0)));
}
AttrTO messages = choreography.getPlainAttrMap().get("messages"); AttrTO messages = choreography.getPlainAttrMap().get("messages");
if (messages != null && !messages.getValues().isEmpty()) { if (messages != null && !messages.getValues().isEmpty()) {
choreographyTO.setMessages(DatatypeConverter.parseBase64Binary(messages.getValues().get(0))); choreographyTO.setMessages(DatatypeConverter.parseBase64Binary(messages.getValues().get(0)));
......
...@@ -22,7 +22,6 @@ import eu.chorevolution.idm.common.types.SecurityFilterInfo; ...@@ -22,7 +22,6 @@ import eu.chorevolution.idm.common.types.SecurityFilterInfo;
import eu.chorevolution.idm.common.types.ServiceAction; import eu.chorevolution.idm.common.types.ServiceAction;
import java.io.InputStream; import java.io.InputStream;
import java.net.URL; import java.net.URL;
import java.util.List;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE; import javax.ws.rs.DELETE;
...@@ -54,23 +53,12 @@ public interface ChoreographyService extends JAXRSService { ...@@ -54,23 +53,12 @@ public interface ChoreographyService extends JAXRSService {
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
ChoreographyTO read(@NotNull @PathParam("key") String choreographyKey); ChoreographyTO read(@NotNull @PathParam("key") String choreographyKey);
/**
* Retrieves choreography list
*
* @return list of all choreographies, with only name, key and description
*/
@GET
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
List<ChoreographyTO> list();
/** /**
* Creates a choreography. * Creates a choreography.
* *
* @param name choreography name * @param name choreography name
* @param synthesisProcessorKey associated synthesis processor instance * @param synthesisProcessorKey associated synthesis processor instance
* @param chorSpec ChorSpec XML representation * @param chorSpec ChorSpec XML representation
* @param diagram XML for the choreography diagram
* @param messages XML for message types
* @return Response object featuring Location header of created choreography * @return Response object featuring Location header of created choreography
*/ */
@POST @POST
...@@ -78,17 +66,13 @@ public interface ChoreographyService extends JAXRSService { ...@@ -78,17 +66,13 @@ public interface ChoreographyService extends JAXRSService {
Response create( Response create(
@NotNull @QueryParam("name") String name, @NotNull @QueryParam("name") String name,
@NotNull @QueryParam("synthesisProcessor") String synthesisProcessorKey, @NotNull @QueryParam("synthesisProcessor") String synthesisProcessorKey,
InputStream chorSpec, InputStream chorSpec);
InputStream diagram,
InputStream messages);
/** /**
* Updates an existing choreography, with updated specification. * Updates an existing choreography, with updated specification.
* *
* @param key choreography key * @param key choreography key
* @param name choreography name * @param name choreography name
* @param diagram XML for the choreography diagram
* @param messages XML for message types
* @param chorSpec ChorSpec XML representation * @param chorSpec ChorSpec XML representation
*/ */
@PUT @PUT
...@@ -97,9 +81,7 @@ public interface ChoreographyService extends JAXRSService { ...@@ -97,9 +81,7 @@ public interface ChoreographyService extends JAXRSService {
void update( void update(
@NotNull @PathParam("key") String key, @NotNull @PathParam("key") String key,
@NotNull @QueryParam("name") String name, @NotNull @QueryParam("name") String name,
InputStream chorSpec, InputStream chorSpec);
InputStream diagram,
InputStream messages);
/** /**
* Deletes the given choreography. * Deletes the given choreography.
......
...@@ -23,7 +23,6 @@ import eu.chorevolution.idm.common.types.ServiceAction; ...@@ -23,7 +23,6 @@ import eu.chorevolution.idm.common.types.ServiceAction;
import org.apache.syncope.core.logic.ChoreographyLogic; import org.apache.syncope.core.logic.ChoreographyLogic;
import java.io.InputStream; import java.io.InputStream;
import java.net.URL; import java.net.URL;
import java.util.List;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import org.apache.syncope.common.lib.to.AnyObjectTO; import org.apache.syncope.common.lib.to.AnyObjectTO;
import org.apache.syncope.common.rest.api.RESTHeaders; import org.apache.syncope.common.rest.api.RESTHeaders;
...@@ -38,13 +37,8 @@ public class ChoreographyServiceImpl extends AbstractServiceImpl implements Chor ...@@ -38,13 +37,8 @@ public class ChoreographyServiceImpl extends AbstractServiceImpl implements Chor
private ChoreographyLogic logic; private ChoreographyLogic logic;
@Override @Override
public Response create( public Response create(final String name, final String synthesisProcessorKey, final InputStream chorSpec) {
final String name, String key = logic.create(name, synthesisProcessorKey, chorSpec);
final String synthesisProcessorKey,
final InputStream chorSpec,
final InputStream diagram,
final InputStream messages) {
String key = logic.create(name, synthesisProcessorKey, chorSpec, diagram, messages);
return Response. return Response.
created(uriInfo.getAbsolutePathBuilder().path(key).build()). created(uriInfo.getAbsolutePathBuilder().path(key).build()).
header(RESTHeaders.RESOURCE_KEY, key). header(RESTHeaders.RESOURCE_KEY, key).
...@@ -57,18 +51,8 @@ public class ChoreographyServiceImpl extends AbstractServiceImpl implements Chor ...@@ -57,18 +51,8 @@ public class ChoreographyServiceImpl extends AbstractServiceImpl implements Chor
} }
@Override @Override
public List<ChoreographyTO> list() { public void update(final String key, final String name, final InputStream chorSpec) {
return logic.getChoreographyList(); logic.update(key, name, chorSpec);
}
@Override
public void update(
final String key,
final String name,
final InputStream chorSpec,
final InputStream diagram,
final InputStream messages) {
logic.update(key, name, chorSpec, diagram, messages);
} }
@Override @Override
......
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