@Test void isNullValueCompoundAttribute() { assertThrows( RuntimeException.class, () -> EntityUtils.isNullValue( getIsNullValueMockEntity(), getIsNullValueMockAttribute("attribute", COMPOUND))); }
public static boolean isNullValue(Entity entity, Attribute attribute) { boolean isNullValue; String attributeName = attribute.getName(); AttributeType attributeType = attribute.getDataType(); switch (attributeType) { case BOOL: isNullValue = entity.getBoolean(attributeName) == null; break; case CATEGORICAL: case FILE: case XREF: isNullValue = entity.getEntity(attributeName) == null; break; case CATEGORICAL_MREF: case MREF: case ONE_TO_MANY: Iterable<Entity> refEntities = entity.getEntities(attributeName); isNullValue = Iterables.isEmpty(refEntities); break; case COMPOUND: throw new RuntimeException(format("Invalid data type [%s]", attribute.getDataType())); case DATE: isNullValue = entity.getLocalDate(attributeName) == null; break; case DATE_TIME: isNullValue = entity.getInstant(attributeName) == null; break; case DECIMAL: isNullValue = entity.getDouble(attributeName) == null; break; case EMAIL: case ENUM: case HTML: case HYPERLINK: case SCRIPT: case STRING: case TEXT: isNullValue = entity.getString(attributeName) == null; break; case INT: isNullValue = entity.getInt(attributeName) == null; break; case LONG: isNullValue = entity.getLong(attributeName) == null; break; default: throw new UnexpectedEnumException(attributeType); } return isNullValue; }
EntityUtils { public static boolean isNullValue(Entity entity, Attribute attribute) { boolean isNullValue; String attributeName = attribute.getName(); AttributeType attributeType = attribute.getDataType(); switch (attributeType) { case BOOL: isNullValue = entity.getBoolean(attributeName) == null; break; case CATEGORICAL: case FILE: case XREF: isNullValue = entity.getEntity(attributeName) == null; break; case CATEGORICAL_MREF: case MREF: case ONE_TO_MANY: Iterable<Entity> refEntities = entity.getEntities(attributeName); isNullValue = Iterables.isEmpty(refEntities); break; case COMPOUND: throw new RuntimeException(format("Invalid data type [%s]", attribute.getDataType())); case DATE: isNullValue = entity.getLocalDate(attributeName) == null; break; case DATE_TIME: isNullValue = entity.getInstant(attributeName) == null; break; case DECIMAL: isNullValue = entity.getDouble(attributeName) == null; break; case EMAIL: case ENUM: case HTML: case HYPERLINK: case SCRIPT: case STRING: case TEXT: isNullValue = entity.getString(attributeName) == null; break; case INT: isNullValue = entity.getInt(attributeName) == null; break; case LONG: isNullValue = entity.getLong(attributeName) == null; break; default: throw new UnexpectedEnumException(attributeType); } return isNullValue; } }
EntityUtils { public static boolean isNullValue(Entity entity, Attribute attribute) { boolean isNullValue; String attributeName = attribute.getName(); AttributeType attributeType = attribute.getDataType(); switch (attributeType) { case BOOL: isNullValue = entity.getBoolean(attributeName) == null; break; case CATEGORICAL: case FILE: case XREF: isNullValue = entity.getEntity(attributeName) == null; break; case CATEGORICAL_MREF: case MREF: case ONE_TO_MANY: Iterable<Entity> refEntities = entity.getEntities(attributeName); isNullValue = Iterables.isEmpty(refEntities); break; case COMPOUND: throw new RuntimeException(format("Invalid data type [%s]", attribute.getDataType())); case DATE: isNullValue = entity.getLocalDate(attributeName) == null; break; case DATE_TIME: isNullValue = entity.getInstant(attributeName) == null; break; case DECIMAL: isNullValue = entity.getDouble(attributeName) == null; break; case EMAIL: case ENUM: case HTML: case HYPERLINK: case SCRIPT: case STRING: case TEXT: isNullValue = entity.getString(attributeName) == null; break; case INT: isNullValue = entity.getInt(attributeName) == null; break; case LONG: isNullValue = entity.getLong(attributeName) == null; break; default: throw new UnexpectedEnumException(attributeType); } return isNullValue; } private  EntityUtils(); }
EntityUtils { public static boolean isNullValue(Entity entity, Attribute attribute) { boolean isNullValue; String attributeName = attribute.getName(); AttributeType attributeType = attribute.getDataType(); switch (attributeType) { case BOOL: isNullValue = entity.getBoolean(attributeName) == null; break; case CATEGORICAL: case FILE: case XREF: isNullValue = entity.getEntity(attributeName) == null; break; case CATEGORICAL_MREF: case MREF: case ONE_TO_MANY: Iterable<Entity> refEntities = entity.getEntities(attributeName); isNullValue = Iterables.isEmpty(refEntities); break; case COMPOUND: throw new RuntimeException(format("Invalid data type [%s]", attribute.getDataType())); case DATE: isNullValue = entity.getLocalDate(attributeName) == null; break; case DATE_TIME: isNullValue = entity.getInstant(attributeName) == null; break; case DECIMAL: isNullValue = entity.getDouble(attributeName) == null; break; case EMAIL: case ENUM: case HTML: case HYPERLINK: case SCRIPT: case STRING: case TEXT: isNullValue = entity.getString(attributeName) == null; break; case INT: isNullValue = entity.getInt(attributeName) == null; break; case LONG: isNullValue = entity.getLong(attributeName) == null; break; default: throw new UnexpectedEnumException(attributeType); } return isNullValue; } private  EntityUtils(); static Object getTypedValue(String valueStr, Attribute attr); static Object getTypedValue(String valueStr, Attribute attr, EntityManager entityManager); static boolean equals(EntityType entityType, EntityType otherEntityType); static boolean equals(Iterable<Attribute> attrsIt, Iterable<Attribute> otherAttrsIt); static boolean equalsEntities(
      Iterable<Entity> entityIterable, Iterable<Entity> otherEntityIterable); static boolean equals(Tag tag, Tag otherTag); static boolean equals(Attribute attr, Attribute otherAttr); static boolean equals(Attribute attr, Attribute otherAttr, boolean checkIdentifier); static boolean equals(Entity entity, Entity otherEntity); static int hashCode(Entity entity); static boolean isNullValue(Entity entity, Attribute attribute); static boolean isSame(Entity thisEntity, Entity thatEntity); }
