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

How to use
ValueType
in
org.hisp.dhis.common

Best Java code snippets using org.hisp.dhis.common.ValueType (Showing top 20 results out of 315)

origin: dhis2/dhis2-core

/**
 * Indicates whether the value type of this attribute is numeric.
 */
public boolean isNumericType()
{
  return valueType.isNumeric();
}
origin: dhis2/dhis2-core

/**
 * Indicates whether the value type of this data element is a file (externally stored resource)
 */
public boolean isFileType()
{
  return getValueType().isFile();
}
origin: dhis2/dhis2-core

private RuleValueType toMappedValueType( ProgramRuleVariable programRuleVariable )
{
  ValueType valueType = VALUE_TYPE_MAPPER.getOrDefault( programRuleVariable.getSourceType(), prv -> ValueType.TEXT ).apply( programRuleVariable );
  if ( valueType.isBoolean() )
  {
    return RuleValueType.BOOLEAN;
  }
  if ( valueType.isText() )
  {
    return RuleValueType.TEXT;
  }
  if ( valueType.isNumeric() )
  {
    return RuleValueType.NUMERIC;
  }
  return RuleValueType.TEXT;
}
origin: dhis2/dhis2-core

/**
 * Returns a string useful for substitution.
 *
 * @param valueType the value type.
 * @return the string.
 */
public static String getSubstitutionValue( ValueType valueType )
{
  if ( valueType.isNumeric() || valueType.isBoolean() )
  {
    return "1";
  }
  else if ( valueType.isDate() )
  {
    return "'2000-01-01'";
  }
  else
  {
    return "'A'";
  }
}
origin: dhis2/dhis2-core

if ( valueType.isDecimal() )
else if ( valueType.isInteger() )
else if ( valueType.isBoolean() )
else if ( valueType.isDate() )
else if ( valueType.isGeo() && databaseInfo.isSpatialSupport() )
origin: dhis2/dhis2-core

if ( valueType.isText() || valueType.isNumeric() || ValueType.USERNAME == valueType )
inputHTML = inputHTML.replace( "$PROGRAMSTAGENAME", programStageName );
inputHTML = inputHTML.replace( "$DATAELEMENTNAME", dataElement.getName() );
inputHTML = inputHTML.replace( "$DATAELEMENTTYPE", dataElement.getValueType().toString() );
inputHTML = inputHTML.replace( "$DISABLED", disabled );
inputHTML = inputHTML.replace( "$COMPULSORY", compulsory );
origin: dhis2/dhis2-core

private String getTrackedEntityAttributeValue( TrackedEntityAttributeValue attributeValue )
{
  ValueType valueType = attributeValue.getAttribute().getValueType();
  if ( valueType.isBoolean() )
  {
    return attributeValue.getValue() != null ? attributeValue.getValue() : "false";
  }
  if ( valueType.isNumeric() )
  {
    return attributeValue.getValue() != null ? attributeValue.getValue() : "0";
  }
  return attributeValue.getValue() != null ? attributeValue.getValue() : "";
}
origin: dhis2/dhis2-core

/**
 * Creates a mapping between data type and data element for the given data
 * elements.
 *
 * @param dataElements list of data elements.
 */
public static ListMap<DataType, DimensionalItemObject> getDataTypeDataElementMap( List<DimensionalItemObject> dataElements )
{
  ListMap<DataType, DimensionalItemObject> map = new ListMap<>();
  for ( DimensionalItemObject element : dataElements )
  {
    DataElement dataElement = (DataElement) element;
    ValueType valueType = dataElement.getValueType();
    // Both text and date types are recognized as DataType.TEXT
    DataType dataType = ( valueType.isText() || valueType.isDate() ) ? DataType.TEXT : DataType.NUMERIC;
    map.putValue( dataType, dataElement );
  }
  return map;
}
origin: dhis2/dhis2-core

public boolean isText()
{
  return valueType.isText();
}
origin: dhis2/dhis2-core

/**
 * Indicates whether the value type of this attribute is date.
 */
public boolean isDateType()
{
  return valueType.isDate();
}
origin: dhis2/dhis2-core

if ( DimensionItemType.DATA_ELEMENT == item.getDimensionItemType() && ((DataElement) item).getValueType().isInteger() )
else if ( DimensionItemType.DATA_ELEMENT_OPERAND == item.getDimensionItemType() && ((DataElementOperand) item).getDataElement().getValueType().isInteger() )
origin: dhis2/dhis2-core

