[midPoint] mapping users to managers, template error

Jason Everling jeverling at bshp.edu
Mon Jan 21 23:45:57 CET 2019


OK I got it working now, yay!!!

Bad Line:

delta =
midpoint.prismContext.deltaFactory().object().createModificationAddContainer(UserType.class,
user.getOid(), UserType.F_ASSIGNMENT, assignment);

Working Line:

delta = ObjectDelta.createModificationAddContainer(UserType.class,
user.getOid(), UserType.F_ASSIGNMENT, midpoint.getPrismContext(),
assignment)


JASON


On Mon, Jan 21, 2019 at 10:35 AM Jason Everling <jeverling at bshp.edu> wrote:

> I have this mapping that I created from some past emails in the group, I
> am using something similar in the user template to assign orgs which are
> ldap based groups(courses) to users based on user attribute, works, this
> one however is like it but in reverse. Assign manager to org(courses) based
> on org attribute. The error is pasted below, can anyone spot the issue? I
> have tried to figure it but I am lost :(
>
>    <mapping>
>       <name>Add Instructors as Managers</name>
>       <strength>strong</strength>
>       <source>
>          <name>instructors</name>
>          <c:path xmlns:bshp="http://www.bshp.edu/xml/ns/public/bshp
> ">$focus/extension/bshp:instructorEmailAddress</c:path>
>       </source>
>       <expression>
>          <script>
>             <relativityMode>absolute</relativityMode>
>             <code>
>                 import
> com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType;
>                 import
> com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType;
>                 import
> com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType;
>                 import
> com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;
>                 import com.evolveum.midpoint.prism.delta.*;
>                 import
> com.evolveum.midpoint.schema.constants.SchemaConstants;
>                 import
> com.evolveum.midpoint.prism.util.PrismContextFactory;
>                 import com.evolveum.midpoint.prism.delta.ObjectDelta;
>                 import com.evolveum.midpoint.schema.util.ObjectTypeUtil
>                 import java.util.*;
>
> if (instructors != null) {
> for (instructor in instructors) {
> instrUID = instructor.split("\\@")[0];  <!-- split uid from email -->
>                                                 user =
> midpoint.searchObjectByName(UserType.class, instrUID);
>                                                 if (user != null) {
>                                                       orgUnit = new
> ObjectReferenceType();
>
> orgUnit.setOid(focus.getOid());
>
> orgUnit.setType(OrgType.COMPLEX_TYPE);
>
> orgUnit.setRelation(SchemaConstants.ORG_MANAGER);
>                                                       AssignmentType
> assignment = new AssignmentType();
>
> assignment.asPrismContainerValue()
>
> assignment.setTargetRef(orgUnit);
>                                                       delta =
> midpoint.prismContext.deltaFactory().object().createModificationAddContainer(UserType.class,
> user.getOid(), UserType.F_ASSIGNMENT, assignment);
>
> midpoint.executeChanges(delta)
>                         }
>                     }
>                 }
>             </code>
>          </script>
>       </expression>
>    </mapping>
>
> Error
>
>
> groovy.lang.MissingMethodException: No signature of method:
> com.evolveum.midpoint.prism.PrismContextImpl.deltaFactory() is applicable
> for argument types: () values: [] in (old) expression in mapping 'Add
> Instructors as Managers' in template mapping 'Add Instructors as Managers'
> in objectTemplate:30000000-0000-0000-0000-000000000101(Default Org Template)
> show
> com.evolveum.midpoint.util.exception.ExpressionEvaluationException:
> groovy.lang.MissingMethodException: No signature of method:
> com.evolveum.midpoint.prism.PrismContextImpl.deltaFactory() is applicable
> for argument types: () values: [] in (old) expression in mapping 'Add
> Instructors as Managers' in template mapping 'Add Instructors as Managers'
> in objectTemplate:30000000-0000-0000-0000-000000000101(Default Org Template)
> 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.evaluateScriptExpression(AbstractValueTransformationExpressionEvaluator.java:279)
> at
> com.evolveum.midpoint.model.common.expression.evaluator.AbstractValueTransformationExpressionEvaluator.evaluateAbsoluteExpression(AbstractValueTransformationExpressionEvaluator.java:198)
> at
> com.evolveum.midpoint.model.common.expression.evaluator.AbstractValueTransformationExpressionEvaluator.evaluate(AbstractValueTransformationExpressionEvaluator.java:106)
> 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.MappingEvaluator.evaluateMapping(MappingEvaluator.java:116)
> at
> com.evolveum.midpoint.model.impl.lens.projector.focus.ObjectTemplateProcessor.collectTripleFromMappings(ObjectTemplateProcessor.java:639)
> at
> com.evolveum.midpoint.model.impl.lens.projector.focus.ObjectTemplateProcessor.processTemplate(ObjectTemplateProcessor.java:176)
> at
> com.evolveum.midpoint.model.impl.lens.projector.focus.FocusProcessor.lambda$processFocusFocus$2(FocusProcessor.java:213)
> at
> com.evolveum.midpoint.model.impl.lens.LensUtil.partialExecute(LensUtil.java:950)
> at
> com.evolveum.midpoint.model.impl.lens.LensUtil.partialExecute(LensUtil.java:937)
> at
> com.evolveum.midpoint.model.impl.lens.projector.focus.FocusProcessor.processFocusFocus(FocusProcessor.java:212)
> at
> com.evolveum.midpoint.model.impl.lens.projector.focus.FocusProcessor.processFocus(FocusProcessor.java:124)
> 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:950)
> 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:447)
> at com.evolveum.midpoint.model.impl.lens.Clockwork.run(Clockwork.java:204)
> at
> com.evolveum.midpoint.model.impl.controller.ModelController.executeChanges(ModelController.java:541)
> at
> com.evolveum.midpoint.model.impl.controller.ModelController.executeChanges(ModelController.java:332)
> at sun.reflect.GeneratedMethodAccessor1606.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at
> org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:508)
> at com.sun.proxy.$Proxy270.executeChanges(Unknown Source)
> at
> com.evolveum.midpoint.web.page.admin.users.component.TreeTablePanel.recomputePerformed(TreeTablePanel.java:507)
> at
> com.evolveum.midpoint.web.page.admin.users.component.TreeTablePanel.recomputeRootPerformed(TreeTablePanel.java:492)
> at
> com.evolveum.midpoint.web.page.admin.users.component.TreeTablePanel.access$700(TreeTablePanel.java:73)
> at
> com.evolveum.midpoint.web.page.admin.users.component.TreeTablePanel$6.onClick(TreeTablePanel.java:202)
> at
> com.evolveum.midpoint.web.component.menu.cog.MenuLinkPanel.onClick(MenuLinkPanel.java:126)
> at
> com.evolveum.midpoint.web.component.menu.cog.MenuLinkPanel$2.onClick(MenuLinkPanel.java:77)
> at org.apache.wicket.ajax.markup.html.AjaxLink$1.onEvent(AjaxLink.java:85)
> at
> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:155)
> at
> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:601)
> at sun.reflect.GeneratedMethodAccessor863.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at
> org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
> at
> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
> at
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:248)
> at
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234)
> at
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:895)
> at
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
> at
> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:265)
> at
> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:222)
> at
> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293)
> at
> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:261)
> at
> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:203)
> at
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:284)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
> at
> com.evolveum.midpoint.web.util.MidPointProfilingServletFilter.doFilter(MidPointProfilingServletFilter.java:86)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
> at
> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
> at
> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> at
> org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> at
> org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> at
> org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> at
> org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> at
> org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> at
> org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:155)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> at
> org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> at
> org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> at
> org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:100)
> at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> at
> org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> at
> org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
> at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> at
> org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
> at
> org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
> at
> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:347)
> at
> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:263)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
> at
> org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
> at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
> at
> org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108)
> at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
> at
> org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)
> at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
> at
> org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:115)
> at
> org.springframework.boot.web.support.ErrorPageFilter.access$000(ErrorPageFilter.java:59)
> at
> org.springframework.boot.web.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:90)
> at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
> at
> org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:108)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
> at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
> at
> org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
> at
> org.apache.coyote.ajp.AbstractAjpProcessor.process(AbstractAjpProcessor.java:868)
> at
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
> at
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
> at
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at
> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
> at java.lang.Thread.run(Thread.java:748)
> Caused by: javax.script.ScriptException:
> groovy.lang.MissingMethodException: No signature of method:
> com.evolveum.midpoint.prism.PrismContextImpl.deltaFactory() is applicable
> for argument types: () values: []
> 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(CompiledScript.java:92)
> at
> com.evolveum.midpoint.model.common.expression.script.jsr223.Jsr223ScriptEvaluator.evaluate(Jsr223ScriptEvaluator.java:116)
> ... 130 more
> Caused by: groovy.lang.MissingMethodException: No signature of method:
> com.evolveum.midpoint.prism.PrismContextImpl.deltaFactory() is applicable
> for argument types: () values: []
> at
> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:56)
> at
> org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
> at
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
> at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
> at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
> at Script74.run(Script74.groovy:29)
> at
> org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:344)
> ... 133 more
>
> JASON
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20190121/972d0877/attachment.htm>


More information about the midPoint mailing list