Tabnine Logo
ScriptExpressionEvaluatorType
Code IndexAdd Tabnine to your IDE (free)

How to use
ScriptExpressionEvaluatorType
in
com.evolveum.midpoint.xml.ns._public.common.common_3

Best Java code snippets using com.evolveum.midpoint.xml.ns._public.common.common_3.ScriptExpressionEvaluatorType (Showing top 20 results out of 315)

origin: Evolveum/midpoint

/**
 * Create an instance of {@link ScriptExpressionEvaluatorType }
 * 
 */
public ScriptExpressionEvaluatorType createScriptExpressionEvaluatorType() {
  return new ScriptExpressionEvaluatorType();
}
origin: Evolveum/midpoint

/**
 * Creates a new {@code ScriptExpressionEvaluatorType} instance by deeply copying a given {@code ScriptExpressionEvaluatorType} instance.
 * 
 * 
 * @param o
 *     The instance to copy.
 * @throws NullPointerException
 *     if {@code o} is {@code null}.
 */
public ScriptExpressionEvaluatorType(final ScriptExpressionEvaluatorType o) {
  // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
  super(o);
  if (o == null) {
    throw new NullPointerException("Cannot create a copy of 'ScriptExpressionEvaluatorType' from 'null'.");
  }
  // CBuiltinLeafInfo: java.lang.String
  this.language = ((o.language == null)?null:o.getLanguage());
  // CEnumLeafInfo: com.evolveum.midpoint.xml.ns._public.common.common_3.ScriptExpressionReturnTypeType
  this.returnType = ((o.returnType == null)?null:o.getReturnType());
  // CBuiltinLeafInfo: java.lang.String
  this.code = ((o.code == null)?null:o.getCode());
}
origin: Evolveum/midpoint

public ScriptExpressionEvaluatorType code(String value) {
  setCode(value);
  return this;
}
origin: Evolveum/midpoint

private MappingType createCondition(String conditionName, char conditionType) {
  ScriptExpressionEvaluatorType script = new ScriptExpressionEvaluatorType();
  switch (conditionType) {
    case '+': script.setCode("basic.stringify(name) == 'jack1'"); break;
    case '-': script.setCode("basic.stringify(name) == 'jack'"); break;
    case '0': script.setCode("basic.stringify(name) == 'never there'"); break;
    case '!': script.setCode(createDumpConditionCode(conditionName)); break;
    default: throw new AssertionError(conditionType);
  }
  ExpressionType expression = new ExpressionType();
  expression.getExpressionEvaluator().add(new ObjectFactory().createScript(script));
  VariableBindingDefinitionType source = new VariableBindingDefinitionType();
  source.setPath(new ItemPathType(UserType.F_NAME));
  MappingType rv = new MappingType();
  rv.setName(conditionName);
  rv.setExpression(expression);
  rv.getSource().add(source);
  return rv;
}
origin: Evolveum/midpoint

private String getLanguage(ScriptExpressionEvaluatorType expressionType) {
  if (expressionType.getLanguage() != null) {
    return expressionType.getLanguage();
  }
  return DEFAULT_LANGUAGE;
}
origin: Evolveum/midpoint

