Curiosité avec les liens inter-objets des réponses des APIs mappées

Bonjour,

Je vous contacte car je suis tombé ce matin sur une curiosité dans les APIs qui est bloquante pour mes consommateurs.
Tout d’abord, voici le morceau de modèle qui nous intéresse ici :

On est ici centré sur l’objet SupCompany et sa liaison avec tout un tas d’autres objets et notamment SupCompanyIdentifierValue et SupCompanyNameValue.
Lorsqu’on fait un appel REST GET sur cette ressource (via l’API mappée) :
image
On obtient le résultat suivant :


Comme on peut le voir l’objet SupCompanyIdentifierValue (via son nom mappé : company-identifiers) n’est pas présent dans les liens disponibles pour la ressource company.

Sachant que ce lien a bien évidemment été déclaré dans le mapping via la méthode addRefField de la même manière que les autres.

J’ai fait relire ça à Bruno qui n’a pas repéré d’erreur non plus.

Cette absence de lien est d’autant plus étrange que lorsque l’on passe par la UI, on a bien accès, depuis la company, à SupCompanyIdentifierValue comme présenté ci-dessous :


J’ai également pu tester que si je fais le même appel que plus haut, mais en ajoutant le lien vers les SupCompanyIdentifierValue “supposé être là” :


on obtient :
image
soit un résultat non filtré par le row_id présent dans la query.

Je ne sais pas si c’est un problème connu, spécifique au mapping de Renault…

Merci d’avance

Y aurait-t-il une logique métier qui masquerait les relations de manière conditionnelle ? (hook canReference, inhibition de l’attribut foreign key via code ou contrainte etc…)

Non aucune, d’ailleurs on le voit dans les panels standards UI avec le même user sur la même donnée.

Puis-je voir le code de mapping de l’objet company ?

NB: De mémoire s’il y a des coquilles dans le mapping il y a des traces dans les logs

Voici le contenu du fichier :

package com.simplicite.extobjects.RenaultSuppliers;

import com.simplicite.util.tools.JSONTool;
import com.simplicite.util.tools.Parameters;

/**
 * Custom REST web services for suppliers
 */
public class SupServicesV1 extends com.simplicite.webapp.services.RESTMappedObjectsExternalObject {
	private static final long serialVersionUID = 1L;

