use of com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType.Host in project midpoint by Evolveum.
the class ConnectorManager method getConnectorTypeReadOnly.
public ConnectorType getConnectorTypeReadOnly(ConnectorSpec connectorSpec, OperationResult result) throws ObjectNotFoundException, SchemaException {
if (connectorSpec.getConnectorOid() == null) {
result.recordFatalError("Connector OID missing in " + connectorSpec);
throw new ObjectNotFoundException("Connector OID missing in " + connectorSpec);
}
String connOid = connectorSpec.getConnectorOid();
ConnectorType connectorType = connectorTypeCache.get(connOid);
if (connectorType == null) {
Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(GetOperationOptions.createReadOnly());
PrismObject<ConnectorType> repoConnector = repositoryService.getObject(ConnectorType.class, connOid, options, result);
connectorType = repoConnector.asObjectable();
connectorTypeCache.put(connOid, connectorType);
} else {
String currentConnectorVersion = repositoryService.getVersion(ConnectorType.class, connOid, result);
if (!currentConnectorVersion.equals(connectorType.getVersion())) {
Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(GetOperationOptions.createReadOnly());
PrismObject<ConnectorType> repoConnector = repositoryService.getObject(ConnectorType.class, connOid, options, result);
connectorType = repoConnector.asObjectable();
connectorTypeCache.put(connOid, connectorType);
}
}
if (connectorType.getConnectorHost() == null && connectorType.getConnectorHostRef() != null) {
// We need to resolve the connector host
String connectorHostOid = connectorType.getConnectorHostRef().getOid();
PrismObject<ConnectorHostType> connectorHost = repositoryService.getObject(ConnectorHostType.class, connectorHostOid, null, result);
connectorType.setConnectorHost(connectorHost.asObjectable());
}
PrismObject<ConnectorType> connector = connectorType.asPrismObject();
Object userDataEntry = connector.getUserData(USER_DATA_KEY_PARSED_CONNECTOR_SCHEMA);
if (userDataEntry == null) {
InternalMonitor.recordConnectorSchemaParse();
PrismSchema connectorSchema = ConnectorTypeUtil.parseConnectorSchema(connectorType, prismContext);
if (connectorSchema == null) {
throw new SchemaException("No connector schema in " + connectorType);
}
connector.setUserData(USER_DATA_KEY_PARSED_CONNECTOR_SCHEMA, connectorSchema);
}
return connectorType;
}
Aggregations