use of com.evolveum.midpoint.web.component.wizard.resource.dto.SchemaHandlingDto in project midpoint by Evolveum.
the class SchemaHandlingStep method loadSchemaHandlingDto.
private SchemaHandlingDto loadSchemaHandlingDto() {
List<ResourceObjectTypeDefinitionTypeDto> objectTypeDefs = new ArrayList<>();
SchemaHandlingType schemaHandling = getOrCreateSchemaHandling();
for (ResourceObjectTypeDefinitionType objectType : schemaHandling.getObjectType()) {
objectTypeDefs.add(new ResourceObjectTypeDefinitionTypeDto(objectType));
}
List<QName> objectClasses = loadResourceObjectClassList(resourceModel, LOGGER, getString("SchemaHandlingStep.message.errorLoadingObjectTypeList"));
return new SchemaHandlingDto(objectTypeDefs, objectClasses);
}
use of com.evolveum.midpoint.web.component.wizard.resource.dto.SchemaHandlingDto in project midpoint by Evolveum.
the class SchemaHandlingStep method resetSelections.
private void resetSelections(AjaxRequestTarget target) {
SchemaHandlingDto dto = schemaHandlingDtoModel.getObject();
if (dto.getSelectedAssociation() != null) {
dto.setSelectedAssociation(null);
target.add(getAssociationList());
}
if (dto.getSelectedAttribute() != null) {
dto.setSelectedAttribute(null);
target.add(getAttributeList());
}
}
use of com.evolveum.midpoint.web.component.wizard.resource.dto.SchemaHandlingDto in project midpoint by Evolveum.
the class SchemaHandlingStep method initObjectTypeEditor.
private void initObjectTypeEditor(WebMarkupContainer editor) {
Label editorLabel = new Label(ID_EDITOR_NAME, new AbstractReadOnlyModel<Object>() {
@Override
public String getObject() {
ResourceObjectTypeDefinitionTypeDto selected = schemaHandlingDtoModel.getObject().getSelectedObjectTypeDto();
return selected != null ? selected.getObjectType().getDisplayName() : "";
}
});
editorLabel.setOutputMarkupId(true);
editor.add(editorLabel);
DropDownChoice editorKind = new DropDownChoice<>(ID_EDITOR_KIND, new PropertyModel<ShadowKindType>(schemaHandlingDtoModel, getExpression(ResourceObjectTypeDefinitionType.F_KIND)), WebComponentUtil.createReadonlyModelFromEnum(ShadowKindType.class), new EnumChoiceRenderer<ShadowKindType>(this));
editorKind.add(new UpdateNamesBehaviour());
parentPage.addEditingEnabledBehavior(editorKind);
editor.add(editorKind);
TextField editorIntent = new TextField<>(ID_EDITOR_INTENT, new PropertyModel<String>(schemaHandlingDtoModel, getExpression(ResourceObjectTypeDefinitionType.F_INTENT)));
editorIntent.add(new UpdateNamesBehaviour());
parentPage.addEditingEnabledBehavior(editorIntent);
editor.add(editorIntent);
TextField editorDisplayName = new TextField<>(ID_EDITOR_DISPLAY_NAME, new PropertyModel<String>(schemaHandlingDtoModel, getExpression(ResourceObjectTypeDefinitionType.F_DISPLAY_NAME)));
editorDisplayName.add(new UpdateNamesBehaviour());
parentPage.addEditingEnabledBehavior(editorDisplayName);
editor.add(editorDisplayName);
TextArea editorDescription = new TextArea<>(ID_EDITOR_DESCRIPTION, new PropertyModel<String>(schemaHandlingDtoModel, getExpression(ResourceObjectTypeDefinitionType.F_DESCRIPTION)));
parentPage.addEditingEnabledBehavior(editorDescription);
editor.add(editorDescription);
final CheckBox editorDefault = new CheckBox(ID_EDITOR_DEFAULT, new PropertyModel<Boolean>(schemaHandlingDtoModel, getExpression(ResourceObjectTypeDefinitionType.F_DEFAULT)));
editorDefault.add(new EmptyOnChangeAjaxFormUpdatingBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
Boolean newValue = editorDefault.getModelObject();
if (Boolean.TRUE.equals(newValue)) {
SchemaHandlingDto dto = schemaHandlingDtoModel.getObject();
ResourceObjectTypeDefinitionTypeDto selected = dto.getSelectedObjectTypeDto();
ShadowKindType selectedKind = fillDefault(selected.getObjectType().getKind());
for (ResourceObjectTypeDefinitionTypeDto currentObjectTypeDto : dto.getObjectTypeDtoList()) {
ShadowKindType currentKind = fillDefault(currentObjectTypeDto.getObjectType().getKind());
if (currentObjectTypeDto != selected && currentKind == selectedKind && Boolean.TRUE.equals(currentObjectTypeDto.getObjectType().isDefault())) {
currentObjectTypeDto.getObjectType().setDefault(false);
}
}
}
parentPage.refreshIssues(target);
}
});
parentPage.addEditingEnabledBehavior(editorDefault);
editor.add(editorDefault);
AjaxSubmitLink editorDependency = new AjaxSubmitLink(ID_EDITOR_BUTTON_DEPENDENCY) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
dependencyEditPerformed(target);
}
};
addDisabledClassModifier(editorDependency);
editor.add(editorDependency);
AutoCompleteSettings autoCompleteSettings = new AutoCompleteSettings();
autoCompleteSettings.setShowListOnEmptyInput(true);
autoCompleteSettings.setMaxHeightInPx(200);
AutoCompleteTextField<String> editorObjectClass = new AutoCompleteTextField<String>(ID_EDITOR_OBJECT_CLASS, new PropertyModel<String>(schemaHandlingDtoModel, SchemaHandlingDto.F_OBJECT_CLASS_NAME), autoCompleteSettings) {
@Override
protected Iterator<String> getChoices(String input) {
return getObjectClassChoices(input);
}
};
editorObjectClass.add(new UpdateNamesBehaviour());
editorObjectClass.add(createObjectClassValidator(new AbstractReadOnlyModel<List<QName>>() {
@Override
public List<QName> getObject() {
return schemaHandlingDtoModel.getObject().getObjectClassList();
}
}));
parentPage.addEditingEnabledBehavior(editorObjectClass);
editorObjectClass.setConvertEmptyInputStringToNull(true);
editor.add(editorObjectClass);
MultiValueTextEditPanel editorAttributes = new MultiValueTextEditPanel<ResourceAttributeDefinitionType>(ID_EDITOR_ATTRIBUTES, new PropertyModel<List<ResourceAttributeDefinitionType>>(schemaHandlingDtoModel, getExpression(ResourceObjectTypeDefinitionType.F_ATTRIBUTE)), new PropertyModel<ResourceAttributeDefinitionType>(schemaHandlingDtoModel, SchemaHandlingDto.F_SELECTED_ATTRIBUTE), false, true, parentPage.getReadOnlyModel()) {
@Override
protected IModel<String> createTextModel(final IModel<ResourceAttributeDefinitionType> model) {
return new Model<String>() {
@Override
public String getObject() {
if (model == null || model.getObject() == null) {
return null;
}
ResourceAttributeDefinitionType attribute = model.getObject();
return formatItemInfo(attribute, attribute.getRef(), attribute.getDisplayName(), attribute.getInbound(), attribute.getOutbound());
}
};
}
@Override
protected ResourceAttributeDefinitionType createNewEmptyItem() {
return createEmptyAttributeObject();
}
@Override
protected void performAddValueHook(AjaxRequestTarget target, ResourceAttributeDefinitionType added) {
parentPage.refreshIssues(target);
}
@Override
protected void editPerformed(AjaxRequestTarget target, ResourceAttributeDefinitionType object) {
editAttributePerformed(target, object);
}
@Override
protected boolean buttonsDisabled() {
return !isAnySelected();
}
@Override
protected void performRemoveValueHook(AjaxRequestTarget target, ListItem<ResourceAttributeDefinitionType> item) {
resetThirdRowContainer(target);
parentPage.refreshIssues(target);
}
};
editorAttributes.setOutputMarkupId(true);
editor.add(editorAttributes);
MultiValueTextEditPanel editorAssociations = new MultiValueTextEditPanel<ResourceObjectAssociationType>(ID_EDITOR_ASSOCIATIONS, new PropertyModel<List<ResourceObjectAssociationType>>(schemaHandlingDtoModel, getExpression(ResourceObjectTypeDefinitionType.F_ASSOCIATION)), new PropertyModel<ResourceObjectAssociationType>(schemaHandlingDtoModel, SchemaHandlingDto.F_SELECTED_ASSOCIATION), false, true, parentPage.getReadOnlyModel()) {
@Override
protected IModel<String> createTextModel(final IModel<ResourceObjectAssociationType> model) {
return new Model<String>() {
@Override
public String getObject() {
ResourceObjectAssociationType association = model.getObject();
if (association == null) {
return null;
}
return formatItemInfo(association, association.getRef(), association.getDisplayName(), association.getInbound(), association.getOutbound());
}
};
}
@Override
protected ResourceObjectAssociationType createNewEmptyItem() {
return createEmptyAssociationObject();
}
@Override
protected void performAddValueHook(AjaxRequestTarget target, ResourceObjectAssociationType added) {
parentPage.refreshIssues(target);
}
@Override
protected void editPerformed(AjaxRequestTarget target, ResourceObjectAssociationType object) {
editAssociationPerformed(target, object);
}
@Override
protected boolean buttonsDisabled() {
return !isAnySelected();
}
@Override
protected void performRemoveValueHook(AjaxRequestTarget target, ListItem<ResourceObjectAssociationType> item) {
resetThirdRowContainer(target);
parentPage.refreshIssues(target);
}
};
editorAssociations.setOutputMarkupId(true);
editor.add(editorAssociations);
// DropDownChoice editorAssignmentPolicyRef = new DropDownChoice<>(ID_EDITOR_ASSIGNMENT_POLICY,
// new PropertyModel<AssignmentPolicyEnforcementType>(schemaHandlingDtoModel,
// getExpression(ResourceObjectTypeDefinitionType.F_ASSIGNMENT_POLICY_ENFORCEMENT)),
// WebComponentUtil.createReadonlyModelFromEnum(AssignmentPolicyEnforcementType.class),
// new EnumChoiceRenderer<AssignmentPolicyEnforcementType>(this));
// parentPage.addEditingEnabledBehavior(editorAssignmentPolicyRef);
// editor.add(editorAssignmentPolicyRef);
AjaxSubmitLink editorIteration = new AjaxSubmitLink(ID_EDITOR_BUTTON_ITERATION) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
iterationEditPerformed(target);
}
};
addDisabledClassModifier(editorIteration);
editor.add(editorIteration);
AjaxSubmitLink editorProtected = new AjaxSubmitLink(ID_EDITOR_BUTTON_PROTECTED) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
protectedEditPerformed(target);
}
};
addDisabledClassModifier(editorProtected);
editor.add(editorProtected);
AjaxSubmitLink editorActivation = new AjaxSubmitLink(ID_EDITOR_BUTTON_ACTIVATION) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
activationEditPerformed(target);
}
};
addDisabledClassModifier(editorActivation);
editor.add(editorActivation);
AjaxSubmitLink editorCredentials = new AjaxSubmitLink(ID_EDITOR_BUTTON_CREDENTIALS) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
credentialsEditPerformed(target);
}
};
addDisabledClassModifier(editorCredentials);
editor.add(editorCredentials);
Label kindTooltip = new Label(ID_T_KIND);
kindTooltip.add(new InfoTooltipBehavior());
editor.add(kindTooltip);
Label intentTooltip = new Label(ID_T_INTENT);
intentTooltip.add(new InfoTooltipBehavior());
editor.add(intentTooltip);
Label defaultTooltip = new Label(ID_T_DEFAULT);
defaultTooltip.add(new InfoTooltipBehavior());
editor.add(defaultTooltip);
Label dependencyTooltip = new Label(ID_T_DEPENDENCY);
dependencyTooltip.add(new InfoTooltipBehavior());
editor.add(dependencyTooltip);
Label objectClassTooltip = new Label(ID_T_OBJECT_CLASS);
objectClassTooltip.add(new InfoTooltipBehavior());
editor.add(objectClassTooltip);
Label attributesTooltip = new Label(ID_T_ATTRIBUTES);
attributesTooltip.add(new InfoTooltipBehavior());
editor.add(attributesTooltip);
Label associationsTooltip = new Label(ID_T_ASSOCIATIONS);
associationsTooltip.add(new InfoTooltipBehavior());
editor.add(associationsTooltip);
Label assignmentPolicyRefTooltip = new Label(ID_T_ASSIGNMENT_POLICY_REF);
assignmentPolicyRefTooltip.add(new InfoTooltipBehavior());
editor.add(assignmentPolicyRefTooltip);
Label iterationTooltip = new Label(ID_T_ITERATION);
iterationTooltip.add(new InfoTooltipBehavior());
editor.add(iterationTooltip);
Label protectedTooltip = new Label(ID_T_PROTECTED);
protectedTooltip.add(new InfoTooltipBehavior());
editor.add(protectedTooltip);
Label activationTooltip = new Label(ID_T_ACTIVATION);
activationTooltip.add(new InfoTooltipBehavior());
editor.add(activationTooltip);
Label credentialsTooltip = new Label(ID_T_CREDENTIALS);
credentialsTooltip.add(new InfoTooltipBehavior());
editor.add(credentialsTooltip);
}
Aggregations