use of com.evolveum.midpoint.schema.processor.ConnectorSchema in project midpoint by Evolveum.
the class RefinedConnectorSchemaImpl method getConnectorSchema.
public static ConnectorSchema getConnectorSchema(PrismObject<ConnectorType> connector, PrismContext prismContext) throws SchemaException {
Element connectorXsdSchema = ConnectorTypeUtil.getConnectorXsdSchema(connector);
if (connectorXsdSchema == null) {
return null;
}
Object userDataEntry = connector.getUserData(USER_DATA_KEY_PARSED_CONNECTOR_SCHEMA);
if (userDataEntry != null) {
if (userDataEntry instanceof ConnectorSchema) {
return (ConnectorSchema) userDataEntry;
} else {
throw new IllegalStateException("Expected ConnectorSchema under user data key " + USER_DATA_KEY_PARSED_CONNECTOR_SCHEMA + "in " + connector + ", but got " + userDataEntry.getClass());
}
} else {
//InternalMonitor.recordConnectorSchemaParse();
ConnectorSchemaImpl parsedSchema = ConnectorSchemaImpl.parse(connectorXsdSchema, "connector schema of " + connector, prismContext);
if (parsedSchema == null) {
throw new IllegalStateException("Parsed schema is null: most likely an internall error");
}
parsedSchema.setUsualNamespacePrefix(ConnectorSchemaImpl.retrieveUsualNamespacePrefix(connector.asObjectable()));
connector.setUserData(USER_DATA_KEY_PARSED_CONNECTOR_SCHEMA, parsedSchema);
return parsedSchema;
}
}
Aggregations