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