[midPoint] reading a binary (jpeg) from a csv file

Brad Fardig brad.fardig at cogitogroup.com.au
Tue Mar 14 03:58:12 CET 2017


Update:

 

It is possible the schema element needs to be:

<xsd:element maxOccurs="1" minOccurs="0" name="Photo" type="xsd:string">

 

And then need a little script like this on the inbound:

 

<script>

 
<language>http://midpoint.evolveum.com/xml/ns/public/expression/language#Gro
ovy</language>

         <code>

               import javax.xml.bind.DatatypeConverter

               Photo = basic.getAttributeValue(shadow,
'http://midpoint.evolveum.com/xml/ns/public/resource/instance-3', 'Photo')

               jpg = DatatypeConverter.parseHexBinary(Photo)

                             

               return jpg

                             

         </code>

</script>

 

 

Regards,

 

Brad

 

 

From: midPoint [mailto:midpoint-bounces at lists.evolveum.com] On Behalf Of
Brad Fardig
Sent: Tuesday, 14 March 2017 10:22 AM
To: midpoint (midpoint at lists.evolveum.com) <midpoint at lists.evolveum.com>
Subject: [midPoint] reading a binary (jpeg) from a csv file

 

Hi,

 

I have a csv file that contains a hex encoded binary string which is a jpeg
image.

 

Is it possible to read this in via the connector with the following schema
definition:

 

<xsd:element maxOccurs="1" minOccurs="0" name="Photo" type="xsd:hexBinary">

 

I have tried this and receive the error below, should I persist with trying
this or look for another approach?

 

 

 

  at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
[quartz-2.1.3.jar:na]

        at
org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557
) [quartz-2.1.3.jar:na]

Caused by: java.lang.IllegalArgumentException: Expected class [B type, but
got class java.lang.String in inbound expression for
{http://midpoint.evolveum.com/xml/ns/public/resource/instance-3}Photo in
resource:9086df29-fd0c-4797-8de8-d64cad7fab76(PACSCSVConnector)

        at
com.evolveum.midpoint.model.impl.lens.projector.MappingEvaluator.evaluateMap
ping(MappingEvaluator.java:99) ~[model-impl-3.4.jar:na]

        at
com.evolveum.midpoint.model.impl.lens.projector.InboundProcessor.evaluateInb
oundMapping(InboundProcessor.java:490) ~[model-impl-3.4.jar:na]

        at
com.evolveum.midpoint.model.impl.lens.projector.InboundProcessor.processInbo
undExpressionsForProjection(InboundProcessor.java:353)
~[model-impl-3.4.jar:na]

        at
com.evolveum.midpoint.model.impl.lens.projector.InboundProcessor.processInbo
undFocal(InboundProcessor.java:186) ~[model-impl-3.4.jar:na]

        at
com.evolveum.midpoint.model.impl.lens.projector.InboundProcessor.processInbo
und(InboundProcessor.java:128) ~[model-impl-3.4.jar:na]

        at
com.evolveum.midpoint.model.impl.lens.projector.FocusProcessor.processFocusF
ocus(FocusProcessor.java:212) ~[model-impl-3.4.jar:na]

        at
com.evolveum.midpoint.model.impl.lens.projector.FocusProcessor.processFocus(
FocusProcessor.java:146) ~[model-impl-3.4.jar:na]

        at
com.evolveum.midpoint.model.impl.lens.projector.Projector.projectInternal(Pr
ojector.java:208) ~[model-impl-3.4.jar:na]

        at
com.evolveum.midpoint.model.impl.lens.projector.Projector.project(Projector.
java:106) ~[model-impl-3.4.jar:na]

        at
com.evolveum.midpoint.model.impl.lens.Clockwork.click(Clockwork.java:302)
~[model-impl-3.4.jar:na]

        at
com.evolveum.midpoint.model.impl.lens.Clockwork.run(Clockwork.java:214)
~[model-impl-3.4.jar:na]

        at
com.evolveum.midpoint.model.impl.sync.SynchronizationServiceImpl.reactToChan
ge(SynchronizationServiceImpl.java:766) ~[model-impl-3.4.jar:na]

        at
com.evolveum.midpoint.model.impl.sync.SynchronizationServiceImpl.notifyChang
e(SynchronizationServiceImpl.java:299) ~[model-impl-3.4.jar:na]

        ... 33 common frames omitted

Caused by: java.lang.IllegalArgumentException: Expected class [B type, but
got class java.lang.String

        at
com.evolveum.midpoint.prism.util.JavaTypeConverter.convert(JavaTypeConverter
.java:249) ~[prism-3.4.jar:na]

        at
com.evolveum.midpoint.model.common.expression.ExpressionUtil.convertValue(Ex
pressionUtil.java:186) ~[model-common-3.4.jar:na]

        at
com.evolveum.midpoint.model.common.expression.ExpressionUtil$1.visit(Express
ionUtil.java:135) ~[model-common-3.4.jar:na]

        at
com.evolveum.midpoint.prism.PrismValue.accept(PrismValue.java:171)
~[prism-3.4.jar:na]

        at
com.evolveum.midpoint.prism.delta.PrismValueDeltaSetTriple.acceptSet(PrismVa
lueDeltaSetTriple.java:266) ~[prism-3.4.jar:na]

        at
com.evolveum.midpoint.prism.delta.PrismValueDeltaSetTriple.accept(PrismValue
DeltaSetTriple.java:256) ~[prism-3.4.jar:na]

        at
com.evolveum.midpoint.model.common.expression.ExpressionUtil.toOutputTriple(
ExpressionUtil.java:122) ~[model-common-3.4.jar:na]

        at
com.evolveum.midpoint.model.common.expression.evaluator.AsIsExpressionEvalua
tor.evaluate(AsIsExpressionEvaluator.java:93) ~[model-common-3.4.jar:na]

        at
com.evolveum.midpoint.model.common.expression.Expression.evaluate(Expression
.java:133) ~[model-common-3.4.jar:na]

        at
com.evolveum.midpoint.model.common.mapping.Mapping.evaluateExpression(Mappin
g.java:985) ~[model-common-3.4.jar:na]

        at
com.evolveum.midpoint.model.common.mapping.Mapping.evaluate(Mapping.java:520
) ~[model-common-3.4.jar:na]

        at
com.evolveum.midpoint.model.impl.lens.projector.MappingEvaluator.evaluateMap
ping(MappingEvaluator.java:95) ~[model-impl-3.4.jar:na]

        ... 45 common frames omitted

 

 

 

Regards,

 

Brad

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170314/087a91ee/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4802 bytes
Desc: not available
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170314/087a91ee/attachment.bin>


More information about the midPoint mailing list