[midPoint] Parsing Dates in Inbound Mapping

Radovan Semancik radovan.semancik at evolveum.com
Wed Aug 24 10:02:44 CEST 2016


Simple way would be to use dateTime and just set the time part to 
00:00:00. That's what we usually do. If you use dataTime instead of 
string then midPoint GUI should provide convenient date/time picker 
widget instead of just text field.

The XMLGregorianCalendar is a slight inconvenience. But the 
XMLGregorianCalendar is Java representation of the xsd:dateTime. This is 
probably caused by the really bad support that the Java platform has for 
data types related to dates and times. There are many data types and it 
is difficult to work with them, there are also some libraries, but these 
are not yet generally accepted as a replacement. So, there is great deal 
of confusion here. We have decided not to contribute to the chaos and 
reuse XMLGregorianCalendar - even if it is not perfect.

Maybe you can use basic.formatDateTime(...) and basic.parseDateTime(...) 
methods?

See 
https://www.evolveum.com/downloads/midpoint/3.4/midpoint-3.4-javadoc/com/evolveum/midpoint/model/common/expression/functions/BasicExpressionFunctions.html
(and https://wiki.evolveum.com/display/midPoint/Script+Expression+Functions)

-- 
Radovan Semancik
Software Architect
evolveum.com




On 08/23/2016 10:05 PM, Mencel, Matt wrote:
> Since it's a birthday and time is not needed, I'm just going to store 
> it as a string for now.  If Midpoint adds support for the xsd:date 
> type someday I'll look at this again.
>
> Thanks for the suggestions.
>
> Matt
>
> On Tue, Aug 23, 2016 at 2:50 PM, Ivan Noris <Ivan.Noris at evolveum.com 
> <mailto:Ivan.Noris at evolveum.com>> wrote:
>
>     Hi Matt,
>
>     this is a fragment from my mapping for date (from Oracle DB I guess)
>     ...
>                    <inbound>
>                         <target>
>     <c:path>$focus/activation/validFrom</c:path>
>                         </target>
>                         <expression>
>                             <script>
>                                 <code>
>       import java.text.SimpleDateFormat;
>       import java.text.DateFormat;
>
>       DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
>
>       if (input!=null) {
>           Date convertedValidFrom = df.parse(input);
>     log.info <http://log.info>("convertedValidFrom = " +
>     convertedValidFrom);
>
>           return
>     com.evolveum.midpoint.util.MiscUtil.asXMLGregorianCalendar(convertedValidFrom);
>       }
>       else {
>           return null;
>       }
>
>                                 </code>
>                             </script>
>                         </expression>
>                     </inbound>
>     ...
>
>     Hope this helps,
>     Ivan
>
>     ------------------------------------------------------------------------
>
>         *From: *"Matt Mencel" <mr-mencel at wiu.edu
>         <mailto:mr-mencel at wiu.edu>>
>         *To: *"midPoint General Discussion"
>         <midpoint at lists.evolveum.com <mailto:midpoint at lists.evolveum.com>>
>         *Sent: *Tuesday, August 23, 2016 9:26:33 PM
>         *Subject: *Re: [midPoint] Parsing Dates in Inbound Mapping
>
>
>         I tried it like this....
>
>         <inbound>
>         <target>
>         <path>$user/extension/birthDate</path>
>         </target>
>         <expression>
>         <script>
>          
>         <language>http://midpoint.evolveum.com/xml/ns/public/expression/language#Groovy
>         <http://midpoint.evolveum.com/xml/ns/public/expression/language#Groovy></language>
>           <code>
>         XMLGregorianCalendar(Date.parse('yyyymmdd', input))
>         </code>
>         </script>
>         </expression>
>         </inbound>
>         </attribute>
>
>         I'm still getting Java errors (see below).  I'll can just
>         switch it back to a string type and not worry about it.
>
>         Thanks,
>         Matt
>
>
>
>
>         2016-08-23 13:21:42,247 [] [midPointScheduler_Worker-8] ERROR
>         (com.evolveum.midpoint.model.impl.sync.SynchronizationServiceImpl):
>         SYNCHRONIZATION: Error in synchronization on
>         resource:0d6babea-6896-11e6-9d38-0050569aa9d2(CSV TEADVS) for
>         situation LINKED: ExpressionEvaluationException:
>         groovy.lang.MissingMethodException: No signature of method:
>         org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.XMLGregorianCalendar()
>         is applicable for argument types: (java.util.Date) values:
>         [Sat Jan 05 00:04:00 CST 1985] expression in mapping in
>         inbound expression for
>         {http://midpoint.evolveum.com/xml/ns/public/resource/instance-3}birthdate
>         <http://midpoint.evolveum.com/xml/ns/public/resource/instance-3%7Dbirthdate>
>         in resource:0d6babea-6896-11e6-9d38-0050569aa9d2(CSV
>         TEADVS)({.../common/common-3}input=PPV(String:19850405); ) in
>         expression in mapping in inbound expression for
>         {http://midpoint.evolveum.com/xml/ns/public/resource/instance-3}birthdate
>         <http://midpoint.evolveum.com/xml/ns/public/resource/instance-3%7Dbirthdate>
>         in resource:0d6babea-6896-11e6-9d38-0050569aa9d2(CSV TEADVS).
>         Change was
>         ResourceObjectShadowChangeDescription(objectDelta=ObjectDelta(ShadowType:4c7c2ce9-9041-46da-b8c3-a57be022ce18,ADD:
>         shadow:4c7c2ce9-9041-46da-b8c3-a57be022ce18(902073705)),
>         currentShadow=shadow:4c7c2ce9-9041-46da-b8c3-a57be022ce18(902073705),
>         oldShadow=null,
>         sourceChannel=http://midpoint.evolveum.com/xml/ns/public/provisioning/channels-3#import
>         <http://midpoint.evolveum.com/xml/ns/public/provisioning/channels-3#import>,
>         resource=resource:0d6babea-6896-11e6-9d38-0050569aa9d2(CSV
>         TEADVS))
>         com.evolveum.midpoint.util.exception.ExpressionEvaluationException:
>         groovy.lang.MissingMethodException: No signature of method:
>         org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.XMLGregorianCalendar()
>         is applicable for argument types: (java.util.Date) values:
>         [Sat Jan 05 00:04:00 CST 1985] expression in mapping in
>         inbound expression for
>         {http://midpoint.evolveum.com/xml/ns/public/resource/instance-3}birthdate
>         <http://midpoint.evolveum.com/xml/ns/public/resource/instance-3%7Dbirthdate>
>         in resource:0d6babea-6896-11e6-9d38-0050569aa9d2(CSV
>         TEADVS)({.../common/common-3}input=PPV(String:19850405); ) in
>         expression in mapping in inbound expression for
>         {http://midpoint.evolveum.com/xml/ns/public/resource/instance-3}birthdate
>         <http://midpoint.evolveum.com/xml/ns/public/resource/instance-3%7Dbirthdate>
>         in resource:0d6babea-6896-11e6-9d38-0050569aa9d2(CSV TEADVS)
>                 at
>         com.evolveum.midpoint.model.common.expression.evaluator.AbstractValueTransformationExpressionEvaluator$1.process(AbstractValueTransformationExpressionEvaluator.java:425)
>         ~[model-common-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.model.common.expression.evaluator.AbstractValueTransformationExpressionEvaluator$1.process(AbstractValueTransformationExpressionEvaluator.java:352)
>         ~[model-common-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.util.MiscUtil.carthesian(MiscUtil.java:367)
>         ~[util-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.util.MiscUtil.carthesian(MiscUtil.java:357)
>         ~[util-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.model.common.expression.evaluator.AbstractValueTransformationExpressionEvaluator.evaluateRelativeExpression(AbstractValueTransformationExpressionEvaluator.java:442)
>         ~[model-common-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.model.common.expression.evaluator.AbstractValueTransformationExpressionEvaluator.evaluate(AbstractValueTransformationExpressionEvaluator.java:114)
>         ~[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(Mapping.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.evaluateMapping(MappingEvaluator.java:95)
>         ~[model-impl-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.model.impl.lens.projector.InboundProcessor.evaluateInboundMapping(InboundProcessor.java:490)
>         ~[model-impl-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.model.impl.lens.projector.InboundProcessor.processInboundExpressionsForProjection(InboundProcessor.java:319)
>         ~[model-impl-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.model.impl.lens.projector.InboundProcessor.processInboundFocal(InboundProcessor.java:186)
>         ~[model-impl-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.model.impl.lens.projector.InboundProcessor.processInbound(InboundProcessor.java:128)
>         ~[model-impl-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.model.impl.lens.projector.FocusProcessor.processFocusFocus(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(Projector.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.reactToChange(SynchronizationServiceImpl.java:766)
>         [model-impl-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.model.impl.sync.SynchronizationServiceImpl.notifyChange(SynchronizationServiceImpl.java:299)
>         [model-impl-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.provisioning.impl.ChangeNotificationDispatcherImpl.notifyChange(ChangeNotificationDispatcherImpl.java:148)
>         [provisioning-impl-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.model.impl.sync.SynchronizeAccountResultHandler.handleObjectInternal(SynchronizeAccountResultHandler.java:203)
>         [model-impl-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.model.impl.sync.SynchronizeAccountResultHandler.handleObject(SynchronizeAccountResultHandler.java:128)
>         [model-impl-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.model.impl.util.AbstractSearchIterativeResultHandler.processRequest(AbstractSearchIterativeResultHandler.java:327)
>         [model-impl-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.model.impl.util.AbstractSearchIterativeResultHandler.handle(AbstractSearchIterativeResultHandler.java:189)
>         [model-impl-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.provisioning.impl.ProvisioningServiceImpl$4.handle(ProvisioningServiceImpl.java:1184)
>         [provisioning-impl-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.provisioning.impl.ShadowCache$2.handle(ShadowCache.java:831)
>         [provisioning-impl-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.provisioning.impl.ResourceObjectConverter$3.handle(ResourceObjectConverter.java:1102)
>         [provisioning-impl-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.provisioning.ucf.impl.ConnectorInstanceIcfImpl$2.handle(ConnectorInstanceIcfImpl.java:2316)
>         [provisioning-impl-3.4.jar:na]
>                 at
>         org.identityconnectors.framework.impl.api.SearchResultsHandlerLoggingProxy.handle(SearchResultsHandlerLoggingProxy.java:64)
>         [connector-framework-internal-1.4.3.0-SNAPSHOT.jar:na]
>                 at
>         org.identityconnectors.framework.impl.api.StreamHandlerUtil$ObjectStreamHandlerAdapter.handle(StreamHandlerUtil.java:101)
>         [connector-framework-internal-1.4.3.0-SNAPSHOT.jar:na]
>                 at
>         org.identityconnectors.framework.impl.api.BufferedResultsProxy.invoke(BufferedResultsProxy.java:262)
>         [connector-framework-internal-1.4.3.0-SNAPSHOT.jar:na]
>                 at
>         org.identityconnectors.framework.impl.api.DelegatingTimeoutProxy.invoke(DelegatingTimeoutProxy.java:94)
>         [connector-framework-internal-1.4.3.0-SNAPSHOT.jar:na]
>                 at com.sun.proxy.$Proxy169.search(Unknown Source) [na:na]
>                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>         Method) ~[na:1.8.0_101]
>                 at
>         sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         ~[na:1.8.0_101]
>                 at
>         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         ~[na:1.8.0_101]
>                 at java.lang.reflect.Method.invoke(Method.java:498)
>         ~[na:1.8.0_101]
>                 at
>         org.identityconnectors.framework.impl.api.LoggingProxy.invoke(LoggingProxy.java:83)
>         [connector-framework-internal-1.4.3.0-SNAPSHOT.jar:na]
>                 at com.sun.proxy.$Proxy169.search(Unknown Source) [na:na]
>                 at
>         org.identityconnectors.framework.impl.api.AbstractConnectorFacade.search(AbstractConnectorFacade.java:177)
>         [connector-framework-internal-1.4.3.0-SNAPSHOT.jar:na]
>                 at
>         com.evolveum.midpoint.provisioning.ucf.impl.ConnectorInstanceIcfImpl.search(ConnectorInstanceIcfImpl.java:2412)
>         [provisioning-impl-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.provisioning.impl.ResourceObjectConverter.searchResourceObjects(ResourceObjectConverter.java:1112)
>         [provisioning-impl-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.provisioning.impl.ShadowCache.searchObjectsIterative(ShadowCache.java:838)
>         [provisioning-impl-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.provisioning.impl.ShadowCache.searchObjectsIterative(ShadowCache.java:763)
>         [provisioning-impl-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.provisioning.impl.ProvisioningServiceImpl.searchObjectsIterative(ProvisioningServiceImpl.java:1232)
>         [provisioning-impl-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.model.impl.ModelObjectResolver.searchIterative(ModelObjectResolver.java:224)
>         [model-impl-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.model.impl.util.AbstractSearchIterativeTaskHandler.runInternal(AbstractSearchIterativeTaskHandler.java:239)
>         [model-impl-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.model.impl.util.AbstractSearchIterativeTaskHandler.run(AbstractSearchIterativeTaskHandler.java:155)
>         [model-impl-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.task.quartzimpl.execution.JobExecutor.executeHandler(JobExecutor.java:479)
>         [task-quartz-impl-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.task.quartzimpl.execution.JobExecutor.executeSingleTask(JobExecutor.java:300)
>         [task-quartz-impl-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.task.quartzimpl.execution.JobExecutor.execute(JobExecutor.java:164)
>         [task-quartz-impl-3.4.jar:na]
>                 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:
>         com.evolveum.midpoint.util.exception.ExpressionEvaluationException:
>         groovy.lang.MissingMethodException: No signature of method:
>         org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.XMLGregorianCalendar()
>         is applicable for argument types: (java.util.Date) values:
>         [Sat Jan 05 00:04:00 CST 1985] expression in mapping in
>         inbound expression for
>         {http://midpoint.evolveum.com/xml/ns/public/resource/instance-3}birthdate
>         <http://midpoint.evolveum.com/xml/ns/public/resource/instance-3%7Dbirthdate>
>         in resource:0d6babea-6896-11e6-9d38-0050569aa9d2(CSV TEADVS)
>                 at
>         com.evolveum.midpoint.model.common.expression.script.jsr223.Jsr223ScriptEvaluator.evaluate(Jsr223ScriptEvaluator.java:119)
>         ~[model-common-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.model.common.expression.script.ScriptExpression.evaluate(ScriptExpression.java:111)
>         ~[model-common-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.model.common.expression.script.ScriptExpressionEvaluator.transformSingleValue(ScriptExpressionEvaluator.java:60)
>         ~[model-common-3.4.jar:na]
>                 at
>         com.evolveum.midpoint.model.common.expression.evaluator.AbstractValueTransformationExpressionEvaluator$1.process(AbstractValueTransformationExpressionEvaluator.java:422)
>         ~[model-common-3.4.jar:na]
>                 ... 55 common frames omitted
>         Caused by: javax.script.ScriptException:
>         groovy.lang.MissingMethodException: No signature of method:
>         org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.XMLGregorianCalendar()
>         is applicable for argument types: (java.util.Date) values:
>         [Sat Jan 05 00:04:00 CST 1985]
>                 at
>         org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:347)
>         ~[groovy-all-2.4.0.jar:2.4.0]
>                 at
>         org.codehaus.groovy.jsr223.GroovyCompiledScript.eval(GroovyCompiledScript.java:41)
>         ~[groovy-all-2.4.0.jar:2.4.0]
>                 at
>         javax.script.CompiledScript.eval(CompiledScript.java:92)
>         ~[na:1.8.0_101]
>                 at
>         com.evolveum.midpoint.model.common.expression.script.jsr223.Jsr223ScriptEvaluator.evaluate(Jsr223ScriptEvaluator.java:117)
>         ~[model-common-3.4.jar:na]
>                 ... 58 common frames omitted
>         Caused by: groovy.lang.MissingMethodException: No signature of
>         method:
>         org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.XMLGregorianCalendar()
>         is applicable for argument types: (java.util.Date) values:
>         [Sat Jan 05 00:04:00 CST 1985]
>                 at
>         org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.callGlobal(GroovyScriptEngineImpl.java:418)
>         ~[groovy-all-2.4.0.jar:2.4.0]
>                 at
>         org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.access$000(GroovyScriptEngineImpl.java:89)
>         ~[groovy-all-2.4.0.jar:2.4.0]
>                 at
>         org.codehaus.groovy.jsr223.GroovyScriptEngineImpl$2.invokeMethod(GroovyScriptEngineImpl.java:330)
>         ~[groovy-all-2.4.0.jar:2.4.0]
>                 at
>         org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
>         ~[groovy-all-2.4.0.jar:2.4.0]
>                 at
>         org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
>         ~[groovy-all-2.4.0.jar:2.4.0]
>                 at
>         org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:81)
>         ~[groovy-all-2.4.0.jar:2.4.0]
>                 at
>         org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:161)
>         ~[groovy-all-2.4.0.jar:2.4.0]
>                 at Script23.run(Script23.groovy:2) ~[na:na]
>                 at
>         org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:344)
>         ~[groovy-all-2.4.0.jar:2.4.0]
>                 ... 61 common frames omitted
>
>
>         On Tue, Aug 23, 2016 at 1:08 PM, Pavol Mederly
>         <mederly at evolveum.com <mailto:mederly at evolveum.com>> wrote:
>
>             Matt,
>
>             maybe you could try this:
>
>             com.evolveum.midpoint.prism.xml.createXMLGregorianCalendar(d)
>
>             where d is a java.util.Date object.
>
>             See
>             https://github.com/Evolveum/midpoint/blob/master/infra/prism/src/main/java/com/evolveum/midpoint/prism/xml/XmlTypeConverter.java#L450
>             <https://github.com/Evolveum/midpoint/blob/master/infra/prism/src/main/java/com/evolveum/midpoint/prism/xml/XmlTypeConverter.java#L450>
>
>             Pavol Mederly
>             Software developer
>             evolveum.com <http://evolveum.com>
>
>             On 23.08.2016 19:52, Mencel, Matt wrote:
>
>                 Ah so now it's getting a bit crazy.  Apparently I have
>                 to convert it to an XMLGregorianCalendar type to put
>                 something in a dateTime attribute.
>
>                 This is probably not the right way, but when I tried
>                 this Groovy couldn't find the XMLGregorianCalendar class.
>
>                 <attribute>
>                 <ref>ri:birthdate</ref>
>                 <displayName>DOB</displayName>
>                 <inbound>
>                 <target>
>                 <path>$user/extension/birthDate</path>
>                 </target>
>                 <expression>
>                            <script>
>                              
>                  <language>http://midpoint.evolveum.com/xml/ns/public/expression/language#Groovy
>                 <http://midpoint.evolveum.com/xml/ns/public/expression/language#Groovy></language>
>                                <code>
>                                    <!-- Date.parse('yyyymmdd', input) -->
>                 GregorianCalendar c = new GregorianCalendar();
>                 c.setTime(input); XMLGregorianCalendar date2 =
>                 DatatypeFactory.newInstance().newXMLGregorianCalendar(c);
>                                </code>
>                            </script>
>                        </expression>
>                 </inbound>
>                 </attribute>
>
>                 So is everyone just storing dates as strings in Midpoint?
>
>                 Matt
>
>                 On Tue, Aug 23, 2016 at 12:24 PM, Pavol Mederly
>                 <mederly at evolveum.com <mailto:mederly at evolveum.com>>
>                 wrote:
>
>                     That's the usual process ;)
>
>                     It seems that midPoint doesn't support xsd:date,
>                     only xsd:dateTime.
>
>                     Best regards,
>
>                     Pavol Mederly
>                     Software developer
>                     evolveum.com <http://evolveum.com>
>
>                     On 23.08.2016 19:20, Mencel, Matt wrote:
>
>                         OK, that changed the error at least.  :)
>
>                         2016-08-23 12:17:19,231 []
>                         [midPointScheduler_Worker-6] ERROR
>                         (com.evolveum.midpoint.model.impl.util.AbstractSearchIterativeResultHandler):
>                         Import of object
>                         shadow:4c7c2ce9-9041-46da-b8c3-a57be022ce18(902073705)
>                         from
>                         resource:0d6babea-6896-11e6-9d38-0050569aa9d2(CSV
>                         TEADVS) failed: java.lang.RuntimeException: No
>                         type mapping for XSD type
>                         {http://www.w3.org/2001/XMLSchema}date({.../common/common-3}input=PPV(String:19850405)
>                         <http://www.w3.org/2001/XMLSchema%7Ddate%28%7B.../common/common-3%7Dinput=PPV%28String:19850405%29>;
>                         ) in expression in mapping in inbound
>                         expression for
>                         {http://midpoint.evolveum.com/xml/ns/public/resource/instance-3}birthdate
>                         <http://midpoint.evolveum.com/xml/ns/public/resource/instance-3%7Dbirthdate>
>                         in
>                         resource:0d6babea-6896-11e6-9d38-0050569aa9d2(CSV
>                         TEADVS)
>                         com.evolveum.midpoint.util.exception.SystemException:
>                         java.lang.RuntimeException: No type mapping
>                         for XSD type
>                         {http://www.w3.org/2001/XMLSchema}date({.../common/common-3}input=PPV(String:19850405)
>                         <http://www.w3.org/2001/XMLSchema%7Ddate%28%7B.../common/common-3%7Dinput=PPV%28String:19850405%29>;
>                         ) in expression in mapping in inbound
>                         expression for
>                         {http://midpoint.evolveum.com/xml/ns/public/resource/instance-3}birthdate
>                         <http://midpoint.evolveum.com/xml/ns/public/resource/instance-3%7Dbirthdate>
>                         in
>                         resource:0d6babea-6896-11e6-9d38-0050569aa9d2(CSV
>                         TEADVS)
>                                 at com.evolveum.midpoint.model.im
>                         <http://com.evolveum.midpoint.model.im>pl.sync.SynchronizationServiceImpl.notifyChange(SynchronizationServiceImpl.java:316)
>                         ~[model-impl-3.4.jar:na]
>                                 at
>                         com.evolveum.midpoint.provisioning.impl.ChangeNotificationDispatcherImpl.notifyChange(ChangeNotificationDispatcherImpl.java:148)
>                         ~[provisioning-impl-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.im
>                         <http://com.evolveum.midpoint.model.im>pl.sync.SynchronizeAccountResultHandler.handleObjectInternal(SynchronizeAccountResultHandler.java:203)
>                         ~[model-impl-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.im
>                         <http://com.evolveum.midpoint.model.im>pl.sync.SynchronizeAccountResultHandler.handleObject(SynchronizeAccountResultHandler.java:128)
>                         ~[model-impl-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.im
>                         <http://com.evolveum.midpoint.model.im>pl.util.AbstractSearchIterativeResultHandler.processRequest(AbstractSearchIterativeResultHandler.java:327)
>                         [model-impl-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.im
>                         <http://com.evolveum.midpoint.model.im>pl.util.AbstractSearchIterativeResultHandler.handle(AbstractSearchIterativeResultHandler.java:189)
>                         [model-impl-3.4.jar:na]
>                                 at
>                         com.evolveum.midpoint.provisioning.impl.ProvisioningServiceImpl$4.handle(ProvisioningServiceImpl.java:1184)
>                         [provisioning-impl-3.4.jar:na]
>                                 at
>                         com.evolveum.midpoint.provisioning.impl.ShadowCache$2.handle(ShadowCache.java:831)
>                         [provisioning-impl-3.4.jar:na]
>                                 at
>                         com.evolveum.midpoint.provisioning.impl.ResourceObjectConverter$3.handle(ResourceObjectConverter.java:1102)
>                         [provisioning-impl-3.4.jar:na]
>                                 at
>                         com.evolveum.midpoint.provisioning.ucf.impl.ConnectorInstanceIcfImpl$2.handle(ConnectorInstanceIcfImpl.java:2316)
>                         [provisioning-impl-3.4.jar:na]
>                                 at
>                         org.identityconnectors.framework.impl.api.SearchResultsHandlerLoggingProxy.handle(SearchResultsHandlerLoggingProxy.java:64)
>                         [connector-framework-internal-1.4.3.0-SNAPSHOT.jar:na]
>                                 at
>                         org.identityconnectors.framework.impl.api.StreamHandlerUtil$ObjectStreamHandlerAdapter.handle(StreamHandlerUtil.java:101)
>                         [connector-framework-internal-1.4.3.0-SNAPSHOT.jar:na]
>                                 at
>                         org.identityconnectors.framework.impl.api.BufferedResultsProxy.invoke(BufferedResultsProxy.java:262)
>                         [connector-framework-internal-1.4.3.0-SNAPSHOT.jar:na]
>                                 at
>                         org.identityconnectors.framework.impl.api.DelegatingTimeoutProxy.invoke(DelegatingTimeoutProxy.java:94)
>                         [connector-framework-internal-1.4.3.0-SNAPSHOT.jar:na]
>                                 at
>                         com.sun.proxy.$Proxy170.search(Unknown Source)
>                         [na:na]
>                                 at
>                         sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>                         Method) ~[na:1.8.0_101]
>                                 at
>                         sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>                         ~[na:1.8.0_101]
>                                 at
>                         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>                         ~[na:1.8.0_101]
>                                 at
>                         java.lang.reflect.Method.invoke(Method.java:498)
>                         ~[na:1.8.0_101]
>                                 at
>                         org.identityconnectors.framework.impl.api.LoggingProxy.invoke(LoggingProxy.java:83)
>                         [connector-framework-internal-1.4.3.0-SNAPSHOT.jar:na]
>                                 at
>                         com.sun.proxy.$Proxy170.search(Unknown Source)
>                         [na:na]
>                                 at
>                         org.identityconnectors.framework.impl.api.AbstractConnectorFacade.search(AbstractConnectorFacade.java:177)
>                         [connector-framework-internal-1.4.3.0-SNAPSHOT.jar:na]
>                                 at
>                         com.evolveum.midpoint.provisioning.ucf.impl.ConnectorInstanceIcfImpl.search(ConnectorInstanceIcfImpl.java:2412)
>                         [provisioning-impl-3.4.jar:na]
>                                 at
>                         com.evolveum.midpoint.provisioning.impl.ResourceObjectConverter.searchResourceObjects(ResourceObjectConverter.java:1112)
>                         [provisioning-impl-3.4.jar:na]
>                                 at
>                         com.evolveum.midpoint.provisioning.impl.ShadowCache.searchObjectsIterative(ShadowCache.java:838)
>                         [provisioning-impl-3.4.jar:na]
>                                 at
>                         com.evolveum.midpoint.provisioning.impl.ShadowCache.searchObjectsIterative(ShadowCache.java:763)
>                         [provisioning-impl-3.4.jar:na]
>                                 at
>                         com.evolveum.midpoint.provisioning.impl.ProvisioningServiceImpl.searchObjectsIterative(ProvisioningServiceImpl.java:1232)
>                         [provisioning-impl-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.im
>                         <http://com.evolveum.midpoint.model.im>pl.ModelObjectResolver.searchIterative(ModelObjectResolver.java:224)
>                         [model-impl-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.im
>                         <http://com.evolveum.midpoint.model.im>pl.util.AbstractSearchIterativeTaskHandler.runInternal(AbstractSearchIterativeTaskHandler.java:239)
>                         [model-impl-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.im
>                         <http://com.evolveum.midpoint.model.im>pl.util.AbstractSearchIterativeTaskHandler.run(AbstractSearchIterativeTaskHandler.java:155)
>                         [model-impl-3.4.jar:na]
>                                 at
>                         com.evolveum.midpoint.task.quartzimpl.execution.JobExecutor.executeHandler(JobExecutor.java:479)
>                         [task-quartz-impl-3.4.jar:na]
>                                 at
>                         com.evolveum.midpoint.task.quartzimpl.execution.JobExecutor.executeSingleTask(JobExecutor.java:300)
>                         [task-quartz-impl-3.4.jar:na]
>                                 at
>                         com.evolveum.midpoint.task.quartzimpl.execution.JobExecutor.execute(JobExecutor.java:164)
>                         [task-quartz-impl-3.4.jar:na]
>                                 at org.quartz.core.JobRunShell.ru
>                         <http://org.quartz.core.JobRunShell.ru>n(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.RuntimeException: No type
>                         mapping for XSD type
>                         {http://www.w3.org/2001/XMLSchema}date({.../common/common-3}input=PPV(String:19850405)
>                         <http://www.w3.org/2001/XMLSchema%7Ddate%28%7B.../common/common-3%7Dinput=PPV%28String:19850405%29>;
>                         ) in expression in mapping in inbound
>                         expression for
>                         {http://midpoint.evolveum.com/xml/ns/public/resource/instance-3}birthdate
>                         <http://midpoint.evolveum.com/xml/ns/public/resource/instance-3%7Dbirthdate>
>                         in
>                         resource:0d6babea-6896-11e6-9d38-0050569aa9d2(CSV
>                         TEADVS)
>                                 at com.evolveum.midpoint.model.co
>                         <http://com.evolveum.midpoint.model.co>mmon.expression.evaluator.AbstractValueTransformationExpressionEvaluator$1.process(AbstractValueTransformationExpressionEvaluator.java:434)
>                         ~[model-common-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.co
>                         <http://com.evolveum.midpoint.model.co>mmon.expression.evaluator.AbstractValueTransformationExpressionEvaluator$1.process(AbstractValueTransformationExpressionEvaluator.java:352)
>                         ~[model-common-3.4.jar:na]
>                                 at
>                         com.evolveum.midpoint.util.MiscUtil.carthesian(MiscUtil.java:367)
>                         ~[util-3.4.jar:na]
>                                 at
>                         com.evolveum.midpoint.util.MiscUtil.carthesian(MiscUtil.java:357)
>                         ~[util-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.co
>                         <http://com.evolveum.midpoint.model.co>mmon.expression.evaluator.AbstractValueTransformationExpressionEvaluator.evaluateRelativeExpression(AbstractValueTransformationExpressionEvaluator.java:442)
>                         ~[model-common-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.co
>                         <http://com.evolveum.midpoint.model.co>mmon.expression.evaluator.AbstractValueTransformationExpressionEvaluator.evaluate(AbstractValueTransformationExpressionEvaluator.java:114)
>                         ~[model-common-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.co
>                         <http://com.evolveum.midpoint.model.co>mmon.expression.Expression.evaluate(Expression.java:133)
>                         ~[model-common-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.co
>                         <http://com.evolveum.midpoint.model.co>mmon.mapping.Mapping.evaluateExpression(Mapping.java:985)
>                         ~[model-common-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.co
>                         <http://com.evolveum.midpoint.model.co>mmon.mapping.Mapping.evaluate(Mapping.java:520)
>                         ~[model-common-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.im
>                         <http://com.evolveum.midpoint.model.im>pl.lens.projector.MappingEvaluator.evaluateMapping(MappingEvaluator.java:95)
>                         ~[model-impl-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.im
>                         <http://com.evolveum.midpoint.model.im>pl.lens.projector.InboundProcessor.evaluateInboundMapping(InboundProcessor.java:490)
>                         ~[model-impl-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.im
>                         <http://com.evolveum.midpoint.model.im>pl.lens.projector.InboundProcessor.processInboundExpressionsForProjection(InboundProcessor.java:319)
>                         ~[model-impl-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.im
>                         <http://com.evolveum.midpoint.model.im>pl.lens.projector.InboundProcessor.processInboundFocal(InboundProcessor.java:186)
>                         ~[model-impl-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.im
>                         <http://com.evolveum.midpoint.model.im>pl.lens.projector.InboundProcessor.processInbound(InboundProcessor.java:128)
>                         ~[model-impl-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.im
>                         <http://com.evolveum.midpoint.model.im>pl.lens.projector.FocusProcessor.processFocusFocus(FocusProcessor.java:212)
>                         ~[model-impl-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.im
>                         <http://com.evolveum.midpoint.model.im>pl.lens.projector.FocusProcessor.processFocus(FocusProcessor.java:146)
>                         ~[model-impl-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.im
>                         <http://com.evolveum.midpoint.model.im>pl.lens.projector.Projector.pr
>                         <http://pl.lens.projector.Projector.pr>ojectInternal(Projector.java:208)
>                         ~[model-impl-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.im
>                         <http://com.evolveum.midpoint.model.im>pl.lens.projector.Projector.pr
>                         <http://pl.lens.projector.Projector.pr>oject(Projector.java:106)
>                         ~[model-impl-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.im
>                         <http://com.evolveum.midpoint.model.im>pl.lens.Clockwork.click(Clockwork.java:302)
>                         ~[model-impl-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.im
>                         <http://com.evolveum.midpoint.model.im>pl.lens.Clockwork.run(Clockwork.java:214)
>                         ~[model-impl-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.im
>                         <http://com.evolveum.midpoint.model.im>pl.sync.SynchronizationServiceImpl.reactToChange(SynchronizationServiceImpl.java:766)
>                         ~[model-impl-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.im
>                         <http://com.evolveum.midpoint.model.im>pl.sync.SynchronizationServiceImpl.notifyChange(SynchronizationServiceImpl.java:299)
>                         ~[model-impl-3.4.jar:na]
>                                 ... 34 common frames omitted
>                         Caused by: java.lang.IllegalArgumentException:
>                         No type mapping for XSD type
>                         {http://www.w3.org/2001/XMLSchema}date
>                         <http://www.w3.org/2001/XMLSchema%7Ddate>
>                                 at
>                         com.evolveum.midpoint.prism.xml.XsdTypeMapper.toJavaType(XsdTypeMapper.java:184)
>                         ~[prism-3.4.jar:na]
>                                 at
>                         com.evolveum.midpoint.prism.xml.XsdTypeMapper.toJavaType(XsdTypeMapper.java:173)
>                         ~[prism-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.co
>                         <http://com.evolveum.midpoint.model.co>mmon.expression.script.jsr223.Jsr223ScriptEvaluator.evaluate(Jsr223ScriptEvaluator.java:129)
>                         ~[model-common-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.co
>                         <http://com.evolveum.midpoint.model.co>mmon.expression.script.ScriptExpression.evaluate(ScriptExpression.java:111)
>                         ~[model-common-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.co
>                         <http://com.evolveum.midpoint.model.co>mmon.expression.script.ScriptExpressionEvaluator.transformSingleValue(ScriptExpressionEvaluator.java:60)
>                         ~[model-common-3.4.jar:na]
>                                 at com.evolveum.midpoint.model.co
>                         <http://com.evolveum.midpoint.model.co>mmon.expression.evaluator.AbstractValueTransformationExpressionEvaluator$1.process(AbstractValueTransformationExpressionEvaluator.java:422)
>                         ~[model-common-3.4.jar:na]
>                                 ... 55 common frames omitted
>
>                         On Tue, Aug 23, 2016 at 12:14 PM, Pavol
>                         Mederly <mederly at evolveum.com
>                         <mailto:mederly at evolveum.com>> wrote:
>
>                             Hello Matt,
>
>                             I assume you get something like "unknown
>                             variable 'birthdate'" exception. When
>                             creating inbound mappings, you refer to
>                             the incoming value (from the resource) via
>                             "input" variable.
>
>                             So your line should be something like
>                             Date.parse(..., input).
>
>                             Best regards,
>
>                             Pavol Mederly
>                             Software developer
>                             evolveum.com <http://evolveum.com>
>
>                             On 23.08.2016 19:10, Mencel, Matt wrote:
>
>                                 So in my CSV I have a birthday field
>                                 stored as a string value like so...
>                                 '20160822'. I've created a DOB field
>                                 in my custom schema of type date...
>
>                                 <xsd:element name="birthDate"
>                                 type="xsd:date" minOccurs="0"
>                                 maxOccurs="1">
>                                 <xsd:annotation>
>                                 <xsd:appinfo>
>                                 <a:indexed>false</a:indexed>
>                                 <a:displayName>DOB</a:displayName>
>                                 <a:displayOrder>130</a:displayOrder>
>                                 </xsd:appinfo>
>                                 </xsd:annotation>
>                                 </xsd:element>
>
>                                 and am trying to parse the string to
>                                 the date field using the following in
>                                 my mapping...which doesn't work at the
>                                 moment.
>
>                                 <attribute>
>                                 <ref>ri:birthdate</ref>
>                                 <displayName>DOB</displayName>
>                                 <inbound>
>                                 <target>
>                                 <path>$user/extension/birthDate</path>
>                                 </target>
>                                 <expression>
>                                  <script>
>                                  <language>http://midpoint.evolveum.com/xml/ns/public/expression/language#Groovy
>                                 <http://midpoint.evolveum.com/xml/ns/public/expression/language#Groovy></language>
>                                  <code>
>                                  Date.parse('yyyymmdd', birthdate)
>                                  </code>
>                                  </script>
>                                  </expression>
>                                 </inbound>
>                                 </attribute>
>
>                                 Do I need to do the script in the user
>                                 object template instead?
>
>                                 Thanks,
>                                 Matt
>
>
>                                 _______________________________________________
>                                 midPoint mailing list
>                                 midPoint at lists.evolveum.com
>                                 <mailto:midPoint at lists.evolveum.com>
>                                 http://lists.evolveum.com/mailman/listinfo/midpoint
>                                 <http://lists.evolveum.com/mailman/listinfo/midpoint>
>
>                             _______________________________________________
>                             midPoint mailing list
>                             midPoint at lists.evolveum.com
>                             <mailto:midPoint at lists.evolveum.com>
>                             http://lists.evolveum.com/mailman/listinfo/midpoint
>                             <http://lists.evolveum.com/mailman/listinfo/midpoint>
>
>
>                         _______________________________________________
>                         midPoint mailing list
>                         midPoint at lists.evolveum.com
>                         <mailto:midPoint at lists.evolveum.com>
>                         http://lists.evolveum.com/mailman/listinfo/midpoint
>                         <http://lists.evolveum.com/mailman/listinfo/midpoint>
>
>                     _______________________________________________
>                     midPoint mailing list midPoint at lists.evolveum.com
>                     <mailto:midPoint at lists.evolveum.com>
>                     http://lists.evolveum.com/mailman/listinfo/midpoint
>                     <http://lists.evolveum.com/mailman/listinfo/midpoint> 
>
>                 _______________________________________________
>                 midPoint mailing list
>                 midPoint at lists.evolveum.com
>                 <mailto:midPoint at lists.evolveum.com>
>                 http://lists.evolveum.com/mailman/listinfo/midpoint
>                 <http://lists.evolveum.com/mailman/listinfo/midpoint>
>
>             _______________________________________________ midPoint
>             mailing list midPoint at lists.evolveum.com
>             <mailto:midPoint at lists.evolveum.com>
>             http://lists.evolveum.com/mailman/listinfo/midpoint
>             <http://lists.evolveum.com/mailman/listinfo/midpoint> 
>
>         _______________________________________________ midPoint
>         mailing list midPoint at lists.evolveum.com
>         <mailto:midPoint at lists.evolveum.com>
>         http://lists.evolveum.com/mailman/listinfo/midpoint
>         <http://lists.evolveum.com/mailman/listinfo/midpoint> 
>
>     -- 
>     Ivan Noris Senior Identity Engineer evolveum.com <http://evolveum.com>
>     _______________________________________________ midPoint mailing
>     list midPoint at lists.evolveum.com
>     <mailto:midPoint at lists.evolveum.com>
>     http://lists.evolveum.com/mailman/listinfo/midpoint
>     <http://lists.evolveum.com/mailman/listinfo/midpoint> 
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20160824/27a23402/attachment.htm>


More information about the midPoint mailing list