Commit 89fea4cc authored by Francesco Chicchiricco's avatar Francesco Chicchiricco
Browse files

Consolidating the Choreography entity from extension as standard Group with...

Consolidating the Choreography entity from extension as standard Group with specialized AnyTypeClass
parent f1b87474
......@@ -202,29 +202,10 @@ we are happy to inform you that the password request was execute successfully fo
<AnyTypeClass id="Service Role"/>
<AnyType_AnyTypeClass anyType_id="SERVICE ROLE" anyTypeClass_id="Service Role"/>
<AnyTypeClass id="Choreography"/>
<RelationshipType id="SERVICE ROLE MEMBERSHIP"
description="Relationship of services assigned to service identity role(s)"/>
<ConnInstance id="88a7a819-dab5-46b4-9b90-0b9769eabdb8"
bundleName="connid-federation-server"
connectorName="eu.chorevolution.idm.connid.federationserver.FederationServerConnector"
displayName="Federation Server"
jsonConf="[{&quot;schema&quot;:{&quot;name&quot;:&quot;sampleProperty&quot;,&quot;displayName&quot;:&quot;sampleProperty&quot;,&quot;helpMessage&quot;:&quot;sampleProperty&quot;,&quot;type&quot;:&quot;java.lang.String&quot;,&quot;required&quot;:false,&quot;order&quot;:1,&quot;confidential&quot;:false,&quot;defaultValues&quot;:[&quot;SAMPLE VALUE&quot;]},&quot;overridable&quot;:false,&quot;values&quot;:[&quot;SAMPLE VALUE&quot;]}]"
location="${connid.location}"
version="${connid.federationserver.version}"/>
<ConnInstance_capabilities conninstance_id="88a7a819-dab5-46b4-9b90-0b9769eabdb8" capability="UPDATE"/>
<ConnInstance_capabilities conninstance_id="88a7a819-dab5-46b4-9b90-0b9769eabdb8" capability="SEARCH"/>
<ConnInstance_capabilities conninstance_id="88a7a819-dab5-46b4-9b90-0b9769eabdb8" capability="CREATE"/>
<ConnInstance_capabilities conninstance_id="88a7a819-dab5-46b4-9b90-0b9769eabdb8" capability="DELETE"/>
<ConnInstance id="5aa5b8be-7521-481a-9651-c557aea078c1"
bundleName="connid-security-filter"
connectorName="eu.chorevolution.idm.connid.securityfilter.SecurityFilterConnector"
displayName="Security Filter"
jsonConf="[{&quot;schema&quot;:{&quot;name&quot;:&quot;sampleProperty&quot;,&quot;displayName&quot;:&quot;sampleProperty&quot;,&quot;helpMessage&quot;:&quot;sampleProperty&quot;,&quot;type&quot;:&quot;java.lang.String&quot;,&quot;required&quot;:false,&quot;order&quot;:1,&quot;confidential&quot;:false,&quot;defaultValues&quot;:[&quot;SAMPLE VALUE&quot;]},&quot;overridable&quot;:false,&quot;values&quot;:[&quot;SAMPLE VALUE&quot;]}]"
location="${connid.location}"
version="${connid.securityfilter.version}"/>
<ConnInstance_capabilities conninstance_id="5aa5b8be-7521-481a-9651-c557aea078c1" capability="UPDATE"/>
<ConnInstance_capabilities conninstance_id="5aa5b8be-7521-481a-9651-c557aea078c1" capability="SEARCH"/>
<SyncopeSchema id="Service Name"/>
<PlainSchema id="Service Name" mandatoryCondition="true"
......@@ -266,5 +247,46 @@ we are happy to inform you that the password request was execute successfully fo
<PlainSchema id="Service Role Description" mandatoryCondition="false"
multivalue="0" readonly="0" type="String" uniqueConstraint="0" anyTypeClass_id="Service Role"/>
<SyncopeSchema id="id"/>
<PlainSchema id="id" mandatoryCondition="true"
multivalue="0" readonly="0" type="String" uniqueConstraint="1" anyTypeClass_id="Choreography"/>
<SyncopeSchema id="description"/>
<PlainSchema id="description" mandatoryCondition="false"
multivalue="0" readonly="0" type="String" uniqueConstraint="0" anyTypeClass_id="Choreography"/>
<SyncopeSchema id="diagram"/>
<PlainSchema id="diagram" mandatoryCondition="false" mimeType="application/xml"
multivalue="0" readonly="0" type="Binary" uniqueConstraint="0" anyTypeClass_id="Choreography"/>
<SyncopeSchema id="messages"/>
<PlainSchema id="messages" mandatoryCondition="false" mimeType="application/xml"
multivalue="0" readonly="0" type="Binary" uniqueConstraint="0" anyTypeClass_id="Choreography"/>
<SyncopeSchema id="image"/>
<PlainSchema id="image" mandatoryCondition="false" mimeType="image/png"
multivalue="0" readonly="0" type="Binary" uniqueConstraint="0" anyTypeClass_id="Choreography"/>
<ConnInstance id="88a7a819-dab5-46b4-9b90-0b9769eabdb8"
bundleName="connid-federation-server"
connectorName="eu.chorevolution.idm.connid.federationserver.FederationServerConnector"
displayName="Federation Server"
jsonConf="[{&quot;schema&quot;:{&quot;name&quot;:&quot;sampleProperty&quot;,&quot;displayName&quot;:&quot;sampleProperty&quot;,&quot;helpMessage&quot;:&quot;sampleProperty&quot;,&quot;type&quot;:&quot;java.lang.String&quot;,&quot;required&quot;:false,&quot;order&quot;:1,&quot;confidential&quot;:false,&quot;defaultValues&quot;:[&quot;SAMPLE VALUE&quot;]},&quot;overridable&quot;:false,&quot;values&quot;:[&quot;SAMPLE VALUE&quot;]}]"
location="${connid.location}"
version="${connid.federationserver.version}"/>
<ConnInstance_capabilities conninstance_id="88a7a819-dab5-46b4-9b90-0b9769eabdb8" capability="UPDATE"/>
<ConnInstance_capabilities conninstance_id="88a7a819-dab5-46b4-9b90-0b9769eabdb8" capability="SEARCH"/>
<ConnInstance_capabilities conninstance_id="88a7a819-dab5-46b4-9b90-0b9769eabdb8" capability="CREATE"/>
<ConnInstance_capabilities conninstance_id="88a7a819-dab5-46b4-9b90-0b9769eabdb8" capability="DELETE"/>
<ConnInstance id="5aa5b8be-7521-481a-9651-c557aea078c1"
bundleName="connid-security-filter"
connectorName="eu.chorevolution.idm.connid.securityfilter.SecurityFilterConnector"
displayName="Security Filter"
jsonConf="[{&quot;schema&quot;:{&quot;name&quot;:&quot;sampleProperty&quot;,&quot;displayName&quot;:&quot;sampleProperty&quot;,&quot;helpMessage&quot;:&quot;sampleProperty&quot;,&quot;type&quot;:&quot;java.lang.String&quot;,&quot;required&quot;:false,&quot;order&quot;:1,&quot;confidential&quot;:false,&quot;defaultValues&quot;:[&quot;SAMPLE VALUE&quot;]},&quot;overridable&quot;:false,&quot;values&quot;:[&quot;SAMPLE VALUE&quot;]}]"
location="${connid.location}"
version="${connid.securityfilter.version}"/>
<ConnInstance_capabilities conninstance_id="5aa5b8be-7521-481a-9651-c557aea078c1" capability="UPDATE"/>
<ConnInstance_capabilities conninstance_id="5aa5b8be-7521-481a-9651-c557aea078c1" capability="SEARCH"/>FF
<!-- [END] CHOReVOLUTION -->
</dataset>
......@@ -16,10 +16,14 @@
package org.apache.syncope.client.console.pages;
import eu.chorevolution.idm.common.to.ChoreographyTO;
import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.panels.ChoreographyActionsPanel;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.syncope.client.console.panels.InstancePanel;
import org.apache.syncope.client.console.rest.ChoreographyRestClient;
import org.apache.syncope.common.lib.to.PlainSchemaTO;
import org.apache.syncope.common.lib.types.SchemaType;
import org.apache.syncope.common.rest.api.service.SchemaService;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink;
import org.apache.wicket.markup.html.basic.Label;
......@@ -53,8 +57,10 @@ public class ChoreographyDetailPage extends BaseExtPage {
// Set choreography image
if (choreography.getImage() != null) {
PlainSchemaTO image = SyncopeConsoleSession.get().getService(SchemaService.class).
read(SchemaType.PLAIN, "image");
content.add(new NonCachingImage("choreography_image",
new ByteArrayResource(choreography.getImageType().getContentType(), choreography.getImage())));
new ByteArrayResource(image.getMimeType(), choreography.getImage())));
} else {
content.add(new Label("choreography_image", "No image available for this choreography"));
}
......@@ -67,6 +73,8 @@ public class ChoreographyDetailPage extends BaseExtPage {
ChoreographyActionsPanel choreographyActionsPanel = new ChoreographyActionsPanel("choreography_actions");
choreographyActionsPanel.addAction(new IndicatingAjaxLink<Void>("link") {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target) {
// No actions
......@@ -74,6 +82,8 @@ public class ChoreographyDetailPage extends BaseExtPage {
}, ChoreographyActionsPanel.ChoreographyActionType.START);
choreographyActionsPanel.addAction(new IndicatingAjaxLink<Void>("link") {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target) {
// No actions
......@@ -81,6 +91,8 @@ public class ChoreographyDetailPage extends BaseExtPage {
}, ChoreographyActionsPanel.ChoreographyActionType.PAUSE);
choreographyActionsPanel.addAction(new IndicatingAjaxLink<Void>("link") {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target) {
// No actions
......@@ -99,6 +111,8 @@ public class ChoreographyDetailPage extends BaseExtPage {
ChoreographyActionsPanel averageDetailsLink = new ChoreographyActionsPanel("avg_details");
averageDetailsLink.addAction(new IndicatingAjaxLink<Void>("link") {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget request) {
PageParameters parameters = new PageParameters();
......
......@@ -17,6 +17,7 @@ package org.apache.syncope.client.console.panels;
import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
import eu.chorevolution.idm.common.to.AVGCoordinationDelegateTO;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
......@@ -169,21 +170,24 @@ public class AVGCDPanel extends DirectoryPanel<
}
protected final class CDComparator implements Comparator<AVGCoordinationDelegateTO>, Serializable {
private static final long serialVersionUID = -5323560030352040506L;
@Override
public int compare(final AVGCoordinationDelegateTO o1, final AVGCoordinationDelegateTO o2) {
return o1.getName().compareTo(o2.getName());
}
}
protected final class CDProvider extends DirectoryDataProvider<AVGCoordinationDelegateTO> {
private static final long serialVersionUID = -185944053385660794L;
private final Comparator<AVGCoordinationDelegateTO> comparator;
private final Comparator<AVGCoordinationDelegateTO> comparator = new CDComparator();
private CDProvider(final int paginatorRows) {
super(paginatorRows);
comparator = new Comparator<AVGCoordinationDelegateTO>() {
@Override
public int compare(final AVGCoordinationDelegateTO o1, final AVGCoordinationDelegateTO o2) {
return o1.getName().compareTo(o2.getName());
}
};
}
@Override
......
......@@ -33,6 +33,7 @@ package org.apache.syncope.client.console.panels;
import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
import eu.chorevolution.idm.common.to.AVGOperationDataTO;
import eu.chorevolution.idm.common.types.ArtifactType;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
......@@ -145,21 +146,24 @@ public class AVGOperationPanel extends DirectoryPanel<
}
protected final class AVGOperationComparator implements Comparator<AVGOperationDataTO>, Serializable {
private static final long serialVersionUID = 5830735410088350127L;
@Override
public int compare(final AVGOperationDataTO o1, final AVGOperationDataTO o2) {
return o1.getName().compareTo(o2.getName());
}
}
protected final class AVGOperationProvider extends DirectoryDataProvider<AVGOperationDataTO> {
private static final long serialVersionUID = -185944053385660794L;
private final Comparator<AVGOperationDataTO> comparator;
private final Comparator<AVGOperationDataTO> comparator = new AVGOperationComparator();
private AVGOperationProvider(final int paginatorRows) {
super(paginatorRows);
comparator = new Comparator<AVGOperationDataTO>() {
@Override
public int compare(final AVGOperationDataTO o1, final AVGOperationDataTO o2) {
return o1.getName().compareTo(o2.getName());
}
};
}
@Override
......
......@@ -17,6 +17,7 @@ package org.apache.syncope.client.console.panels;
import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
import eu.chorevolution.idm.common.to.AVGServiceTO;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
......@@ -151,21 +152,24 @@ public class AVGServicePanel extends DirectoryPanel<
}
protected final class AVGServiceComparator implements Comparator<AVGServiceTO>, Serializable {
private static final long serialVersionUID = 1195401098208482891L;
@Override
public int compare(final AVGServiceTO o1, final AVGServiceTO o2) {
return o1.getName().compareTo(o2.getName());
}
}
protected final class AVGServiceProvider extends DirectoryDataProvider<AVGServiceTO> {
private static final long serialVersionUID = -185944053385660794L;
private final Comparator<AVGServiceTO> comparator;
private final Comparator<AVGServiceTO> comparator = new AVGServiceComparator();
private AVGServiceProvider(final int paginatorRows) {
super(paginatorRows);
comparator = new Comparator<AVGServiceTO>() {
@Override
public int compare(final AVGServiceTO o1, final AVGServiceTO o2) {
return o1.getName().compareTo(o2.getName());
}
};
}
@Override
......
......@@ -17,6 +17,7 @@ package org.apache.syncope.client.console.panels;
import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
import eu.chorevolution.idm.common.to.CoordinationDelegateTO;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
......@@ -161,21 +162,25 @@ public class CDPanel extends DirectoryPanel<
}
protected final class CDComparator implements Comparator<CoordinationDelegateTO>, Serializable {
private static final long serialVersionUID = 5481158713159363083L;
@Override
public int compare(final CoordinationDelegateTO o1, final CoordinationDelegateTO o2) {
return o1.getName().compareTo(o2.getName());
}
}
protected final class CDProvider extends DirectoryDataProvider<CoordinationDelegateTO> {
private static final long serialVersionUID = -185944053385660794L;
private final Comparator<CoordinationDelegateTO> comparator;
private final Comparator<CoordinationDelegateTO> comparator = new CDComparator();
private CDProvider(final int paginatorRows) {
super(paginatorRows);
comparator = new Comparator<CoordinationDelegateTO>() {
@Override
public int compare(final CoordinationDelegateTO o1, final CoordinationDelegateTO o2) {
return o1.getName().compareTo(o2.getName());
}
};
}
@Override
......
......@@ -17,6 +17,7 @@ package org.apache.syncope.client.console.panels;
import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
import eu.chorevolution.idm.common.to.ChoreographyInstanceTO;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
......@@ -161,21 +162,24 @@ public class InstancePanel extends DirectoryPanel<
}
protected final class InstanceComparator implements Comparator<ChoreographyInstanceTO>, Serializable {
private static final long serialVersionUID = -1959177332431794755L;
@Override
public int compare(final ChoreographyInstanceTO o1, final ChoreographyInstanceTO o2) {
return o1.getChoreographyInstanceId().compareTo(o2.getChoreographyInstanceId());
}
}
protected final class InstanceProvider extends DirectoryDataProvider<ChoreographyInstanceTO> {
private static final long serialVersionUID = -185944053385660794L;
private final Comparator<ChoreographyInstanceTO> comparator;
private final Comparator<ChoreographyInstanceTO> comparator = new InstanceComparator();
private InstanceProvider(final int paginatorRows) {
super(paginatorRows);
comparator = new Comparator<ChoreographyInstanceTO>() {
@Override
public int compare(final ChoreographyInstanceTO o1, final ChoreographyInstanceTO o2) {
return o1.getChoreographyInstanceId().compareTo(o2.getChoreographyInstanceId());
}
};
}
@Override
......
......@@ -17,6 +17,7 @@ package org.apache.syncope.client.console.panels;
import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
import eu.chorevolution.idm.common.to.ServiceTO;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
......@@ -148,21 +149,24 @@ public class ServicePanel extends DirectoryPanel<ServiceTO, ServiceTO, ServicePr
}
protected final class ServiceComparator implements Comparator<ServiceTO>, Serializable {
private static final long serialVersionUID = -1842505741294215561L;
@Override
public int compare(final ServiceTO o1, final ServiceTO o2) {
return o1.getName().compareTo(o2.getName());
}
}
protected final class ServiceProvider extends DirectoryDataProvider<ServiceTO> {
private static final long serialVersionUID = -185944053385660794L;
private final Comparator<ServiceTO> comparator;
private final Comparator<ServiceTO> comparator = new ServiceComparator();
private ServiceProvider(final int paginatorRows) {
super(paginatorRows);
comparator = new Comparator<ServiceTO>() {
@Override
public int compare(final ServiceTO o1, final ServiceTO o2) {
return o1.getName().compareTo(o2.getName());
}
};
}
@Override
......
......@@ -15,7 +15,6 @@
*/
package eu.chorevolution.idm.common.to;
import eu.chorevolution.idm.common.types.ImageType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.apache.syncope.common.lib.AbstractBaseBean;
......@@ -34,12 +33,10 @@ public class ChoreographyTO extends AbstractBaseBean {
private byte[] diagram;
private byte[] messageTypes;
private byte[] messages;
private byte[] image;
private ImageType imageType;
public String getId() {
return id;
}
......@@ -72,12 +69,12 @@ public class ChoreographyTO extends AbstractBaseBean {
this.diagram = diagram;
}
public byte[] getMessageTypes() {
return messageTypes;
public byte[] getMessages() {
return messages;
}
public void setMessageTypes(final byte[] messageTypes) {
this.messageTypes = messageTypes;
public void setMessages(final byte[] messages) {
this.messages = messages;
}
public byte[] getImage() {
......@@ -88,12 +85,4 @@ public class ChoreographyTO extends AbstractBaseBean {
this.image = image;
}
public ImageType getImageType() {
return imageType;
}
public void setImageType(final ImageType imageType) {
this.imageType = imageType;
}
}
/*
* Copyright 2016 The CHOReVOLUTION project.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.chorevolution.idm.common.types;
public enum ImageType {
JPEG("jpg"),
PNG("png"),
BMP("bmp");
private String extension;
ImageType(final String extension) {
this.extension = extension;
}
public String getExtension() {
return this.extension + ".";
}
public String getContentType() {
return "image/" + this.extension;
}
}
......@@ -17,14 +17,12 @@ package org.apache.syncope.core.logic;
import eu.chorevolution.idm.common.BusinessException;
import eu.chorevolution.idm.common.to.ChoreographyInstanceTO;
import eu.chorevolution.idm.common.to.ChoreographyTO;
import eu.chorevolution.idm.common.to.EventDataTO;
import java.lang.reflect.Method;
import java.util.List;
import org.apache.syncope.common.lib.AbstractBaseBean;
import org.apache.syncope.core.persistence.api.dao.ChoreographyDAO;
import org.apache.syncope.core.persistence.api.dao.EventDAO;
import org.apache.syncope.core.persistence.api.entity.Choreography;
import org.apache.syncope.core.persistence.api.entity.Event;
import org.apache.syncope.core.persistence.jpa.entity.JPAEvent;
import org.apache.syncope.core.persistence.jpa.entity.JPAChoreographyInstance;
......@@ -32,7 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.apache.syncope.core.persistence.api.entity.ChoreographyInstance;
import org.apache.syncope.core.persistence.api.dao.ChoreographyInstanceDAO;
import org.apache.syncope.core.persistence.jpa.entity.JPAChoreography;
import org.apache.syncope.core.persistence.api.entity.group.Group;
@Component
public class CollectorLogic extends AbstractTransactionalLogic<AbstractBaseBean> {
......@@ -74,64 +72,45 @@ public class CollectorLogic extends AbstractTransactionalLogic<AbstractBaseBean>
event.setEventTimestamp(data.getEventTimestamp());
event.setEventType(data.getEventType());
choreographyInstance.addEvent(event);
choreographyInstance.add(event);
eventDAO.save(event);
}
public void addChoreography(final ChoreographyTO data) {
Choreography choreography = new JPAChoreography();
choreography.setName(data.getName());
choreography.setDescription(data.getDescription());
choreography.setDiagram(data.getDiagram());
choreography.setImage(data.getImage());
choreography.setImageType(data.getImageType());
choreography.setMessageTypes(data.getMessageTypes());
choreographyDAO.save(choreography);
}
public void addInstance(final ChoreographyInstanceTO data) throws BusinessException {
Choreography choreography = choreographyDAO.findByName(data.getChoreographyName());
Group choreography = choreographyDAO.findByName(data.getChoreographyName());
if (choreography == null) {
throw new BusinessException("Cannot find choreography");
throw new BusinessException("Cannot find choreography with name " + data.getChoreographyName());
}
ChoreographyInstance choreographyInstance = new JPAChoreographyInstance();
choreographyInstance.setChoreographyInstanceId(data.getChoreographyInstanceId());
choreographyInstance.setDestription(data.getInstanceDescription());
choreography.addChoreographyInstance(choreographyInstance);
choreographyInstance.setDescription(data.getInstanceDescription());
choreographyInstanceDAO.save(choreographyInstance);
}
//TODO remove this method
public String getDatabase() {
List<Choreography> chors = choreographyDAO.findAll();
List<Group> chors = choreographyDAO.findAll();
List<ChoreographyInstance> ins = choreographyInstanceDAO.findAll();
List<Event> es = eventDAO.findAll();
String r = "CHOREOGRAPHIES:\n";
for (Choreography current : chors) {
r = r + "-> ID: " + current.getKey() + "\t" + current.getName() + "\t" + current.getDescription() + "\n";
for (Group current : chors) {
r = r + "-> ID: " + current.getKey() + "\t" + current.getName() + "\n";