/** * Convert's the passed application into a DTO. * * @param \AppserverIo\Appserver\Core\Api\Node\AppNodeInterface $appNode The application node to convert * * @return \AppserverIo\Apps\Api\TransferObject\ApplicationOverviewData The DTO */ public function toApplicationOverviewData(AppNodeInterface $appNode) { $overviewData = new ApplicationOverviewData(); $overviewData->setId($appNode->getPrimaryKey()); $overviewData->setName($appNode->getName()); $overviewData->setWebappPath($appNode->getWebappPath()); return $overviewData; }
/** * Returns the full path to the application's thumbnail. * * @param \AppserverIo\Appserver\Core\Api\Node\AppNodeInterface $appNode The application node to return the thumbnail path for * * @return string The absolute path to the app's thumbnail */ protected function getThumbnailPath(AppNodeInterface $appNode) { // prepare the thumbnail path of the passed app node $thumbnailPath = $appNode->getWebappPath() . DIRECTORY_SEPARATOR . 'WEB-INF' . DIRECTORY_SEPARATOR . ApplicationRepository::THUMBNAIL; // check if the app contains a thumbnail in it's WEB-INF folder if (file_exists($thumbnailPath)) { return $thumbnailPath; } // if not, return the placeholder thumbnail return $appNode->getWebappPath() . DIRECTORY_SEPARATOR . 'WEB-INF' . DIRECTORY_SEPARATOR . ApplicationRepository::THUMBNAIL_PLACEHOLDER; }