Commit 945aae5c authored by Gianluca Filippone's avatar Gianluca Filippone
Browse files

Commit of missing files for Choreography ext

parent 2ae15fa4
/*
* 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.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_instance")
@XmlType
public class ChoreographyInstanceTO extends AbstractBaseBean {
private static final long serialVersionUID = 4829635452545920453L;
private long key;
private long choreographyKey;
private String name;
private String description;
public long getKey() {
return key;
}
@PathParam("key")
public void setKey(final long key) {
this.key = key;
}
public long getChoreographyKey() {
return choreographyKey;
}
public void setChoreographyKey(final long choreographyKey) {
this.choreographyKey = choreographyKey;
}
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;
}
}
......@@ -26,6 +26,7 @@ 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.pages.InstancePage;
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;
......@@ -41,6 +42,7 @@ 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;
import org.apache.wicket.request.mapper.parameter.PageParameters;
public class ChoreographyPanel extends AbstractSearchResultPanel<
ChoreographyTO, ChoreographyTO, ChoreographyProvider, ChoreographyRestClient> {
......@@ -104,7 +106,7 @@ public class ChoreographyPanel extends AbstractSearchResultPanel<
@Override
public void populateItem(final Item<ICellPopulator<ChoreographyTO>> item, final String componentId,
final IModel<ChoreographyTO> model) {
final IModel<ChoreographyTO> model) {
ActionLinksPanel.Builder<Serializable> actionLinks = ActionLinksPanel.builder(page.getPageReference());
actionLinks.setDisableIndicator(true);
......@@ -114,8 +116,11 @@ public class ChoreographyPanel extends AbstractSearchResultPanel<
@Override
public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
PageParameters param = new PageParameters();
param.add("chor", model.getObject().getKey());
setResponsePage(InstancePage.class, param);
}
}, ActionLink.ActionType.EDIT);
}, ActionLink.ActionType.SEARCH);
actionLinks.add(new ActionLink<Serializable>() {
private static final long serialVersionUID = -3722207913631435501L;
......@@ -123,13 +128,12 @@ public class ChoreographyPanel extends AbstractSearchResultPanel<
@Override
public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
}
}, ActionLink.ActionType.SEARCH);
}, ActionLink.ActionType.EDIT);
item.add(actionLinks.build(componentId));
}
});
return columns;
}
protected final class ChoreographyProvider extends SearchableDataProvider<ChoreographyTO> {
......@@ -145,14 +149,14 @@ public class ChoreographyPanel extends AbstractSearchResultPanel<
@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();
List<ChoreographyTO> choreographyList = restClient.choreographyList();
Collections.sort(choreographyList, comparator);
return choreographyList.subList((int) first, (int) first + (int) count).iterator();
}
@Override
public long size() {
return restClient.list().size();
return restClient.choreographyList().size();
}
@Override
......
......@@ -15,6 +15,7 @@
*/
package org.apache.syncope.client.console.rest;
import eu.chorevolution.idm.common.to.ChoreographyInstanceTO;
import eu.chorevolution.idm.common.to.ChoreographyTO;
import java.util.List;
import org.apache.syncope.common.rest.api.service.CollectorService;
......@@ -25,8 +26,12 @@ public class ChoreographyRestClient extends BaseRestClient {
private static final long serialVersionUID = -2018208424159468912L;
public List<ChoreographyTO> list() {
return getService(CollectorService.class).list();
public List<ChoreographyTO> choreographyList() {
return getService(CollectorService.class).choreographyList();
}
public List<ChoreographyInstanceTO> instanceList(final long choreographyKey) {
return getService(CollectorService.class).instanceList(choreographyKey);
}
}
......@@ -15,6 +15,7 @@
*/
package org.apache.syncope.common.rest.api.service;
import eu.chorevolution.idm.common.to.ChoreographyInstanceTO;
import eu.chorevolution.idm.common.to.ChoreographyTO;
import eu.chorevolution.idm.common.types.ChoreographyAction;
import eu.chorevolution.idm.common.types.ServiceAction;
......@@ -42,7 +43,17 @@ public interface CollectorService extends JAXRSService {
* @return all defined choreographies
*/
@GET
List<ChoreographyTO> list();
List<ChoreographyTO> choreographyList();
/**
* This is a temporary method.
*
* @param chorId
* @return all running instances of choreographies
*/
@Path("{chor}")
@GET
List<ChoreographyInstanceTO> instanceList(@NotNull @PathParam("chor") long chorId);
/**
* This operation will be invoked after a newly created choreography is enacted.
......
......@@ -15,6 +15,7 @@
*/
package org.apache.syncope.core.rest.cxf.service;
import eu.chorevolution.idm.common.to.ChoreographyInstanceTO;
import eu.chorevolution.idm.common.to.ChoreographyTO;
import eu.chorevolution.idm.common.types.ChoreographyAction;
import eu.chorevolution.idm.common.types.ServiceAction;
......@@ -31,27 +32,70 @@ public class CollectorServiceImpl extends AbstractServiceImpl implements Collect
@Autowired
private CollectorLogic logic;
// Implementation for methods choreographyList and instanceList are fake
@Override
public List<ChoreographyTO> list() {
public List<ChoreographyTO> choreographyList() {
List<ChoreographyTO> result = new ArrayList<>();
ChoreographyTO to = new ChoreographyTO();
to.setKey(1);
to.setDescription("desc1");
to.setName("name1");
to.setDescription("desc choreography 1");
to.setName("name chor1");
result.add(to);
to = new ChoreographyTO();
to.setKey(2);
to.setDescription("desc2");
to.setName("name2");
to.setDescription("desc choreography 2");
to.setName("name chor2");
result.add(to);
to = new ChoreographyTO();
to.setKey(3);
to.setDescription("desc3");
to.setName("name3");
to.setDescription("desc choreography 3");
to.setName("name chor3");
result.add(to);
to = new ChoreographyTO();
to.setKey(4);
to.setDescription("desc choreography 4");
to.setName("name chor4");
result.add(to);
return result;
}
@Override
public List<ChoreographyInstanceTO> instanceList(final long chor) {
List<ChoreographyInstanceTO> result = new ArrayList<>();
ChoreographyInstanceTO to = new ChoreographyInstanceTO();
to.setKey(1);
to.setChoreographyKey(chor);
to.setDescription("desc instance 1");
to.setName("name instance1");
result.add(to);
to = new ChoreographyInstanceTO();
to.setKey(2);
to.setChoreographyKey(chor);
to.setDescription("desc instance 2");
to.setName("name instance2");
result.add(to);
to = new ChoreographyInstanceTO();
to.setKey(3);
to.setChoreographyKey(chor);
to.setDescription("desc instance 3");
to.setName("name instance3");
result.add(to);
to = new ChoreographyInstanceTO();
to.setKey(4);
to.setChoreographyKey(chor);
to.setDescription("desc instance 4");
to.setName("name instance4");
result.add(to);
return result;
......
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