use of com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType in project midpoint by Evolveum.
the class PageResources method initResourceColumns.
private List<IColumn<SelectableBean<ResourceType>, String>> initResourceColumns() {
List<IColumn<SelectableBean<ResourceType>, String>> columns = new ArrayList<>();
columns.add(new PropertyColumn(createStringResource("pageResources.connectorType"), SelectableBean.F_VALUE + ".connector.connectorType"));
columns.add(new PropertyColumn(createStringResource("pageResources.version"), SelectableBean.F_VALUE + ".connector.connectorVersion"));
return columns;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType in project midpoint by Evolveum.
the class PageResources method deleteResourcePerformed.
private void deleteResourcePerformed(AjaxRequestTarget target, ResourceType single) {
List<ResourceType> selected = isAnyResourceSelected(target, single);
singleDelete = single;
if (selected.isEmpty()) {
return;
}
ConfirmationPanel dialog = new ConfirmationPanel(((PageBase) getPage()).getMainPopupBodyId(), createDeleteConfirmString("pageResources.message.deleteResourceConfirm", "pageResources.message.deleteResourcesConfirm", true)) {
@Override
public void yesPerformed(AjaxRequestTarget target) {
((PageBase) getPage()).hideMainPopup(target);
deleteResourceConfirmedPerformed(target);
}
};
((PageBase) getPage()).showMainPopup(dialog, target);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType in project midpoint by Evolveum.
the class PageResources method deleteResourceConfirmedPerformed.
private void deleteResourceConfirmedPerformed(AjaxRequestTarget target) {
List<ResourceType> selected = new ArrayList<>();
if (singleDelete != null) {
selected.add(singleDelete);
} else {
selected = getResourceTable().getSelectedObjects();
}
OperationResult result = new OperationResult(OPERATION_DELETE_RESOURCES);
for (ResourceType resource : selected) {
try {
Task task = createSimpleTask(OPERATION_DELETE_RESOURCES);
ObjectDelta<ResourceType> delta = ObjectDelta.createDeleteDelta(ResourceType.class, resource.getOid(), getPrismContext());
getModelService().executeChanges(WebComponentUtil.createDeltaCollection(delta), null, task, result);
} catch (Exception ex) {
result.recordPartialError("Couldn't delete resource.", ex);
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't delete resource", ex);
}
}
result.recomputeStatus();
if (result.isSuccess()) {
result.recordStatus(OperationResultStatus.SUCCESS, "The resource(s) have been successfully deleted.");
}
getResourceTable().clearCache();
showResult(result);
target.add(getFeedbackPanel(), (Component) getResourceTable());
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType in project midpoint by Evolveum.
the class ResourceContentPanel method newTaskPerformed.
private void newTaskPerformed(String category, AjaxRequestTarget target) {
TaskType taskType = new TaskType();
PrismProperty<ShadowKindType> pKind;
try {
pKind = taskType.asPrismObject().findOrCreateProperty(new ItemPath(TaskType.F_EXTENSION, SchemaConstants.MODEL_EXTENSION_KIND));
pKind.setRealValue(getKind());
} catch (SchemaException e) {
getSession().warn("Could not set kind for new task " + e.getMessage());
}
PrismProperty<String> pIntent;
try {
pIntent = taskType.asPrismObject().findOrCreateProperty(new ItemPath(TaskType.F_EXTENSION, SchemaConstants.MODEL_EXTENSION_INTENT));
pIntent.setRealValue(getIntent());
} catch (SchemaException e) {
getSession().warn("Could not set kind for new task " + e.getMessage());
}
PrismObject<ResourceType> resource = getResourceModel().getObject();
taskType.setObjectRef(ObjectTypeUtil.createObjectRef(resource));
taskType.setCategory(category);
setResponsePage(new PageTaskAdd(taskType));
;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType in project midpoint by Evolveum.
the class PageResourceEdit method updateConnectorRef.
/**
* Method which attempts to resolve connector reference filter to actual connector (if necessary).
*
* @param resource {@link PrismObject} resource
*/
private void updateConnectorRef(PrismObject<ResourceType> resource, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
if (resource == null) {
return;
}
PrismReference resourceRef = resource.findReference(ResourceType.F_CONNECTOR_REF);
if (resourceRef == null || resourceRef.getValue() == null) {
return;
}
PrismReferenceValue refValue = resourceRef.getValue();
if (StringUtils.isNotEmpty(refValue.getOid())) {
return;
}
if (refValue.getFilter() == null) {
return;
}
SchemaRegistry registry = getPrismContext().getSchemaRegistry();
PrismObjectDefinition objDef = registry.findObjectDefinitionByCompileTimeClass(ConnectorType.class);
ObjectFilter filter = QueryConvertor.parseFilter(refValue.getFilter(), objDef);
List<PrismObject<ConnectorType>> connectors = getModelService().searchObjects(ConnectorType.class, ObjectQuery.createObjectQuery(filter), null, task, result);
if (connectors.size() != 1) {
return;
}
PrismObject<ConnectorType> connector = connectors.get(0);
refValue.setOid(connector.getOid());
refValue.setTargetType(ConnectorType.COMPLEX_TYPE);
refValue.setFilter(null);
}
Aggregations