[midPoint] - Execute stored procedure in SQLScript resource

Ivan Noris ivan.noris at evolveum.com
Wed Aug 31 10:32:23 CEST 2016


Rodrigo,

a wild guess: your outbound mappings in the resource are not setting the
mandatory attributes, i.e. icfs:name, when adding new account. Could
this be the case?

Ivan

On 08/30/2016 09:48 PM, Rodrigo Yanis wrote:
> Hello everyone,
>
> I'm currently trying to perform a call on a stored procedure in my
> Oracle DB through a SQLScript resource. The use case is as follows:
> 1. The resource is assigned to the user X
> 2. Resource performs a call to a stored procedure on the database,
> sending one of the user attributes as a parameter for the stored
> procedure to do its magic
> 3. Stored procedure outputs a value, and its written into a different
> attribute on my midPoint user.
>
> I've tried to do this by modifying the CreateScript in the midPoint
> examples, here:
> https://github.com/Evolveum/midpoint/blob/master/samples/resources/scriptedsql/CreateScript.groovy
>
> The script I've come up with is the following:
>
>     log.info <http://log.info>("Entering "+action+" Script");
>     def sql = new Sql(connection);
>     try {
>             sql.call("{? = call STORED_PROCEDURE(?, ?)}",[Sql.VARCHAR,
>     attributes?.get("pidm")?.get(0), Sql.VARCHAR])
>             {
>                     alias -> return alias
>             };
>     }
>     catch(all) {
>             log.error("Exception in Stored Procedure execution");
>     }
>     return "errorInCall";
>
> Stored procedure logic is out of the scope of this case.
>
> I've configured the resource so it maps the "pidm" attribute i'm
> requesting in my script to the user attribute in midPoint. I've also
> mapped "alias" as an inbound attribute to my attribute in midPoint.
>
> Does this scenario make any sense to you? Is this being approached
> correctly? Is there a way to perform a "set attribute" on the script
> itself?
>
> Right now I'm getting the following error in step 1. of the use case I
> described:
>
>     Error executing changes for (account (default) on
>     resource:e1054471-b559-4f13-bc32-aec273c51e46(Banner Personas)):
>     Couldn't add object. Schema violation: Schema violation during
>     processing shadow: shadow: null (OID:null): Attempt to add shadow
>     without any attributes: shadow:null(null)
>     com.evolveum.midpoint.util.exception.SchemaException: Couldn't add
>     object. Schema violation: Schema violation during processing
>     shadow: shadow: null (OID:null): Attempt to add shadow without any
>     attributes: shadow:null(null)
>
>
> Thanks in advance,
>
> *Rodrigo Yanis.*
> Identicum S.A.
> Jorge Newbery 3226
> Tel: +54 (11) 4824-9971
> ryanis at identicum.com <mailto:ryanis at identicum.com>
> www.identicum.com <http://www.identicum.com/>
>
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint

-- 
Ivan Noris
Senior Identity Engineer
evolveum.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20160831/0d899fbb/attachment.htm>


More information about the midPoint mailing list