Applicable Types Now Enforced by Web API
Overview
As part of the ongoing changes to the Extended API, we have updated the Web API to now handle the logic associated with Applicable Types. This ensures that items cannot be created linked to parents that are not compatible or applicable to that item. The Applicable Types logic only governs the creation of Jobs, Inspections and Defects to Assets and Job Work Units to Jobs.
This change also includes the creation of new endpoints on the API to handle listing and managing Applicable Types. Attempting to create an item that is governed by applicable types, to a parent item that is not applicable will result in an error.
Who will be affected?
This change affects all users who create Jobs/Inspections/Defects through the Web API directly or through the Create Item process on the Web Frontend. Whereas previously it was possible to create items that did not adhere to Applicable Types, this will no longer be possible.
Details
Currently, it is possible to create Jobs/Inspections/Defects/Job Work Units through the Web API and set the parent asset or job, regardless of the design. Therefore bypassing the logic implemented on the Extended API through Applicable Types. This created the possibility for inconsistencies as users from one service area could raise items against incorrect parents from another service area.
To support this change, a number of Applicable Type filter designs and attributes have been deprecated and will be set to customer context:
designs_jobFilters
designs_jobFilterApplicableTypes
designs_inspectionFilters
designs_inspectionFi
lterApplicableTypes
designs_defectFilters
designs_defectFilterApplicableTypes
attributes_workItemsAppliesTo
designs_workItemApplicableTypes
Two new designs designs_applicableTo
and designs_applicableFilter
have been created as part of Core blueprints to handle Applicability across Alloy.
designs_applicableTo
designs_applicableTo
contains two string attributes that describe applicability:
attributes_applicableFrom
- Can contain a Design or Design Interface Code or ItemID
attributes_applicableToTo
- Will contain a Design or Design Interface Code
Values in attributes_applicableFrom
are considered applicable to the corresponding values in attributes_applicableToTo
.
designs_applicableFilter
designs_applicableFilter
holds information that defines the validation rules applied by the Alloy Engine that were previously hard-coded. The design holds the following attributes:
attributes_applicableFilterLink
- a string attribute containing a link attribute code. Changes to this link attribute will be validated against the applicable types. The design containing this attribute will be treated as "to" side of the filter and the design it links to will be considered the "from"
attributes_applicableFilterFrom
- a required string attribute that contains the design or design interface code that of the "from" side of the applicable type
attributes_applicableFilterVia
- an optional string attribute containing a link attribute code. This is a child or parent link that changes the "to" side of the applicable type to be the child or parent items
New API Endpoints
The following new endpoints have been added to the Web API to allow management of the new applicable types:
/api/applicable-type/applicable-to
- Lists applicable to types
/api/applicable-type/applicable-from
- Lists applicable from types
/api/applicable-type/add
- Add applicable types
/api/applicable-type/remove
- Remove applicable types
The existing applicable types endpoints on the Extended API will not be removed. Calls to these endpoints will be re-routed through the new endpoints automatically.
Expected Release Date
This change will be included as part of the v2.37 release of Alloy on 30th June 2022