public String getTrackedEntityInstanceRecipient( TrackedEntityInstance tei, ValueType type )
{
  Set<TrackedEntityAttributeValue> attributeValues = tei.getTrackedEntityAttributeValues();
  for ( TrackedEntityAttributeValue value : attributeValues )
  {
    if ( value != null && value.getAttribute().getValueType().equals( type ) &&
      value.getPlainValue() != null && !value.getPlainValue().trim().isEmpty() )
    {
      return value.getPlainValue();
    }
  }
  throw new IllegalQueryException( "Tracked entity does not have any attribute of value type: " + type.toString() );
}
origin: dhis2/dhis2-core

public static boolean validateValueType( TextPattern textPattern, ValueType valueType )
{
  if ( ValueType.TEXT.equals( valueType ) )
  {
    return true;
  }
  else if ( ValueType.NUMBER.equals( valueType ) )
  {
    boolean isAllNumbers = true;
    for ( TextPatternSegment segment : textPattern.getSegments() )
    {
      isAllNumbers = isAllNumbers && isNumericOnly( segment );
    }
    return isAllNumbers;
  }
  else
  {
    return false;
  }
}
origin: dhis2/dhis2-core

else if ( valueType.isText() || valueType.isNumeric() || ValueType.USERNAME == valueType )
inputHTML = inputHTML.replace( "$PROGRAMSTAGENAME", programStageName );
inputHTML = inputHTML.replace( "$DATAELEMENTNAME", dataElement.getFormNameFallback() );
inputHTML = inputHTML.replace( "$DATAELEMENTTYPE", dataElement.getValueType().toString() );
inputHTML = inputHTML.replace( "$DISABLED", disabled );
inputHTML = inputHTML.replace( "$COMPULSORY", compulsory );
origin: dhis2/dhis2-core

  private String getTrackedEntityDataValue( TrackedEntityDataValue dataValue )
  {
    ValueType valueType = dataValue.getDataElement().getValueType();

    if ( valueType.isBoolean() )
    {
      return dataValue.getValue() != null ? dataValue.getValue() : "false";
    }

    if ( valueType.isNumeric() )
    {
      return dataValue.getValue() != null ? dataValue.getValue() : "0";
    }

    return dataValue.getValue() != null ? dataValue.getValue() : "";
  }
}
origin: dhis2/dhis2-core

if ( valueType.isDecimal() )
else if ( valueType.isInteger() )
else if ( valueType.isBoolean() )
else if ( valueType.isDate() )
else if ( valueType.isGeo() && databaseInfo.isSpatialSupport() )
origin: dhis2/dhis2-core

/**
 * Indicates whether the given time field is valid, i.e. whether
 * it is either a fixed time field or matches the identifier of an
 * attribute or data element of date value type part of the query program.
 */
public boolean timeFieldIsValid()
{
  if ( timeField == null )
  {
    return true;
  }
  if ( TimeField.fieldIsValid( timeField ) )
  {
    return true;
  }
  if ( program.getTrackedEntityAttributes().stream()
    .anyMatch( at -> at.getValueType().isDate() && timeField.equals( at.getUid() ) ) )
  {
    return true;
  }
  if ( program.getDataElements().stream()
    .anyMatch( de -> de.getValueType().isDate() && timeField.equals( de.getUid() ) ) )
  {
    return true;
  }
  return false;
}
origin: dhis2/dhis2-core

else if ( dv.getDataElement().getValueType().isInteger() )
origin: dhis2/dhis2-core

@Override
public boolean equals( Object o )
{
  if ( this == o )
    return true;
  if ( o == null || getClass() != o.getClass() )
    return false;
  Attribute attribute1 = (Attribute) o;
  if ( attribute != null ? !attribute.equals( attribute1.attribute ) : attribute1.attribute != null )
  {
    return false;
  }
  if ( displayName != null ? !displayName.equals( attribute1.displayName ) : attribute1.displayName != null )
  {
    return false;
  }
  if ( valueType != null ? !valueType.equals( attribute1.valueType ) : attribute1.valueType != null )
  {
    return false;
  }
  if ( code != null ? !code.equals( attribute1.code ) : attribute1.code != null )
  {
    return false;
  }
  if ( value != null ? !value.equals( attribute1.value ) : attribute1.value != null )
  {
    return false;
  }
  return true;
}
origin: dhis2/dhis2-core

public boolean isNumeric()
{
  return valueType.isNumeric();
}
org.hisp.dhis.commonValueType

Most used methods

  • isNumeric
    Includes integer and decimal types.
  • isFile
  • isText
  • isBoolean
  • isDate
  • isInteger
  • equals
  • toString
  • getJavaClass
  • hashCode
  • isAggregateable
  • isDecimal
  • isAggregateable,
  • isDecimal,
  • isGeo,
  • isOrganisationUnit,
  • name,
  • valueOf

Popular in Java

  • Finding current android device location
  • setContentView (Activity)
  • compareTo (BigDecimal)
  • addToBackStack (FragmentTransaction)
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Top plugins for WebStorm
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