Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Mar 16, 2016
2 parents 2699fa0 + 5c5a0cb commit f5f72cc
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 35 deletions.
Expand Up @@ -321,7 +321,7 @@ public void onClick(AjaxRequestTarget target) {

columns.add(column);
columns.add(new PropertyColumn(createStringResource("pageDebugList.description"),
DebugObjectItem.F_DESCRIPTION));
DebugObjectItem.F_DESCRIPTION));

if (ShadowType.class.isAssignableFrom(type)) {
columns.add(new PropertyColumn(createStringResource("pageDebugList.resourceName"),
Expand Down Expand Up @@ -384,15 +384,33 @@ public void onSubmit(AjaxRequestTarget target, Form<?> form) {

headerMenuItems
.add(new InlineMenuItem(createStringResource("pageDebugList.menu.exportAllSelectedType"),
true, new HeaderMenuAction(this) {
true, new HeaderMenuAction(this) {

@Override
public void onSubmit(AjaxRequestTarget target, Form<?> form) {
exportAllType(target);
}
}));
@Override
public void onSubmit(AjaxRequestTarget target, Form<?> form) {
exportAllType(target);
}
}));

headerMenuItems
.add(new InlineMenuItem(createStringResource("pageDebugList.menu.exportShadowsOnResource"),
new Model(true), new AbstractReadOnlyModel<Boolean>() {

@Override
public Boolean getObject() {
DebugSearchDto dto = searchModel.getObject();
return ObjectTypes.SHADOW.equals(dto.getType());
}

headerMenuItems.add(new InlineMenuItem(createStringResource("pageDebugList.menu.exportAll"), true,
}, false, new HeaderMenuAction(this) {

@Override
public void onClick(AjaxRequestTarget target) {
exportAllShadowsOnResource(target);
}
}));

headerMenuItems.add(new InlineMenuItem(createStringResource("pageDebugList.menu.exportAll"), true,
new HeaderMenuAction(this) {

@Override
Expand Down Expand Up @@ -423,21 +441,21 @@ public void onSubmit(AjaxRequestTarget target, Form<?> form) {

headerMenuItems
.add(new InlineMenuItem(createStringResource("pageDebugList.menu.deleteShadowsOnResource"),
new Model(true), new AbstractReadOnlyModel<Boolean>() {
new Model(true), new AbstractReadOnlyModel<Boolean>() {

@Override
public Boolean getObject() {
DebugSearchDto dto = searchModel.getObject();
return ObjectTypes.SHADOW.equals(dto.getType());
}
@Override
public Boolean getObject() {
DebugSearchDto dto = searchModel.getObject();
return ObjectTypes.SHADOW.equals(dto.getType());
}

}, false, new HeaderMenuAction(this) {
}, false, new HeaderMenuAction(this) {

@Override
public void onClick(AjaxRequestTarget target) {
deleteAllShadowsOnResource(target);
}
}));
@Override
public void onClick(AjaxRequestTarget target) {
deleteAllShadowsOnResource(target);
}
}));

headerMenuItems.add(new InlineMenuItem());

Expand Down Expand Up @@ -493,7 +511,7 @@ private void listObjectsPerformed(ObjectQuery query, AjaxRequestTarget target) {

if (selected != null) {
provider.setType(selected.getClassDefinition());
addOrReplaceTable(provider);
// addOrReplaceTable(provider);
}

// save object type category to session storage, used by back button
Expand Down Expand Up @@ -620,7 +638,7 @@ private void deleteAllShadowsConfirmed(OperationResult result, boolean deleteAcc
throws ObjectAlreadyExistsException, ObjectNotFoundException, SchemaException {

ObjectFilter kind = EqualFilter.createEqual(ShadowType.F_KIND, ShadowType.class, getPrismContext(),
null, ShadowKindType.ACCOUNT);
null, ShadowKindType.ACCOUNT);

String taskName;
ObjectQuery query;
Expand Down Expand Up @@ -773,6 +791,21 @@ private void deleteAllShadowsOnResource(AjaxRequestTarget target) {
target);
}

private void exportAllShadowsOnResource(AjaxRequestTarget target) {
DebugSearchDto dto = searchModel.getObject();
if (dto.getResource() == null) {
error(getString("pageDebugList.message.resourceNotSelected"));
target.add(getFeedbackPanel());
return;
}

RefFilter ref = RefFilter.createReferenceEqual(ShadowType.F_RESOURCE_REF, ShadowType.class,
getPrismContext(), dto.getResource().getOid());
ObjectQuery objectQuery = ObjectQuery.createObjectQuery(ref);
initDownload(target, dto.getType().getClassDefinition(), objectQuery);

}


private Component getDeleteConfirmationPanel() {
return new ConfirmationPanel(getMainPopupBodyId(),
Expand Down Expand Up @@ -911,24 +944,32 @@ protected void onUpdate(AjaxRequestTarget target) {
});

DropDownChoice resource = new DropDownChoice(ID_RESOURCE,
new PropertyModel(model, DebugSearchDto.F_RESOURCE_OID), resourcesModel,
new PropertyModel(model, DebugSearchDto.F_RESOURCE), resourcesModel,
createResourceRenderer());
resource.setNullValid(true);
resource.add(new AjaxFormComponentUpdatingBehavior("blur") {

@Override
protected void onUpdate(AjaxRequestTarget target) {
// nothing to do, it's here just to update model
}
});
@Override
protected void onUpdate(AjaxRequestTarget target) {
// nothing to do, it's here just to update model
}
});
resource.add(new OnChangeAjaxBehavior() {

@Override
protected void onUpdate(AjaxRequestTarget target) {
PageDebugList page = (PageDebugList) getPage();
page.listObjectsPerformed(target);
}
});
resource.add(new VisibleEnableBehaviour() {

@Override
public boolean isVisible() {
DebugSearchDto dto = model.getObject();
return ObjectTypes.SHADOW.equals(dto.getType());
}
});
@Override
public boolean isVisible() {
DebugSearchDto dto = model.getObject();
return ObjectTypes.SHADOW.equals(dto.getType());
}
});
searchForm.add(resource);

AjaxCheckBox zipCheck = new AjaxCheckBox(ID_ZIP_CHECK, new Model<>(false)) {
Expand Down
Expand Up @@ -28,7 +28,7 @@
public class DebugSearchDto implements Serializable {

public static final String F_TYPE = "type";
public static final String F_RESOURCE_OID = "resource";
public static final String F_RESOURCE = "resource";
public static final String F_SEARCH = "search";

private ObjectTypes type;
Expand Down
Expand Up @@ -1519,6 +1519,7 @@ pageDebugList.menu.deleteAllIdentities=Delete all identities
pageDebugList.menu.deleteAllType=Delete all of selected type
pageDebugList.menu.deleteSelected=Delete selected
pageDebugList.menu.deleteShadowsOnResource=Delete all shadows on resource
pageDebugList.menu.exportShadowsOnResource=Export all shadows on resource
pageDebugList.menu.exportAll=Export all objects
pageDebugList.menu.exportAllSelectedType=Export all of selected type
pageDebugList.menu.exportSelected=Export selected
Expand Down

0 comments on commit f5f72cc

Please sign in to comment.