[midPoint] ValidFrom and ValidTo

Jan Kaspar Caspi at seznam.cz
Mon Jan 1 20:20:59 CET 2018


Hi All,



need help with importing date times in MidPoint from CSV.




In CSV there is date time in format:  "12/31/2000 11:00:00 AM" 




In resource i have enabled activation capability and I tryed to map value as
showwn in config bellow:






         <attribute id="12">

            <c:ref>ri:StartDate</c:ref>

            <tolerant>true</tolerant>

            <exclusiveStrong>false</exclusiveStrong>

            <inbound id="17">

               <authoritative>true</authoritative>

               <exclusive>false</exclusive>

               <strength>normal</strength>

               <expression>

                  <script xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance"

                          xsi:type="c:ScriptExpressionEvaluatorType">

                     <code>

       import java.text.SimpleDateFormat;

       import java.text.DateFormat;




       DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss a");




       if (input!=null) {

           Date convertedValidFrom = df.parse(input);

     log.info ("convertedValidFrom = " +

     convertedValidFrom);




           return

     com.evolveum.midpoint.util.MiscUtil.asXMLGregorianCalendar
(convertedValidFrom);

       }

       else {

           return null;

       }




                                 </code>

                  </script>

               </expression>

               <target>

                  <c:path>$focus/activation/validFrom</c:path>

               </target>

            </inbound>

         </attribute>





