Commit e48d271e authored by Gianluca Filippone's avatar Gianluca Filippone
Browse files

Added WP7 services into test data

parent 13dd61fb
......@@ -46,13 +46,16 @@ public class ChoreographyDetailPage extends BaseExtPage {
private final String choreographyId;
private final String choreographyKey;
private final ChoreographyTO choreography;
public ChoreographyDetailPage(final PageParameters parameters) {
super(parameters);
restClient = new ChoreographyRestClient();
choreographyId = parameters.get("chor").toString();
choreographyId = parameters.get("chorId").toString();
choreographyKey = parameters.get("key").toString();
choreography = restClient.getChoreography(choreographyId);
......@@ -101,7 +104,7 @@ public class ChoreographyDetailPage extends BaseExtPage {
tabs.add(new AbstractTab(new ResourceModel("services")) {
@Override
public WebMarkupContainer getPanel(final String panelId) {
return new ChoreographyServiceDirectoryPanel(panelId, getPageReference(), choreographyId);
return new ChoreographyServiceDirectoryPanel(panelId, getPageReference(), choreographyKey);
}
});
......
......@@ -132,7 +132,9 @@ public class ChoreographyDirectoryPanel extends GroupDirectoryPanel {
@Override
public void onClick(final AjaxRequestTarget target) {
PageParameters param = new PageParameters();
param.add("chor", model.getObject().getPlainAttrMap().get("id").getValues().iterator().next());
param.add("chorId",
model.getObject().getPlainAttrMap().get("id").getValues().iterator().next());
param.add("key", model.getObject().getKey());
setResponsePage(ChoreographyDetailPage.class, param);
}
}, ChoreographyActionsPanel.ChoreographyActionType.SHOW);
......
......@@ -15,140 +15,27 @@
*/
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;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import org.apache.syncope.client.console.commons.DirectoryDataProvider;
import org.apache.syncope.client.console.pages.ChoreographyDetailPage;
import org.apache.syncope.client.console.panels.ChoreographyServiceDirectoryPanel.ServiceProvider;
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.wizards.WizardMgtPanel;
import org.apache.syncope.client.console.pages.ChoreographyPage;
import org.apache.syncope.common.lib.search.AnyObjectFiqlSearchConditionBuilder;
import org.apache.syncope.common.lib.to.AnyObjectTO;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.wicket.PageReference;
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.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.ResourceModel;
public class ChoreographyServiceDirectoryPanel extends DirectoryPanel<
ServiceTO, ServiceTO, ServiceProvider, ChoreographyRestClient> {
private static final long serialVersionUID = 3727444742501082182L;
private String choreographyId;
public ChoreographyServiceDirectoryPanel(final String id,
final PageReference pageRef,
final String choreographyId) {
super(id, new DirectoryPanel.Builder<ServiceTO, ServiceTO, ChoreographyRestClient>(
new ChoreographyRestClient(), pageRef) {
private static final long serialVersionUID = 8769126634538601689L;
@Override
protected WizardMgtPanel<ServiceTO> newInstance(final String id, final boolean wizardInModal) {
return new ChoreographyServiceDirectoryPanel(id, this);
}
}.disableCheckBoxes());
this.choreographyId = choreographyId;
setFooterVisibility(true);
modal.addSubmitButton();
modal.size(Modal.Size.Large);
initResultTable();
}
private ChoreographyServiceDirectoryPanel(
final String id,
final DirectoryPanel.Builder<ServiceTO, ServiceTO, ChoreographyRestClient> builder) {
super(id, builder);
}
@Override
protected ServiceProvider dataProvider() {
return new ServiceProvider(rows);
}
@Override
protected String paginatorRowsKey() {
return ChoreographyDetailPage.PREF_SERVICE_PAGINATOR_ROWS;
}
@Override
protected Collection<ActionLink.ActionType> getBulkActions() {
return Collections.<ActionLink.ActionType>emptyList();
}
@Override
protected List<IColumn<ServiceTO, String>> getColumns() {
final List<IColumn<ServiceTO, String>> columns = new ArrayList<>();
columns.add(new PropertyColumn<>(new ResourceModel("name", "Name"), "Name", "name"));
return columns;
}
protected final class ServiceComparator implements Comparator<ServiceTO>, Serializable {
private static final long serialVersionUID = -1843653604375242876L;
@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 = -8754548053385660794L;
private final Comparator<ServiceTO> comparator = new ServiceComparator();
private ServiceProvider(final int paginatorRows) {
super(paginatorRows);
}
@Override
public Iterator<ServiceTO> iterator(final long first, final long count) {
List<ServiceTO> list = restClient.choreographyServiceList(choreographyId);
Collections.sort(list, comparator);
return list.subList((int) first, (int) first + (int) count).iterator();
}
@Override
public long size() {
return restClient.choreographyServiceList(choreographyId).size();
}
@Override
public IModel<ServiceTO> model(final ServiceTO object) {
return new CompoundPropertyModel<>(object);
}
}
}
// New panel which lists all services defined for a choreography
/*public class ChoreographyServiceDirectoryPanel extends AnyObjectDirectoryPanel {
public class ChoreographyServiceDirectoryPanel extends AnyObjectDirectoryPanel {
private static final long serialVersionUID = 7303610381539502741L;
public ChoreographyServiceDirectoryPanel(final String id,
final PageReference pageRef,
final String choreographyId) {
final String choreographyKey) {
super(id, new Builder(AnyTypeKind.ANY_OBJECT.name(), pageRef), false);
this.fiql = new AnyObjectFiqlSearchConditionBuilder("SERVICE").inGroups(choreographyId).query();
this.fiql = new AnyObjectFiqlSearchConditionBuilder("ENACTMENT ENGINE").inGroups(choreographyKey).query();
dataProvider.setFIQL(fiql);
}
@Override
protected String paginatorRowsKey() {
return ChoreographyPage.PREF_CHOREOGRAPHY_PAGINATOR_ROWS;
......@@ -169,4 +56,4 @@ public class ChoreographyServiceDirectoryPanel extends DirectoryPanel<
setShowResultPage(true);
}
}
}*/
}
......@@ -20,13 +20,13 @@ limitations under the License.
<div class="form-group">
<form wicket:id="AddEEForm">
<div class="form-group">
<span wicket:id="username"/>
<span wicket:id="url"/>
</div>
<div class="form-group">
<span wicket:id="password"/>
<span wicket:id="username"/>
</div>
<div class="form-group">
<span wicket:id="url"/>
<span wicket:id="password"/>
</div>
</form>
</div>
......
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