Skip to content

Commit

Permalink
Temporal: example for timeline with object key (#154)
Browse files Browse the repository at this point in the history
* Example for timeline with object key

* Fixed typo

* Cleanup
  • Loading branch information
ralfhandl authored Sep 16, 2021
1 parent 92dc874 commit 122dff8
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 0 deletions.
78 changes: 78 additions & 0 deletions examples/Org.OData.Temporal.V1.objectkey-sample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"$Version": "4.0",
"$Reference": {
"https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Core.V1.json": {
"$Include": [
{
"$Namespace": "Org.OData.Core.V1",
"$Alias": "Core"
}
]
},
"https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Temporal.V1.json": {
"$Include": [
{
"$Namespace": "Org.OData.Temporal.V1",
"$Alias": "Temporal"
}
]
}
},
"org.example.odata.costcenter": {
"$Alias": "this",
"CostCenter": {
"$Kind": "EntityType",
"$Key": [
"AreaID",
"ID",
"ValidTo"
],
"AreaID": {},
"ID": {},
"ValidTo": {
"$Type": "Edm.Date"
},
"ValidFrom": {
"$Type": "Edm.Date"
},
"ProfitCenterID": {
"$Nullable": true
},
"DepartmentID": {
"$Nullable": true
}
},
"Default": {
"$Kind": "EntityContainer",
"CostCenters": {
"$Collection": true,
"$Type": "this.CostCenter"
}
},
"$Annotations": {
"this.Default/CostCenters": {
"@Temporal.ApplicationTimeSupport": {
"UnitOfTime": {
"@odata.type": "https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Temporal.V1.xml#Temporal.UnitOfTimeDate",
"ClosedClosedPeriods": true
},
"Timeline": {
"@odata.type": "https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Temporal.V1.xml#Temporal.TimelineVisible",
"PeriodStart": "ValidFrom",
"PeriodEnd": "ValidTo",
"ObjectKey": [
"AreaID",
"ID"
]
},
"SupportedActions": [
"Temporal.Update",
"Temporal.Upsert",
"Temporal.Delete"
]
}
}
}
},
"$EntityContainer": "org.example.odata.costcenter.Default"
}
64 changes: 64 additions & 0 deletions examples/Org.OData.Temporal.V1.objectkey-sample.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
<edmx:Reference Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Core.V1.xml">
<edmx:Include Namespace="Org.OData.Core.V1" Alias="Core" />
</edmx:Reference>
<edmx:Reference Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Temporal.V1.xml">
<edmx:Include Alias="Temporal" Namespace="Org.OData.Temporal.V1" />
</edmx:Reference>
<edmx:DataServices>
<Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Alias="this" Namespace="org.example.odata.costcenter">

<EntityType Name="CostCenter">
<Key>
<PropertyRef Name="AreaID" />
<PropertyRef Name="ID" />
<PropertyRef Name="ValidTo" />
</Key>
<Property Name="AreaID" Type="Edm.String" Nullable="false" />
<Property Name="ID" Type="Edm.String" Nullable="false" />
<Property Name="ValidTo" Type="Edm.Date" Nullable="false" />

<Property Name="ValidFrom" Type="Edm.Date" Nullable="false" />
<Property Name="ProfitCenterID" Type="Edm.String" />
<Property Name="DepartmentID" Type="Edm.String" />
</EntityType>

<EntityContainer Name="Default">
<EntitySet Name="CostCenters" EntityType="this.CostCenter" />
</EntityContainer>

<Annotations Target="this.Default/CostCenters">
<Annotation Term="Temporal.ApplicationTimeSupport">
<Record>
<PropertyValue Property="UnitOfTime">
<Record Type="Temporal.UnitOfTimeDate">
<PropertyValue Property="ClosedClosedPeriods" Bool="true" />
</Record>
</PropertyValue>
<PropertyValue Property="Timeline">
<Record Type="Temporal.TimelineVisible">
<PropertyValue Property="PeriodStart" PropertyPath="ValidFrom" />
<PropertyValue Property="PeriodEnd" PropertyPath="ValidTo" />
<PropertyValue Property="ObjectKey">
<Collection>
<PropertyPath>AreaID</PropertyPath>
<PropertyPath>ID</PropertyPath>
</Collection>
</PropertyValue>
</Record>
</PropertyValue>
<PropertyValue Property="SupportedActions">
<Collection>
<String>Temporal.Update</String>
<String>Temporal.Upsert</String>
<String>Temporal.Delete</String>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>

</Schema>
</edmx:DataServices>
</edmx:Edmx>

0 comments on commit 122dff8

Please sign in to comment.