Skip to content

Commit

Permalink
Fix subfunctions
Browse files Browse the repository at this point in the history
  • Loading branch information
rjzondervan committed Nov 10, 2023
1 parent 08ae193 commit 00c90f3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
16 changes: 14 additions & 2 deletions Installation/Mapping/oc.githubPubliccodeComponent.mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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"
}
}
18 changes: 9 additions & 9 deletions src/Service/GithubPubliccodeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand All @@ -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);
Expand Down

0 comments on commit 00c90f3

Please sign in to comment.