[midPoint] Generate string according to valuePolicy in groovy

Lubomir Odlevak odlevak.lubomir at gmail.com
Mon Nov 11 21:47:03 CET 2019


How it is possible to generate random string according to valuePolicy in
groovy with GenerateExpressionEvaluatorType ? I would like to achieve
something like this, but GenerateExpressionEvaluatorType does not have any
generate method ( generateNewValue()  in my ecample):
             <code>
                    import
com.evolveum.midpoint.xml.ns._public.common.common_3.*
                    import com.evolveum.midpoint.schema.constants.*

                    generator = new GenerateExpressionEvaluatorType()
                    ortype= new ObjectReferenceType()

                    ortype.setOid(valuePolicyOID);
                    ortype.setType(ValuePolicyType.COMPLEX_TYPE);
                    ortype.setRelation(SchemaConstants.ORG_DEFAULT);
                    generator.setValuePolicyRef(ortype)

                    while(1){
                        newValue=generator.generateNewValue()
                        if(myCondition == True){
                            return newValue
                        }
                     }
              </code>

I know there is similar xml-way to generate password according to
valuePolicy:
        <expression>
            <generate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="c:GenerateExpressionEvaluatorType">
                <valuePolicyRef oid="12340000-0000-0000-0000-123400332211"/>
            </generate>
        </expression>
,but my valuePolicy contains <checkExpression> part and it seems that
generate function ignore that.

Thanks
Lubomir Odlevak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20191111/62a1a92a/attachment.htm>


More information about the midPoint mailing list