<?php
namespace App\Entity\ExternalPartner;
use App\Entity\User;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Exception;
use ReflectionClass;
/**
* This entity represents an external business partner of JOBOO!® which provides data that becomes recurrent jobs or external joboffers.
*
* The naming for this class is not optimal – a much better name would be something like "ExternalJobsDataSource".
* It is important to not mix it with the concept of Customers. A Customer is the external party which ultimately
* "owns" a recurrent job and wants to fill a job position. An External Partner is the provider of the data source
* where recurrent job data (or, in the case of Joblift, external joboffer data) comes from.
*
* Put differently, an External Partner is where a recurrent job comes *from*, while the Customer is who the
* recurrent job is *for*.
*
* We do have scenarios where External Partner and Customer are truly orthogonal – for example, GOhiring is a "pure"
* data source provide who doesn't want to fill any positions through us itself, providing job data for Wisag, Edeka and
* KFC who don't have a data source of their own (and thus use the services of GOhiring).
*
* But there are also scenarios where data source and employer – External Partner and Customer – are identical. For
* example, REWE is an employer who wants to fill positions through us, and they have their own data feed to provide us
* the required job data.
*
* We still need to keep these cleanly separated conceptually - thus, the ExternalPartner entity dubbed "REWE" means the
* feed-based data source provided by REWE, while the sole Customer entity linked to this ExternalPartner, which is also
* dubbed "REWE" means the employer that wants to fill job positions.
*
* @ORM\Entity
*
* @ORM\Table(
* name="external_partners"
* )
*/
class ExternalPartner
{
// This id is used to create external partner objects that do not have an id initially.
// This is important for creating quotas.
public const int ID_PLACEHOLDER = -1;
public const int ID_TANKUNDRAST_API_CLIENT = 0;
public const int ID_JOBLIFT_FEED = 1;
public const int ID_GOHIRING_API = 2;
public const int ID_GERMAN_PERSONNEL_FEED = 3;
public const int ID_REWE_FEED = 4;
public const int ID_HAYS_FEED = 5;
public const int ID_KAUFLAND_CRAWLER = 6;
public const int ID_ONLYFY_CRAWLER = 7;
public const int ID_JOBOO_VERTRIEB_DATENEINGABE = 8;
public const int ID_MYSTAFFPILOT_FEED = 9;
public const int ID_SOFTGARDEN_FEED = 10;
public const int ID_JOBOO_HEADACCOUNTS = 11;
public const int ID_CELLIT_FEED = 12;
public const int ID_LENKZEIT_FEED = 13;
public const int ID_ROSSMANN_CRAWLER = 14;
public const int ID_MOEVENPICK_CRAWLER = 15;
public const int ID_FAHR_ZEIT_CRAWLER = 16;
public const int ID_GLOBETROTTER_CRAWLER = 17;
public const int ID_KOETTER_CRAWLER = 18;
public const int ID_CONCENTRIX_CRAWLER = 19;
public const int ID_ARTEMIS_FEED = 20;
public const int ID_EDEKA_CAREER_SITE_CRAWLER = 21;
public const int ID_FLASCHENPOST_FEED = 22;
public const int ID_BOFROST_CRAWLER = 23;
public const int ID_HOFMANNS_CATERING_CRAWLER = 24;
public const int ID_DEUTSCHE_BAHN_AG_FEED = 25;
public const int ID_MILCH_UND_ZUCKER_FEED = 26;
public const int ID_TENHIL_STELLENANZEIGEN_DE_FEED = 27;
public const int ID_TENHIL_YOURFIRM_FEED = 28;
public const int ID_TENHIL_REGIO_JOBANZEIGER_FEED = 29;
public const int ID_TENHIL_JOBBLITZ_FEED = 30;
public const int ID_TENHIL_KALAYDO_FEED = 31;
public const int ID_TENHIL_IT_JOBS_FEED = 32;
public const int ID_TALENT_FEED = 33;
public const int ID_A_UND_H_ZEITARBEIT_CRAWLER = 34;
public const int ID_KAUFLAND_FEED = 35;
public const int ID_SMART_RECRUITERS_CRAWLER = 36;
public const int ID_AVATURE_CRAWLER = 37;
public const int ID_MEINESTADT_DE_FEED = 38;
public const int ID_SUPERBIOMARKT_CRAWLER = 39;
public const int ID_VION_CAREER_SITE_CRAWLER = 40;
public const int ID_TALENTSCONNECT_CRAWLER = 41;
public const int ID_EUROPERSONAL_CRAWLER = 42;
public const int ID_JOHANNESBAD_CAREER_SITE_CRAWLER = 43;
public const int ID_RANGER = 44;
public const int ID_ADECCO_FEED = 45;
public const int ID_A_UND_O_HOSTELS_CRAWLER = 46;
public const int ID_KAEFER_FEED = 47;
public const int ID_HELLOFRESH_CRAWLER = 48;
public const int ID_PHENOM_FEED = 49;
public const int ID_THYSSENKRUPP_CRAWLER = 50;
public const int ID_EPOS_CRAWLER = 51;
public const int ID_RUDOLF_WEBER_CRAWLER = 52;
public const int ID_PIEPENBROCK_CRAWLER = 53;
public const int ID_SMART_RECRUITERS_API_CLIENT = 54;
public const int ID_WITHTEC_CRAWLER = 55;
public const int ID_CONDOR_SICHERHEIT_CRAWLER = 56;
public const int ID_ZVOOVE_FEED = 57;
public const int ID_LIDL_CRAWLER = 58;
public const int ID_ROFU_CRAWLER = 59;
public const int ID_CLOPPENBURG_CRAWLER = 60;
public const int ID_INTERNATIONALER_BUND_CRAWLER = 61;
public const int ID_JOHANNITER_CRAWLER = 62;
public const int ID_MHM_CRAWLER = 63;
public const int ID_ALB_FILS_KLINIKUM_CRAWLER = 64;
public const int ID_RUNMED_CRAWLER = 65;
public const int ID_DEUTSCHE_BAHN_CRAWLER = 66;
public const int ID_STEPSTONE_FEED = 67;
public const int ID_APETITO_FEED = 68;
public const int ID_VONQ_FEED = 69;
public const int ID_A_UND_H_ZEITARBEIT_XML_FEED = 70;
public const int ID_CONTACT_100_FEED = 71;
public const int ID_A_I_FITNESS_FEED = 72;
public const int ID_XING_FEED = 73;
public const int ID_IMMOBILIEN_SERVICE_DEUTSCHLAND_FEED = 74;
public const int ID_FUNKE_FEED = 75;
/* IMPORTANT!
* Whenever a new external partner is defined here,
* it MUST be added to the documentation at
* https://go-gastro.atlassian.net/wiki/spaces/SD/pages/1171783681/Austausch+fachlicher+Daten+mit+Dritten!
*/
public const array IDS_INTEGRATED = [
self::ID_PLACEHOLDER,
self::ID_TANKUNDRAST_API_CLIENT,
self::ID_GOHIRING_API,
self::ID_GERMAN_PERSONNEL_FEED,
self::ID_REWE_FEED,
self::ID_HAYS_FEED,
self::ID_KAUFLAND_CRAWLER,
self::ID_ONLYFY_CRAWLER,
self::ID_JOBOO_VERTRIEB_DATENEINGABE,
self::ID_MYSTAFFPILOT_FEED,
self::ID_SOFTGARDEN_FEED,
self::ID_JOBOO_HEADACCOUNTS,
self::ID_CELLIT_FEED,
self::ID_LENKZEIT_FEED,
self::ID_ROSSMANN_CRAWLER,
self::ID_MOEVENPICK_CRAWLER,
self::ID_FAHR_ZEIT_CRAWLER,
self::ID_GLOBETROTTER_CRAWLER,
self::ID_KOETTER_CRAWLER,
self::ID_CONCENTRIX_CRAWLER,
self::ID_ARTEMIS_FEED,
self::ID_EDEKA_CAREER_SITE_CRAWLER,
self::ID_FLASCHENPOST_FEED,
self::ID_BOFROST_CRAWLER,
self::ID_HOFMANNS_CATERING_CRAWLER,
self::ID_DEUTSCHE_BAHN_AG_FEED,
self::ID_MILCH_UND_ZUCKER_FEED,
self::ID_A_UND_H_ZEITARBEIT_CRAWLER,
self::ID_KAUFLAND_FEED,
self::ID_CELLIT_FEED,
self::ID_SMART_RECRUITERS_CRAWLER,
self::ID_AVATURE_CRAWLER,
self::ID_MEINESTADT_DE_FEED,
self::ID_SUPERBIOMARKT_CRAWLER,
self::ID_VION_CAREER_SITE_CRAWLER,
self::ID_TALENTSCONNECT_CRAWLER,
self::ID_EUROPERSONAL_CRAWLER,
self::ID_JOHANNESBAD_CAREER_SITE_CRAWLER,
self::ID_RANGER,
self::ID_ADECCO_FEED,
self::ID_A_UND_O_HOSTELS_CRAWLER,
self::ID_KAEFER_FEED,
self::ID_HELLOFRESH_CRAWLER,
self::ID_PHENOM_FEED,
self::ID_THYSSENKRUPP_CRAWLER,
self::ID_EPOS_CRAWLER,
self::ID_RUDOLF_WEBER_CRAWLER,
self::ID_PIEPENBROCK_CRAWLER,
self::ID_SMART_RECRUITERS_API_CLIENT,
self::ID_WITHTEC_CRAWLER,
self::ID_CONDOR_SICHERHEIT_CRAWLER,
self::ID_ZVOOVE_FEED,
self::ID_LIDL_CRAWLER,
self::ID_ROFU_CRAWLER,
self::ID_CLOPPENBURG_CRAWLER,
self::ID_INTERNATIONALER_BUND_CRAWLER,
self::ID_JOHANNITER_CRAWLER,
self::ID_MHM_CRAWLER,
self::ID_ALB_FILS_KLINIKUM_CRAWLER,
self::ID_RUNMED_CRAWLER,
self::ID_DEUTSCHE_BAHN_CRAWLER,
self::ID_STEPSTONE_FEED,
self::ID_APETITO_FEED,
self::ID_VONQ_FEED,
self::ID_A_UND_H_ZEITARBEIT_XML_FEED,
self::ID_CONTACT_100_FEED,
self::ID_A_I_FITNESS_FEED,
self::ID_XING_FEED,
self::ID_IMMOBILIEN_SERVICE_DEUTSCHLAND_FEED,
self::ID_FUNKE_FEED
];
public const array IDS_INTEGRATED_TO_NAMES = [
self::ID_PLACEHOLDER => 'placeholder',
self::ID_TANKUNDRAST_API_CLIENT => 'tank und rast api client',
self::ID_GOHIRING_API => 'go hiring api',
self::ID_GERMAN_PERSONNEL_FEED => 'german personnel feed',
self::ID_REWE_FEED => 'rewe feed',
self::ID_HAYS_FEED => 'hays feed',
self::ID_KAUFLAND_CRAWLER => 'kaufland crawler',
self::ID_ONLYFY_CRAWLER => 'onlyfy crawler',
self::ID_JOBOO_VERTRIEB_DATENEINGABE => 'joboo vertrieb dateneingabe',
self::ID_MYSTAFFPILOT_FEED => 'mystaffpilot feed',
self::ID_SOFTGARDEN_FEED => 'softgarden feed',
self::ID_JOBOO_HEADACCOUNTS => 'joboo headaccounts',
self::ID_CELLIT_FEED => 'cellit feed',
self::ID_LENKZEIT_FEED => 'lenkzeit feed',
self::ID_ROSSMANN_CRAWLER => 'rossmann crawler',
self::ID_MOEVENPICK_CRAWLER => 'moevenpick crawler',
self::ID_FAHR_ZEIT_CRAWLER => 'fahr-zeit crawler',
self::ID_GLOBETROTTER_CRAWLER => 'globetrotter crawler',
self::ID_KOETTER_CRAWLER => 'koetter crawler',
self::ID_CONCENTRIX_CRAWLER => 'concentrix crawler',
self::ID_ARTEMIS_FEED => 'artemis feed',
self::ID_EDEKA_CAREER_SITE_CRAWLER => 'edeka career-site crawler',
self::ID_FLASCHENPOST_FEED => 'flaschenpost feed',
self::ID_BOFROST_CRAWLER => 'bofrost crawler',
self::ID_HOFMANNS_CATERING_CRAWLER => 'hofmanns catering crawler',
self::ID_DEUTSCHE_BAHN_AG_FEED => 'deutsche bahn ag feed',
self::ID_MILCH_UND_ZUCKER_FEED => 'milch und zucker feed',
self::ID_TENHIL_STELLENANZEIGEN_DE_FEED => 'tenhil stellenanzeigen de feed',
self::ID_TENHIL_YOURFIRM_FEED => 'tenhil yourfirm feed',
self::ID_TENHIL_REGIO_JOBANZEIGER_FEED => 'tenhil regio jobanzeiger feed',
self::ID_TENHIL_JOBBLITZ_FEED => 'tenhil jobblitz feed',
self::ID_TENHIL_KALAYDO_FEED => 'tenhil kalaydo feed',
self::ID_TENHIL_IT_JOBS_FEED => 'tenhil it-jobs feed',
self::ID_TALENT_FEED => 'talent feed',
self::ID_A_UND_H_ZEITARBEIT_CRAWLER => 'a und h zeitarbeit crawler',
self::ID_KAUFLAND_FEED => 'kaufland feed',
self::ID_SMART_RECRUITERS_CRAWLER => 'smart recruiters crawler',
self::ID_AVATURE_CRAWLER => 'avature crawler',
self::ID_MEINESTADT_DE_FEED => 'meinestadt.de feed',
self::ID_SUPERBIOMARKT_CRAWLER => 'superbiomarkt crawler',
self::ID_VION_CAREER_SITE_CRAWLER => 'vion career-site crawler',
self::ID_TALENTSCONNECT_CRAWLER => 'talentsconnect crawler',
self::ID_EUROPERSONAL_CRAWLER => 'europersonal crawler',
self::ID_JOHANNESBAD_CAREER_SITE_CRAWLER => 'johannesbad career-site crawler',
self::ID_RANGER => 'ranger',
self::ID_ADECCO_FEED => 'adecco feed',
self::ID_A_UND_O_HOSTELS_CRAWLER => 'a und o hostels crawler',
self::ID_KAEFER_FEED => 'kaefer feed',
self::ID_HELLOFRESH_CRAWLER => 'hellofresh crawler',
self::ID_PHENOM_FEED => 'phenom feed',
self::ID_THYSSENKRUPP_CRAWLER => 'thyssenkrupp crawler',
self::ID_EPOS_CRAWLER => 'epos crawler',
self::ID_RUDOLF_WEBER_CRAWLER => 'rudolf weber crawler',
self::ID_PIEPENBROCK_CRAWLER => 'piepenbrock crawler',
self::ID_SMART_RECRUITERS_API_CLIENT => 'smart recruiters api client',
self::ID_WITHTEC_CRAWLER => 'withtec crawler',
self::ID_CONDOR_SICHERHEIT_CRAWLER => 'condor sicherheit crawler',
self::ID_ZVOOVE_FEED => 'zvoove feed',
self::ID_LIDL_CRAWLER => 'lidl crawler',
self::ID_ROFU_CRAWLER => 'rofu crawler',
self::ID_CLOPPENBURG_CRAWLER => 'cloppenburg crawler',
self::ID_INTERNATIONALER_BUND_CRAWLER => 'internationaler bund crawler',
self::ID_JOHANNITER_CRAWLER => 'johanniter crawler',
self::ID_MHM_CRAWLER => 'mhm crawler',
self::ID_ALB_FILS_KLINIKUM_CRAWLER => 'alb fils klinikum crawler',
self::ID_RUNMED_CRAWLER => 'runmed crawler',
self::ID_DEUTSCHE_BAHN_CRAWLER => 'deutsche bahn crawler',
self::ID_STEPSTONE_FEED => 'stepstone feed',
self::ID_APETITO_FEED => 'apetito feed',
self::ID_VONQ_FEED => 'vonq feed',
self::ID_A_UND_H_ZEITARBEIT_XML_FEED => 'a und h zeitarbeit feed',
self::ID_CONTACT_100_FEED => 'contact 100 feed',
self::ID_A_I_FITNESS_FEED => 'ai fitness feed',
self::ID_XING_FEED => 'xing feed',
self::ID_IMMOBILIEN_SERVICE_DEUTSCHLAND_FEED => 'immobilien service deutschland feed',
self::ID_FUNKE_FEED => 'funke feed'
];
public function __construct()
{
$this->users = new ArrayCollection();
$this->integratedExternalPartnerCustomers = new ArrayCollection();
}
/**
* @var int
*
* @ORM\Column(name="id", type="smallint")
*
* @ORM\Id
*/
protected $id;
/** @throws Exception */
public function setId(int $id): void
{
$refl = new ReflectionClass(ExternalPartner::class);
$constants = $refl->getConstants();
$found = false;
foreach ($constants as $constantName => $constantValue) {
if (substr($constantName, 0, 3) === 'ID_' && $constantValue === $id) {
$found = true;
}
}
if (!$found) {
throw new Exception('Value ' . $id . ' not allowed for id.');
}
$this->id = $id;
}
public function getId(): int
{
return $this->id;
}
public function isIntegrated(): bool
{
if (in_array($this->getId(), self::IDS_INTEGRATED)) {
return true;
} else {
return false;
}
}
/**
* @var User[]|Collection
*
* @ORM\OneToMany(targetEntity="\App\Entity\User", mappedBy="externalPartner", cascade={"persist", "remove"})
*/
protected $users;
public function getUsers(): Collection
{
return $this->users;
}
/**
* @var IntegratedExternalPartnerCustomer[]|Collection
*
* @ORM\OneToMany(targetEntity="\App\Entity\ExternalPartner\IntegratedExternalPartnerCustomer", mappedBy="externalPartner", cascade={"persist", "remove"})
*/
protected Collection $integratedExternalPartnerCustomers;
public function getIntegratedExternalPartnerCustomers(): Collection
{
return $this->integratedExternalPartnerCustomers;
}
/**
* @throws Exception
*/
public function getNameById(int $id): string
{
if (array_key_exists($id, self::IDS_INTEGRATED_TO_NAMES)) {
return self::IDS_INTEGRATED_TO_NAMES[$id];
} else {
throw new Exception('External partner with id ' . $id . ' was not found.');
}
}
/**
* @throws Exception
*/
public function getHyphenatedNameById(int $id): string
{
$name = $this->getNameById($id);
return mb_ereg_replace('[.\s]', '-', $name);
}
}