String codeString = expressionType.getCode();
if (codeString == null) {
  throw new ExpressionEvaluationException("No script code in " + contextDescription);
if (expressionType.isAllowEmptyValues() != null) {
  allowEmptyValues = expressionType.isAllowEmptyValues();
origin: Evolveum/midpoint

private String formatCode() {
  return DebugUtil.excerpt(scriptType.getCode().replaceAll("[\\s\\r\\n]+", " "), MAX_CODE_CHARS);
}
origin: Evolveum/midpoint

@Test
public void test130DeputyAssignmentFalseCondition() throws Exception {
  final String TEST_NAME = "test130DeputyAssignmentFalseCondition";
  executeDeputyLimitationsTest(TEST_NAME, null,
      (a) -> a.beginCondition()
            .beginExpression()
              .expressionEvaluator(
                  new JAXBElement<ScriptExpressionEvaluatorType>(new QName("script"),
                      ScriptExpressionEvaluatorType.class,
                      new ScriptExpressionEvaluatorType().code("false"))
              ));
}
origin: Evolveum/midpoint

@Override
protected List<V> transformSingleValue(ExpressionVariables variables, PlusMinusZero valueDestination, boolean useNew,
    ExpressionEvaluationContext context, String contextDescription, Task task, OperationResult result)
        throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, SecurityViolationException {
  ScriptExpressionReturnTypeType returnType = getExpressionEvaluatorType().getReturnType();
  if (returnType == null && isRelative()) {
    returnType = ScriptExpressionReturnTypeType.SCALAR;
  }
  scriptExpression.setAdditionalConvertor(context.getAdditionalConvertor());
  return (List<V>) scriptExpression.evaluate(variables, returnType, useNew, contextDescription, task, result);
}
origin: Evolveum/midpoint

/**
 * Creates and returns a deep copy of a given {@code javax.xml.bind.JAXBElement<com.evolveum.midpoint.xml.ns._public.common.common_3.ScriptExpressionEvaluatorType>} instance.
 * 
 * @param e
 *     The instance to copy or {@code null}.
 * @return
 *     A deep copy of {@code e} or {@code null} if {@code e} is {@code null}.
 */
@SuppressWarnings("unchecked")
private static JAXBElement<ScriptExpressionEvaluatorType> copyOfScriptExpressionEvaluatorTypeElement(final JAXBElement<ScriptExpressionEvaluatorType> e) {
  // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
  if (e!= null) {
    final JAXBElement<ScriptExpressionEvaluatorType> copy = new JAXBElement<ScriptExpressionEvaluatorType>(e.getName(), e.getDeclaredType(), e.getScope(), e.getValue());
    copy.setNil(e.isNil());
    // CClassInfo: com.evolveum.midpoint.xml.ns._public.common.common_3.ScriptExpressionEvaluatorType
    copy.setValue(((((ScriptExpressionEvaluatorType) copy.getValue()) == null)?null:((ScriptExpressionEvaluatorType) copy.getValue()).clone()));
    return copy;
  }
  return null;
}
origin: Evolveum/midpoint

private void createCustomConstruction(RoleType role, String name, int order) {
  ConstructionType c = new ConstructionType(prismContext);
  c.setDescription(name);
  c.setResourceRef(ObjectTypeUtil.createObjectRef(RESOURCE_DUMMY_EMPTY_OID, ObjectTypes.RESOURCE));
  ResourceAttributeDefinitionType nameDef = new ResourceAttributeDefinitionType();
  nameDef.setRef(new ItemPathType(ItemPath.create(new QName(SchemaConstants.NS_ICF_SCHEMA, "name"))));
  MappingType outbound = new MappingType();
  outbound.setName(name);
  ExpressionType expression = new ExpressionType();
  ScriptExpressionEvaluatorType script = new ScriptExpressionEvaluatorType();
  script.setCode(
       "import com.evolveum.midpoint.model.impl.lens.TestAssignmentProcessor2\n\n"
      + "TestAssignmentProcessor2.startCallback('" + name + "')\n"
      + "this.binding.variables.each {k,v -> TestAssignmentProcessor2.variableCallback(k, v, '" + name + "')}\n"
      + "TestAssignmentProcessor2.finishCallback('" + name + "')\n"
      + "return null");
  expression.getExpressionEvaluator().add(new ObjectFactory().createScript(script));
  outbound.setExpression(expression);
  nameDef.setOutbound(outbound);
  c.getAttribute().add(nameDef);
  AssignmentType a = new AssignmentType(prismContext);
  a.setDescription("Assignment for " + c.getDescription());
  a.setConstruction(c);
  addAssignmentOrInducement(role, order, a);
}
origin: Evolveum/midpoint

} else if (eval instanceof ScriptExpressionEvaluatorType) {
  ScriptExpressionEvaluatorType script = (ScriptExpressionEvaluatorType) eval;
  if (script.getLanguage() == null) {
    return "groovy";
  } else {
    return StringUtils.substringAfter(script.getLanguage(), "#");
origin: Evolveum/midpoint

String codeString = expressionType.getCode();
if (codeString == null) {
  throw new ExpressionEvaluationException("No script code in " + contextDescription);
if (expressionType.isAllowEmptyValues() != null) {
  allowEmptyValues = expressionType.isAllowEmptyValues();
origin: Evolveum/midpoint

private String getTooltipString() {
  ExpressionType expression = getMapping().getExpression();
  if (expression == null || expression.getExpressionEvaluator().isEmpty()) {
    return "asIs";
  }
  JAXBElement<?> evalElement = expression.getExpressionEvaluator().get(0);
  Object eval = evalElement.getValue();
  if (QNameUtil.match(evalElement.getName(), SchemaConstants.C_VALUE)) {
    return getStringConstant(eval);
  } else if (eval instanceof AsIsExpressionEvaluatorType) {
    return "asIs";
  } else if (eval instanceof ScriptExpressionEvaluatorType) {
    return ((ScriptExpressionEvaluatorType) eval).getCode();
  } else if (eval instanceof ItemPathType) {
    return String.valueOf(((ItemPathType) eval).getItemPath());
  } else {
    return "";
  }
}
origin: Evolveum/midpoint

clone.script = ((this.script == null)?null:((this.getScript() == null)?null:this.getScript().clone()));
return clone;
origin: Evolveum/midpoint

/**
 * Creates and returns a deep copy of this object.
 * 
 * 
 * @return
 *     A deep copy of this object.
 */
@Override
public ScriptExpressionEvaluatorType clone() {
  {
    // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
    final ScriptExpressionEvaluatorType clone = ((ScriptExpressionEvaluatorType) super.clone());
    // CBuiltinLeafInfo: java.lang.String
    clone.language = ((this.language == null)?null:this.getLanguage());
    // CEnumLeafInfo: com.evolveum.midpoint.xml.ns._public.common.common_3.ScriptExpressionReturnTypeType
    clone.returnType = ((this.returnType == null)?null:this.getReturnType());
    // CBuiltinLeafInfo: java.lang.String
    clone.code = ((this.code == null)?null:this.getCode());
    return clone;
  }
}
origin: Evolveum/midpoint

/**
 * Create an instance of {@link ScriptExpressionEvaluatorType }
 * 
 */
public ScriptExpressionEvaluatorType createScriptExpressionEvaluatorType() {
  return new ScriptExpressionEvaluatorType();
}
origin: Evolveum/midpoint

private ScriptExpression createScriptExpression(ScriptExpressionEvaluatorType expressionType, ItemDefinition outputDefinition, String shortDesc) throws ExpressionSyntaxException {
  ScriptExpression expression = new ScriptExpression(scriptExpressionfactory.getEvaluators().get(expressionType.getLanguage()), expressionType);
  expression.setOutputDefinition(outputDefinition);
  expression.setObjectResolver(scriptExpressionfactory.getObjectResolver());
  expression.setFunctions(new ArrayList<>(scriptExpressionfactory.getFunctions()));
  return expression;
}

origin: Evolveum/midpoint

@Test
public void testParseExpressionFromJaxb() throws SchemaException, SAXException, IOException, JAXBException {
  PrismContext prismContext = PrismTestUtil.getPrismContext();
  RoleType roleType = PrismTestUtil.parseObjectable(new File(TestConstants.COMMON_DIR, "role.xml"), RoleType.class);
  // WHEN
  PrismObject<RoleType> role = roleType.asPrismObject();
  role.revive(prismContext);
  // THEN
  System.out.println("Parsed role:");
  System.out.println(role.debugDump());
  role.checkConsistence();
  assertPropertyValue(role, RoleType.F_NAME, PrismTestUtil.createPolyString("r3"));
  PrismAsserts.assertEquals("Wrong number of approver expressions", 1, role.asObjectable().getApproverExpression().size());
  Object o = role.asObjectable().getApproverExpression().get(0).getExpressionEvaluator().get(0).getValue();
  PrismAsserts.assertEquals("Invalid evaluator type", ScriptExpressionEvaluatorType.class, o.getClass());
  String code = ((ScriptExpressionEvaluatorType) o).getCode();
  PrismAsserts.assertEquals("Incorrect code parsed", "midpoint.oid2ort(user.getOid())", code);
}
origin: Evolveum/midpoint

/**
 * Creates a new {@code HookType} instance by deeply copying a given {@code HookType} instance.
 * 
 * 
 * @param o
 *     The instance to copy.
 * @throws NullPointerException
 *     if {@code o} is {@code null}.
 */
public HookType(final HookType o) {
  // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
  super();
  if (o == null) {
    throw new NullPointerException("Cannot create a copy of 'HookType' from 'null'.");
  }
  // CBuiltinLeafInfo: java.lang.String
  this.name = ((o.name == null)?null:o.getName());
  // CBuiltinLeafInfo: java.lang.String
  this.description = ((o.description == null)?null:o.getDescription());
  // CBuiltinLeafInfo: java.lang.Boolean
  this.enabled = ((o.enabled == null)?null:o.isEnabled());
  // CEnumLeafInfo: com.evolveum.midpoint.xml.ns._public.common.common_3.ModelStateType
  this.state = ((o.state == null)?null:o.getState());
  // CBuiltinLeafInfo: javax.xml.namespace.QName
  this.focusType = ((o.focusType == null)?null:o.getFocusType());
  // CBuiltinLeafInfo: java.lang.String
  this.ref = ((o.ref == null)?null:o.getRef());
  // CClassInfo: com.evolveum.midpoint.xml.ns._public.common.common_3.ScriptExpressionEvaluatorType
  this.script = ((o.script == null)?null:((o.getScript() == null)?null:o.getScript().clone()));
}
com.evolveum.midpoint.xml.ns._public.common.common_3ScriptExpressionEvaluatorType

Most used methods

    Popular in Java

    • Running tasks concurrently on multiple threads
    • orElseThrow (Optional)
      Return the contained value, if present, otherwise throw an exception to be created by the provided s
    • scheduleAtFixedRate (Timer)
    • addToBackStack (FragmentTransaction)
    • Table (com.google.common.collect)
      A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
    • Path (java.nio.file)
    • Deque (java.util)
      A linear collection that supports element insertion and removal at both ends. The name deque is shor
    • Semaphore (java.util.concurrent)
      A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
    • Manifest (java.util.jar)
      The Manifest class is used to obtain attribute information for a JarFile and its entries.
    • Base64 (org.apache.commons.codec.binary)
      Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
    • Best IntelliJ plugins
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Tabnine for your IDE now