diff --git a/entity/AttributeUsage_entity/AttributeUsage_entity.aod b/entity/AttributeUsage_entity/AttributeUsage_entity.aod index f585a185e5427229444a837f3d15b2e53e9b7dbd..606005be564855829aea148394eda4eca3fc2b0c 100644 --- a/entity/AttributeUsage_entity/AttributeUsage_entity.aod +++ b/entity/AttributeUsage_entity/AttributeUsage_entity.aod @@ -70,7 +70,7 @@ <dependency> <name>dependency</name> <entityName>Context_entity</entityName> - <fieldName>#PROVIDER</fieldName> + <fieldName>Exclusive</fieldName> </dependency> <children> <entityParameter> @@ -78,12 +78,12 @@ <valueProcess>%aditoprj%/entity/AttributeUsage_entity/entityfields/context/children/getallcontexts_param/valueProcess.js</valueProcess> </entityParameter> <entityParameter> - <name>UseExclusives_param</name> - <valueProcess>%aditoprj%/entity/AttributeUsage_entity/entityfields/context/children/useexclusives_param/valueProcess.js</valueProcess> + <name>Blacklist_param</name> + <valueProcess>%aditoprj%/entity/AttributeUsage_entity/entityfields/context/children/blacklist_param/valueProcess.js</valueProcess> </entityParameter> <entityParameter> - <name>ExclusiveContexts_param</name> - <valueProcess>%aditoprj%/entity/AttributeUsage_entity/entityfields/context/children/exclusivecontexts_param/valueProcess.js</valueProcess> + <name>InvertBlacklist_param</name> + <valueProcess>%aditoprj%/entity/AttributeUsage_entity/entityfields/context/children/invertblacklist_param/valueProcess.js</valueProcess> </entityParameter> </children> </entityConsumer> diff --git a/entity/AttributeUsage_entity/entityfields/context/children/blacklist_param/valueProcess.js b/entity/AttributeUsage_entity/entityfields/context/children/blacklist_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..3e85628ab0e9f4d61857da5f73c5461afe5f75de --- /dev/null +++ b/entity/AttributeUsage_entity/entityfields/context/children/blacklist_param/valueProcess.js @@ -0,0 +1,4 @@ +import("Attribute_lib"); +import("system.result"); + +result.object(AttributeUtil.getPossibleUsageContexts()); \ No newline at end of file diff --git a/entity/AttributeUsage_entity/entityfields/context/children/exclusivecontexts_param/valueProcess.js b/entity/AttributeUsage_entity/entityfields/context/children/exclusivecontexts_param/valueProcess.js deleted file mode 100644 index a304ae418593bf3e837ae999f81e3507125c0e16..0000000000000000000000000000000000000000 --- a/entity/AttributeUsage_entity/entityfields/context/children/exclusivecontexts_param/valueProcess.js +++ /dev/null @@ -1,16 +0,0 @@ -import("system.result"); - -result.object([ - "Organisation", - "Person", - "Contract", - "Product", - "Activity", - "Offer", - "Order", - "Employee", - "Salesproject", - "Campaign", - "DocumentTemplate", - "SupportTicket" -]); \ No newline at end of file diff --git a/entity/AttributeUsage_entity/entityfields/context/children/useexclusives_param/valueProcess.js b/entity/AttributeUsage_entity/entityfields/context/children/invertblacklist_param/valueProcess.js similarity index 100% rename from entity/AttributeUsage_entity/entityfields/context/children/useexclusives_param/valueProcess.js rename to entity/AttributeUsage_entity/entityfields/context/children/invertblacklist_param/valueProcess.js diff --git a/entity/Attribute_entity/Attribute_entity.aod b/entity/Attribute_entity/Attribute_entity.aod index 8752963e7b2b0f7efeed05322086e6b251b27230..ce9b1778aa24158ee9cf2fb7f9ca2f8a2304881e 100644 --- a/entity/Attribute_entity/Attribute_entity.aod +++ b/entity/Attribute_entity/Attribute_entity.aod @@ -380,8 +380,22 @@ <dependency> <name>dependency</name> <entityName>Context_entity</entityName> - <fieldName>#PROVIDER</fieldName> + <fieldName>Exclusive</fieldName> </dependency> + <children> + <entityParameter> + <name>Blacklist_param</name> + <valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/contexts/children/blacklist_param/valueProcess.js</valueProcess> + </entityParameter> + <entityParameter> + <name>GetAllContexts_param</name> + <valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/contexts/children/getallcontexts_param/valueProcess.js</valueProcess> + </entityParameter> + <entityParameter> + <name>InvertBlacklist_param</name> + <valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/contexts/children/invertblacklist_param/valueProcess.js</valueProcess> + </entityParameter> + </children> </entityConsumer> </entityFields> <recordContainers> diff --git a/entity/Attribute_entity/entityfields/contexts/children/blacklist_param/valueProcess.js b/entity/Attribute_entity/entityfields/contexts/children/blacklist_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..3e85628ab0e9f4d61857da5f73c5461afe5f75de --- /dev/null +++ b/entity/Attribute_entity/entityfields/contexts/children/blacklist_param/valueProcess.js @@ -0,0 +1,4 @@ +import("Attribute_lib"); +import("system.result"); + +result.object(AttributeUtil.getPossibleUsageContexts()); \ No newline at end of file diff --git a/entity/Attribute_entity/entityfields/contexts/children/getallcontexts_param/valueProcess.js b/entity/Attribute_entity/entityfields/contexts/children/getallcontexts_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..40effa0178464da0c7850912345f19c7fa95975a --- /dev/null +++ b/entity/Attribute_entity/entityfields/contexts/children/getallcontexts_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string(true); \ No newline at end of file diff --git a/entity/Attribute_entity/entityfields/contexts/children/invertblacklist_param/valueProcess.js b/entity/Attribute_entity/entityfields/contexts/children/invertblacklist_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..40effa0178464da0c7850912345f19c7fa95975a --- /dev/null +++ b/entity/Attribute_entity/entityfields/contexts/children/invertblacklist_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string(true); \ No newline at end of file diff --git a/entity/Context_entity/Context_entity.aod b/entity/Context_entity/Context_entity.aod index efc6a9df140ce133be11b7ef49f3a71590897e32..04b6a3654874423236f42cd5cd6738c912b93bfc 100644 --- a/entity/Context_entity/Context_entity.aod +++ b/entity/Context_entity/Context_entity.aod @@ -16,18 +16,6 @@ <fieldName>Context</fieldName> <isConsumer v="false" /> </entityDependency> - <entityDependency> - <name>f1eebe8c-93d2-4977-b619-b6315f843f7a</name> - <entityName>AttributeUsage_entity</entityName> - <fieldName>Context</fieldName> - <isConsumer v="false" /> - </entityDependency> - <entityDependency> - <name>68f79479-52e5-42b1-81f5-bb725e032382</name> - <entityName>Attribute_entity</entityName> - <fieldName>Contexts</fieldName> - <isConsumer v="false" /> - </entityDependency> </dependencies> </entityProvider> <entityField> @@ -65,32 +53,20 @@ <fieldName>Contexts</fieldName> <isConsumer v="false" /> </entityDependency> - <entityDependency> - <name>420468aa-c237-4e29-a24f-8851e56343b9</name> - <entityName>Offer_entity</entityName> - <fieldName>Contexts</fieldName> - <isConsumer v="false" /> - </entityDependency> - <entityDependency> - <name>98695ca8-7f46-489d-a479-f856f6d2b5ca</name> - <entityName>Order_entity</entityName> - <fieldName>Contexts</fieldName> - <isConsumer v="false" /> - </entityDependency> </dependencies> <children> <entityParameter> - <name>ExclusiveContexts_param</name> + <name>InvertBlacklist_param</name> <expose v="false" /> </entityParameter> <entityParameter> - <name>UseExclusives_param</name> + <name>Blacklist_param</name> <expose v="false" /> </entityParameter> </children> </entityProvider> <entityParameter> - <name>ExclusiveContexts_param</name> + <name>Blacklist_param</name> <expose v="true" /> <description>PARAMETER</description> </entityParameter> @@ -136,34 +112,38 @@ <description>PARAMETER</description> </entityParameter> <entityParameter> - <name>UseExclusives_param</name> + <name>InvertBlacklist_param</name> <expose v="true" /> <description>PARAMETER</description> </entityParameter> - <entityParameter> - <name>Whitelist</name> - <expose v="true" /> - </entityParameter> <entityProvider> <name>Exclusive</name> - <children> - <entityParameter> - <name>ExclusiveContexts_param</name> - <expose v="false" /> - </entityParameter> - <entityParameter> - <name>GetAllContexts_param</name> - <expose v="false" /> - </entityParameter> - <entityParameter> - <name>UseExclusives_param</name> - <expose v="false" /> - </entityParameter> - <entityParameter> - <name>Whitelist</name> - <expose v="false" /> - </entityParameter> - </children> + <dependencies> + <entityDependency> + <name>2fb3e0df-0372-4ba4-acde-210432517ee8</name> + <entityName>Offer_entity</entityName> + <fieldName>Contexts</fieldName> + <isConsumer v="false" /> + </entityDependency> + <entityDependency> + <name>66a69b09-d02a-4de6-a2dd-d11ce1467e01</name> + <entityName>Order_entity</entityName> + <fieldName>Contexts</fieldName> + <isConsumer v="false" /> + </entityDependency> + <entityDependency> + <name>b48df8c7-9d56-40f2-8269-b749afc92af5</name> + <entityName>Attribute_entity</entityName> + <fieldName>Contexts</fieldName> + <isConsumer v="false" /> + </entityDependency> + <entityDependency> + <name>9ad799f1-6303-4119-9bea-8e559850541b</name> + <entityName>AttributeUsage_entity</entityName> + <fieldName>Context</fieldName> + <isConsumer v="false" /> + </entityDependency> + </dependencies> </entityProvider> </entityFields> <recordContainers> diff --git a/entity/Context_entity/recordcontainers/jdito/contentProcess.js b/entity/Context_entity/recordcontainers/jdito/contentProcess.js index d061ec44cabdd958023b7ff36548273e6f0199ba..25682212551e2b430d137096dd04818e97fbfb5f 100644 --- a/entity/Context_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/Context_entity/recordcontainers/jdito/contentProcess.js @@ -2,21 +2,25 @@ import("system.vars"); import("system.result"); import("Context_lib"); -var excludeContexts = vars.getString("$param.ExclusiveContexts_param"); -if (excludeContexts) - excludeContexts = JSON.parse(excludeContexts); -var filterContexts = !(vars.exists("$param.GetAllContexts_param") && vars.get("$param.GetAllContexts_param") == "true"); -var useExclusives = vars.exists("$param.UseExclusives_param") && vars.get("$param.UseExclusives_param") == "true"; +var blacklist +var invertBlacklist +var filterContexts = vars.get("$param.GetAllContexts_param") != "true"; var whitelist; if (vars.get("$local.idvalues") && vars.get("$local.idvalues").length > 0) { - whitelist = vars.get("$local.idvalues") + blacklist = vars.get("$local.idvalues") + invertBlacklist = true; } else { - whitelist = vars.get("$param.Whitelist") ? JSON.parse(vars.get("$param.Whitelist")) : undefined; - + blacklist = vars.getString("$param.Blacklist_param"); + if (blacklist) + blacklist = JSON.parse(blacklist); + else + blacklist = undefined; + + invertBlacklist = vars.get("$param.InvertBlacklist_param") == "true"; } -result.object(ContextUtils.getContexts(filterContexts, excludeContexts, useExclusives, whitelist)); \ No newline at end of file +result.object(ContextUtils.getContexts(filterContexts, blacklist, invertBlacklist)); \ No newline at end of file diff --git a/entity/Offer_entity/Offer_entity.aod b/entity/Offer_entity/Offer_entity.aod index 62a2d841e53c3413d52cd3afba223d9f24a7b70f..c613c94c3c72d539303cf3dfa32ae64c67f3b39a 100644 --- a/entity/Offer_entity/Offer_entity.aod +++ b/entity/Offer_entity/Offer_entity.aod @@ -690,12 +690,16 @@ <dependency> <name>dependency</name> <entityName>Context_entity</entityName> - <fieldName>Context</fieldName> + <fieldName>Exclusive</fieldName> </dependency> <children> <entityParameter> - <name>Whitelist</name> - <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/contexts/children/whitelist/valueProcess.js</valueProcess> + <name>Blacklist_param</name> + <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/contexts/children/blacklist_param/valueProcess.js</valueProcess> + </entityParameter> + <entityParameter> + <name>InvertBlacklist_param</name> + <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/contexts/children/invertblacklist_param/valueProcess.js</valueProcess> </entityParameter> </children> </entityConsumer> diff --git a/entity/Offer_entity/entityfields/contexts/children/whitelist/valueProcess.js b/entity/Offer_entity/entityfields/contexts/children/blacklist_param/valueProcess.js similarity index 97% rename from entity/Offer_entity/entityfields/contexts/children/whitelist/valueProcess.js rename to entity/Offer_entity/entityfields/contexts/children/blacklist_param/valueProcess.js index 928bc6a94ca7787626928dc47c2262baabb82854..91cfc662013bf495f3c3180479eef66edf954b1f 100644 --- a/entity/Offer_entity/entityfields/contexts/children/whitelist/valueProcess.js +++ b/entity/Offer_entity/entityfields/contexts/children/blacklist_param/valueProcess.js @@ -1,4 +1,4 @@ -import("system.vars"); -import("system.result"); - +import("system.vars"); +import("system.result"); + result.string(vars.get("$param.PossibleConnectionTypes")) \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/contexts/children/invertblacklist_param/valueProcess.js b/entity/Offer_entity/entityfields/contexts/children/invertblacklist_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..40effa0178464da0c7850912345f19c7fa95975a --- /dev/null +++ b/entity/Offer_entity/entityfields/contexts/children/invertblacklist_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string(true); \ No newline at end of file diff --git a/entity/Order_entity/Order_entity.aod b/entity/Order_entity/Order_entity.aod index 80b6937c3ce27ac85a763a87b4b3fe8478d78f56..0dcd4c1d48fcfd777aef4388c0e02f66a8f8dbb1 100644 --- a/entity/Order_entity/Order_entity.aod +++ b/entity/Order_entity/Order_entity.aod @@ -607,12 +607,16 @@ <dependency> <name>dependency</name> <entityName>Context_entity</entityName> - <fieldName>Context</fieldName> + <fieldName>Exclusive</fieldName> </dependency> <children> <entityParameter> - <name>Whitelist</name> - <valueProcess>%aditoprj%/entity/Order_entity/entityfields/contexts/children/whitelist/valueProcess.js</valueProcess> + <name>Blacklist_param</name> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/contexts/children/blacklist_param/valueProcess.js</valueProcess> + </entityParameter> + <entityParameter> + <name>InvertBlacklist_param</name> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/contexts/children/invertblacklist_param/valueProcess.js</valueProcess> </entityParameter> </children> </entityConsumer> diff --git a/entity/Order_entity/entityfields/contexts/children/blacklist_param/valueProcess.js b/entity/Order_entity/entityfields/contexts/children/blacklist_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..767a3db63e072dc4dfaef4c700b358c75470a2fd --- /dev/null +++ b/entity/Order_entity/entityfields/contexts/children/blacklist_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$param.PossibleConnectionTypes")); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/contexts/children/invertblacklist_param/valueProcess.js b/entity/Order_entity/entityfields/contexts/children/invertblacklist_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..40effa0178464da0c7850912345f19c7fa95975a --- /dev/null +++ b/entity/Order_entity/entityfields/contexts/children/invertblacklist_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string(true); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/contexts/children/whitelist/valueProcess.js b/entity/Order_entity/entityfields/contexts/children/whitelist/valueProcess.js deleted file mode 100644 index 928bc6a94ca7787626928dc47c2262baabb82854..0000000000000000000000000000000000000000 --- a/entity/Order_entity/entityfields/contexts/children/whitelist/valueProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.vars"); -import("system.result"); - -result.string(vars.get("$param.PossibleConnectionTypes")) \ No newline at end of file diff --git a/process/Attribute_lib/process.js b/process/Attribute_lib/process.js index a2a93c3da05cdb4a4aaef1e10c164f51e0f1ffc8..d5e2fe99b1a41ab94838f2b7d524df0c84cc7830 100644 --- a/process/Attribute_lib/process.js +++ b/process/Attribute_lib/process.js @@ -21,6 +21,27 @@ import("Keyword_lib"); */ function AttributeUtil () {} +/** + * @return all Contexts (Object types) which can be the usage of attributes + */ +AttributeUtil.getPossibleUsageContexts = function() +{ + return [ + "Organisation", + "Person", + "Contract", + "Product", + "Activity", + "Offer", + "Order", + "Employee", + "Salesproject", + "Campaign", + "DocumentTemplate", + "SupportTicket" + ]; +} + /** * Gives an array of all available attributes for a context. This is used in the possibleItems * process for the attribute id in AttributeRelation diff --git a/process/Context_lib/process.js b/process/Context_lib/process.js index 6d7b5c396dfe5d730b32b38f45a5e74af9cbcba0..aa417543da872a6c3d85b72ee1d9c57b8dd4ddad 100644 --- a/process/Context_lib/process.js +++ b/process/Context_lib/process.js @@ -88,47 +88,39 @@ ContextUtils.getContextConsumer = function(pContextId) /** * * @param {Boolean} [pFilter=false] filter only for contexts which have a mapping in ContextUtils.getSelectMap - * @param {String[]} [pExclusiveContexts] contextIds that shall not be included (so this is a additional filter to the pFilter param) - * @param {Boolean} [pUseExclusives=false] decides whether the items in pExclusiveContexts are excluded (false) or - * everything that is NOT in pExclusiveContexts is excluded (true) + * @param {String[]} [pBlacklist] contextIds that shall not be included (so this is a additional filter to the pFilter param) + * @param {Boolean} [pInvertBlacklist=false] decides whether the items in pBlacklist are excluded (false) or + * everything that is NOT in pBlacklist is excluded (true) * (-> if it is a whitelist or blacklist) - * @param {String[]} [pWhitelist=undefined] only allowed contexts * * @return {String[][]} the contexts [[contextId, contextName, contextTitle], [... ], ...] */ -ContextUtils.getContexts = function(pFilter, pExclusiveContexts, pUseExclusives, pWhitelist) +ContextUtils.getContexts = function(pFilter, pBlacklist, pInvertBlacklist) { if (pFilter == undefined) pFilter = false; - if (pUseExclusives == undefined) - pUseExclusives = false; + if (pInvertBlacklist == undefined) + pInvertBlacklist = false; var contexts = project.getDataModels(project.DATAMODEL_KIND_CONTEXT); if (pFilter) { contexts = contexts.filter(function(pContext) { - if (pExclusiveContexts && pExclusiveContexts.indexOf(pContext[0]) > -1 != pUseExclusives) + if (pBlacklist && pBlacklist.indexOf(pContext[0]) > -1 != pInvertBlacklist) return false; // filter only contexts which have defined mappings in Context_lib return ContextUtils.getSelectMap ()[pContext[0]] != undefined; }); } - else if (pExclusiveContexts) + else if (pBlacklist) { contexts = contexts.filter(function(pContext) { - if (pExclusiveContexts && pExclusiveContexts.indexOf(pContext[0]) > -1 != pUseExclusives) + if (pBlacklist && pBlacklist.indexOf(pContext[0]) > -1 != pInvertBlacklist) return false; return true; }); } - - if (pWhitelist) - { - contexts = contexts.filter(function(pContext) { - return (pWhitelist.indexOf(pContext[0]) >= 0); - }); - } return contexts.map(ContextUtils._contextDataMapping).sort(function(pContext1, pContext2) {