-
Notifications
You must be signed in to change notification settings - Fork 50
Feat/service tasks #2277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bjorntore
wants to merge
8
commits into
master
Choose a base branch
from
feat/service-tasks
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feat/service tasks #2277
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5010b3f
First version of service task docs. Missing Studio docs.
bjorntore 5b43edb
Add some info about standard service tasks.
bjorntore cf06417
Adjust a sentence. Add diagram.
bjorntore c17ef14
Split in concept and guides.
bjorntore 9e16de7
Update service task code example.
bjorntore ad93e63
Update content/altinn-studio/guides/development/service-tasks/_index.…
bjorntore c241a12
Update content/altinn-studio/guides/development/service-tasks/intro.n…
bjorntore a369df4
Update code example.
bjorntore File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| --- | ||
| title: Prosess | ||
| linktitle: Prosess | ||
| description: Altinn apps har en forretningsprosess som er definert i filen process.bpmn. | ||
| tags: [prosess, oppgave, process, bpmn, tasks] | ||
| weight: 50 | ||
| aliases: | ||
| - /nb/altinn-studio/guides/process/ | ||
| --- | ||
|
|
||
|
|
||
| Det må defineres minimum én oppgave i denne prosessen, og nyopprettede apps kommer med en "data"-oppgave som standard. | ||
| Det er en oppgave hvor man skal samle inn data, enten via skjema i appen eller via API-kall. | ||
|
|
||
| Mer om prosessen i [referansedokumentasjonen](/nb/altinn-studio/reference/process). | ||
|
|
||
| ## Prosessoppgave (task) | ||
| Det er mulig å opprette sine egne prosessoppgaver, men det er sannsynlig at det kommer relativt store breaking changes på interfacet i neste major versjon (9.0). | ||
| Prosessoppgavene som følger med som standard, implementerer interfacet `IProcessTask`, og i prinsippet kan man lage egne implementasjoner av dette. | ||
| Det anbefales at man kontakter oss dersom dette anses som aktuelt. | ||
|
|
||
| ## Systemoppgave (service task) | ||
| {{% insert "content/altinn-studio/guides/development/service-tasks/intro.nb.md" %}} | ||
|
|
||
| [Slik gjør du det](/nb/altinn-studio/guides/development/service-tasks) |
20 changes: 20 additions & 0 deletions
20
content/altinn-studio/guides/development/service-tasks/_index.nb.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| --- | ||
| title: Hvordan konfigurere systemoppgaver i din Altinn-app | ||
| linktitle: Systemoppgaver | ||
| description: Nedenfor finner du veiledninger for systemoppgaver | ||
| tags: [systemoppgave, service task] | ||
| weight: 50 | ||
| --- | ||
|
|
||
| ## Standard | ||
|
|
||
| Det følger med noen standard systemoppgaver: | ||
|
|
||
| [Generere PDF](/nb/altinn-studio/guides/development/service-tasks/pdf) | ||
|
|
||
| [eFormidling](/nb/altinn-studio/guides/development/service-tasks/eformidling) | ||
|
|
||
| ## Egendefinert | ||
| Det er mulig å lage egne systemoppgaver og inkludere dem i prosessflyten. | ||
|
|
||
| [Slik gjør du det](/nb/altinn-studio/guides/development/service-tasks/custom) |
69 changes: 69 additions & 0 deletions
69
content/altinn-studio/guides/development/service-tasks/custom/_index.nb.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| --- | ||
| title: Egendefinert | ||
| tags: [altinn-apps, process, bpmn, task, service task, systemoppgave] | ||
| weight: 10 | ||
| alias: | ||
| --- | ||
|
|
||
| En egendefinert systemoppgave krever: | ||
| - En C#-implementasjon av interfacet `IServiceTask` | ||
| - Et nytt steg i prosessen | ||
| - Tilgangsstyring | ||
|
|
||
| ### Implementasjon i C# | ||
|
|
||
| ```csharp | ||
| using System.Threading.Tasks; | ||
| using Altinn.App.Core.Internal.Process.ProcessTasks.ServiceTasks; | ||
| using Altinn.App.Core.Models; | ||
| using Altinn.App.Models.model; | ||
| using Altinn.Platform.Storage.Interface.Models; | ||
|
|
||
| namespace Altinn.App.Code; | ||
|
|
||
| public class ExampleServiceTask : IServiceTask | ||
| { | ||
| public string Type => "exampleServiceTask"; | ||
|
|
||
| public async Task<ServiceTaskResult> Execute(ServiceTaskContext context) | ||
| { | ||
| Instance instance = context.InstanceDataMutator.Instance; | ||
| DataElement dataElement = instance.Data.Find(x => x.DataType == "model"); | ||
|
|
||
| var formData = (model) await context.InstanceDataMutator.GetFormData(new DataElementIdentifier(dataElement)); | ||
|
|
||
| if (formData.property1 != "true") | ||
| return new ServiceTaskFailedResult(); | ||
|
|
||
| return new ServiceTaskSuccessResult(); | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Legg til en serviceTask-node i BPMN-prosessen. | ||
| Verdien i taskType må være like Type-property på C#-implementasjonen. | ||
|
|
||
| ```xml | ||
| <bpmn:serviceTask id="ExampleServiceTask" name="Hilsen"> | ||
| <bpmn:extensionElements> | ||
| <altinn:taskExtension> | ||
| <altinn:taskType>exampleServiceTask</altinn:taskType> | ||
| </altinn:taskExtension> | ||
| </bpmn:extensionElements> | ||
| <bpmn:incoming>Flow_1yq6g64</bpmn:incoming> | ||
| <bpmn:outgoing>Flow_1xowpt0</bpmn:outgoing> | ||
| </bpmn:serviceTask> | ||
| ``` | ||
|
|
||
| ### Tilgangsstyring | ||
| Systemoppgaver kjører med rettighetene til den brukeren som driver prosessen videre (process next). Standard systemoppgaver autoriseres som `write`-operasjoner. For at brukeren skal ha rettigheter til å kjøre en egendefinert systemoppgave må `Type` fra implementasjonen legges inn som en action i policy.xml. | ||
|
|
||
| Legg den på samme sted som andre actions den relevante brukeren skal ha tilgang til. | ||
| ``` | ||
| <xacml:AllOf> | ||
| <xacml:Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case"> | ||
| <xacml:AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">exampleServiceTask</xacml:AttributeValue> | ||
| <xacml:AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false" /> | ||
| </xacml:Match> | ||
| </xacml:AllOf> | ||
| ``` | ||
25 changes: 25 additions & 0 deletions
25
content/altinn-studio/guides/development/service-tasks/eformidling/_index.nb.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| --- | ||
| title: eFormidling | ||
| tags: [altinn-apps, process, bpmn, task, service task, eformidling, systemoppgave] | ||
| weight: 10 | ||
| --- | ||
|
|
||
| En systemoppgave for å sende instansdata via eFormilding følger med appen som standard, og kan legges til som et steg i prosessen for å tas i bruk. | ||
|
|
||
| {{<notice warning>}} | ||
| Tidligere lå ikke denne funksjonaliteten i en systemoppgave, men var bakt inn i den grenerelle koden for å endre prosesssteg. Dersom appen din ble satt opp før versjon 8.7, så bør du deaktivere funksjonalitenen som kjøres utenfor prosessdefinisjonen. | ||
| {{</notice>}} | ||
|
|
||
| Slik legger du til eFormidling i prosessen: | ||
| ```xml | ||
| <bpmn:serviceTask id="Task_4" name="eFormidling"> | ||
| <bpmn:extensionElements> | ||
| <altinn:taskExtension> | ||
| <altinn:taskType>eFormidling</altinn:taskType> | ||
| </altinn:taskExtension> | ||
| </bpmn:extensionElements> | ||
| <bpmn:incoming>SequenceFlow_5assd2s</bpmn:incoming> | ||
| <bpmn:outgoing>SequenceFlow_2asasd1</bpmn:outgoing> | ||
| </bpmn:serviceTask> | ||
| ``` | ||
|
|
Binary file added
BIN
+36.1 KB
...altinn-studio/guides/development/service-tasks/example-service-task-process.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions
11
content/altinn-studio/guides/development/service-tasks/intro.nb.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --- | ||
| hidden: true | ||
| --- | ||
|
|
||
| {{%notice info%}} | ||
| Systemoppgaver krever minst versjon 8.7.0 av Altinn NuGet-pakkene. | ||
| {{%/notice%}} | ||
|
|
||
| En systemoppgave er en prosessoppgave som kjører automatisk på serveren. Prosessen går som hovedregel videre til neste steg når den har kjørt ferdig, men dette kan systemoppgaven definere selv. Eksempler på standard systemoppgaver PDF-generering og eFormidling. | ||
|
|
||
| Tjenesteeiere kan implementere sine egne systemoppgaver og legge de som steg i appens prosess. |
57 changes: 57 additions & 0 deletions
57
content/altinn-studio/guides/development/service-tasks/pdf/_index.nb.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| --- | ||
| title: PDF | ||
| tags: [altinn-apps, process, bpmn, task, service task, pdf, systemoppgave] | ||
| weight: 10 | ||
| --- | ||
|
|
||
| Generering av PDF følger med appen som en standard systemoppgave som kan legges til som et steg i prosessen. | ||
|
|
||
| {{<notice warning>}} | ||
| Tidligere lå ikke denne funksjonaliteten i en systemoppgave, men var bakt inn i den grenerelle koden for å endre prosesssteg. Dersom appen din ble satt opp før versjon 8.7, så bør du deaktivere funksjonalitenen som kjøres utenfor prosessdefinisjonen. | ||
|
|
||
| Det gjør du ved å slå av "enablePdfGeneration" på alle datatyper. | ||
| {{</notice>}} | ||
|
|
||
|
|
||
| Slik legger du til PDF-generering i prosessen: | ||
| ```xml | ||
| <bpmn:serviceTask id="Task_3" name="PDF"> | ||
| <bpmn:extensionElements> | ||
| <altinn:taskExtension> | ||
| <altinn:taskType>pdf</altinn:taskType> | ||
| <altinn:pdfConfig> | ||
| <altinn:filename>pdfFileNameTextResourceKey</altinn:filename> | ||
| </altinn:pdfConfig> | ||
| </altinn:taskExtension> | ||
| </bpmn:extensionElements> | ||
| <bpmn:incoming>SequenceFlow_0c458hu</bpmn:incoming> | ||
| <bpmn:outgoing>SequenceFlow_5assd2s</bpmn:outgoing> | ||
| </bpmn:serviceTask> | ||
| ``` | ||
|
|
||
| Innholdet i PDF-en definerer du ved å opprette et layout-set for systemoppgaven, på samme måte som for andre prosessoppgaver. | ||
| ```json | ||
| { | ||
| "$schema": "https://altinncdn.no/toolkits/altinn-app-frontend/4/schemas/json/layout/layout.schema.v1.json", | ||
| "data": { | ||
| "layout": [ | ||
| { | ||
| "id": "SummaryTask1", | ||
| "type": "Summary2", | ||
| "target": { | ||
| "type": "layoutSet", | ||
| "taskId": "Task_1" | ||
| } | ||
| }, | ||
| { | ||
| "id": "SummaryTask2", | ||
| "type": "Summary2", | ||
| "target": { | ||
| "type": "layoutSet", | ||
| "taskId": "Task_2" | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Front-matter key typo breaks Hugo aliases
The front-matter uses
alias:instead of the expectedaliases:array. Hugo will silently ignore this, so canonical/old URLs won’t redirect.📝 Committable suggestion
🤖 Prompt for AI Agents