# Déclaration d'un graphe de workflow
Le cycle présenté est un cycle standard de rédaction d'article de presse :
- Le Smart Element est rédigé par un rédacteur.
 - Il est ensuite soumis à un contrôle : "Vérification".
 - Suite à ce contrôle, le vérificateur peut :
- accepter l'article,
 - le renvoyer en rédaction
 
 - Une fois l'article vérifié, il peut être :
- diffusé
 - abandonné
 
 - Pendant la publication, l'article peut être :
- abandonné
 - donné à l'impression
 
 - Impression est l'étape finale
 
La définition d'un graphe se fait via un fichier XML de configuration qui suit le schéma
https://platform.anakeen.com/4/schemas/workflow/1.0.
Fichier : vendor/My/SmartStructures/MyWorkflow/MyArticleGraph.xml
<smart:config
    xmlns:smart="https://platform.anakeen.com/4/schemas/smart/1.0"
    xmlns:workflow="https://platform.anakeen.com/4/schemas/workflow/1.0">
    <workflow:graph ns="MY" name="ArticleGraph" label="Cycle de publication">
        <workflow:steps>
            <workflow:step name="start" state-label="Initialisé" activity-label="Rédaction" initial="true"/>
            <workflow:step name="control" state-label="Rédigé" activity-label="Vérification"/>
            <workflow:step name="published" state-label="Publié" activity-label="Publication"/>
            <workflow:step name="printed" state-label="Imprimé"/>
            <workflow:step name="rejected" state-label="Rejeté"/>
        </workflow:steps>
        <workflow:transitions>
            <workflow:transition name="transmission" from="start" to="control" label="Transmettre"/>
            <workflow:transition name="correcting" from="control" to="start" label="Corriger"/>
            <workflow:transition name="rejecting" from="control" to="rejected" label="Abandonner"/>
            <workflow:transition name="publishing" from="control" to="published" label="Diffuser"/>
            <workflow:transition name="rejecting" from="published" to="rejected" label="Abandonner"/>
            <workflow:transition name="printing" from="published" to="printed" label="Imprimer"/>
        </workflow:transitions>
    </workflow:graph>
</smart:config>
Les étapes sont définis dans les balises graph/steps/step :
graph/steps/step/@name: la référence de l'étapegraph/steps/step/@state-label: le libellé par défaut de l'étatgraph/steps/step/@activity-label: le libellé par défaut de l'activitégraph/steps/step/@initial:truepour indiquer l'étape initiale
Les transitions sont définies dans les balises graph/transitions/transition :
graph/transitions/transition/@name: la référence de la transitiongraph/transitions/transition/@label: la libellé par défaut de la transitiongraph/transitions/transition/@from: la référence à l'étape de départgraph/transitions/transition/@to: la référence à l'étape d'arrivée