From 94e8a3af38d746d89d0be86c275ff1eed40cde6f Mon Sep 17 00:00:00 2001
From: Johannes Hoermann <j.hoermann@adito.de>
Date: Wed, 13 Feb 2019 11:04:09 +0100
Subject: [PATCH] Documentation for Provider Consumer Parameter

---
 others/guide/ProviderConsumerParameter.adoc | 92 +++++++++++++++++++++
 1 file changed, 92 insertions(+)
 create mode 100644 others/guide/ProviderConsumerParameter.adoc

diff --git a/others/guide/ProviderConsumerParameter.adoc b/others/guide/ProviderConsumerParameter.adoc
new file mode 100644
index 0000000000..67b427e998
--- /dev/null
+++ b/others/guide/ProviderConsumerParameter.adoc
@@ -0,0 +1,92 @@
+Provider - Consumer
+===================
+:toc2: left
+:numbered:
+
+=== Provider ===
+Is the old dfi.
+
+==== Purpose ====
+The provider provides access to an entity.
+You can get data of another entity by connecting a consumer to a provider.
+
+==== Naming ====
+The names should provide information about *what the provider provides*.
+
+For example:
+Communication_entity has 3 providers:
+
+- *AllCommunications*
+- *EmailCommunications*
+- *PhoneCommunications*
+
+If you connect to *AllCommunications* you get *all* communication types of a contact.
+If you connect to *EmailCommunications* you get *only the Email* communication type of a contact.
+If you connect to *PhoneCommunications* you get *only the Phone* communication type of a contact.
+
+*Important:*
+*Do not always create a new provider when connecting a new entity. Maybe u can use an already existing provider.*
+*Try to reuse providers if you need similar data for two dependencies*
+
+=== Consumer ===
+Is the old dfo.
+
+=== Purpose ===
+The Consumer *consumes* the data a provider provides.
+It can be connected to a provider and fill the parameters of the provider.
+
+=== Naming ===
+Most of the time you get a list of "something" so you should call it the plural of what you get.
+
+Example:
+Persons
+Organisations
+
+If you have two Consumer to the same Entity, you should use speaking names. 
+
+Example:
+Documents (e.g. for all documents of a person)
+MainDocuments (e.g. for only the main documents of a person)
+
+If you know you get only one row, you can use the singular.
+
+Example:
+Person
+
+=== Parameter ===
+Parameters provide a way to tell a provider *what exactly you need*.
+
+==== Properties ====
+The most important properties are
+code, exposed, triggerRecalculation and mandatory
+
+Parameters work with a fallback mechanism.
+This means that if you set the code on the parameter directly then this is executed *only if you did not* provide the code on the parameter at the *provider* and/or *consumer*.
+Likewise if you set the code on a parameter at the provider it will only be executed if a *consumer* which connects to this provider *has no code set* at the parameter.
+
+Here some examples for the *code* property:
+
+[options="header"]
+|========================================================================================================================================================================================================================================================
+| Parameter | Provider | Consumer | Result                       | Notes                                                                                                                                                                                 
+| default   | default  | default  | Nothing executed             |                                                                                                                                                                                       
+| default   | default  | code set | Code from consumer executed  | This is the mostly used  scenario.                                                                                                                                                    
+| default   | code set | default  | Code from provider executed  | This is used if you need a default value for a parameter which is different on each provider. e.g. used by the Document_entity to determine if it should show main documents or not.  
+| code set  | default  | default  | Code from parameter executed |                                                                                                                                                                                       
+|========================================================================================================================================================================================================================================================
+
+The checkbox-parameters can have *three* states: default, checked, unchecked. Default means the property is *gray* and the value from the previous instance is used. Checked and unchecked overwrite always the previous instance.
+
+The exposed property is a way to decide if a parameter should be visible by the next instance
+Here some examples for the *exposed* property:
+
+[options="header"]
+|========================================================================================================================================================
+| Parameter | Provider | Result      | Notes                                                                                                             
+| default   | default  | NOT Exposed | because the default for exposed is: NOT exposed. -> the parameter won't be visible on the provider and consumer! 
+| set       | set      | Exposed     | This means that the parameter can be set by the consumer.                                                         
+| set       | UNset    | NOT Exposed | This will disable the parameter for one specific provider.                                                        
+| set       | default  | Exposed     |                                                                                                                   
+|========================================================================================================================================================
+
+*Note that there are currently (13.02.2019) some bugs and the handling of parameters with the default #PROVIDER may change.*
\ No newline at end of file
-- 
GitLab