diff --git a/Installation/Mapping/oc.githubPubliccodeComponent.mapping.json b/Installation/Mapping/oc.githubPubliccodeComponent.mapping.json index 5e4e0da3..e5c47c82 100644 --- a/Installation/Mapping/oc.githubPubliccodeComponent.mapping.json +++ b/Installation/Mapping/oc.githubPubliccodeComponent.mapping.json @@ -2,7 +2,7 @@ "title": "GithubPubliccodeToComponent", "$id": "https://api.github.com/oc.githubPubliccodeComponent.mapping.json", "$schema": "https://docs.commongateway.nl/schemas/Mapping.schema.json", - "version": "0.0.1", + "version": "0.0.2", "passTrough": false, "mapping": { "softwareVersion": "publiccodeYmlVersion", @@ -18,6 +18,8 @@ "outputTypes": "outputTypes", "platforms": "platforms", "categories": "categories", + "applicationSuite.name": "applicationSuite", + "applicationSuite._id": "applicationSuite", "description.shortDescription": "description.nl.shortDescription", "description.longDescription": "description.nl.longDescription", "description.documentation": "description.nl.documentation", @@ -27,6 +29,10 @@ "intendedAudience.scope": "intendedAudience.scope", "legal.license": "legal.license", "legal.authorsFile": "legal.authorsFile", + "legal.mainCopyrightOwner._id": "legal.mainCopyrightOwner", + "legal.mainCopyrightOwner.name": "legal.mainCopyrightOwner", + "legal.repoOwner._id": "legal.repoOwner", + "legal.repoOwner.name": "legal.repoOwner", "maintenance.type": "maintenance.type", "localisation.localisationReady": "localisation.localisationReady", "localisation.availableLanguages": "localisation.availableLanguages", @@ -81,6 +87,12 @@ "nl.gemma.model": "keyCantBeValue", "nl.gemma.referentieComponenten": "keyCantBeValue", "nl.apm": "keyCantBeValue", - "nl.upl": "keyCantBeValue" + "nl.upl": "keyCantBeValue", + "applicationSuite.name": "unsetIfValue==applicationSuite", + "applicationSuite._id": "unsetIfValue==applicationSuite", + "legal.mainCopyrightOwner._id": "unsetIfValue==legal.mainCopyrightOwner", + "legal.mainCopyrightOwner.name": "unsetIfValue==legal.mainCopyrightOwner", + "legal.repoOwner._id": "unsetIfValue==legal.repoOwner", + "legal.repoOwner.name": "unsetIfValue==legal.repoOwner" } } diff --git a/src/Service/GithubPubliccodeService.php b/src/Service/GithubPubliccodeService.php index 798c7369..1ec70f78 100644 --- a/src/Service/GithubPubliccodeService.php +++ b/src/Service/GithubPubliccodeService.php @@ -353,8 +353,7 @@ public function createMainCopyrightOwner(array $publiccode, ObjectEntity $compon ) { $organisation = $this->entityManager->getRepository('App:ObjectEntity')->findOneBy(['entity' => $organisationEntity, 'name' => $publiccode['legal']['mainCopyrightOwner']]); if ($organisation === null) { - $organisation = new ObjectEntity($organisationEntity); - $organisation->hydrate(['name' => $publiccode['legal']['mainCopyrightOwner']]); + return $componentObject; }//end if $this->entityManager->persist($organisation); @@ -631,9 +630,10 @@ public function findPubliccodeSync(ObjectEntity $repository, array $configuratio */ public function mapPubliccode(ObjectEntity $repository, array $publiccode, array $configuration, string $publiccodeUrl): ?ObjectEntity { - $githubSource = $this->resourceService->getSource($configuration['githubSource'], 'open-catalogi/open-catalogi-bundle'); - $componentMapping = $this->resourceService->getMapping($configuration['componentMapping'], 'open-catalogi/open-catalogi-bundle'); - $componentSchema = $this->resourceService->getSchema($configuration['componentSchema'], 'open-catalogi/open-catalogi-bundle'); + $githubSource = $this->resourceService->getSource($configuration['githubSource'], 'open-catalogi/open-catalogi-bundle'); + $userContentSource = $this->resourceService->getSource($configuration['usercontentSource'], 'open-catalogi/open-catalogi-bundle'); + $componentMapping = $this->resourceService->getMapping($configuration['componentMapping'], 'open-catalogi/open-catalogi-bundle'); + $componentSchema = $this->resourceService->getSchema($configuration['componentSchema'], 'open-catalogi/open-catalogi-bundle'); $sync = $this->findPubliccodeSync($repository, $configuration, $publiccodeUrl); @@ -655,14 +655,14 @@ public function mapPubliccode(ObjectEntity $repository, array $publiccode, array $componentArray['_sourceId'] = $publiccodeUrl; - $component = $this->hydrationService->searchAndReplaceSynchronizations($componentArray, $githubSource, $componentSchema); + $component = $this->hydrationService->searchAndReplaceSynchronizations($componentArray, $userContentSource, $componentSchema); // set the name $component->hydrate(['name' => key_exists('name', $publiccode) ? $publiccode['name'] : $repository->getValue('name'), 'url' => $repository]); - // $this->createApplicationSuite($publiccode, $component); - // $this->createMainCopyrightOwner($publiccode, $component); - // $this->createRepoOwner($publiccode, $component); +// $this->createApplicationSuite($publiccode, $component); +// $this->createMainCopyrightOwner($publiccode, $component); +// $this->createRepoOwner($publiccode, $component); // @TODO These to functions aren't working. // contracts and contacts are not set to the component // $component = $this->createContractors($publiccode, $component);