public ValueListType value(Object value) { getValue().add(value); return this; }
/** * Creates a new {@code ValueListType} instance by deeply copying a given {@code ValueListType} instance. * * * @param o * The instance to copy. * @throws NullPointerException * if {@code o} is {@code null}. */ public ValueListType(final ValueListType 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 'ValueListType' from 'null'."); } // 'Value' collection. if (o.value!= null) { copyValue(o.getValue(), this.getValue()); } }
/** * Creates and returns a deep copy of this object. * * * @return * A deep copy of this object. */ @Override public ValueListType clone() { try { { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 final ValueListType clone = ((ValueListType) super.clone()); // 'Value' collection. if (this.value!= null) { clone.value = null; copyValue(this.getValue(), clone.getValue()); } return clone; } } catch (CloneNotSupportedException e) { // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ throw new AssertionError(e); } }
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) { int currentHashCode = 1; { List<Object> theValue; theValue = (((this.value!= null)&&(!this.value.isEmpty()))?this.getValue():null); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "value", theValue), currentHashCode, theValue); } return currentHashCode; }
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) { if (!(object instanceof ValueListType)) { return false; } if (this == object) { return true; } final ValueListType that = ((ValueListType) object); { List<Object> lhsValue; lhsValue = (((this.value!= null)&&(!this.value.isEmpty()))?this.getValue():null); List<Object> rhsValue; rhsValue = (((that.value!= null)&&(!that.value.isEmpty()))?that.getValue():null); if (!strategy.equals(LocatorUtils.property(thisLocator, "value", lhsValue), LocatorUtils.property(thatLocator, "value", rhsValue), lhsValue, rhsValue)) { return false; } } return true; }
if (executeScriptRequestTemplate.getInput() != null && !executeScriptRequestTemplate.getInput().getValue().isEmpty()) { LOGGER.warn("Ignoring input values in executeScript data in task {}", coordinatorTask);
@Test public void testParseTaskFile() throws Exception { System.out.println("===[ testParseTaskFile ]==="); // GIVEN PrismContext prismContext = PrismTestUtil.getPrismContext(); // WHEN PrismObject<TaskType> task = prismContext.parserFor(TASK_FILE).xml().parse(); // THEN System.out.println("Parsed task:"); System.out.println(task.debugDump()); assertTask(task); Item executeScriptItem = task.findExtensionItem(new QName("executeScript")); ExecuteScriptType executeScript = (ExecuteScriptType) executeScriptItem.getRealValue(); Object o = executeScript.getInput().getValue().get(0); System.out.println(o); assertTrue("Raw value is not parsed", o instanceof RawType && ((RawType) o).getAlreadyParsedValue() != null); }
private void executeScript(ScriptExecutionPolicyActionType action, EvaluatedPolicyRule rule, ModelContext<?> context, Task task, OperationResult parentResult, ExecuteScriptType executeScriptBean) { OperationResult result = parentResult.createSubresult(EXECUTE_SCRIPT_OPERATION); try { Map<String, Object> initialVariables = createInitialVariables(action, rule, context); if (executeScriptBean.getInput() == null && context.getFocusContext() != null) { PrismObject objectAny = ((LensFocusContext) context.getFocusContext()).getObjectAny(); if (objectAny != null) { ValueListType input = new ValueListType(); input.getValue().add(objectAny.getValue().clone()); executeScriptBean.setInput(input); } } scriptingExpressionEvaluator.evaluateExpression(executeScriptBean, initialVariables, false, task, result); } catch (ScriptExecutionException | RuntimeException e) { result.recordFatalError("Couldn't execute script policy action: " + e.getMessage(), e); LoggingUtils.logUnexpectedException(LOGGER, "Couldn't execute script with id={} in scriptExecution policy action '{}' (rule '{}'): {}", e, action.getId(), action.getName(), rule.getName(), e.getMessage()); } finally { result.computeStatusIfUnknown(); } }
static PipelineData parseFrom(ValueListType input, Map<String, Object> frozenInitialVariables, PrismContext prismContext) { PipelineData rv = new PipelineData(); if (input != null) { for (Object o : input.getValue()) { if (o instanceof RawType) { // a bit of hack: this should have been solved by the parser (we'll fix this later) RawType raw = (RawType) o; PrismValue prismValue = raw.getAlreadyParsedValue(); if (prismValue != null) { rv.addValue(prismValue, frozenInitialVariables); } else { throw new IllegalArgumentException("Raw value in the input data: " + DebugUtil.debugDump(raw.getXnode())); // TODO attempt to parse it somehow (e.g. by passing to the pipeline and then parsing based on expected type) } } else { if (o instanceof Containerable) { rv.addValue(((Containerable) o).asPrismContainerValue(), frozenInitialVariables); } else if (o instanceof Referencable) { rv.addValue(((Referencable) o).asReferenceValue(), frozenInitialVariables); } else { rv.addValue(prismContext.itemFactory().createPropertyValue(o), frozenInitialVariables); } } } } return rv; }
Object o = executeScript.getInput().getValue().get(0); System.out.println(o); assertTrue("Raw value is not parsed", o instanceof RawType && ((RawType) o).getAlreadyParsedValue() != null);