Package com.saperion.operations.inject
Interface DocumentDefinitionService
public interface DocumentDefinitionService
Manages
document definitions
- Author:
- jschwarz
-
Method Summary
Modifier and TypeMethodDescriptionvoid
checkForMandatoryConstraintViolations
(DDC definition, Map<String, com.lexmark.saperion.PropertyType> properties, boolean isCreation) For a given definition this method checks a given map of properties for mandatory constraint violations.void
checkForSystemFields
(DDC definition, Map<String, com.lexmark.saperion.PropertyType> indexData) For a given definition and a map of properties this method checks whether it contains system fields.com.lexmark.saperion.remote.common.query.QueryExpression<Boolean>
createUniqueConstraintViolationCheck
(DDC definition, String id, Map<String, com.lexmark.saperion.PropertyType> properties) For a given map of fields this method checks a definition and a database row id, this method creates a query expression that filters a corresponding datbase table so that the result contains exactly the existing entries that would collide with the given database row.com.lexmark.saperion.remote.common.query.QueryExpression<Boolean>
createUniqueConstraintViolationCheck
(SaFieldDescription fieldDescription, com.lexmark.saperion.PropertyType newValue, boolean ignoreCounters) For a givenSaFieldDescription
and a given value this method creates aQueryExpression
that checks whether the given value would violate a unique constraint.filterSystemFields
(DDC definition, List<Map<String, com.lexmark.saperion.PropertyType>> resultMaps) This method the system fields from a given list of result map.filterSystemFields
(DDC definition, Map<String, com.lexmark.saperion.PropertyType> resultMap) This method filters the system fields from a given result map.getDefinition
(String definitionName) This method returns the document definition object identified by the given name
-
Method Details
-
getDefinition
DDC getDefinition(String definitionName) throws com.lexmark.saperion.exceptions.system.SystemException This method returns the document definition object identified by the given name- Parameters:
definitionName
- tha name of the definition wanted- Returns:
- the document definition object identified by the given name
- Throws:
com.lexmark.saperion.exceptions.system.SystemException
-
filterSystemFields
List<Map<String,com.lexmark.saperion.PropertyType>> filterSystemFields(DDC definition, List<Map<String, com.lexmark.saperion.PropertyType>> resultMaps) This method the system fields from a given list of result map. Will return a list of maps containing exactly the entries from the given result maps whose key is a non-system field in the given definition.- Parameters:
definition
- the definition from which the maps resultedresultMaps
- the result map“s to filter- Returns:
- a list of maps containing exactly the entries from the given result maps whose key is a non-system field in the given definition
-
filterSystemFields
Map<String,com.lexmark.saperion.PropertyType> filterSystemFields(DDC definition, Map<String, com.lexmark.saperion.PropertyType> resultMap) This method filters the system fields from a given result map. Will return a map containing exactly the entries from the given result map whose key is a non-system field in the given definition.- Parameters:
definition
- the definition from which the map resultedresultMap
- the result map to filter- Returns:
- a map containing exactly the entries from the given result map whose key is a non-system field in the given definition
-
createUniqueConstraintViolationCheck
com.lexmark.saperion.remote.common.query.QueryExpression<Boolean> createUniqueConstraintViolationCheck(DDC definition, String id, Map<String, com.lexmark.saperion.PropertyType> properties) For a given map of fields this method checks a definition and a database row id, this method creates a query expression that filters a corresponding datbase table so that the result contains exactly the existing entries that would collide with the given database row.- Parameters:
definition
- the definition to check for field dataid
- the id of the row given or null if the row represents a new entryproperties
- the properties to check for conformance
-
createUniqueConstraintViolationCheck
com.lexmark.saperion.remote.common.query.QueryExpression<Boolean> createUniqueConstraintViolationCheck(SaFieldDescription fieldDescription, com.lexmark.saperion.PropertyType newValue, boolean ignoreCounters) For a givenSaFieldDescription
and a given value this method creates aQueryExpression
that checks whether the given value would violate a unique constraint. If the field does not define such an constraint or the given value and field do not qualify for checking by other reasons null is returned.- Parameters:
fieldDescription
- the field to check for constraint violationnewValue
- the value to check for constraint violationignoreCounters
- whether counters should be ignored- Returns:
- a
QueryExpression
that checks whether the given value would violate an unique constraint or null if no suh constraint applies
-
checkForMandatoryConstraintViolations
void checkForMandatoryConstraintViolations(DDC definition, Map<String, com.lexmark.saperion.PropertyType> properties, boolean isCreation) throws com.lexmark.saperion.exceptions.runtime.MandatoryConstraintViolationExceptionFor a given definition this method checks a given map of properties for mandatory constraint violations. If such a constraint is violated it will throw an MandatoryConstraintViolationException.- Parameters:
definition
- the definition that holds the constraints to check againstproperties
- the properties to check for validationsisCreation
- whether the properties represent a new entry or an old one- Throws:
com.lexmark.saperion.exceptions.runtime.MandatoryConstraintViolationException
-
checkForSystemFields
void checkForSystemFields(DDC definition, Map<String, com.lexmark.saperion.PropertyType> indexData) throws com.lexmark.saperion.exceptions.runtime.SystemFieldWriteExceptionFor a given definition and a map of properties this method checks whether it contains system fields. If so it throws an Exception. In this context a counter field is considered a system field.- Parameters:
definition
- the definition defining the dataindexData
- the properties to check- Throws:
com.lexmark.saperion.exceptions.runtime.SystemFieldWriteException
-