use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class AbstractTreeTablePanel method createOrgChildQuery.
protected ObjectQuery createOrgChildQuery() {
SelectableBean<OrgType> dto = selected.getObject();
String oid = dto != null && dto.getValue() != null ? dto.getValue().getOid() : getModel().getObject();
BasicSearchPanel<String> basicSearch = (BasicSearchPanel) get(createComponentPath(ID_SEARCH_FORM, ID_BASIC_SEARCH));
String object = basicSearch.getModelObject();
DropDownChoice<String> searchScopeChoice = (DropDownChoice) get(createComponentPath(ID_SEARCH_FORM, ID_SEARCH_SCOPE));
String scope = searchScopeChoice.getModelObject();
if (StringUtils.isBlank(object)) {
object = null;
}
PageBase page = getPageBase();
PrismContext context = page.getPrismContext();
S_AtomicFilterExit q;
if (object == null || SEARCH_SCOPE_ONE.equals(scope)) {
q = QueryBuilder.queryFor(OrgType.class, context).isDirectChildOf(oid);
} else {
q = QueryBuilder.queryFor(OrgType.class, context).isChildOf(oid);
}
if (object == null) {
return q.build();
}
PolyStringNormalizer normalizer = context.getDefaultPolyStringNormalizer();
String normalizedString = normalizer.normalize(object);
if (StringUtils.isEmpty(normalizedString)) {
return q.build();
}
ObjectQuery query = q.and().block().item(OrgType.F_NAME).containsPoly(normalizedString).matchingNorm().or().item(OrgType.F_DISPLAY_NAME).containsPoly(normalizedString).matchingNorm().build();
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Searching child orgs of org {} with query:\n{}", oid, query.debugDump());
}
return query;
}
use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class AssignmentPreviewDialog method initLayout.
public void initLayout() {
List<IColumn<AssignmentsPreviewDto, String>> columns = initColumns();
ListDataProvider provider = new ListDataProvider(pageBase, data);
WebMarkupContainer content = new WebMarkupContainer(ID_CONTENT);
content.setOutputMarkupId(true);
add(content);
TablePanel table = new TablePanel<>(ID_TABLE, provider, columns);
table.setOutputMarkupId(true);
content.add(table);
AjaxButton addButton = new AjaxButton(ID_BUTTON_ADD, createStringResource("userBrowserDialog.button.selectButton")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
List<AssignmentsPreviewDto> previewDtos = data.getObject();
List<AssignmentsPreviewDto> selectedDtos = new ArrayList<>();
for (AssignmentsPreviewDto dto : previewDtos) {
if (dto.isSelected()) {
selectedDtos.add(dto);
}
}
AssignmentPreviewDialog.this.addButtonClicked(target, selectedDtos);
}
};
addButton.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return multiselect;
}
});
content.add(addButton);
AjaxButton cancelButton = new AjaxButton(ID_BUTTON_CANCEL, createStringResource("AssignmentPreviewDialog.button.cancel")) {
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
((PageBase) getPage()).hideMainPopup(ajaxRequestTarget);
}
};
content.add(cancelButton);
}
use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class TreeTablePanel method deleteNodeConfirmedPerformed.
private void deleteNodeConfirmedPerformed(SelectableBean<OrgType> orgToDelete, AjaxRequestTarget target) {
getPageBase().hideMainPopup(target);
OperationResult result = new OperationResult(OPERATION_DELETE_OBJECT);
PageBase page = getPageBase();
if (orgToDelete == null) {
orgToDelete = getTreePanel().getRootFromProvider();
}
if (orgToDelete.getValue() == null) {
return;
}
String oidToDelete = orgToDelete.getValue().getOid();
WebModelServiceUtils.deleteObject(OrgType.class, oidToDelete, result, page);
result.computeStatusIfUnknown();
page.showResult(result);
// TODO is this ok? [pmed]
throw new RestartResponseException(getPage().getClass());
}
use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class ResourceListPanel method initLayout.
protected void initLayout() {
TablePanel resources = new TablePanel("table", new ObjectDataProvider((PageBase) getPage(), ResourceType.class), initColumns());
resources.setOutputMarkupId(true);
add(resources);
}
use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class AssignmentEditorPanel method getTargetObject.
private <O extends ObjectType> PrismObject<O> getTargetObject(AssignmentEditorDto dto) throws ObjectNotFoundException, SchemaException, SecurityViolationException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
PrismContainerValue<AssignmentType> assignment = dto.getOldValue();
PrismReference targetRef = assignment.findReference(AssignmentType.F_TARGET_REF);
if (targetRef == null) {
return null;
}
PrismReferenceValue refValue = targetRef.getValue();
if (refValue != null && refValue.getObject() != null) {
PrismObject object = refValue.getObject();
return object;
}
String oid = targetRef.getOid();
OperationResult result = new OperationResult(OPERATION_LOAD_OBJECT);
PageBase page = getPageBase();
ModelService model = page.getMidpointApplication().getModel();
Task task = page.createSimpleTask(OPERATION_LOAD_OBJECT);
Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(GetOperationOptions.createNoFetch());
Class<O> type = (Class<O>) ObjectType.class;
if (refValue.getTargetType() != null) {
type = getPageBase().getPrismContext().getSchemaRegistry().determineCompileTimeClass(refValue.getTargetType());
}
PrismObject<O> object = model.getObject(type, oid, options, task, result);
refValue.setObject(object);
return object;
}
Aggregations