Commit 001c9bef authored by Francesco Chicchiricco's avatar Francesco Chicchiricco
Browse files

Adding skeleton for choreography extension

parent 15954af7
/*
* Copyright 2015 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.to;
import javax.ws.rs.PathParam;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.apache.syncope.common.lib.AbstractBaseBean;
@XmlRootElement(name = "choreography")
@XmlType
public class ChoreographyTO extends AbstractBaseBean {
private static final long serialVersionUID = 4518569389223742217L;
private long key;
private String name;
private String description;
public long getKey() {
return key;
}
@PathParam("key")
public void setKey(final long key) {
this.key = key;
}
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(final String description) {
this.description = description;
}
}
......@@ -58,6 +58,12 @@ limitations under the License.
<artifactId>syncope-client-console</artifactId>
</dependency>
<dependency>
<groupId>eu.chorevolution.idm.ext.choreography</groupId>
<artifactId>syncope-ext-choreography-client-console</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
......
......@@ -127,7 +127,7 @@ under the License.
<footer class="main-footer block-footer">
<label>CHOReVOLUTION</label> console - based on Apache Syncope <label wicket:id="version"/><br/>
<strong>Copyright &copy; 2015–<span id="spanYear"></span>
<strong>Copyright &copy; 2015–2016
<a href="http://www.chorevolution.eu/" target="_blank">The CHOReVOLUTION project</a>.</strong>
All rights reserved.<br/>
<strong>Copyright &copy; 2010–<span id="spanYear"></span>
......
......@@ -80,6 +80,11 @@ limitations under the License.
<artifactId>syncope-ext-ee-rest-cxf</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>eu.chorevolution.idm.ext.choreography</groupId>
<artifactId>syncope-ext-choreography-rest-cxf</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>eu.chorevolution.idm.ext</groupId>
<artifactId>syncope-ext-choreography</artifactId>
<version>0.1-SNAPSHOT</version>
</parent>
<name>CHOReVOLUTION IdM Extensions: Choreography Client Console</name>
<description>CHOReVOLUTION IdM Extensions: Choreography Client Console</description>
<groupId>eu.chorevolution.idm.ext.choreography</groupId>
<artifactId>syncope-ext-choreography-client-console</artifactId>
<packaging>jar</packaging>
<properties>
<rootpom.basedir>${basedir}/../../..</rootpom.basedir>
</properties>
<dependencies>
<dependency>
<groupId>eu.chorevolution.idm.ext.choreography</groupId>
<artifactId>syncope-ext-choreography-rest-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.syncope.client</groupId>
<artifactId>syncope-client-console</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>
/*
* 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 org.apache.syncope.client.console.pages;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.syncope.client.console.annotations.ExtPage;
import org.apache.syncope.client.console.panels.ChoreographyPanel;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.request.mapper.parameter.PageParameters;
@ExtPage(label = "Choreographies", icon = "fa-area-chart", priority = 100)
public class ChoreographyPage extends AbstractExtPage {
private static final long serialVersionUID = 1965360932245590233L;
public static final String PREF_CHOREOGRAPHY_PAGINATOR_ROWS = "choreography.paginator.rows";
public ChoreographyPage(final PageParameters parameters) {
super(parameters);
WebMarkupContainer content = new WebMarkupContainer("content");
content.setOutputMarkupId(true);
content.add(new Label("header", getString("header_title")));
content.add(new ChoreographyPanel("choreographies", getPageReference()));
// Re-enable when entilements for this service will be defined
//MetaDataRoleAuthorizationStrategy.authorize(content, ENABLE, CamelEntitlement.ROUTE_LIST);
add(content);
}
}
/*
* 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 org.apache.syncope.client.console.panels;
import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
import eu.chorevolution.idm.common.to.ChoreographyTO;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.apache.syncope.client.console.commons.SearchableDataProvider;
import org.apache.syncope.client.console.commons.SortableDataProviderComparator;
import org.apache.syncope.client.console.pages.ChoreographyPage;
import org.apache.syncope.client.console.panels.ChoreographyPanel.ChoreographyProvider;
import org.apache.syncope.client.console.rest.ChoreographyRestClient;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel;
import org.apache.syncope.client.console.wizards.WizardMgtPanel;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
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.repeater.Item;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.ResourceModel;
public class ChoreographyPanel extends AbstractSearchResultPanel<
ChoreographyTO, ChoreographyTO, ChoreographyProvider, ChoreographyRestClient> {
private static final long serialVersionUID = 3727444742501082182L;
public ChoreographyPanel(final String id, final PageReference pageRef) {
super(id, new Builder<ChoreographyTO, ChoreographyTO, ChoreographyRestClient>(
new ChoreographyRestClient(), pageRef) {
private static final long serialVersionUID = 8769126634538601689L;
@Override
protected WizardMgtPanel<ChoreographyTO> newInstance(final String id) {
return new ChoreographyPanel(id, this);
}
}.disableCheckBoxes());
setFooterVisibility(true);
modal.addSumbitButton();
modal.size(Modal.Size.Large);
initResultTable();
}
private ChoreographyPanel(
final String id,
final Builder<ChoreographyTO, ChoreographyTO, ChoreographyRestClient> builder) {
super(id, builder);
}
@Override
protected ChoreographyProvider dataProvider() {
return new ChoreographyProvider(rows);
}
@Override
protected String paginatorRowsKey() {
return ChoreographyPage.PREF_CHOREOGRAPHY_PAGINATOR_ROWS;
}
@Override
protected Collection<ActionLink.ActionType> getBulkActions() {
return Collections.<ActionLink.ActionType>emptyList();
}
@Override
protected List<IColumn<ChoreographyTO, String>> getColumns() {
final List<IColumn<ChoreographyTO, String>> columns = new ArrayList<>();
columns.add(new PropertyColumn<>(new ResourceModel("key"), "key", "key"));
columns.add(new PropertyColumn<>(new ResourceModel("name"), "name", "name"));
columns.add(new PropertyColumn<>(new ResourceModel("description"), "description", "description"));
columns.add(new AbstractColumn<ChoreographyTO, String>(new ResourceModel("actions", "")) {
private static final long serialVersionUID = -3503023501954863131L;
@Override
public String getCssClass() {
return "action";
}
@Override
public void populateItem(final Item<ICellPopulator<ChoreographyTO>> item, final String componentId,
final IModel<ChoreographyTO> model) {
ActionLinksPanel.Builder<Serializable> actionLinks = ActionLinksPanel.builder(page.getPageReference());
actionLinks.setDisableIndicator(true);
actionLinks.add(new ActionLink<Serializable>() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
}
}, ActionLink.ActionType.EDIT);
actionLinks.add(new ActionLink<Serializable>() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
}
}, ActionLink.ActionType.SEARCH);
item.add(actionLinks.build(componentId));
}
});
return columns;
}
protected final class ChoreographyProvider extends SearchableDataProvider<ChoreographyTO> {
private static final long serialVersionUID = -185944053385660794L;
private final SortableDataProviderComparator<ChoreographyTO> comparator;
private ChoreographyProvider(final int paginatorRows) {
super(paginatorRows);
comparator = new SortableDataProviderComparator<>(this);
}
@Override
public Iterator<ChoreographyTO> iterator(final long first, final long count) {
List<ChoreographyTO> list = restClient.list();
Collections.sort(list, comparator);
return list.subList((int) first, (int) first + (int) count).iterator();
}
@Override
public long size() {
return restClient.list().size();
}
@Override
public IModel<ChoreographyTO> model(final ChoreographyTO object) {
return new CompoundPropertyModel<>(object);
}
}
}
/*
* 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 org.apache.syncope.client.console.rest;
import eu.chorevolution.idm.common.to.ChoreographyTO;
import java.util.List;
import org.apache.syncope.common.rest.api.service.CollectorService;
import org.springframework.stereotype.Component;
@Component
public class ChoreographyRestClient extends BaseRestClient {
private static final long serialVersionUID = -2018208424159468912L;
public List<ChoreographyTO> list() {
return getService(CollectorService.class).list();
}
}
<!DOCTYPE html>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
-->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
<wicket:extend>
<div class="wrapper">
<div class="admin-content-page" wicket:id="content">
<div class="box box-solid box-primary">
<div class="box-header with-border">
<h3 class="box-title">
<span wicket:id="header"></span>
</h3>
<div class="box-tools pull-right">
</div>
</div>
<div class="box-body">
<div class="realms">
<div wicket:id="choreographies"></div>
</div>
</div>
</div>
</div>
</div>
</wicket:extend>
</html>
\ No newline at end of file
#
# 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.
#
header_title=Choreographies
description=Description
#
# 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.
#
header_title=Coreografie
description=Descrizione
#
# 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.
#
header_title=Coreografias
description=Descri\u00e7\u00e3o
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2015 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>eu.chorevolution.idm.ext</groupId>
<artifactId>syncope-ext-choreography</artifactId>
<version>0.1-SNAPSHOT</version>
</parent>
<name>CHOReVOLUTION IdM Extensions: Choreography Logic</name>
<description>CHOReVOLUTION IdM Extensions: Choreography Logic</description>
<groupId>eu.chorevolution.idm.ext.choreography</groupId>
<artifactId>syncope-ext-choreography-logic</artifactId>
<packaging>jar</packaging>
<properties>
<rootpom.basedir>${basedir}/../../..</rootpom.basedir>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.syncope.core</groupId>
<artifactId>syncope-core-logic</artifactId>
<version>${syncope.version}</version>
</dependency>
<dependency>
<groupId>eu.chorevolution.idm</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
/*
* Copyright 2015 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
*