Class DataModelGenerator
ODataToVdmGenerator
, gathering all relevant parameter or providing default values for
unspecified ones.-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The default fully-qualified name of the class to use for providing generated Java classes with necessary annotations.static final String
The default base path, used in absence of a swagger file to determine a service path.static final String
The default copyright header that is added to generated files.static final Boolean
The default flag indicating whether the output directory should be deleted prior to the generation.static final String
The default ant style pattern of filenames for which VDM should not be generated - empty string.static final Boolean
The default flag indicating whether to exit with a failure in case a warning occurs.static final String
The default directory name to search and save configuration data in.static final boolean
The default flag indicating that existing signatures from already generated classes will be considered.static final Boolean
The default flag indicating whether to generate API reference URLs linking to the SAP Business Accelerator Hub.static final NameSource
The default naming source used in theS4HanaNamingStrategy
.static final String
The default fully-qualified name of the class to use for converting names from the OData world to the Java world.static final String
The default directory name to store the generated sources in.static final Boolean
The default flag indicating whether already existing files should be overwritten.static final String
The default package prefix of the generated sources.static final Boolean
The default flag indicating whether to generate just the POJO classes (entities and complex types).static final Boolean
By default the generator generates service methods for the first entity set per entity type only.static final String
The default file name to the name mapping properties file.static final Boolean
The default flag indicating whether to skip generating comments indicating the version reference of the used OData generator plugin.static final String
An SAP copyright header that can be added to generated files. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncopyrightHeader
(String copyrightHeader) Defines a copyright header to be placed at the beginning of generated files.Deletes the output directory specified bywithPackageName(String)
prior to generating the sources.deleteOutputDirectory
(boolean deleteOutputDirectory) Defines whether to delete the output directory specified bywithPackageName(String)
prior to generating the sources.void
execute()
Executes the actual generator based on the given parameter or, in case of absence, their default values.The generator exists with failure in case a warning occurs during processing.failOnWarning
(boolean failOnWarning) Defines whether to exit with failure in case a warning occurs during processing.boolean
Get the failure indicator due to warning messages.boolean
boolean
The flag indicating whether the generator fails in case a warning occurs.boolean
boolean
boolean
boolean
boolean
boolean
keepExistingSignatures
(boolean keepExistingSignatures) Defines whether existing signatures from already generated classes will be considered when generating again.Activates generation of API reference URLs linking to the SAP Business Accelerator Hub.linkToApiBusinessHub
(boolean linkToApiBusinessHub) Defines whether to generate API reference URLs linking to the SAP Business Accelerator Hub.Defines that already existing files will get overwritten.overwriteFiles
(boolean overwriteFiles) Defines whether already existing files will get overwritten.Activates POJO only generation, so just entity and complex type classes are generated.pojosOnly
(boolean pojosOnly) Defines whether to generate just the POJO classes (entities and complex types).protected void
Prints all information gathered in this builder.Generate SAP copyright headers at the top of generated files.The generator generates service methods for each entity set of one entity type.serviceMethodsPerEntitySet
(boolean serviceMethodsPerEntitySet) The generator generates service methods for each entity set of one entity type.Generate comments, which indicate the version of the used OData VDM generator plugin.versionReference
(boolean versionReference) Defines whether to generate the version reference of the used OData generator plugin.withAnnotationStrategy
(AnnotationStrategy annotationStrategy) Sets the class to use to provide generated Java classes with necessary annotations.withAnnotationStrategy
(String annotationStrategyClassName) Sets the class to use to provide generated Java classes with necessary annotations.withDefaultBasePath
(String defaultBasePath) Specifies the default base path.withDeprecationNotice
(String deprecationNotice) Generates deprecation notices for generated service,and it's implementation classwithExcludeFilePattern
(String excludeFilePattern) The ant style filename pattern for which VDM should not be generated.withIncludedActionImports
(Set<String> includedActionImports) Restricts the generated action imports to the provided values, plus any dependent complex types.withIncludedEntitySets
(Set<String> includedEntitySets) Restricts the generated entity classes to the provided values, plus any dependent complex types.withIncludedFunctionImports
(Set<String> includedFunctionImports) Restricts the generated function imports to the provided values, plus any dependent complex types.withInputDirectory
(File inputDirectory) Input directory that contains the service definition files.withInputDirectory
(String inputDirectory) Path to the input directory that contains the service definition files.withNameSource
(NameSource nameSource) Getter for the givenNameSource
.withNamingStrategy
(NamingStrategy namingStrategy) Sets the class to use to convert OData names into suitable Java names.withNamingStrategy
(String namingStrategyClassName) Sets the class to use to convert OData names into suitable Java names.withOutputDirectory
(File outputDirectory) Output directory to store the generated sources in.withOutputDirectory
(String outputDirectory) Path to the output directory to store the generated sources in.withPackageName
(String packageName) Specifies the package prefix to be used in the generated sources.withServiceNameMapping
(File serviceNameMappingFile) The properties file containing the service name mapping.withServiceNameMapping
(String serviceNameMappingFile) The path to the properties file containing the service name mapping.
-
Field Details
-
DEFAULT_INPUT_DIRECTORY_NAME
The default directory name to search and save configuration data in.- See Also:
-
DEFAULT_OUTPUT_DIRECTORY_NAME
The default directory name to store the generated sources in.- See Also:
-
DEFAULT_DELETE_OUTPUT_DIRECTORY
The default flag indicating whether the output directory should be deleted prior to the generation. -
DEFAULT_OVERWRITE_FILES
The default flag indicating whether already existing files should be overwritten. Iffalse
, an exception is thrown if a file already exists. -
DEFAULT_KEEP_EXISTING_SIGNATURES
public static final boolean DEFAULT_KEEP_EXISTING_SIGNATURESThe default flag indicating that existing signatures from already generated classes will be considered.- See Also:
-
DEFAULT_PACKAGE_NAME
The default package prefix of the generated sources.- See Also:
-
DEFAULT_BASE_PATH
The default base path, used in absence of a swagger file to determine a service path. -
DEFAULT_SERVICE_NAME_MAPPING_FILE_NAME
The default file name to the name mapping properties file.- See Also:
-
DEFAULT_NAMING_STRATEGY
The default fully-qualified name of the class to use for converting names from the OData world to the Java world.- See Also:
-
DEFAULT_ANNOTATION_STRATEGY
The default fully-qualified name of the class to use for providing generated Java classes with necessary annotations.- See Also:
-
DEFAULT_NAMING_SOURCE
The default naming source used in theS4HanaNamingStrategy
. -
DEFAULT_POJOS_ONLY
The default flag indicating whether to generate just the POJO classes (entities and complex types). -
DEFAULT_EXCLUDES_PATTERN
The default ant style pattern of filenames for which VDM should not be generated - empty string.- See Also:
-
DEFAULT_LINK_TO_API_BUSINESS_HUB
The default flag indicating whether to generate API reference URLs linking to the SAP Business Accelerator Hub. -
DEFAULT_FAIL_ON_WARNING
The default flag indicating whether to exit with a failure in case a warning occurs. -
DEFAULT_VERSION_REFERENCE
The default flag indicating whether to skip generating comments indicating the version reference of the used OData generator plugin. -
DEFAULT_COPYRIGHT_HEADER
The default copyright header that is added to generated files. By default, no copyright headers are added.- See Also:
-
DEFAULT_SERVICE_METHODS_PER_ENTITY_SET
By default the generator generates service methods for the first entity set per entity type only. All additional entity sets of for the entity type are disregarded. -
SAP_COPYRIGHT_HEADER
An SAP copyright header that can be added to generated files.- See Also:
-
-
Constructor Details
-
DataModelGenerator
public DataModelGenerator()
-
-
Method Details
-
withInputDirectory
Path to the input directory that contains the service definition files.- Parameters:
inputDirectory
- The directory to read the service data from.- Returns:
- This
DataModelGenerator
for chained method calls.
-
withInputDirectory
Input directory that contains the service definition files.- Parameters:
inputDirectory
- The directory to read the service data from.- Returns:
- This
DataModelGenerator
for chained method calls.
-
withOutputDirectory
Path to the output directory to store the generated sources in.The generated sources will be stored under this directory according to the packages specified.
- Parameters:
outputDirectory
- The path to the root directory to store the generated sources in.- Returns:
- This
DataModelGenerator
for chained method calls.
-
withOutputDirectory
Output directory to store the generated sources in.The generated sources will be stored under this directory according to the packages specified.
- Parameters:
outputDirectory
- The root directory to store the generated sources in.- Returns:
- This
DataModelGenerator
for chained method calls.
-
deleteOutputDirectory
Deletes the output directory specified bywithPackageName(String)
prior to generating the sources.This option should be used to determine the whole change set, including deleted files.
- Returns:
- This
DataModelGenerator
for chained method calls.
-
deleteOutputDirectory
Defines whether to delete the output directory specified bywithPackageName(String)
prior to generating the sources.This option should be used to determine the whole change set, including deleted files.
- Parameters:
deleteOutputDirectory
- Flag indicating whether the output directory should be cleaned.- Returns:
- This
DataModelGenerator
for chained method calls.
-
overwriteFiles
Defines that already existing files will get overwritten. Otherwise, an exception is thrown if a file already exists.- Returns:
- This
DataModelGenerator
for chained method calls.
-
overwriteFiles
Defines whether already existing files will get overwritten. Iffalse
, an exception is thrown if a file already exists.- Parameters:
overwriteFiles
- Flag indicating whether already existing files can be overwritten.- Returns:
- This
DataModelGenerator
for chained method calls.
-
keepExistingSignatures
Defines whether existing signatures from already generated classes will be considered when generating again. Iftrue
, breaking changes in method signature will be avoided, when the argument order in OData specification was altered.- Parameters:
keepExistingSignatures
- Flag indicating whether already generated classes will be considered.- Returns:
- This
DataModelGenerator
for chained method calls.
-
withPackageName
Specifies the package prefix to be used in the generated sources.- Parameters:
packageName
- The package prefix for the generated sources.- Returns:
- This
DataModelGenerator
for chained method calls.
-
withDefaultBasePath
Specifies the default base path.If no swagger file is given, this base path, together with the metadata file name, constitute the service path with the following pattern: <defaultBasePath> + <metadataFileNameWithoutExtension>.
- Parameters:
defaultBasePath
- The default base path.- Returns:
- This
DataModelGenerator
for chained method calls.
-
withServiceNameMapping
The properties file containing the service name mapping.Any service not mapped in this file will get created/updated.
- Parameters:
serviceNameMappingFile
- The file to read/set the service name mappings in.- Returns:
- This
DataModelGenerator
for chained method calls.
-
withServiceNameMapping
The path to the properties file containing the service name mapping.Any service not mapped in this file will get created/updated.
- Parameters:
serviceNameMappingFile
- The file to read/set the service name mappings in.- Returns:
- This
DataModelGenerator
for chained method calls.
-
withNamingStrategy
Sets the class to use to convert OData names into suitable Java names.- Parameters:
namingStrategy
- Instance of a class, which must either implement theCodeNamingStrategy
interface, or extend a class which implements this interface.- Returns:
- This
DataModelGenerator
for chained method calls.
-
withNamingStrategy
Sets the class to use to convert OData names into suitable Java names.- Parameters:
namingStrategyClassName
- Fully-qualified name of a class, which must either implement theNamingStrategy
interface, or extend a class which implements this interface.- Returns:
- This
DataModelGenerator
for chained method calls.
-
withNameSource
Getter for the givenNameSource
.If the
namingStrategy
isS4HanaNamingStrategy
, this enum will be used to determine the actual source of the java name.- Parameters:
nameSource
- TheNameSource
to be used by theDefaulNamingStrategy
.- Returns:
- This
DataModelGenerator
for chained method calls.
-
withAnnotationStrategy
@Nonnull public DataModelGenerator withAnnotationStrategy(@Nonnull AnnotationStrategy annotationStrategy) Sets the class to use to provide generated Java classes with necessary annotations.- Parameters:
annotationStrategy
- Instance of a class, which must either implement theAnnotationStrategy
interface, or extend a class which implements this interface.- Returns:
- This
DataModelGenerator
for chained method calls.
-
withAnnotationStrategy
@Nonnull public DataModelGenerator withAnnotationStrategy(@Nonnull String annotationStrategyClassName) Sets the class to use to provide generated Java classes with necessary annotations.- Parameters:
annotationStrategyClassName
- Fully-qualified name of a class, which must either implement theAnnotationStrategy
interface, or extend a class which implements this interface.- Returns:
- This
DataModelGenerator
for chained method calls.
-
failOnWarning
Defines whether to exit with failure in case a warning occurs during processing.- Parameters:
failOnWarning
- Flag indicating whether to generate just the POJO classes.- Returns:
- This
DataModelGenerator
for chained method calls.
-
failOnWarning
The generator exists with failure in case a warning occurs during processing.- Returns:
- This
DataModelGenerator
for chained method calls.
-
pojosOnly
Defines whether to generate just the POJO classes (entities and complex types).- Parameters:
pojosOnly
- Flag indicating whether to generate just the POJO classes.- Returns:
- This
DataModelGenerator
for chained method calls.
-
pojosOnly
Activates POJO only generation, so just entity and complex type classes are generated.- Returns:
- This
DataModelGenerator
for chained method calls.
-
serviceMethodsPerEntitySet
The generator generates service methods for each entity set of one entity type. If this flag is not used, the generator generates service methods only for the first entity set of one entity type. All additional entity sets for the entity type are disregarded.- Parameters:
serviceMethodsPerEntitySet
- Flag indicating whether to generate service methods per entity set- Returns:
- This
DataModelGenerator
for chained method calls.
-
serviceMethodsPerEntitySet
The generator generates service methods for each entity set of one entity type.- Returns:
- This
DataModelGenerator
for chained method calls.
-
withExcludeFilePattern
The ant style filename pattern for which VDM should not be generated.- Parameters:
excludeFilePattern
- Provide the ant style pattern for filenames for which VDM should not be generated.- Returns:
- This
DataModelGenerator
for chained method calls.
-
linkToApiBusinessHub
Defines whether to generate API reference URLs linking to the SAP Business Accelerator Hub.- Parameters:
linkToApiBusinessHub
- Flag indicating whether to generate URLs.- Returns:
- This
DataModelGenerator
for chained method calls.
-
linkToApiBusinessHub
Activates generation of API reference URLs linking to the SAP Business Accelerator Hub.- Returns:
- This
DataModelGenerator
for chained method calls.
-
versionReference
Defines whether to generate the version reference of the used OData generator plugin.- Parameters:
versionReference
- Flag indicating whether to generate the comments.- Returns:
- This
DataModelGenerator
for chained method calls.
-
versionReference
Generate comments, which indicate the version of the used OData VDM generator plugin.- Returns:
- This
DataModelGenerator
for chained method calls.
-
copyrightHeader
Defines a copyright header to be placed at the beginning of generated files. Use an empty string if no header needs to be set. For setting SAP copyright headers .- Parameters:
copyrightHeader
- The copyright header to add to generated files.- Returns:
- This
DataModelGenerator
for chained method calls.
-
sapCopyrightHeader
Generate SAP copyright headers at the top of generated files.- Returns:
- This
DataModelGenerator
for chained method calls.
-
withIncludedEntitySets
Restricts the generated entity classes to the provided values, plus any dependent complex types. For navigation properties, the associated entity set names must be included in order to be generated.- Parameters:
includedEntitySets
- List of entity set names to generate classes for. These names must exist in the provided EDMX files in order to be recognized. If a null value is provided, then all entity sets will be generated.- Returns:
- This
DataModelGenerator
for chained method calls.
-
withIncludedFunctionImports
@Nonnull public DataModelGenerator withIncludedFunctionImports(@Nullable Set<String> includedFunctionImports) Restricts the generated function imports to the provided values, plus any dependent complex types. If the return type is an entity, then make sure to include its entity set name usingwithIncludedEntitySets(Set)
(or generate all entity sets). Otherwise the function import code cannot be generated.- Parameters:
includedFunctionImports
- List of function import names to generate code for. These names must exist in the provided EDMX files in order to be recognized. If a null value is provided, then all function imports will be generated.- Returns:
- This
DataModelGenerator
for chained method calls.
-
withIncludedActionImports
@Nonnull public DataModelGenerator withIncludedActionImports(@Nullable Set<String> includedActionImports) Restricts the generated action imports to the provided values, plus any dependent complex types. If the return type is an entity, then make sure to include its entity set name usingwithIncludedEntitySets(Set)
(or generate all entity sets). Otherwise the action import code cannot be generated.- Parameters:
includedActionImports
- List of action import names to generate code for. These names must exist in the provided EDMX files in order to be recognized. If a null value is provided, then all action imports will be generated.- Returns:
- This
DataModelGenerator
for chained method calls.
-
withDeprecationNotice
Generates deprecation notices for generated service,and it's implementation class- Parameters:
deprecationNotice
- The custom deprecation notice to be added- Returns:
- This
DataModelGenerator
for chained method calls
-
getNamingStrategy
-
execute
public void execute()Executes the actual generator based on the given parameter or, in case of absence, their default values. -
printExecuteInformation
protected void printExecuteInformation()Prints all information gathered in this builder. -
failureDueToWarningsNecessary
public boolean failureDueToWarningsNecessary()Get the failure indicator due to warning messages.- Returns:
- true if there where warning messages and the flag to fail was set.
-
getInputDirectory
-
getOutputDirectory
-
isDeleteTargetDirectory
public boolean isDeleteTargetDirectory() -
isForceFileOverride
public boolean isForceFileOverride() -
isKeepExistingSignatures
public boolean isKeepExistingSignatures() -
getPackageName
-
getDefaultBasePath
-
getServiceNameMappings
-
getNameSource
-
getAnnotationStrategy
-
isGeneratePojosOnly
public boolean isGeneratePojosOnly() -
getExcludeFilePattern
-
isGenerateLinksToApiBusinessHub
public boolean isGenerateLinksToApiBusinessHub() -
isGenerateVersionReference
public boolean isGenerateVersionReference() -
getCopyrightHeader
-
getIncludedEntitySets
-
getIncludedFunctionImports
-
getIncludedActionImports
-
isServiceMethodsPerEntitySet
public boolean isServiceMethodsPerEntitySet() -
getDeprecationNotice
-
isFailOnWarning
public boolean isFailOnWarning()The flag indicating whether the generator fails in case a warning occurs. True, if the generator fails on a warning; false otherwise.
-