Package org.umlg.sqlg.util
Class SqlgUtil
java.lang.Object
org.umlg.sqlg.util.SqlgUtil
Date: 2014/07/12
Time: 3:13 PM
-
Method Summary
Modifier and TypeMethodDescriptionstatic Object
convertByteArrayToPrimitiveArray
(Byte[] value) static Boolean[]
convertObjectArrayToBooleanArray
(Object[] booleanArray) static boolean[]
convertObjectArrayToBooleanPrimitiveArray
(Object[] booleanArray) static byte[]
convertObjectArrayToBytePrimitiveArray
(Object[] byteArray) static BigDecimal[]
convertObjectOfDoublesArrayToBigDecimalArray
(Object[] doubleArray) static Double[]
convertObjectOfDoublesArrayToDoubleArray
(Object[] doubleArray) static double[]
convertObjectOfDoublesArrayToDoublePrimitiveArray
(Object[] doubleArray) static Float[]
convertObjectOfFloatsArrayToFloatArray
(Object[] doubleArray) static float[]
convertObjectOfFloatsArrayToFloatPrimitiveArray
(Object[] floatArray) static Integer[]
convertObjectOfIntegersArrayToIntegerArray
(Object[] integerArray) static int[]
convertObjectOfIntegersArrayToIntegerPrimitiveArray
(Object[] integerArray) static Short[]
convertObjectOfIntegersArrayToShortArray
(Object[] shortArray) static short[]
convertObjectOfIntegersArrayToShortPrimitiveArray
(Object[] shortArray) static Long[]
convertObjectOfLongsArrayToLongArray
(Object[] longArray) static long[]
convertObjectOfLongsArrayToLongPrimitiveArray
(Object[] longArray) static Short[]
convertObjectOfShortsArrayToShortArray
(Object[] shortArray) static short[]
convertObjectOfShortsArrayToShortPrimitiveArray
(Object[] shortArray) static String[]
convertObjectOfStringsArrayToStringArray
(Object[] stringArray) static Byte[]
convertPrimitiveByteArrayToByteArray
(byte[] value) static <T> T
copyObjectArrayOfDateToLocalDate
(Object[] value, T target) static <T> T
copyObjectArrayOfTimestampToLocalDate
(Object[] value, T target) static <T> T
copyObjectArrayOfTimestampToLocalDateTime
(Object[] value, T target) static <T> T
copyObjectArrayOfTimeToLocalTime
(Object[] value, T target) static <T> T
copyToLocalDate
(Date[] value, T target) static <T> T
copyToLocalDateTime
(Timestamp[] value, T target) static <T> T
copyToLocalTime
(Time[] value, T target) static void
dropDb
(SqlDialect sqlDialect, Connection conn) static void
static List<Comparable>
getValue
(ResultSet resultSet, List<ColumnList.Column> columns) static boolean
isBulkWithin
(SqlgGraph sqlgGraph, org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer hasContainer) static boolean
isBulkWithinAndOut
(SqlgGraph sqlgGraph, org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer hasContainer) static List<Emit<SqlgElement>>
loadRecursiveIncludeEdgeResultSetIntoResultIterator
(SqlgGraph sqlgGraph, ResultSetMetaData resultSetMetaData, ResultSet resultSet, SchemaTableTree rootSchemaTableTree, List<LinkedList<SchemaTableTree>> subQueryStacks, boolean first, Map<String, Integer> idColumnCountMap, boolean forParent) static List<Emit<SqlgElement>>
loadRecursiveResultSetIntoResultIterator
(SqlgGraph sqlgGraph, ResultSetMetaData resultSetMetaData, ResultSet resultSet, SchemaTableTree rootSchemaTableTree, boolean first, Map<String, Integer> idColumnCountMap, boolean forParent) static List<Emit<SqlgElement>>
loadResultSetIntoResultIterator
(SqlgGraph sqlgGraph, ResultSetMetaData resultSetMetaData, ResultSet resultSet, SchemaTableTree rootSchemaTableTree, List<LinkedList<SchemaTableTree>> subQueryStacks, boolean first, Map<String, Integer> idColumnCountMap, boolean forParent) static Object[]
mapTokeyValues
(Map<Object, Object> keyValues) static Object[]
mapToStringKeyValues
(Map<String, Object> keyValues) static String
originalLabel
(String label) static SchemaTable
parseLabel
(String label) static String
removeTrailingInId
(String foreignKey) static String
removeTrailingOutId
(String foreignKey) static int
setKeyValueAsParameter
(SqlgGraph sqlgGraph, boolean mod, int parameterStartIndex, PreparedStatement preparedStatement, org.apache.commons.lang3.tuple.ImmutablePair<PropertyDefinition, Object> pair) static int
setKeyValuesAsParameter
(SqlgGraph sqlgGraph, boolean mod, int parameterStartIndex, PreparedStatement preparedStatement, Collection<org.apache.commons.lang3.tuple.ImmutablePair<PropertyDefinition, Object>> typeAndValues) static int
setKeyValuesAsParameterUsingPropertyColumn
(SqlgGraph sqlgGraph, boolean mod, int parameterStartIndex, PreparedStatement preparedStatement, Collection<org.apache.commons.lang3.tuple.Pair<PropertyDefinition, Object>> typeAndValues) static int
setKeyValuesAsParameterUsingPropertyColumn
(SqlgGraph sqlgGraph, int i, PreparedStatement preparedStatement, Map<String, org.apache.commons.lang3.tuple.Pair<PropertyDefinition, Object>> properties) static void
setParametersOnStatement
(SqlgGraph sqlgGraph, LinkedList<SchemaTableTree> schemaTableTreeStack, PreparedStatement preparedStatement, boolean includeAdditionalPartitionHasContainer) static Object
stringValueToType
(PropertyType propertyType, String value) transformToColumnDefinitionMap
(Object... keyValues) transformToKeyList
(Object... keyValues) validateAndTransformVertexKeysValues
(SqlDialect sqlDialect, Object[] keyValues) validateAndTransformVertexKeysValues
(SqlDialect sqlDialect, Object[] keyValues, List<String> previousBatchModeKeys) static void
validateIncomingPropertyType
(String incomingPropertyDescription, PropertyDefinition incomingPropertyDefinition, String propertyDescription, PropertyDefinition propertyDefinition) validateVertexKeysValues
(SqlDialect sqlDialect, Object[] keyValues) Validates the key values and converts it into a Triple with three maps.validateVertexKeysValues
(SqlDialect sqlDialect, Object[] keyValues, List<String> previousBatchModeKeys)
-
Method Details
-
loadRecursiveIncludeEdgeResultSetIntoResultIterator
public static List<Emit<SqlgElement>> loadRecursiveIncludeEdgeResultSetIntoResultIterator(SqlgGraph sqlgGraph, ResultSetMetaData resultSetMetaData, ResultSet resultSet, SchemaTableTree rootSchemaTableTree, List<LinkedList<SchemaTableTree>> subQueryStacks, boolean first, Map<String, Integer> idColumnCountMap, boolean forParent) throws SQLException- Throws:
SQLException
-
loadRecursiveResultSetIntoResultIterator
public static List<Emit<SqlgElement>> loadRecursiveResultSetIntoResultIterator(SqlgGraph sqlgGraph, ResultSetMetaData resultSetMetaData, ResultSet resultSet, SchemaTableTree rootSchemaTableTree, boolean first, Map<String, Integer> idColumnCountMap, boolean forParent) throws SQLException- Throws:
SQLException
-
loadResultSetIntoResultIterator
public static List<Emit<SqlgElement>> loadResultSetIntoResultIterator(SqlgGraph sqlgGraph, ResultSetMetaData resultSetMetaData, ResultSet resultSet, SchemaTableTree rootSchemaTableTree, List<LinkedList<SchemaTableTree>> subQueryStacks, boolean first, Map<String, Integer> idColumnCountMap, boolean forParent) throws SQLException- Parameters:
forParent
- Indicates that the gremlin query is for SqlgVertexStep. It is in the context of an incoming traverser, the parent.- Returns:
- A list of @
Emit
s that represent a single @Path
- Throws:
SQLException
-
isBulkWithinAndOut
public static boolean isBulkWithinAndOut(SqlgGraph sqlgGraph, org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer hasContainer) -
isBulkWithin
public static boolean isBulkWithin(SqlgGraph sqlgGraph, org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer hasContainer) -
setParametersOnStatement
public static void setParametersOnStatement(SqlgGraph sqlgGraph, LinkedList<SchemaTableTree> schemaTableTreeStack, PreparedStatement preparedStatement, boolean includeAdditionalPartitionHasContainer) throws SQLException - Throws:
SQLException
-
setKeyValuesAsParameterUsingPropertyColumn
public static int setKeyValuesAsParameterUsingPropertyColumn(SqlgGraph sqlgGraph, int i, PreparedStatement preparedStatement, Map<String, org.apache.commons.lang3.tuple.Pair<PropertyDefinition, throws SQLExceptionObject>> properties) - Throws:
SQLException
-
setKeyValuesAsParameterUsingPropertyColumn
public static int setKeyValuesAsParameterUsingPropertyColumn(SqlgGraph sqlgGraph, boolean mod, int parameterStartIndex, PreparedStatement preparedStatement, Collection<org.apache.commons.lang3.tuple.Pair<PropertyDefinition, Object>> typeAndValues) throws SQLException- Throws:
SQLException
-
setKeyValuesAsParameter
public static int setKeyValuesAsParameter(SqlgGraph sqlgGraph, boolean mod, int parameterStartIndex, PreparedStatement preparedStatement, Collection<org.apache.commons.lang3.tuple.ImmutablePair<PropertyDefinition, Object>> typeAndValues) throws SQLException- Throws:
SQLException
-
setKeyValueAsParameter
public static int setKeyValueAsParameter(SqlgGraph sqlgGraph, boolean mod, int parameterStartIndex, PreparedStatement preparedStatement, org.apache.commons.lang3.tuple.ImmutablePair<PropertyDefinition, Object> pair) throws SQLException- Throws:
SQLException
-
parseLabel
-
mapTokeyValues
-
mapToStringKeyValues
-
transformToKeyList
-
transformToColumnDefinitionMap
public static ConcurrentHashMap<String,PropertyDefinition> transformToColumnDefinitionMap(Object... keyValues) -
validateAndTransformVertexKeysValues
public static Map<String,Object> validateAndTransformVertexKeysValues(SqlDialect sqlDialect, Object[] keyValues) -
validateVertexKeysValues
public static org.apache.commons.lang3.tuple.Pair<Map<String,PropertyDefinition>, validateVertexKeysValuesMap<String, Object>> (SqlDialect sqlDialect, Object[] keyValues) Validates the key values and converts it into a Triple with three maps. The left map is a map of keys together with their PropertyType. The middle map is a map of keys together with their values. The right map is a map of keys with values where the values are guaranteed not to be null.- Parameters:
sqlDialect
- The dialect.keyValues
- The key value pairs.- Returns:
- A Triple with 3 maps.
-
validateAndTransformVertexKeysValues
-
validateVertexKeysValues
public static org.apache.commons.lang3.tuple.Pair<Map<String,PropertyDefinition>, validateVertexKeysValuesMap<String, Object>> (SqlDialect sqlDialect, Object[] keyValues, List<String> previousBatchModeKeys) -
removeTrailingInId
-
removeTrailingOutId
-
dropDb
-
dropDb
-
convertPrimitiveByteArrayToByteArray
-
convertByteArrayToPrimitiveArray
-
convertObjectArrayToBytePrimitiveArray
-
convertObjectArrayToBooleanArray
-
convertObjectArrayToBooleanPrimitiveArray
-
convertObjectOfIntegersArrayToShortArray
-
convertObjectOfShortsArrayToShortArray
-
convertObjectOfIntegersArrayToShortPrimitiveArray
-
convertObjectOfShortsArrayToShortPrimitiveArray
-
convertObjectOfIntegersArrayToIntegerArray
-
convertObjectOfIntegersArrayToIntegerPrimitiveArray
-
convertObjectOfLongsArrayToLongPrimitiveArray
-
convertObjectOfDoublesArrayToDoublePrimitiveArray
-
convertObjectOfDoublesArrayToBigDecimalArray
-
convertObjectOfFloatsArrayToFloatPrimitiveArray
-
convertObjectOfLongsArrayToLongArray
-
convertObjectOfDoublesArrayToDoubleArray
-
convertObjectOfFloatsArrayToFloatArray
-
convertObjectOfStringsArrayToStringArray
-
copyToLocalDateTime
-
copyObjectArrayOfTimestampToLocalDateTime
-
copyObjectArrayOfTimestampToLocalDate
-
copyToLocalDate
-
copyObjectArrayOfDateToLocalDate
-
copyToLocalTime
-
copyObjectArrayOfTimeToLocalTime
-
originalLabel
-
getValue
-
stringValueToType
-
validateIncomingPropertyType
public static void validateIncomingPropertyType(String incomingPropertyDescription, PropertyDefinition incomingPropertyDefinition, String propertyDescription, PropertyDefinition propertyDefinition)
-