-
François Agneray authoredFrançois Agneray authored
Instance.php 15.14 KiB
<?php
/*
* This file is part of Anis Server.
*
* (c) Laboratoire d'Astrophysique de Marseille / CNRS
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @author François Agneray <francois.agneray@lam.fr>
* @package App\Entity
*
* @Entity
* @Table(name="instance")
*/
class Instance implements \JsonSerializable
{
/**
* @var string
*
* @Id
* @Column(type="string", nullable=false)
*/
protected $name;
/**
* @var string
*
* @Column(type="string", nullable=false)
*/
protected $label;
/**
* @var string
*
* @Column(type="text", nullable=true)
*/
protected $description;
/**
* @var string
*
* @Column(type="string", name="scientific_manager", nullable=true)
*/
protected $scientificManager;
/**
* @var string
*
* @Column(type="string", name="instrument", nullable=true)
*/
protected $instrument;
/**
* @var string
*
* @Column(type="string", name="wavelength_domain", nullable=true)
*/
protected $wavelengthDomain;
/**
* @var int
*
* @Column(type="integer", nullable=false)
*/
protected $display;
/**
* @var string
*
* @Column(type="string", name="data_path", nullable=true)
*/
protected $dataPath;
/**
* @var string
*
* @Column(type="string", name="files_path", nullable=true)
*/
protected $filesPath;
/**
* @var bool
*
* @Column(type="boolean", nullable=false)
*/
protected $public;
/**
* @var string
*
* @Column(type="string", name="portal_logo", nullable=true)
*/
protected $portalLogo;
/**
* @var string
*
* @Column(type="string", name="design_color", nullable=true)
*/
protected $designColor;
/**
* @var string
*
* @Column(type="string", name="design_background_color", nullable=true)
*/
protected $designBackgroundColor;
/**
* @var string
*
* @Column(type="string", name="design_logo", nullable=true)
*/
protected $designLogo;
/**
* @var string
*
* @Column(type="string", name="design_favicon", nullable=true)
*/
protected $designFavicon;
/**
* @var string
*
* @Column(type="string", name="navbar_background_color", nullable=false, options={"default" : "#F8F9FA"})
*/
protected $navbarBackgroundColor;
/**
* @var string
*
* @Column(type="string", name="navbar_border_bottom_color", nullable=false, options={"default" : "#DEE2E6"})
*/
protected $navbarBorderBottomColor;
/**
* @var string
*
* @Column(type="string", name="navbar_color_href", nullable=false, options={"default" : "#000000"})
*/
protected $navbarColorHref;
/**
* @var string
*
* @Column(type="string", name="family_border_color", nullable=false, options={"default" : "#DFDFDF"})
*/
protected $familyBorderColor;
/**
* @var string
*
* @Column(type="string", name="family_header_background_color", nullable=false, options={"default" : "#F7F7F7"})
*/
protected $familyHeaderBackgroundColor;
/**
* @var string
*
* @Column(type="string", name="family_title_color", nullable=false, options={"default" : "#007bff"})
*/
protected $familyTitleColor;
/**
* @var bool
*
* @Column(type="boolean", name="family_title_bold", nullable=false, options={"default" : false})
*/
protected $familyTitleBold;
/**
* @var string
*
* @Column(type="string", name="family_color", nullable=false, options={"default" : "#212529"})
*/
protected $familyColor;
/**
* @var bool
*
* @Column(type="boolean", name="samp_enabled", nullable=false)
*/
protected $sampEnabled;
/**
* @var bool
*
* @Column(type="boolean", name="back_to_portal", nullable=false)
*/
protected $backToPortal;
/**
* @var bool
*
* @Column(type="boolean", name="user_menu_enabled", nullable=false, options={"default" : true})
*/
protected $userMenuEnabled;
/**
* @var bool
*
* @Column(type="boolean", name="search_by_criteria_allowed", nullable=false)
*/
protected $searchByCriteriaAllowed;
/**
* @var string
*
* @Column(type="string", name="search_by_criteria_label", nullable=false)
*/
protected $searchByCriteriaLabel;
/**
* @var bool
*
* @Column(type="boolean", name="search_multiple_allowed", nullable=false)
*/
protected $searchMultipleAllowed;
/**
* @var string
*
* @Column(type="string", name="search_multiple_label", nullable=false)
*/
protected $searchMultipleLabel;
/**
* @var bool
*
* @Column(type="boolean", name="search_multiple_all_datasets_selected", nullable=false)
*/
protected $searchMultipleAllDatasetsSelected;
/**
* @var bool
*
* @Column(type="boolean", name="documentation_allowed", nullable=false)
*/
protected $documentationAllowed;
/**
* @var string
*
* @Column(type="string", name="documentation_label", nullable=false)
*/
protected $documentationLabel;
/**
* @var DatasetFamily[]
*
* @OneToMany(targetEntity="DatasetFamily", mappedBy="instance")
*/
protected $datasetFamilies;
public function __construct(string $name, string $label)
{
$this->name = $name;
$this->label = $label;
$this->datasetFamilies = new ArrayCollection();
}
public function getName()
{
return $this->name;
}
public function getLabel()
{
return $this->label;
}
public function setLabel(string $label)
{
$this->label = $label;
}
public function getDescription()
{
return $this->description;
}
public function setDescription($description)
{
$this->description = $description;
}
public function getScientificManager()
{
return $this->scientificManager;
}
public function setScientificManager($scientificManager)
{
$this->scientificManager = $scientificManager;
}
public function getInstrument()
{
return $this->instrument;
}
public function setInstrument($instrument)
{
$this->instrument = $instrument;
}
public function getWavelengthDomain()
{
return $this->wavelengthDomain;
}
public function setWavelengthDomain($wavelengthDomain)
{
$this->wavelengthDomain = $wavelengthDomain;
}
public function getDisplay()
{
return $this->display;
}
public function setDisplay($display)
{
$this->display = $display;
}
public function getDataPath()
{
return $this->dataPath;
}
public function setDataPath($dataPath)
{
$this->dataPath = $dataPath;
}
public function getFilesPath()
{
return $this->filesPath;
}
public function setFilesPath($filesPath)
{
$this->filesPath = $filesPath;
}
public function getPublic()
{
return $this->public;
}
public function setPublic($public)
{
$this->public = $public;
}
public function getPortalLogo()
{
return $this->portalLogo;
}
public function setPortalLogo($portalLogo)
{
$this->portalLogo = $portalLogo;
}
public function getDesignColor()
{
return $this->designColor;
}
public function setDesignColor($designColor)
{
$this->designColor = $designColor;
}
public function getDesignBackgroundColor()
{
return $this->designBackgroundColor;
}
public function setDesignBackgroundColor($designBackgroundColor)
{
$this->designBackgroundColor = $designBackgroundColor;
}
public function getDesignLogo()
{
return $this->designLogo;
}
public function setDesignLogo($designLogo)
{
$this->designLogo = $designLogo;
}
public function getDesignFavicon()
{
return $this->designFavicon;
}
public function setDesignFavicon($designFavicon)
{
$this->designFavicon = $designFavicon;
}
public function getNavbarBackgroundColor()
{
return $this->navbarBackgroundColor;
}
public function setNavbarBackgroundColor($navbarBackgroundColor)
{
$this->navbarBackgroundColor = $navbarBackgroundColor;
}
public function getNavbarBorderBottomColor()
{
return $this->navbarBorderBottomColor;
}
public function setNavbarBorderBottomColor($navbarBorderBottomColor)
{
$this->navbarBorderBottomColor = $navbarBorderBottomColor;
}
public function getNavbarColorHref()
{
return $this->navbarColorHref;
}
public function setNavbarColorHref($navbarColorHref)
{
$this->navbarColorHref = $navbarColorHref;
}
public function getFamilyBorderColor()
{
return $this->familyBorderColor;
}
public function setFamilyBorderColor($familyBorderColor)
{
$this->familyBorderColor = $familyBorderColor;
}
public function getFamilyHeaderBackgroundColor()
{
return $this->familyHeaderBackgroundColor;
}
public function setFamilyHeaderBackgroundColor($familyHeaderBackgroundColor)
{
$this->familyHeaderBackgroundColor = $familyHeaderBackgroundColor;
}
public function getFamilyTitleColor()
{
return $this->familyTitleColor;
}
public function setFamilyTitleColor($familyTitleColor)
{
$this->familyTitleColor = $familyTitleColor;
}
public function getFamilyTitleBold()
{
return $this->familyTitleBold;
}
public function setFamilyTitleBold($familyTitleBold)
{
$this->familyTitleBold = $familyTitleBold;
}
public function getFamilyColor()
{
return $this->familyColor;
}
public function setFamilyColor($familyColor)
{
$this->familyColor = $familyColor;
}
public function getSampEnabled()
{
return $this->sampEnabled;
}
public function setSampEnabled($sampEnabled)
{
$this->sampEnabled = $sampEnabled;
}
public function getBackToPortal()
{
return $this->backToPortal;
}
public function setBackToPortal($backToPortal)
{
$this->backToPortal = $backToPortal;
}
public function getUserMenuEnabled()
{
return $this->userMenuEnabled;
}
public function setUserMenuEnabled($userMenuEnabled)
{
$this->userMenuEnabled = $userMenuEnabled;
}
public function getSearchByCriteriaAllowed()
{
return $this->searchByCriteriaAllowed;
}
public function setSearchByCriteriaAllowed($searchByCriteriaAllowed)
{
$this->searchByCriteriaAllowed = $searchByCriteriaAllowed;
}
public function getSearchByCriteriaLabel()
{
return $this->searchByCriteriaLabel;
}
public function setSearchByCriteriaLabel($searchByCriteriaLabel)
{
$this->searchByCriteriaLabel = $searchByCriteriaLabel;
}
public function getSearchMultipleAllowed()
{
return $this->searchMultipleAllowed;
}
public function setSearchMultipleAllowed($searchMultipleAllowed)
{
$this->searchMultipleAllowed = $searchMultipleAllowed;
}
public function getSearchMultipleLabel()
{
return $this->searchMultipleLabel;
}
public function setSearchMultipleLabel($searchMultipleLabel)
{
$this->searchMultipleLabel = $searchMultipleLabel;
}
public function getSearchMultipleAllDatasetsSelected()
{
return $this->searchMultipleAllDatasetsSelected;
}
public function setSearchMultipleAllDatasetsSelected($searchMultipleAllDatasetsSelected)
{
$this->searchMultipleAllDatasetsSelected = $searchMultipleAllDatasetsSelected;
}
public function getDocumentationAllowed()
{
return $this->documentationAllowed;
}
public function setDocumentationAllowed($documentationAllowed)
{
$this->documentationAllowed = $documentationAllowed;
}
public function getDocumentationLabel()
{
return $this->documentationLabel;
}
public function setDocumentationLabel($documentationLabel)
{
$this->documentationLabel = $documentationLabel;
}
public function getDatasetFamilies()
{
return $this->datasetFamilies;
}
public function getNbDatasets()
{
$nbDatasets = 0;
foreach ($this->datasetFamilies as $family) {
$nbDatasets += count($family->getDatasets());
}
return $nbDatasets;
}
public function jsonSerialize(): array
{
return [
'name' => $this->getName(),
'label' => $this->getLabel(),
'description' => $this->getDescription(),
'scientific_manager' => $this->getScientificManager(),
'instrument' => $this->getInstrument(),
'wavelength_domain' => $this->getWavelengthDomain(),
'display' => $this->getDisplay(),
'data_path' => $this->getDataPath(),
'files_path' => $this->getFilesPath(),
'public' => $this->getPublic(),
'portal_logo' => $this->getPortalLogo(),
'design_color' => $this->getDesignColor(),
'design_background_color' => $this->getDesignBackgroundColor(),
'design_logo' => $this->getDesignLogo(),
'design_favicon' => $this->getDesignFavicon(),
'navbar_background_color' => $this->getNavbarBackgroundColor(),
'navbar_border_bottom_color' => $this->getNavbarBorderBottomColor(),
'navbar_color_href' => $this->getNavbarColorHref(),
'family_border_color' => $this->getFamilyBorderColor(),
'family_header_background_color' => $this->getFamilyHeaderBackgroundColor(),
'family_title_color' => $this->getFamilyTitleColor(),
'family_title_bold' => $this->getFamilyTitleBold(),
'family_color' => $this->getFamilyColor(),
'samp_enabled' => $this->getSampEnabled(),
'back_to_portal' => $this->getBackToPortal(),
'user_menu_enabled' => $this->getUserMenuEnabled(),
'search_by_criteria_allowed' => $this->getSearchByCriteriaAllowed(),
'search_by_criteria_label' => $this->getSearchByCriteriaLabel(),
'search_multiple_allowed' => $this->getSearchMultipleAllowed(),
'search_multiple_label' => $this->getSearchMultipleLabel(),
'search_multiple_all_datasets_selected' => $this->getSearchMultipleAllDatasetsSelected(),
'documentation_allowed' => $this->getDocumentationAllowed(),
'documentation_label' => $this->getDocumentationLabel(),
'nb_dataset_families' => count($this->getDatasetFamilies()),
'nb_datasets' => $this->getNbDatasets()
];
}
}