org.camunda.bpm.engine.variable.value.IntegerValue Java Examples

The following examples show how to use org.camunda.bpm.engine.variable.value.IntegerValue. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PrimitiveValueTypeImpl.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Override
public IntegerValue convertFromTypedValue(TypedValue typedValue) {
  if (typedValue.getType() != ValueType.NUMBER) {
    throw unsupportedConversion(typedValue.getType());
  }

  IntegerValueImpl integerValue = null;
  NumberValue numberValue = (NumberValue) typedValue;
  if (numberValue.getValue() != null) {
    integerValue = (IntegerValueImpl) Variables.integerValue(numberValue.getValue().intValue());
  } else {
    integerValue = (IntegerValueImpl) Variables.integerValue(null);
  }
  integerValue.setTransient(numberValue.isTransient());
  return integerValue;
}
 
Example #2
Source File: IntegerValueMapper.java    From camunda-external-task-client-java with Apache License 2.0 5 votes vote down vote up
public IntegerValue readValue(TypedValueField typedValueField) {
  Integer intValue = null;

  Object value = typedValueField.getValue();
  if (value != null) {
    Number numValue = (Number) value;
    intValue = numValue.intValue();
  }

  return Variables.integerValue(intValue);
}
 
Example #3
Source File: IntegerValueSerializer.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public void writeValue(IntegerValue variableValue, ValueFields valueFields) {
  Integer value = variableValue.getValue();

  if (value!=null) {
    valueFields.setLongValue(((Integer) value).longValue());
    valueFields.setTextValue(value.toString());
  } else {
    valueFields.setLongValue(null);
    valueFields.setTextValue(null);
  }

}
 
Example #4
Source File: IntegerValueSerializer.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public IntegerValue readValue(ValueFields valueFields, boolean asTransientValue) {
  Integer intValue = null;

  if(valueFields.getLongValue() != null) {
    intValue = Integer.valueOf(valueFields.getLongValue().intValue());
  }

  return Variables.integerValue(intValue, asTransientValue);
}
 
Example #5
Source File: DefaultDmnHistoryEventProducer.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected Double getCollectResultValue(TypedValue collectResultValue) {
  // the built-in collect aggregators return only numbers
  if(collectResultValue instanceof IntegerValue) {
    return ((IntegerValue) collectResultValue).getValue().doubleValue();

  } else if(collectResultValue instanceof LongValue) {
    return ((LongValue) collectResultValue).getValue().doubleValue();

  } else if(collectResultValue instanceof DoubleValue) {
    return ((DoubleValue) collectResultValue).getValue();

  } else {
    throw LOG.collectResultValueOfUnsupportedTypeException(collectResultValue);
  }
}
 
Example #6
Source File: IntegerValueMapper.java    From camunda-external-task-client-java with Apache License 2.0 4 votes vote down vote up
public IntegerValue convertToTypedValue(UntypedValueImpl untypedValue) {
  return Variables.integerValue((Integer) untypedValue.getValue());
}
 
Example #7
Source File: IntegerValueMapper.java    From camunda-external-task-client-java with Apache License 2.0 4 votes vote down vote up
public void writeValue(IntegerValue intValue, TypedValueField typedValueField) {
  typedValueField.setValue(intValue.getValue());
}
 
Example #8
Source File: IntegerValueSerializer.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public IntegerValue convertToTypedValue(UntypedValueImpl untypedValue) {
  return Variables.integerValue((Integer) untypedValue.getValue(), untypedValue.isTransient());
}
 
Example #9
Source File: MultiInstanceActivityBehavior.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
protected Integer getLoopVariable(ActivityExecution execution, String variableName) {
  IntegerValue value = execution.getVariableLocalTyped(variableName);
  ensureNotNull("The variable \"" + variableName + "\" could not be found in execution with id " + execution.getId(), "value", value);
  return value.getValue();
}
 
Example #10
Source File: Variables.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new {@link IntegerValue} that encapsulates the given <code>integer</code>
 */
public static IntegerValue integerValue(Integer integer) {
  return integerValue(integer, false);
}
 
Example #11
Source File: Variables.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new {@link IntegerValue} that encapsulates the given <code>integer</code>
 */
public static IntegerValue integerValue(Integer integer, boolean isTransient) {
  return new IntegerValueImpl(integer, isTransient);
}
 
Example #12
Source File: PrimitiveValueTypeImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public IntegerValue createValue(Object value, Map<String, Object> valueInfo) {
  return Variables.integerValue((Integer) value, isTransient(valueInfo));
}