private String formatCode() { return DebugUtil.excerpt(scriptType.getCode().replaceAll("[\\s\\r\\n]+", " "), MAX_CODE_CHARS); }
/** * 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()); }
/** * 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; } }
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 ""; } }
String codeString = expressionType.getCode(); if (codeString == null) { throw new ExpressionEvaluationException("No script code in " + contextDescription);
@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); }
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) { int currentHashCode = super.hashCode(locator, strategy); { String theLanguage; theLanguage = this.getLanguage(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "language", theLanguage), currentHashCode, theLanguage); } { ScriptExpressionReturnTypeType theReturnType; theReturnType = this.getReturnType(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "returnType", theReturnType), currentHashCode, theReturnType); } { String theCode; theCode = this.getCode(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "code", theCode), currentHashCode, theCode); } return currentHashCode; }
String codeString = expressionType.getCode(); if (codeString == null) { throw new ExpressionEvaluationException("No script code in " + contextDescription);