public class CsdlDocument
extends java.lang.Object
Constructor and Description |
---|
CsdlDocument() |
Modifier and Type | Method and Description |
---|---|
void |
addOwner(java.lang.Object owner)
Register
owner as an owner of this metadata document. |
AnnotationTermMap |
getAnnotationTerms()
Map of annotation terms defined by the CSDL.
|
DataTypeMap |
getBuiltinTypes()
Map of predefined CSDL data types.
|
boolean |
getCanChangeAnything()
Allows any model element to be changed in the latest service metadata before calling
DataService.refreshMetadata . |
boolean |
getCanRemoveAnything()
Allows any model element to be removed in the latest service metadata before calling
DataService.refreshMetadata . |
ComplexType |
getComplexType(java.lang.String name)
Lookup a complex type by qualified name.
|
ComplexTypeMap |
getComplexTypes()
Map of complex types defined by the CSDL.
|
DataMethod |
getDataMethod(java.lang.String name)
Lookup a data method by qualified name (for function/action definitions) or by unqualified name (for function/action imports).
|
DataMethodMap |
getDataMethods()
Map of data methods (actions, functions) defined by the CSDL.
|
DataSchema |
getDataSchema(java.lang.String name)
Lookup a data schema by name.
|
DataSchemaMap |
getDataSchemas()
Map of data schemas defined by the CSDL.
|
EntityContainer |
getDefaultContainer()
(nullable) Default entity container defined by the CSDL (or
null if there are no containers defined). |
EntityContainerMap |
getEntityContainers()
Map of entity containers defined by the CSDL.
|
EntitySet |
getEntitySet(java.lang.String name)
Lookup an entity set (or singleton entity) by name.
|
EntitySetMap |
getEntitySets()
Map of entity sets defined by the CSDL.
|
EntityType |
getEntityType(java.lang.String name)
Lookup an entity type by qualified name.
|
EntityTypeMap |
getEntityTypes()
Map of entity types defined by the CSDL.
|
EnumType |
getEnumType(java.lang.String name)
Lookup an enum type by qualified name.
|
EnumTypeMap |
getEnumTypes()
Map of enum types defined by the CSDL.
|
DataMethodMap |
getLookupMethods()
For internal use only.
|
EntitySetMap |
getLookupSets()
For internal use only.
|
EntitySetMap |
getLookupSingletons()
For internal use only.
|
DataSchema |
getMainSchema()
(nullable) Main data schema defined by the CSDL (or
null if there are no schemas defined). |
java.lang.String |
getOriginalText()
(nullable) Original CSDL (XML) text.
|
ObjectList |
getOwners()
Return all the current registered owners of this metadata document.
|
PathAnnotationsMap |
getPathAnnotations()
Map of path annotations defined by the CSDL (where the
TargetPath does not directly reference a model element). |
java.lang.String |
getProxyVersion()
(nullable) If this metadata was parsed by generated proxy classes, then the framework version that generated the proxies.
|
java.lang.String |
getResolvedText()
(nullable) Resolved CSDL (XML) text, with inline references and expanded aliases.
|
SimpleType |
getSimpleType(java.lang.String name)
Lookup a simple type by qualified name.
|
SimpleTypeMap |
getSimpleTypes()
Map of simple types defined by the CSDL.
|
EntitySet |
getSingleton(java.lang.String name)
Lookup a singleton entity by name.
|
EntitySetMap |
getSingletons()
Map of singletons defined by the CSDL.
|
DataSchemaList |
getTopSchemas()
Top-level schemas defined by the CSDL (empty if there are no schemas defined).
|
int |
getVersionCode()
Code for the OData version, e.g.
|
java.lang.String |
getVersionText()
Text for the OData version, e.g.
|
StringMap |
getXmlNamespaces()
Map of XML namespaces defined by the CSDL.
|
boolean |
hasGeneratedProxies()
true if this metadata is associated with generated proxy classes. |
boolean |
hasOpenEnumerations()
Allows addition of enumeration members in the latest service metadata before calling
DataService.refreshMetadata . |
void |
removeOwner(java.lang.Object owner)
Unregister
owner as an owner of this metadata document. |
void |
resolveEntity(EntityValue entity)
Resolve the
EntityValue.entitySet of `entity' (if it is not already set). |
void |
setCanChangeAnything(boolean value)
Allows any model element to be changed in the latest service metadata before calling
DataService.refreshMetadata . |
void |
setCanRemoveAnything(boolean value)
Allows any model element to be removed in the latest service metadata before calling
DataService.refreshMetadata . |
void |
setDefaultContainer(EntityContainer value)
Default entity container defined by the CSDL (or
null if there are no containers defined). |
void |
setGeneratedProxies(boolean value)
true if this metadata is associated with generated proxy classes. |
void |
setMainSchema(DataSchema value)
Main data schema defined by the CSDL (or
null if there are no schemas defined). |
void |
setOpenEnumerations(boolean value)
Allows addition of enumeration members in the latest service metadata before calling
DataService.refreshMetadata . |
void |
setOriginalText(java.lang.String value)
Original CSDL (XML) text.
|
void |
setProxyVersion(java.lang.String value)
If this metadata was parsed by generated proxy classes, then the framework version that generated the proxies.
|
void |
setResolvedText(java.lang.String value)
Resolved CSDL (XML) text, with inline references and expanded aliases.
|
void |
setTopSchemas(DataSchemaList value)
Top-level schemas defined by the CSDL (empty if there are no schemas defined).
|
void |
setVersionCode(int value)
Code for the OData version, e.g.
|
void |
setVersionText(java.lang.String value)
Text for the OData version, e.g.
|
public void addOwner(java.lang.Object owner)
Register owner
as an owner of this metadata document.
owner
- Metadata owner.public AnnotationTermMap getAnnotationTerms()
Map of annotation terms defined by the CSDL.
public DataTypeMap getBuiltinTypes()
Map of predefined CSDL data types.
public boolean getCanChangeAnything()
Allows any model element to be changed in the latest service metadata before calling DataService.refreshMetadata
. Defaults to false
.
Warning: enabling this option can result in application instability (depending on the changes) if the application uses proxy classes!
public boolean getCanRemoveAnything()
Allows any model element to be removed in the latest service metadata before calling DataService.refreshMetadata
. Defaults to false
.
Warning: enabling this option can result in application instability unless the application checks isRemoved
flags on model elements!
public ComplexType getComplexType(java.lang.String name)
Lookup a complex type by qualified name. If the complex type does not exist it indicates a fundamental implementation problem,
therefore a non-catchable FatalException
will be thrown, and the app intentionally crashes.
The reason behind this drastic behaviour is to avoid mismatch between server and client.
It is still possible to avoid the FatalException
by looking up simplet types before calling this method like in the
following code snippet:
public void checkComplexTypeExistsExample() { com.sap.client.odata.v4.csdl.CsdlDocument csdlDocument = this.getService() .getMetadata(); if (csdlDocument.getComplexTypes() .has("Microsoft.OData.Service.Sample.TrippinInMemory.Models.EventLocation")) { Ignore.valueOf_any(csdlDocument.getComplexType("Microsoft.OData.Service.Sample.TrippinInMemory.Models.EventLocation")); } else { } }
CsdlDocument.complexTypes
, for looking up types that might not exist.
name
- Name of the complex type to be returned.public ComplexTypeMap getComplexTypes()
Map of complex types defined by the CSDL.
public DataMethod getDataMethod(java.lang.String name)
Lookup a data method by qualified name (for function/action definitions) or by unqualified name (for function/action imports).
If the data method does not exist it indicates a fundamental implementation problem, therefore a non-catchable
FatalException
will be thrown, and the app intentionally crashes.
The reason behind this drastic behaviour is to avoid mismatch between server and client.
It is still possible to avoid the FatalException
by looking up data methods before calling this method like in the
following code snippet:
public void checkDataMethodInCsdlDocumentExistsExample() { com.sap.client.odata.v4.csdl.CsdlDocument csdlDocument = this.getService() .getMetadata(); if (csdlDocument.getLookupMethods() .has("Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person.UpdatePersonLastName")) { Ignore.valueOf_any(csdlDocument.getDataMethod("Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person.UpdatePersonLastName")); } else { } }
CsdlDocument.dataMethods
, for looking up methods that might not exist.
name
- Name of the data method to be returned.public DataMethodMap getDataMethods()
Map of data methods (actions, functions) defined by the CSDL.
public DataSchema getDataSchema(java.lang.String name)
Lookup a data schema by name. If the data schema does not exist it indicates a fundamental
implementation problem, therefore a non-catchable FatalException
will be thrown, and the app intentionally crashes.
The reason behind this drastic behaviour is to avoid mismatch between server and client.
It is still possible to avoid the FatalException
by looking up data schemas before calling this method like in the
following code snippet:
public void checkDataSchemaExistsExample() { com.sap.client.odata.v4.csdl.CsdlDocument csdlDocument = this.getService() .getMetadata(); if (csdlDocument.getDataSchemas() .has("Microsoft.OData.Service.Sample.TrippinInMemory.Models")) { Ignore.valueOf_any(csdlDocument.getDataSchema("Microsoft.OData.Service.Sample.TrippinInMemory.Models")); } else { } }
CsdlDocument.dataSchemas
, for looking up schemas that might not exist.
name
- Name of the data schema to be returned.public DataSchemaMap getDataSchemas()
Map of data schemas defined by the CSDL.
public EntityContainer getDefaultContainer()
(nullable) Default entity container defined by the CSDL (or null
if there are no containers defined).
public EntityContainerMap getEntityContainers()
Map of entity containers defined by the CSDL.
public EntitySet getEntitySet(java.lang.String name)
Lookup an entity set (or singleton entity) by name. If the entity set does not exist it indicates a fundamental implementation problem,
therefore a non-catchable FatalException
will be thrown, and the app intentionally crashes.
The reason behind this drastic behaviour is to avoid mismatch between server and client.
It is still possible to avoid the FatalException
by looking up simplet types before calling this method like in the
following code snippet:
Note that OData singleton entities are represented by entity sets where EntitySet.isSingleton
is true
.
public void checkEntitySetInCsdlDocumentExistsExample() { com.sap.client.odata.v4.csdl.CsdlDocument csdlDocument = this.getService() .getMetadata(); if (csdlDocument.getEntitySets() .has("Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airlines")) { Ignore.valueOf_any(csdlDocument.getEntitySet("Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airlines")); } else { } }
CsdlDocument.entitySets
, for looking up sets that might not exist.
name
- Name of the entity set to be returned.public EntitySetMap getEntitySets()
Map of entity sets defined by the CSDL.
public EntityType getEntityType(java.lang.String name)
Lookup an entity type by qualified name. If the entity type does not exist it indicates a fundamental implementation problem,
therefore a non-catchable FatalException
will be thrown, and the app intentionally crashes.
The reason behind this drastic behaviour is to avoid mismatch between server and client.
It is still possible to avoid the FatalException
by looking up simplet types before calling this method like in the
following code snippet:
public void checkEntityTypeExistsExample() { com.sap.client.odata.v4.csdl.CsdlDocument csdlDocument = this.getService() .getMetadata(); if (csdlDocument.getEntityTypes() .has("Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airport")) { Ignore.valueOf_any(csdlDocument.getEntityType("Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airport")); } else { } }
CsdlDocument.entityTypes
, for looking up types that might not exist.
name
- Name of the entity type to be returned.public EntityTypeMap getEntityTypes()
Map of entity types defined by the CSDL.
public EnumType getEnumType(java.lang.String name)
Lookup an enum type by qualified name. If the enum type does not exist it indicates a fundamental implementation problem,
therefore a non-catchable FatalException
will be thrown, and the app intentionally crashes.
The reason behind this drastic behaviour is to avoid mismatch between server and client.
It is still possible to avoid the FatalException
by looking up simplet types before calling this method like in the
following code snippet:
public void checkEnumTypeExistsExample() { com.sap.client.odata.v4.csdl.CsdlDocument csdlDocument = this.getService() .getMetadata(); if (csdlDocument.getEnumTypes() .has("Microsoft.OData.Service.Sample.TrippinInMemory.Models.PersonGender")) { Ignore.valueOf_any(csdlDocument.getEnumType("Microsoft.OData.Service.Sample.TrippinInMemory.Models.PersonGender")); } else { } }
CsdlDocument.enumTypes
, for looking up types that might not exist.
name
- Name of the enum type to be returned.public EnumTypeMap getEnumTypes()
Map of enum types defined by the CSDL.
public DataMethodMap getLookupMethods()
For internal use only.
public EntitySetMap getLookupSets()
For internal use only.
public EntitySetMap getLookupSingletons()
For internal use only.
public DataSchema getMainSchema()
(nullable) Main data schema defined by the CSDL (or null
if there are no schemas defined).
public java.lang.String getOriginalText()
(nullable) Original CSDL (XML) text.
CsdlOption.RETAIN_ORIGINAL_TEXT.
public ObjectList getOwners()
Return all the current registered owners of this metadata document.
public PathAnnotationsMap getPathAnnotations()
Map of path annotations defined by the CSDL (where the TargetPath
does not directly reference a model element).
public java.lang.String getProxyVersion()
(nullable) If this metadata was parsed by generated proxy classes, then the framework version that generated the proxies. Otherwise null
.
public java.lang.String getResolvedText()
(nullable) Resolved CSDL (XML) text, with inline references and expanded aliases.
CsdlOption.RETAIN_RESOLVED_TEXT.
public SimpleType getSimpleType(java.lang.String name)
Lookup a simple type by qualified name. If the simple type does not exist it indicates a fundamental implementation problem,
therefore a non-catchable FatalException
will be thrown, and the app intentionally crashes.
The reason behind this drastic behaviour is to avoid mismatch between server and client.
It is still possible to avoid the FatalException
by looking up simplet types before calling this method like in the
following code snippet:
public void checkSimpleTypeExistsExample() { com.sap.client.odata.v4.csdl.CsdlDocument csdlDocument = this.getService() .getMetadata(); if (csdlDocument.getSimpleTypes() .has("Microsoft.OData.Service.Sample.TrippinInMemory.Models.MySimpleType")) { Ignore.valueOf_any(csdlDocument.getSimpleType("Microsoft.OData.Service.Sample.TrippinInMemory.Models.MySimpleType")); } else { } }
CsdlDocument.simpleTypes
, for looking up types that might not exist.
name
- Name of the simple type to be returned.public SimpleTypeMap getSimpleTypes()
Map of simple types defined by the CSDL.
public EntitySet getSingleton(java.lang.String name)
Lookup a singleton entity by name. If the singleton entity does not exist it indicates a fundamental implementation problem,
therefore a non-catchable FatalException
will be thrown, and the app intentionally crashes.
The reason behind this drastic behaviour is to avoid mismatch between server and client.
It is still possible to avoid the FatalException
by looking up simplet types before calling this method like in the
following code snippet:
Note that OData singleton entities are represented by entity sets where EntitySet.isSingleton
is true
.
public void checkSingletonExistsExample() { com.sap.client.odata.v4.csdl.CsdlDocument csdlDocument = this.getService() .getMetadata(); if (csdlDocument.getSingletons() .has("Microsoft.OData.Service.Sample.TrippinInMemory.Models.Container/Me")) { Ignore.valueOf_any(csdlDocument.getSingleton("Microsoft.OData.Service.Sample.TrippinInMemory.Models.Container/Me")); } else { } }
CsdlDocument.entitySets
, for looking up sets that might not exist.
name
- Name of the entity set to be returned.public EntitySetMap getSingletons()
Map of singletons defined by the CSDL.
Each singleton is represented by an EntitySet
with isSingleton == true
public DataSchemaList getTopSchemas()
Top-level schemas defined by the CSDL (empty if there are no schemas defined).
public int getVersionCode()
Code for the OData version, e.g. 400. If the OData version is considered as a decimal number (e.g. 4.0), then multiplying by 100 will give the code (e.g. 400).
public java.lang.String getVersionText()
Text for the OData version, e.g. "4.0".
public StringMap getXmlNamespaces()
Map of XML namespaces defined by the CSDL.
public boolean hasGeneratedProxies()
true
if this metadata is associated with generated proxy classes. Defaults to false
(generated proxies will override to true
).
public boolean hasOpenEnumerations()
Allows addition of enumeration members in the latest service metadata before calling DataService.refreshMetadata
. Defaults to false
.
Warning: enabling this option can result in application instability if the application uses proxy classes without "-open:enumerations".
public void removeOwner(java.lang.Object owner)
Unregister owner
as an owner of this metadata document.
owner
- Metadata owner.public void resolveEntity(EntityValue entity)
Resolve the EntityValue.entitySet
of `entity' (if it is not already set).
DataServiceException
if entity.entitySet
is not set, and is not unique (i.e. multiple entity sets use the same entity type).
entity
- Entity to resolve.public void setCanChangeAnything(boolean value)
Allows any model element to be changed in the latest service metadata before calling DataService.refreshMetadata
. Defaults to false
.
Warning: enabling this option can result in application instability (depending on the changes) if the application uses proxy classes!
public void setCanRemoveAnything(boolean value)
Allows any model element to be removed in the latest service metadata before calling DataService.refreshMetadata
. Defaults to false
.
Warning: enabling this option can result in application instability unless the application checks isRemoved
flags on model elements!
public void setDefaultContainer(EntityContainer value)
Default entity container defined by the CSDL (or null
if there are no containers defined).
public void setGeneratedProxies(boolean value)
true
if this metadata is associated with generated proxy classes. Defaults to false
(generated proxies will override to true
).
public void setMainSchema(DataSchema value)
Main data schema defined by the CSDL (or null
if there are no schemas defined).
public void setOpenEnumerations(boolean value)
Allows addition of enumeration members in the latest service metadata before calling DataService.refreshMetadata
. Defaults to false
.
Warning: enabling this option can result in application instability if the application uses proxy classes without "-open:enumerations".
public void setOriginalText(java.lang.String value)
Original CSDL (XML) text.
CsdlOption.RETAIN_ORIGINAL_TEXT.
public void setProxyVersion(java.lang.String value)
If this metadata was parsed by generated proxy classes, then the framework version that generated the proxies. Otherwise null
.
public void setResolvedText(java.lang.String value)
Resolved CSDL (XML) text, with inline references and expanded aliases.
CsdlOption.RETAIN_RESOLVED_TEXT.
public void setTopSchemas(DataSchemaList value)
Top-level schemas defined by the CSDL (empty if there are no schemas defined).
public void setVersionCode(int value)
Code for the OData version, e.g. 400. If the OData version is considered as a decimal number (e.g. 4.0), then multiplying by 100 will give the code (e.g. 400).
public void setVersionText(java.lang.String value)
Text for the OData version, e.g. "4.0".