use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class ResourceSchemaHandlingPanel method initLayout.
protected void initLayout() {
MidpointForm<?> form = new MidpointForm<>(ID_FORM);
add(form);
MultivalueContainerListPanelWithDetailsPanel<ResourceObjectTypeDefinitionType> objectTypesPanel = new MultivalueContainerListPanelWithDetailsPanel<>(ID_TABLE, ResourceObjectTypeDefinitionType.class) {
@Override
protected MultivalueContainerDetailsPanel<ResourceObjectTypeDefinitionType> getMultivalueContainerDetailsPanel(ListItem<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> item) {
return createMultivalueContainerDetailsPanel(ID_ITEM_DETAILS, item.getModel());
}
@Override
protected boolean isCreateNewObjectVisible() {
return false;
}
@Override
protected IModel<PrismContainerWrapper<ResourceObjectTypeDefinitionType>> getContainerModel() {
return PrismContainerWrapperModel.fromContainerWrapper(getObjectWrapperModel(), ItemPath.create(ResourceType.F_SCHEMA_HANDLING, SchemaHandlingType.F_OBJECT_TYPE));
}
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.TABLE_SCHEMA_HANDLING;
}
@Override
protected List<IColumn<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>, String>> createDefaultColumns() {
List<IColumn<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>, String>> columns = new ArrayList<>();
// columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_DISPLAY_NAME, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_KIND, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_INTENT, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_DEFAULT, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_DESCRIPTION, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
List<InlineMenuItem> menuActionsList = getMultivalueContainerListPanel().getDefaultMenuActions();
columns.add(new InlineMenuButtonColumn(menuActionsList, getPageBase()) {
private static final long serialVersionUID = 1L;
@Override
public String getCssClass() {
return " col-md-1 ";
}
});
return columns;
}
@Override
protected IColumn<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>, String> createNameColumn(IModel<String> displayModel, GuiObjectColumnType customColumn, ItemPath itemPath, ExpressionType expression) {
return new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_DISPLAY_NAME, AbstractItemWrapperColumn.ColumnType.LINK, getPageBase()) {
@Override
protected void onClick(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> model) {
itemDetailsPerformed(target, model);
}
};
}
@Override
public void editItemPerformed(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> rowModel, List<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> listItems) {
AbstractPageObjectDetails parent = findParent(AbstractPageObjectDetails.class);
if (parent == null) {
super.editItemPerformed(target, rowModel, listItems);
return;
}
ContainerPanelConfigurationType detailsPanel = new ContainerPanelConfigurationType(getPrismContext());
detailsPanel.setPanelType("schemaHandlingDetails");
PrismContainerValueWrapper<ResourceObjectTypeDefinitionType> objectTypeDef;
if (rowModel != null) {
objectTypeDef = rowModel.getObject();
} else {
objectTypeDef = listItems.iterator().next();
}
// VirtualContainersSpecificationType virtualContainer = new VirtualContainersSpecificationType(getPrismContext());
detailsPanel.setPath(new ItemPathType(objectTypeDef.getPath()));
// detailsPanel.getContainer().add(virtualContainer);
detailsPanel.setIdentifier("schemaHandlingDetails");
DisplayType displayType = new DisplayType();
displayType.setLabel(getObjectTypeDisplayName(objectTypeDef.getNewValue().asContainerable()));
detailsPanel.setDisplay(displayType);
getPageBase().getSessionStorage().setObjectDetailsStorage("details" + parent.getType().getSimpleName(), detailsPanel);
ResourceSchemaHandlingPanel.this.getPanelConfiguration().getPanel().add(detailsPanel);
target.add(parent);
parent.replacePanel(detailsPanel, target);
// super.editItemPerformed(target, rowModel, listItems);
}
};
form.add(objectTypesPanel);
}
use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class DefaultGuiConfigurationCompiler method compileContainerPanelConfiguration.
private ContainerPanelConfigurationType compileContainerPanelConfiguration(Class<?> clazz, Class<? extends Containerable> containerable, PanelInstance panelInstance) {
ContainerPanelConfigurationType config = new ContainerPanelConfigurationType();
config.setIdentifier(panelInstance.identifier());
addPanelTypeConfiguration(clazz, config);
compileDisplay(panelInstance, config);
List<ContainerPanelConfigurationType> children = processChildren(containerable, clazz);
config.getPanel().addAll(children);
if (panelInstance.defaultPanel()) {
config.setDefault(true);
}
if (panelInstance.applicableForOperation().length == 1) {
config.setApplicableForOperation(panelInstance.applicableForOperation()[0]);
}
createDefaultVirtualContainer(config, panelInstance.containerPath(), panelInstance.expanded());
if (panelInstance.hiddenContainers().length > 0) {
for (String path : panelInstance.hiddenContainers()) {
VirtualContainersSpecificationType c = new VirtualContainersSpecificationType();
c.setVisibility(UserInterfaceElementVisibilityType.HIDDEN);
ItemPathType itemPath = prismContext.itemPathParser().asItemPathType(path);
c.setPath(itemPath);
config.getContainer().add(c);
}
}
if (StringUtils.isNotEmpty(panelInstance.type())) {
config.setType(QNameUtil.uriToQName(panelInstance.type(), SchemaConstantsGenerated.NS_COMMON));
}
return config;
}
use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class DefaultGuiConfigurationCompiler method createDefaultVirtualContainer.
private void createDefaultVirtualContainer(ContainerPanelConfigurationType config, String path, Boolean expanded) {
if (StringUtils.isEmpty(path)) {
return;
}
VirtualContainersSpecificationType container = new VirtualContainersSpecificationType();
if ("empty".equals(path)) {
container.setPath(new ItemPathType(ItemPath.EMPTY_PATH));
} else {
ItemPathType itemPath = prismContext.itemPathParser().asItemPathType(path);
container.setPath(itemPath);
}
container.setDisplayOrder(10);
container.setExpanded(expanded);
config.getContainer().add(container);
}
use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class ResourceAttributeEditor method loadObjectReferences.
private List<ItemPathType> loadObjectReferences() {
List<ItemPathType> references = new ArrayList<>();
ResourceSchema schema = loadResourceSchema();
if (schema == null || objectType == null) {
return references;
}
for (ResourceObjectClassDefinition def : schema.getObjectClassDefinitions()) {
if (objectType.getObjectClass().equals(def.getTypeName()) || objectType.getAuxiliaryObjectClass().contains(def.getTypeName())) {
for (ResourceAttributeDefinition<?> attributeDefinition : def.getAttributeDefinitions()) {
ItemPath itemPath = attributeDefinition.getItemName();
ItemPathType itemPathType = new ItemPathType(itemPath);
if (!references.contains(itemPathType)) {
references.add(itemPathType);
}
}
}
}
references.sort((o1, o2) -> String.CASE_INSENSITIVE_ORDER.compare(prepareReferenceDisplayValue(o1), prepareReferenceDisplayValue(o2)));
return references;
}
use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class ResourceAttributeEditor method initLayout.
protected void initLayout(final NonEmptyModel<Boolean> readOnlyModel) {
Label label = new Label(ID_LABEL, new ResourceModel("ResourceAttributeEditor.label.edit"));
label.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
add(label);
WebMarkupContainer schemaRefPanel = new WebMarkupContainer(ID_SCHEMA_REF_PANEL);
schemaRefPanel.setOutputMarkupId(true);
schemaRefPanel.setOutputMarkupPlaceholderTag(true);
schemaRefPanel.add(new VisibleEnableBehaviour() {
@Override
public boolean isEnabled() {
return !readOnlyModel.getObject();
}
});
add(schemaRefPanel);
Label refTooltip = new Label(ID_T_REF);
refTooltip.add(new InfoTooltipBehavior());
refTooltip.setOutputMarkupId(true);
refTooltip.setOutputMarkupId(true);
schemaRefPanel.add(refTooltip);
IChoiceRenderer<ItemPathType> choiceRenderer = new IChoiceRenderer<ItemPathType>() {
@Override
public ItemPathType getObject(String id, IModel<? extends List<? extends ItemPathType>> choices) {
return StringUtils.isNotBlank(id) ? choices.getObject().get(Integer.parseInt(id)) : null;
}
@Override
public Object getDisplayValue(ItemPathType object) {
return prepareReferenceDisplayValue(object);
}
@Override
public String getIdValue(ItemPathType object, int index) {
return Integer.toString(index);
}
};
DropDownChoice<?> refSelect = new DropDownChoice<ItemPathType>(ID_REFERENCE_SELECT, new PropertyModel<>(getModel(), "ref"), (IModel<List<ItemPathType>>) () -> loadObjectReferences(), choiceRenderer) {
@Override
protected boolean isSelected(ItemPathType object, int index, String selected) {
if (getModelObject() == null || getModelObject().equals(new ItemPathType())) {
return false;
}
QName referenceQName = ItemPathTypeUtil.asSingleName(getModelObject());
QName optionQName = ItemPathTypeUtil.asSingleName(object);
return Objects.equals(referenceQName, optionQName);
}
};
refSelect.setNullValid(false);
refSelect.setOutputMarkupId(true);
refSelect.setOutputMarkupPlaceholderTag(true);
refSelect.add(new EmptyOnChangeAjaxFormUpdatingBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(parentStep.getAttributeList());
((PageResourceWizard) getPageBase()).refreshIssues(target);
}
});
refSelect.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
schemaRefPanel.add(refSelect);
TextField<?> displayName = new TextField<>(ID_DISPLAY_NAME, new PropertyModel<String>(getModel(), "displayName"));
displayName.add(new EmptyOnChangeAjaxFormUpdatingBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(parentStep.getAttributeList());
}
});
displayName.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
add(displayName);
TextArea<?> description = new TextArea<>(ID_DESCRIPTION, new PropertyModel<String>(getModel(), "description"));
description.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
add(description);
AjaxLink<Void> limitations = new AjaxLink<Void>(ID_BUTTON_LIMITATIONS) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
limitationsEditPerformed(target);
}
};
add(limitations);
CheckBox exclusiveStrong = new CheckBox(ID_EXCLUSIVE_STRONG, new PropertyModel<>(getModel(), "exclusiveStrong"));
exclusiveStrong.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
add(exclusiveStrong);
CheckBox tolerant = new CheckBox(ID_TOLERANT, new PropertyModel<>(getModel(), "tolerant"));
tolerant.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
add(tolerant);
MultiValueTextPanel<?> tolerantVP = new MultiValueTextPanel<>(ID_TOLERANT_VP, new PropertyModel<List<String>>(getModel(), "tolerantValuePattern"), readOnlyModel, true);
tolerantVP.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
add(tolerantVP);
MultiValueTextPanel<?> intolerantVP = new MultiValueTextPanel<>(ID_INTOLERANT_VP, new PropertyModel<List<String>>(getModel(), "intolerantValuePattern"), readOnlyModel, true);
intolerantVP.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
add(intolerantVP);
DropDownChoice<?> fetchStrategy = new DropDownChoice<>(ID_FETCH_STRATEGY, new PropertyModel<>(getModel(), "fetchStrategy"), WebComponentUtil.createReadonlyModelFromEnum(AttributeFetchStrategyType.class), new EnumChoiceRenderer<>(this));
fetchStrategy.setNullValid(true);
fetchStrategy.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
add(fetchStrategy);
AttributeEditorUtils.addMatchingRuleFields(this, readOnlyModel);
TextField<String> outboundLabel = new TextField<>(ID_OUTBOUND_LABEL, (IModel<String>) () -> {
ResourceAttributeDefinitionType attributeDefinition = getModel().getObject();
if (attributeDefinition == null) {
return null;
}
return MappingTypeDto.createMappingLabel(attributeDefinition.getOutbound(), LOGGER, getPageBase().getPrismContext(), getString("MappingType.label.placeholder"), getString("MultiValueField.nameNotSpecified"));
});
outboundLabel.setEnabled(false);
outboundLabel.setOutputMarkupId(true);
VisibleEnableBehaviour showIfEditingOrOutboundExists = AttributeEditorUtils.createShowIfEditingOrOutboundExists(getModel(), readOnlyModel);
outboundLabel.add(showIfEditingOrOutboundExists);
add(outboundLabel);
AjaxSubmitLink outbound = new AjaxSubmitLink(ID_BUTTON_OUTBOUND) {
@Override
protected void onSubmit(AjaxRequestTarget target) {
outboundEditPerformed(target);
}
@Override
protected void onError(AjaxRequestTarget target) {
target.add(parentStep.getPageBase().getFeedbackPanel());
}
};
outbound.setOutputMarkupId(true);
outbound.add(showIfEditingOrOutboundExists);
add(outbound);
AjaxSubmitLink deleteOutbound = new AjaxSubmitLink(ID_DELETE_OUTBOUND) {
@Override
protected void onSubmit(AjaxRequestTarget target) {
deleteOutboundPerformed(target);
}
@Override
protected void onError(AjaxRequestTarget target) {
target.add(parentStep.getPageBase().getFeedbackPanel());
}
};
deleteOutbound.setOutputMarkupId(true);
deleteOutbound.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
add(deleteOutbound);
MultiValueTextEditPanel<?> inbound = new MultiValueTextEditPanel<MappingType>(ID_INBOUND, new PropertyModel<>(getModel(), "inbound"), null, false, true, readOnlyModel) {
@Override
protected IModel<String> createTextModel(final IModel<MappingType> model) {
return new Model<String>() {
@Override
public String getObject() {
return MappingTypeDto.createMappingLabel(model.getObject(), LOGGER, getPageBase().getPrismContext(), getString("MappingType.label.placeholder"), getString("MultiValueField.nameNotSpecified"));
}
};
}
@Override
protected MappingType createNewEmptyItem() {
return WizardUtil.createEmptyMapping();
}
@Override
protected void performAddValueHook(AjaxRequestTarget target, MappingType added) {
target.add(parentStep.getAttributeList());
target.add(parentStep.getAssociationList());
((PageResourceWizard) getPageBase()).refreshIssues(target);
}
@Override
protected void performRemoveValueHook(AjaxRequestTarget target, ListItem<MappingType> item) {
target.add(parentStep.getAttributeList());
target.add(parentStep.getAssociationList());
((PageResourceWizard) getPageBase()).refreshIssues(target);
}
@Override
protected void editPerformed(AjaxRequestTarget target, MappingType object) {
inboundEditPerformed(target, object);
}
};
inbound.setOutputMarkupId(true);
add(inbound);
Label allowTooltip = new Label(ID_T_ALLOW);
allowTooltip.add(new InfoTooltipBehavior());
add(allowTooltip);
Label limitationsTooltip = new Label(ID_T_LIMITATIONS);
limitationsTooltip.add(new InfoTooltipBehavior());
add(limitationsTooltip);
Label exclusiveStrongTooltip = new Label(ID_T_EXCLUSIVE_STRONG);
exclusiveStrongTooltip.add(new InfoTooltipBehavior());
add(exclusiveStrongTooltip);
Label tolerantTooltip = new Label(ID_T_TOLERANT);
tolerantTooltip.add(new InfoTooltipBehavior());
add(tolerantTooltip);
Label tolerantVPTooltip = new Label(ID_T_TOLERANT_VP);
tolerantVPTooltip.add(new InfoTooltipBehavior());
add(tolerantVPTooltip);
Label intolerantVPTooltip = new Label(ID_T_INTOLERANT_VP);
intolerantVPTooltip.add(new InfoTooltipBehavior());
add(intolerantVPTooltip);
Label fetchTooltip = new Label(ID_T_FETCH);
fetchTooltip.add(new InfoTooltipBehavior());
add(fetchTooltip);
Label matchingRuleTooltip = new Label(ID_T_MATCHING_RULE);
matchingRuleTooltip.add(new InfoTooltipBehavior());
add(matchingRuleTooltip);
Label outboundTooltip = new Label(ID_T_OUTBOUND);
outboundTooltip.add(new InfoTooltipBehavior());
add(outboundTooltip);
Label inboundTooltip = new Label(ID_T_INBOUND);
inboundTooltip.add(new InfoTooltipBehavior());
add(inboundTooltip);
initModals(readOnlyModel);
}
Aggregations