EntityUtils { public static boolean isNullValue(Entity entity, Attribute attribute) { boolean isNullValue; String attributeName = attribute.getName(); AttributeType attributeType = attribute.getDataType(); switch (attributeType) { case BOOL: isNullValue = entity.getBoolean(attributeName) == null; break; case CATEGORICAL: case FILE: case XREF: isNullValue = entity.getEntity(attributeName) == null; break; case CATEGORICAL_MREF: case MREF: case ONE_TO_MANY: Iterable<Entity> refEntities = entity.getEntities(attributeName); isNullValue = Iterables.isEmpty(refEntities); break; case COMPOUND: throw new RuntimeException(format("Invalid data type [%s]", attribute.getDataType())); case DATE: isNullValue = entity.getLocalDate(attributeName) == null; break; case DATE_TIME: isNullValue = entity.getInstant(attributeName) == null; break; case DECIMAL: isNullValue = entity.getDouble(attributeName) == null; break; case EMAIL: case ENUM: case HTML: case HYPERLINK: case SCRIPT: case STRING: case TEXT: isNullValue = entity.getString(attributeName) == null; break; case INT: isNullValue = entity.getInt(attributeName) == null; break; case LONG: isNullValue = entity.getLong(attributeName) == null; break; default: throw new UnexpectedEnumException(attributeType); } return isNullValue; } private  EntityUtils(); static Object getTypedValue(String valueStr, Attribute attr); static Object getTypedValue(String valueStr, Attribute attr, EntityManager entityManager); static boolean equals(EntityType entityType, EntityType otherEntityType); static boolean equals(Iterable<Attribute> attrsIt, Iterable<Attribute> otherAttrsIt); static boolean equalsEntities(
      Iterable<Entity> entityIterable, Iterable<Entity> otherEntityIterable); static boolean equals(Tag tag, Tag otherTag); static boolean equals(Attribute attr, Attribute otherAttr); static boolean equals(Attribute attr, Attribute otherAttr, boolean checkIdentifier); static boolean equals(Entity entity, Entity otherEntity); static int hashCode(Entity entity); static boolean isNullValue(Entity entity, Attribute attribute); static boolean isSame(Entity thisEntity, Entity thatEntity);  }