But it doesnt work to me. I am getting error messages like here:








 1001: java.text.ParseException: Unparseable date: "12/31/2000 11:00:00 AM" 
 in expression in mapping in inbound expression for {http://midpoint.
 evolveum.com/xml/ns/public/resource/instance-3}StartDate in resource:900dd
 939-02da-48f2-a7b9-683de6b8d486(HR Feed)({.../common/common-3}input=12/31/
 2000 11:00:00 AM; ) in expression in mapping in inbound expression for 
 {http://midpoint.evolveum.com/xml/ns/public/resource/instance-3}StartDate 
 in resource:900dd939-02da-48f2-a7b9-683de6b8d486(HR Feed)
 
 	

Operation
Save (GUI)
Message
java.text.ParseException: Unparseable date: "12/31/2000 11:00:00 AM" in 
expression in mapping in inbound expression for {http://midpoint.evolveum.
com/xml/ns/public/resource/instance-3}StartDate in resource:900dd939-02da-48
f2-a7b9-683de6b8d486(HR Feed)({.../common/common-3}input=12/31/2000 11:00:00
AM; ) in expression in mapping in inbound expression for {http://midpoint.
evolveum.com/xml/ns/public/resource/instance-3}StartDate in resource:900dd
939-02da-48f2-a7b9-683de6b8d486(HR Feed)






Error
java.text.ParseException: Unparseable date: "12/31/2000 11:00:00 AM" in 
expression in mapping in inbound expression for {http://midpoint.evolveum.
com/xml/ns/public/resource/instance-3}StartDate in resource:900dd939-02da-48
f2-a7b9-683de6b8d486(HR Feed)({.../common/common-3}input=12/31/2000 11:00:00
AM; ) in expression in mapping in inbound expression for {http://midpoint.
evolveum.com/xml/ns/public/resource/instance-3}StartDate in resource:900dd
939-02da-48f2-a7b9-683de6b8d486(HR Feed)
show
com.evolveum.midpoint.util.exception.ExpressionEvaluationException: java.
text.ParseException: Unparseable date: "12/31/2000 11:00:00 AM" in 
expression in mapping in inbound expression for {http://midpoint.evolveum.
com/xml/ns/public/resource/instance-3}StartDate in resource:900dd939-02da-48
f2-a7b9-683de6b8d486(HR Feed)({.../common/common-3}input=12/31/2000 11:00:00
AM; ) in expression in mapping in inbound expression for {http://midpoint.
evolveum.com/xml/ns/public/resource/instance-3}StartDate in resource:900dd
939-02da-48f2-a7b9-683de6b8d486(HR Feed) at com.evolveum.midpoint.model.
common.expression.evaluator.AbstractValueTransformationExpressionEvaluator.
lambda$evaluateRelativeExpression$0
(AbstractValueTransformationExpressionEvaluator.java:433) at com.evolveum.
midpoint.util.MiscUtil.carthesian(MiscUtil.java:370) at com.evolveum.
midpoint.util.MiscUtil.carthesian(MiscUtil.java:360) at com.evolveum.
midpoint.model.common.expression.evaluator.
AbstractValueTransformationExpressionEvaluator.evaluateRelativeExpression
(AbstractValueTransformationExpressionEvaluator.java:457) at com.evolveum.
midpoint.model.common.expression.evaluator.
AbstractValueTransformationExpressionEvaluator.evaluate
(AbstractValueTransformationExpressionEvaluator.java:118) at com.evolveum.
midpoint.repo.common.expression.Expression.evaluateExpressionEvaluators
(Expression.java:213) at com.evolveum.midpoint.repo.common.expression.
Expression.evaluate(Expression.java:149) at com.evolveum.midpoint.model.
common.mapping.Mapping.evaluateExpression(Mapping.java:1055) at com.
evolveum.midpoint.model.common.mapping.Mapping.evaluateBody(Mapping.java:
446) at com.evolveum.midpoint.model.common.mapping.Mapping.evaluate(Mapping.
java:372) at com.evolveum.midpoint.model.impl.lens.projector.
MappingEvaluator.evaluateMapping(MappingEvaluator.java:140) at com.evolveum.
midpoint.model.impl.lens.projector.focus.InboundProcessor.
evaluateInboundMapping(InboundProcessor.java:836) at com.evolveum.midpoint.
model.impl.lens.projector.focus.InboundProcessor.
processInboundMappingsForProjection(InboundProcessor.java:293) at com.
evolveum.midpoint.model.impl.lens.projector.focus.InboundProcessor.
processInboundFocal(InboundProcessor.java:223) at com.evolveum.midpoint.
model.impl.lens.projector.focus.InboundProcessor.processInbound
(InboundProcessor.java:165) at com.evolveum.midpoint.model.impl.lens.
projector.focus.FocusProcessor.lambda$processFocusFocus$0(FocusProcessor.
java:210) at com.evolveum.midpoint.model.impl.lens.LensUtil.partialExecute
(LensUtil.java:947) at com.evolveum.midpoint.model.impl.lens.LensUtil.
partialExecute(LensUtil.java:934) at com.evolveum.midpoint.model.impl.lens.
projector.focus.FocusProcessor.processFocusFocus(FocusProcessor.java:207) at
com.evolveum.midpoint.model.impl.lens.projector.focus.FocusProcessor.
processFocus(FocusProcessor.java:140) at com.evolveum.midpoint.model.impl.
lens.projector.Projector.lambda$projectInternal$1(Projector.java:229) at 
com.evolveum.midpoint.model.impl.lens.LensUtil.partialExecute(LensUtil.java:
947) at com.evolveum.midpoint.model.impl.lens.projector.Projector.
projectInternal(Projector.java:227) at com.evolveum.midpoint.model.impl.
lens.projector.Projector.project(Projector.java:116) at com.evolveum.
midpoint.model.impl.lens.Clockwork.click(Clockwork.java:445) at com.
evolveum.midpoint.model.impl.lens.Clockwork.run(Clockwork.java:202) at com.
evolveum.midpoint.model.impl.controller.ModelController.executeChanges
(ModelController.java:538) at com.evolveum.midpoint.web.component.progress.
ProgressPanel$14.callWithContextPrepared(ProgressPanel.java:605) at com.
evolveum.midpoint.web.component.progress.ProgressPanel$14.
callWithContextPrepared(ProgressPanel.java:591) at com.evolveum.midpoint.
web.component.SecurityContextAwareCallable.call
(SecurityContextAwareCallable.java:59) at java.util.concurrent.FutureTask.
run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker
(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run
(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: com.
evolveum.midpoint.util.exception.ExpressionEvaluationException: java.text.
ParseException: Unparseable date: "12/31/2000 11:00:00 AM" in expression in 
mapping in inbound expression for {http://midpoint.evolveum.com/xml/ns/
public/resource/instance-3}StartDate in resource:900dd939-02da-48f2-a7b9-683
de6b8d486(HR Feed) at com.evolveum.midpoint.model.common.expression.script.
jsr223.Jsr223ScriptEvaluator.evaluate(Jsr223ScriptEvaluator.java:120) at 
com.evolveum.midpoint.model.common.expression.script.ScriptExpression.
evaluate(ScriptExpression.java:107) at com.evolveum.midpoint.model.common.
expression.script.ScriptExpressionEvaluator.transformSingleValue
(ScriptExpressionEvaluator.java:63) at com.evolveum.midpoint.model.common.
expression.evaluator.AbstractValueTransformationExpressionEvaluator.lambda$
evaluateRelativeExpression$0(AbstractValueTransformationExpressionEvaluator.
java:425) ... 33 more Caused by: javax.script.ScriptException: java.text.
ParseException: Unparseable date: "12/31/2000 11:00:00 AM" at org.codehaus.
groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:347) 
at org.codehaus.groovy.jsr223.GroovyCompiledScript.eval
(GroovyCompiledScript.java:41) at javax.script.CompiledScript.eval(Unknown 
Source) at com.evolveum.midpoint.model.common.expression.script.jsr223.Jsr
223ScriptEvaluator.evaluate(Jsr223ScriptEvaluator.java:116) ... 36 more 
Caused by: java.text.ParseException: Unparseable date: "12/31/2000 11:00:00 
AM" at java.text.DateFormat.parse(Unknown Source) at java_text_DateFormat$
parse.call(Unknown Source) at Script41.run(Script41.groovy:8) at org.
codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.
java:344) ... 39 more





Can someone help me with that?




Thanks Jan



(http://192.168.2.102:8080/admin/task2/03b67e2f-4b00-420e-a13e-fa897e93586d?635-1.ILinkListener-mainPanel-mainForm-tabPanel-panel-showResult)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20180101/6f0d3a2a/attachment.htm>


More information about the midPoint mailing list