Search in sources :

Example 1 with KeyConversionException

use of io.jans.orm.exception.KeyConversionException in project jans by JanssenProject.

the class SqlConnectionProvider method getTableMappingByKey.

public TableMapping getTableMappingByKey(String key, String objectClass) {
    String tableName = objectClass;
    Map<String, String> columTypes = tableColumnsMap.get(tableName);
    if ("_".equals(key)) {
        return new TableMapping("", tableName, objectClass, columTypes);
    }
    String[] baseNameParts = key.split("_");
    if (ArrayHelper.isEmpty(baseNameParts)) {
        throw new KeyConversionException("Failed to determine base key part!");
    }
    TableMapping tableMapping = new TableMapping(baseNameParts[0], tableName, objectClass, columTypes);
    return tableMapping;
}
Also used : KeyConversionException(io.jans.orm.exception.KeyConversionException) TableMapping(io.jans.orm.sql.model.TableMapping)

Example 2 with KeyConversionException

use of io.jans.orm.exception.KeyConversionException in project jans by JanssenProject.

the class HybridEntryManager method getPersistenceEntryManagerByKey.

private PersistenceEntryManager getPersistenceEntryManagerByKey(String key) {
    if ("_".equals(key)) {
        return defaultPersistenceEntryManager;
    }
    String[] baseNameParts = key.split("_");
    if (ArrayHelper.isEmpty(baseNameParts)) {
        throw new KeyConversionException("Failed to determine base key part!");
    }
    PersistenceEntryManager persistenceEntryManager = baseNameToEntryManagerMapping.get(baseNameParts[0]);
    if (persistenceEntryManager != null) {
        return persistenceEntryManager;
    }
    return defaultPersistenceEntryManager;
}
Also used : PersistenceEntryManager(io.jans.orm.PersistenceEntryManager) KeyConversionException(io.jans.orm.exception.KeyConversionException)

Example 3 with KeyConversionException

use of io.jans.orm.exception.KeyConversionException in project jans by JanssenProject.

the class CouchbaseConnectionProvider method getBucketMappingByKey.

public BucketMapping getBucketMappingByKey(String key) {
    if ("_".equals(key)) {
        return defaultBucketMapping;
    }
    String[] baseNameParts = key.split("_");
    if (ArrayHelper.isEmpty(baseNameParts)) {
        throw new KeyConversionException("Failed to determine base key part!");
    }
    BucketMapping bucketMapping = baseNameToBucketMapping.get(baseNameParts[0]);
    if (bucketMapping != null) {
        return bucketMapping;
    }
    return defaultBucketMapping;
}
Also used : KeyConversionException(io.jans.orm.exception.KeyConversionException) BucketMapping(io.jans.orm.couchbase.model.BucketMapping)

Example 4 with KeyConversionException

use of io.jans.orm.exception.KeyConversionException in project jans by JanssenProject.

the class SpannerConnectionProvider method getTableMappingByKey.

public TableMapping getTableMappingByKey(String key, String objectClass, String tableName) {
    Map<String, StructField> columTypes = tableColumnsMap.get(tableName);
    if (!tableColumnsMap.containsKey(tableName)) {
        throw new MappingException(String.format("Table '%s' metadata is not exists '", tableName));
    }
    if ("_".equals(key)) {
        return new TableMapping("", tableName, objectClass, columTypes);
    }
    String[] baseNameParts = key.split("_");
    if (ArrayHelper.isEmpty(baseNameParts)) {
        throw new KeyConversionException("Failed to determine base key part!");
    }
    TableMapping tableMapping = new TableMapping(baseNameParts[0], tableName, objectClass, columTypes);
    return tableMapping;
}
Also used : StructField(com.google.cloud.spanner.Type.StructField) KeyConversionException(io.jans.orm.exception.KeyConversionException) TableMapping(io.jans.orm.cloud.spanner.model.TableMapping) MappingException(io.jans.orm.exception.MappingException)

Aggregations

KeyConversionException (io.jans.orm.exception.KeyConversionException)4 StructField (com.google.cloud.spanner.Type.StructField)1 PersistenceEntryManager (io.jans.orm.PersistenceEntryManager)1 TableMapping (io.jans.orm.cloud.spanner.model.TableMapping)1 BucketMapping (io.jans.orm.couchbase.model.BucketMapping)1 MappingException (io.jans.orm.exception.MappingException)1 TableMapping (io.jans.orm.sql.model.TableMapping)1