@Component public class MappingManagerImpl extends com.marklogic.client.ext.helper.LoggingObject implements MappingManager
Modifier and Type | Field and Description |
---|---|
protected HubConfig |
hubConfig |
MAPPING_FILE_EXTENSION
Constructor and Description |
---|
MappingManagerImpl() |
MappingManagerImpl(HubConfig hubConfig) |
Modifier and Type | Method and Description |
---|---|
Mapping |
createMapping(java.lang.String mappingName)
Creates a mapping given a string name
|
Mapping |
createMapping(java.lang.String mappingName,
java.lang.String entityName)
Creates a mapping given a string name
|
Mapping |
createMappingFromJSON(com.fasterxml.jackson.databind.JsonNode json)
Creates a mapping from a given JsonNode
|
Mapping |
createMappingFromJSON(java.lang.String json)
Creates a mapping from a given JSON string
|
void |
deleteMapping(java.lang.String mappingName)
Deletes a defined mapping by string name
|
Mapping |
getMapping(java.lang.String mappingName)
Returns a mapping based on the provided name
|
Mapping |
getMapping(java.lang.String mappingName,
int version,
boolean createIfNotExisted)
Returns a mapping based on the provided name
|
java.lang.String |
getMappingAsJSON(java.lang.String mappingName)
Returns a mapping based on the provided name as JSON string
|
java.lang.String |
getMappingAsJSON(java.lang.String mappingName,
int version,
boolean createIfNotExisted)
Returns a mapping based on the provided name as JSON string
|
java.util.ArrayList<Mapping> |
getMappings()
Returns a list of all mappings currently defined
|
java.util.ArrayList<java.lang.String> |
getMappingsNames()
Returns a string list of names for all mappings currently defined
|
void |
saveMapping(Mapping mapping)
Saves a map to disk
|
void |
saveMapping(Mapping mapping,
boolean autoIncrement)
Saves a map to disk, incrementing its version by 1
|
@Autowired protected HubConfig hubConfig
public MappingManagerImpl()
public MappingManagerImpl(HubConfig hubConfig)
public Mapping createMapping(java.lang.String mappingName)
MappingManager
createMapping
in interface MappingManager
mappingName
- - the base name of the mapping you want to createpublic Mapping createMapping(java.lang.String mappingName, java.lang.String entityName)
MappingManager
createMapping
in interface MappingManager
mappingName
- - the base name of the mapping you want to createentityName
- - the name of the entity being mapped topublic Mapping createMappingFromJSON(java.lang.String json) throws java.io.IOException
MappingManager
createMappingFromJSON
in interface MappingManager
json
- - string representation of jsonjava.io.IOException
- - thrown if mapping file cannot be found/read off diskpublic Mapping createMappingFromJSON(com.fasterxml.jackson.databind.JsonNode json)
MappingManager
createMappingFromJSON
in interface MappingManager
json
- - JsonNodepublic void deleteMapping(java.lang.String mappingName)
MappingManager
deleteMapping
in interface MappingManager
mappingName
- - the base-name of the mapping you want to delete as a stringpublic void saveMapping(Mapping mapping)
MappingManager
saveMapping
in interface MappingManager
mapping
- - the mapping object to be savedpublic void saveMapping(Mapping mapping, boolean autoIncrement)
MappingManager
saveMapping
in interface MappingManager
mapping
- the mapping object to be savedautoIncrement
- - true to increment version, false if not topublic java.util.ArrayList<java.lang.String> getMappingsNames()
MappingManager
getMappingsNames
in interface MappingManager
public java.util.ArrayList<Mapping> getMappings()
MappingManager
getMappings
in interface MappingManager
public Mapping getMapping(java.lang.String mappingName)
MappingManager
getMapping
in interface MappingManager
mappingName
- - the basename of the mappingpublic Mapping getMapping(java.lang.String mappingName, int version, boolean createIfNotExisted)
MappingManager
getMapping
in interface MappingManager
mappingName
- - name of the mapversion
- - the version of the mappingcreateIfNotExisted
- - create mapping object if true, otherwise throws exceptionpublic java.lang.String getMappingAsJSON(java.lang.String mappingName)
MappingManager
getMappingAsJSON
in interface MappingManager
mappingName
- - name of the mappingpublic java.lang.String getMappingAsJSON(java.lang.String mappingName, int version, boolean createIfNotExisted)
MappingManager
getMappingAsJSON
in interface MappingManager
mappingName
- - name of the mappingversion
- - the version number of the mappingcreateIfNotExisted
- - create mapping object if true, otherwise throws exception