private static String getColumnValue(FieldMapping fm) { switch (fm.getMappingType()) { case COLUMN: case COUNTER: return fm.getFamilyAsString() + ":" + fm.getQualifierAsString(); case KEY_AS_COLUMN: return fm.getFamilyAsString() + ":" + (fm.getPrefix() == null ? "" : fm.getPrefix()); default: return null; } }
private static String getColumnValue(FieldMapping fm) { switch (fm.getMappingType()) { case COLUMN: case COUNTER: return fm.getFamilyAsString() + ":" + fm.getQualifierAsString(); case KEY_AS_COLUMN: return fm.getFamilyAsString() + ":" + (fm.getPrefix() == null ? "" : fm.getPrefix()); default: return null; } }
} else if (fieldMapping.getMappingType() == MappingType.KEY_AS_COLUMN) { serializeKeyAsColumn(fieldName, fieldMapping.getFamily(), fieldMapping.getPrefix(), fieldValue, put); } else if (fieldMapping.getMappingType() == MappingType.OCC_VERSION) { serializeOCCColumn(fieldValue, putAction);
/** * Deserialize an entity field from the HBase Result. * * @param fieldMapping * The FieldMapping that specifies this field's mapping type and * field name. * @param result * The HBase Result that represents a row in HBase. * @return The field Object we deserialized from the Result. */ public Object deserialize(FieldMapping fieldMapping, Result result) { String fieldName = fieldMapping.getFieldName(); MappingType mappingType = fieldMapping.getMappingType(); if (mappingType == MappingType.COLUMN || mappingType == MappingType.COUNTER) { return deserializeColumn(fieldMapping.getFieldName(), fieldMapping.getFamily(), fieldMapping.getQualifier(), result); } else if (mappingType == MappingType.KEY_AS_COLUMN) { return deserializeKeyAsColumn(fieldMapping.getFieldName(), fieldMapping.getFamily(), fieldMapping.getPrefix(), result); } else if (mappingType == MappingType.OCC_VERSION) { return deserializeOCCColumn(result); } else { throw new ValidationException( "Invalid field mapping for field with name: " + fieldName); } }
} else if (fieldMapping.getMappingType() == MappingType.KEY_AS_COLUMN) { serializeKeyAsColumn(fieldName, fieldMapping.getFamily(), fieldMapping.getPrefix(), fieldValue, put); } else if (fieldMapping.getMappingType() == MappingType.OCC_VERSION) { serializeOCCColumn(fieldValue, putAction);
/** * Deserialize an entity field from the HBase Result. * * @param fieldMapping * The FieldMapping that specifies this field's mapping type and * field name. * @param result * The HBase Result that represents a row in HBase. * @return The field Object we deserialized from the Result. */ public Object deserialize(FieldMapping fieldMapping, Result result) { String fieldName = fieldMapping.getFieldName(); MappingType mappingType = fieldMapping.getMappingType(); if (mappingType == MappingType.COLUMN || mappingType == MappingType.COUNTER) { return deserializeColumn(fieldMapping.getFieldName(), fieldMapping.getFamily(), fieldMapping.getQualifier(), result); } else if (mappingType == MappingType.KEY_AS_COLUMN) { return deserializeKeyAsColumn(fieldMapping.getFieldName(), fieldMapping.getFamily(), fieldMapping.getPrefix(), result); } else if (mappingType == MappingType.OCC_VERSION) { return deserializeOCCColumn(result); } else { throw new ValidationException( "Invalid field mapping for field with name: " + fieldName); } }