Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions node.js/cds-reflect.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ let m = cds.linked`
entity Books {...}
entity Authors {...}
`

// Function nature
let { Books, Authors } = m.entities ('my.bookshop')


// Object nature (uses the model's top-level namespace)
let { Books, Authors } = m.entities
// Object nature
let { 'my.bookshop.Books': Books, 'my.bookshop.Authors': Authors } = m.entities

// Array nature
for (let each of m.entities) console.log (each.name)
Expand Down
46 changes: 26 additions & 20 deletions node.js/fiori.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@ See [Cookbook > Serving UIs > Draft Support](../advanced/fiori#draft-support) fo
[[toc]]



<!--
## Serving `$metadata` Requests
-->



<!--
## Serving `$batch` Requests

-->



## Draft Entities {#draft-support}

Draft-enabled entities have corresponding CSN entities for drafts:
Expand Down Expand Up @@ -135,6 +139,7 @@ srv.on('someAction', [ MyEntity, MyEntity.drafts ], /*...*/)
```



## Draft Locks

To prevent inconsistency, the entities with draft are locked for modifications by other users. The lock is released when the draft is saved, canceled or a timeout is hit. The default timeout is 15 minutes. You can configure this timeout by the following application configuration property:
Expand All @@ -153,6 +158,7 @@ If the `draft_lock_timeout` has been reached, every user can delete other users'
:::



## Draft Timeouts

Inactive drafts are deleted automatically after the default timeout of 30 days. You can configure or deactivate this timeout by the following configuration:
Expand All @@ -178,43 +184,42 @@ It can occur that inactive drafts are still in the database after the configured
:::


## Bypassing Drafts
Creating or modifying active instances directly is possible without creating drafts. This comes in handy when technical services without a UI interact with each other.

To enable this feature, set this feature flag in your configuration:
## Bypassing Drafts {.deprecated}

Use [Direct CRUD](#direct-crud) instead.

Until the next major release (`cds10`), you can still activate the draft bypass without also allowing direct CRUD via <Config>cds.fiori.bypass_draft:true</Config>.

```json
{
"cds": {
"fiori": {
"bypass_draft": true
}
}
}
```

You can then create active instances directly:

## Direct CRUD <Beta />

With <Config>cds.fiori.direct_crud:true</Config>, creating or modifying active instances directly is possible without creating drafts.
This comes in handy when technical services without a UI interact with each other.

That is, you can then create and modify active instances directly:

```http
POST /Books

{
"ID": 123,
"IsActiveEntity": true
"ID": 123
}
```

You can modify them directly:

```http
PATCH /Books(ID=123,IsActiveEntity=true)
PATCH /Books(ID=123)

{
"title": "How to be more active"
}
```

This feature is required to enable [SAP Fiori Elements Mass Edit](https://sapui5.hana.ondemand.com/sdk/#/topic/965ef5b2895641bc9b6cd44f1bd0eb4d.html), allowing users to change multiple objects with the
For this, the default draft creation behavior by SAP Fiori Elements is redirected to a collection-bound action via annotation `@Common.DraftRoot.NewAction`.
The thereby freed `POST` request to draft roots without specifying `IsActiveEntity` leads to the creation of an active instance (as it would without draft enablement).

The feature is required to enable [SAP Fiori Elements Mass Edit](https://sapui5.hana.ondemand.com/sdk/#/topic/965ef5b2895641bc9b6cd44f1bd0eb4d.html), allowing users to change multiple objects with the
same editable properties without creating drafts for each row.

:::warning Additional entry point
Expand All @@ -223,6 +228,7 @@ payloads rather than the complete business object.
:::



## Programmatic APIs <Beta />

You can programmatically invoke draft actions with the following APIs:
Expand Down