	@Override
	protected void init(Parameters params) {
		setDebug(getGrant().getFlagParameter("SUP_WS_DEBUG", false));
		setUseCache(false);
		setOpenAPISpec(JSONTool.OPENAPI_OAS2);
		setOpenAPIDesc(getDesc() + "\n\n> Business model version : **" + getGrant().getVersion() + "**");
		setOpenAPIBasePath("/suppliers/v1");

		// Remote services objects
		addObject("sites", "SupSiteService");
		addObject("site-identifiers", "SupSiteIdentifierService");
		addObject("site-access-points", "SupSiteAccessPointService");
		addObject("pwos", "SupPurchasingWorkingOrganizationService");

		//---------------------------------------------------------
		// NB: supGen* fields are used to filter which records
		// are available thru these APIs.
		// => no need to map them here as fields
		//---------------------------------------------------------

		//Pas besoin (ou alors dans company directement)
		addObject("company-identifier-keys", "SupCompanyIdentifierKey");
		addField("company-identifier-keys", "name", "supCpitName");
		addField("company-identifier-keys", "description", "supGenDescription");
		addField("company-identifier-keys", "type", "supCpiType");


		addObject("company-status", "SupCompanyStatus");
		addField("company-status", "code", "supCstCode");
		addField("company-status", "description", "supGenDescription");
		
		
		//Companies, à récupérer avec businessEntities et tous les identifiers
		addObject("companies", "SupCompany");
		addField("companies", "allianceIdentifier", "supCpyIdentifier");
		addField("companies", "legalName", "supCpyLegalName");
		addField("companies", "termsSigned", "supCpyTermsSigned");
		addField("companies", "startDate", "supGenStartDate");
		addField("companies", "endDate", "supGenEndDate");
		addRefField("companies", "company-status", "companyStatusId", "supCpyCstId");
		addField("companies", "companyStatusCode", "supCpyCstId.supCstCode");
		
		//TODO => Ajouter les companies avant?
		addObject("company-identifiers", "SupCompanyIdentifierValue");
		addRefField("company-identifiers", "companies", "companyId", "supCpiCpyId");
		addField("company-identifiers", "companyAllianceIdentifier", "supCpiCpyId.supCpyIdentifier");
		addRefField("company-identifiers", "company-identifier-keys", "companyIdentifierTypeId", "supCpiCpitId");
		addField("company-identifiers", "companyIdentifierKeyName", "supCpiCpitId.supCpitName");
		addField("company-identifiers", "value", "supCpiValue");
		addField("company-identifiers", "startDate", "supGenStartDate");
		addField("company-identifiers", "endDate", "supGenEndDate");

		addObject("company-name-types", "SupCompanyNameType");
		addField("company-name-types", "name", "supCpntName");
		addField("company-name-types", "description", "supGenDescription");

		addObject("company-names", "SupCompanyNameValue");
		addRefField("company-names", "companies", "companyId", "supCpnCpyId");
		addField("company-names", "companyAllianceIdentifier", "supCpnCpyId.supCpyIdentifier");
		addRefField("company-names", "company-name-types", "companyNameTypeId", "supCpnCpntId");
		addField("company-names", "companyNameTypeName", "supCpnCpntId.supCpntName");
		addField("company-names", "value", "supCpnValue");
		addField("company-names", "startDate", "supGenStartDate");
		addField("company-names", "endDate", "supGenEndDate");
		
		
		addObject("business-entities", "SupBusinessEntity");
		addField("business-entities", "identifier", "supBusIdentifier");
		addField("business-entities", "isHQ", "supBusIsHQ");
		addRefField("business-entities", "companies", "companyId", "supBusCpyId");
		addField("business-entities", "companyAllianceIdentifier", "supBusCpyId.supCpyIdentifier");
		addField("business-entities", "companyLegalName", "supBusCpyId.supCpyLegalName");
		addField("business-entities", "modificationStatus", "supGenStatus");

		addObject("business-entity-identifier-types", "SupBusinessEntityIdentifierType");
		addField("business-entity-identifier-types", "name", "supBuitName");
		addField("business-entity-identifier-types", "description", "supGenDescription");
		addField("business-entity-identifier-types", "type", "supBuitType");

		addObject("business-entity-identifiers", "SupBusinessEntityIdentifierValue");
		addRefField("business-entity-identifiers", "business-entities", "businessEntityId", "supBuiBusId");
		addField("business-entity-identifiers", "businessEntityAllianceIdentifier", "supBuiBusId.supBusIdentifier");
		addRefField("business-entity-identifiers", "business-entity-identifier-types", "businessEntityIdentifierTypeId", "supBuiBuitId");
		addField("business-entity-identifiers", "businessEntityIdentifierTypeName", "supBuiBuitId.supBuitName");
		addField("business-entity-identifiers", "value", "supBuiValue");
		addField("business-entity-identifiers", "startDate", "supBuiStartDate");
		addField("business-entity-identifiers", "endDate", "supGenEndDate");


		//Companies, à récupérer avec businessEntities et tous les identifiers
		addObject("companies", "SupCompany");
		addField("companies", "allianceIdentifier", "supCpyIdentifier");
		addField("companies", "legalName", "supCpyLegalName");
		addField("companies", "termsSigned", "supCpyTermsSigned");
		// addRefField("companies", "currencies", "currencyId", "supCpyCurId");
		// addField("companies", "currencyCode", "supCpyCurId.isoCurCode");
		addField("companies", "startDate", "supGenStartDate");
		addField("companies", "endDate", "supGenEndDate");
		// addField("companies", "linkedElements", "supCpyLinkedElements");
		addRefField("companies", "company-status", "companyStatusId", "supCpyCstId");
		addField("companies", "companyStatusCode", "supCpyCstId.supCstCode");
		

		// Capitalistik links - OK
		addObject("capitalistic-links", "SupCapitalisticLink");
		addRefField("capitalistic-links", "companies", "fromCompanyId", "supCplCpyFromId");
		addField("capitalistic-links", "fromAllianceIdentifier", "supCplCpyFromId.supCpyIdentifier");
		addField("capitalistic-links", "fromLegalName", "supCplCpyFromId.supCpyLegalName");
		addRefField("capitalistic-links", "companies", "toCompanyId", "supCplCpyToId");
		addField("capitalistic-links", "toCompanyAllianceIdentifier", "supCplCpyToId.supCpyIdentifier");
		addField("capitalistic-links", "toCompanyLegalName", "supCplCpyToId.supCpyLegalName");
		addField("capitalistic-links", "type", "supCplType");
		addField("capitalistic-links", "ownershipPercentage", "supCplOwnershipPercentage");
		addField("capitalistic-links", "effectiveDate", "supCplEffectiveDate");
		addField("capitalistic-links", "untilDate", "supCplUntilDate");
		
		
		// Legal documents
		addObject("company-documents", "supCompanyDocument");
		addField("company-documents", "identifier", "supDocIdentifier");
		addField("company-documents", "url", "supDocUrl");
		addField("company-documents", "status", "supDocStatus");
		addField("company-documents", "type", "supDocType");
		addRefField("company-documents", "company", "companyId", "supCpyDocId");
		addField("company-documents", "companyIdentifier", "supCpyDocId.supCpyIdentifier");
		

		//Pour groupes
		addObject("group-identifier-keys", "SupGroupIdentifierKey");
		addField("group-identifier-keys", "name", "supGritName");
		addField("group-identifier-keys", "description", "supGenDescription");

		//Pour groupes
		addObject("group-identifiers", "SupGroupIdentifierValue");
		addRefField("group-identifiers", "groups", "groupId", "supGriGrpId");
		addField("group-identifiers", "groupAllianceIdentifier", "supGriGrpId.supGrpIdentifier");
		addField("group-identifiers", "groupName", "supGriGrpId.supGrpName");
		addRefField("group-identifiers", "group-identifier-keys", "groupIdentifierKeyId", "supGriGritId");
		addField("group-identifiers", "groupIdentifierKeyName", "supGriGritId.supGritName");
		addField("group-identifiers", "value", "supGriValue");
		addField("group-identifiers", "startDate", "supGenStartDate");
		addField("group-identifiers", "endDate", "supGenEndDate");
		
		addObject("group-types", "SupGroupType");
		addField("group-types", "groupTypeCode", "supGtyCode");
		addField("group-types", "groupTypeDescription", "supGenDescription");
		
		// Groups
		addObject("groups", "SupGroup");
		addField("groups", "allianceIdentifier", "supGrpIdentifier");
		addField("groups", "name", "supGrpName");
		// addField("groups", "type", "supGrpType");
		addField("groups", "startDate", "supGenStartDate");
		addField("groups", "endDate", "supGenEndDate");
		addField("groups", "modificationStatus", "supGenStatus");
		addRefField("groups", "companies", "representingCompanyId", "supGrpCpyRepresentingId");
		addField("groups", "representingCompanyAllianceIdentifier", "supGrpCpyRepresentingId.supCpyIdentifier");
		addRefField("groups", "group-types", "groupTypes", "supGtyGrpId");
		addField("groups", "groupTypeCode", "supGtyGrpId.supGtyCode");


		//Approval scope for approval
		addObject("approval-scopes", "SupApprovalScope");
		addField("approval-scopes", "code", "supAscCode");
		addField("approval-scopes", "decription", "supGenDescription");
		//Approval status for approval
		addObject("approval-status", "SupApprovalStatus");
		addField("approval-status", "code", "supAstCode");
		addField("approval-status", "description", "supGenDescription");

		// Récupérer ceux qui sont liés à un PWO
		//Approval
		addObject("approvals", "SupApproval");
		addField("approvals", "identifier", "supAppIdentifier");
		addField("approvals", "type", "supAppType");
		addField("approvals", "approvalModificationStatus", "supGenStatus");
		addField("approvals", "validityStartDate", "supGenStartDate");
		addField("approvals", "validityEndDate", "supGenEndDate");
		addRefField("approvals", "approval-scopes", "scopeId", "supAppAscId");
		addField("approvals", "	scopeCode", "supAppAscId.supAscCode");
		addRefField("approvals", "approval-status", "statusId", "supAstCode");
		addField("approvals", "	statusCode", "supAstCode.supAstCode");
		
		//groupApproval
		addObject("group-approvals", "SupGroupApproval");
		addField("group-approvals", "identifier", "supAppIdentifier");
		addField("group-approvals", "type", "supAppType");
		addField("group-approvals", "approvalModificationStatus", "supGenStatus");
		addField("group-approvals", "validityStartDate", "supGenStartDate");
		addField("group-approvals", "validityEndDate", "supGenEndDate");
		addRefField("group-approvals", "approval-scopes", "scopeId", "supAppAscId");
		addField("group-approvals", "	scopeCode", "supAppAscId.supAscCode");
		addRefField("group-approvals", "approval-status", "statusId", "supAstCode");
		addField("group-approvals", "	statusCode", "supAstCode.supAstCode");
		addRefField("group-approvals", "groups", "groupId", "supGapGrpId");
		addField("group-approvals", "groupIdentifier", "supGapGrpId.supGrpIdentifier");
		addField("group-approvals", "groupName", "supGapGrpId.supGrpName");
		addField("group-approvals", "groupType", "supGapGrpId.supGtyGrpId.supGtyCode");
		addRefField("group-approvals", "pwos", "groupPwo", "supGapPwo");
		
		
		
		//companyApproval
		addObject("company-approvals", "SupCompanyApproval");
		addField("company-approvals", "identifier", "supAppIdentifier");
		addField("company-approvals", "type", "supAppType");
		addField("company-approvals", "approvalModificationStatus", "supGenStatus");
		addField("company-approvals", "validityStartDate", "supGenStartDate");
		addField("company-approvals", "validityEndDate", "supGenEndDate");
		addRefField("company-approvals", "approval-scopes", "scopeId", "supAppAscId");
		addRefField("company-approvals", "approval-status", "statusId", "SupAppAstId");
		addField("company-approvals", "scopeCode", "supAppAscId.supAscCode");
		addField("company-approvals", "statusCode", "SupAppAstId.supAstCode");
		addRefField("company-approvals", "companies", "companiesId", "supCapCpyId");
		addField("company-approvals", "	companyIdentifier", "supCapCpyId.supCpyIdentifier");
		addRefField("company-approvals", "clientCompanies", "clientCompanyId", "supCapClcId");
		addField("company-approvals", "	clientCompanyIdentifier", "supCapClcId.supClcIdentifier");
		addField("company-approvals", "	clientCompanyLegalName", "supCapClcId.supClcLegalName");
		
	
		addObject("group-assignment-types", "SupGroupAssignmentType");
		addField("group-assignment-types", "groupAssignementTypeCode", "supGatCode");
		addField("group-assignment-types", "groupAssignementTypeDescription", "supGatDescription");
	

		addObject("group-assignments", "SupGroupAssignment");
		addField("group-assignments", "identifier", "supGraIdentifier");
		addRefField("group-assignments", "groups", "groupId", "supGraGrpId");
		addField("group-assignments", "groupAllianceIdentifier", "supGraGrpId.supGrpIdentifier");
		addField("group-assignments", "groupName", "supGraGrpId.supGrpName");
		addRefField("group-assignments", "companies", "companyId", "supGraCpyId");
		addField("group-assignments", "companyAllianceIdentifier", "supGraCpyId.supCpyIdentifier");
		addField("group-assignments", "companyAllianceLegalName", "supGraCpyId.supCpyLegalName");
		addRefField("group-assignments", "group-assignment-types", "groupTypeId", "supGraGatId");
		addField("group-assignments", "groupTypeCode", "supGraGatId.supGatCode");
		addField("group-assignments", "apoStatus", "supGraApoStatus");
		addField("group-assignments", "status", "supGenStatus");
		addField("group-assignments", "validityEndDate", "supGraValidityEndDate");
		addField("group-assignments", "validityStartDate", "supGraValidityStartDate");


		addObject("site-assignments", "SupSiteAssignment");
		addField("site-assignments", "identifier", "supGenIdentifier");
		addRefField("site-assignments", "business-entities", "businessEntityId", "supSiaBusId");
		addField("site-assignments", "businessEntityAllianceIdentifier", "supSiaBusId.supBusIdentifier");
		addField("site-assignments", "businessEntityCompanyId", "supSiaBusId.supBusCpyId");
		addField("site-assignments", "businessEntityCompanyAllianceIdentifier", "supSiaBusId.supBusCpyId.supCpyIdentifier");
		addField("site-assignments", "businessEntityCompanyLegalName", "supSiaBusId.supBusCpyId.supCpyLegalName");
		addField("site-assignments", "site", "supSiaSite");
		addField("site-assignments", "validityStartDate", "supSiaValidityStartDate");
		addField("site-assignments", "validityEndDate", "supSiaValidityEndDate");
		addField("site-assignments", "status", "supGenStatus");
		
		addObject("paying-company", "SupCliCompany");
		addField("paying-company", "identifier", "supClcIdentifier");
		addField("paying-company", "legalName", "supClcLegalName");
		
		addObject("bvd-interface", "SupBvdBridge");
		addField("bvd-interface", "name", "bvdName");
		addField("bvd-interface", "country", "bvdCountry");
		addField("bvd-interface", "city", "bvdCity");
		addField("bvd-interface", "address", "bvdAddress");
		addField("bvd-interface", "national-id", "bvdNationalId");
		addField("bvd-interface", "result", "bvdResult");
		
		/*
		* Completion part
		*/
		addObject("groups-completion", "SupGroupCompletion");
		addField("groups-completion", "allianceIdentifier", "supGrpIdentifier");
		addField("groups-completion", "name", "supGrpName");
		
		addObject("company-completion", "SupCompanyCompletion");
		addField("company-completion", "allianceIdentifier", "supCpyIdentifier");
		addField("company-completion", "name", "supCpyLegalName");
		
		addObject("business-entity-identifiers-completion", "SupBusinessEntityIdentifierValueCompletion");
		addField("business-entity-identifiers-completion", "value", "supBuiValue");
		
		addObject("groups-identifiers-completion", "SupGroupIdentifierValueCompletion");
		addField("groups-identifiers-completion", "value", "supCpiValue");
		
		addObject("company-identifiers-completion", "SupCompanyIdentifierValueCompletion");
		addField("company-identifiers-completion", "value", "supGriValue");

	}
}

Quid d’éventuels messages dans les logs ?

Pas grand chose si ce n’est des warnings :

OK ce serait bien de commencer par résoudre ces warnings pour être sur de bonnes bases