If article is not published the document will be of typ unknown-document.
Also check the workflow stage if it`s a ArticleDocument.

{@inheritdoc}
774136
public function isPublished($entityClass, $id, $locale)
    {
        $object = $this->documentManager->find($id, $locale);

        if (!$object instanceof ArticleInterface || WorkflowStage::PUBLISHED !== $object->getWorkflowStage()) {
            return false;
        }

        if (!$object instanceof WebspaceBehavior) {
            return true;
        }

        $webspace = $this->requestAnalyzer->getWebspace();
        if (!$webspace ||
            (
                $this->webspaceResolver->resolveMainWebspace($object) !== $webspace->getKey()
                && !in_array($webspace->getKey(), $this->webspaceResolver->resolveAdditionalWebspaces($object))
            )
        ) {
            return false;
        }

        return true;
    }
589071
private function updateArticle(ArticleDocument $article, BasePageDocument $document)
    {
        $locale = $document->getLocale();
        $resourceSegment = $document->getResourceSegment();

        $property = $this->getRoutePathPropertyNameByStructureType($article->getStructureType());
        $propertyName = $this->propertyEncoder->localizedContentName($property->getName(), $locale);

        $node = $this->documentInspector->getNode($article);
        $node->setProperty($propertyName . '-page', $document->getUuid());
        $node->setProperty($propertyName . '-page-path', $resourceSegment);

        $suffix = $node->getPropertyValueWithDefault($propertyName . '-suffix', null);
        if ($suffix) {
            $path = rtrim($resourceSegment, '/') . '/' . $suffix;
            $node->setProperty($propertyName, $path);
            $article->setRoutePath($path);
        }

        $workflowStage = $article->getWorkflowStage();

        $this->documentManager->persist($article, $locale);
        if (WorkflowStage::PUBLISHED === $workflowStage) {
            $this->documentManager->publish($article, $locale);
        }
    }
650643
public function setNextToBePublished()
    {
        $next = $this->find()
            ->where([
                sprintf('%s.active', $this->getAlias()) => true,
                sprintf('%s.created >', $this->getAlias()) => new Time,
            ])
            ->order([sprintf('%s.created', $this->getAlias()) => 'ASC'])
            ->extract('created')
            ->first();

        $next = empty($next) ? false : $next->toUnixString();

        Cache::write('next_to_be_published', $next, $this->getCacheName());

        return $next;
    }
593253
function uploadTranslatable($document) {
		if (! isset ( $this->submission ) || ! isset ( $this->submission->ticket )) {
			throw new Exception ( "Submission not initialized." );
		}
		$this->_validateDocument ( $document );
		
		$documentInfo = $document->getDocumentInfo ( $this->submission );
		$resourceInfo = $document->getResourceInfo ();
		
		$submitDocumentWithBinaryResourceRequest = new submitDocumentWithBinaryResource ();
		
		$submitDocumentWithBinaryResourceRequest->documentInfo = $documentInfo;
		$submitDocumentWithBinaryResourceRequest->resourceInfo = $resourceInfo;
		$submitDocumentWithBinaryResourceRequest->data = $document->data;
		
		$documentTicket = $this->documentService->submitDocumentWithBinaryResource ( $submitDocumentWithBinaryResourceRequest )->return;
		if (isset ( $documentTicket )) {
			$this->submission->ticket = $documentTicket->submissionTicket;
		}
		
		return $documentTicket->ticketId;
	}
1292040
public function isPublished()
	{
		$time = time();
		$published = ($this->published && ($this->publicationStart == '' || $this->publicationStart < $time) && ($this->publicationStop == '' || $this->publicationStop > $time));
		return $published;
	}
1048935
def is_published(self):
        """"""
        return self.status == Status.published and self.timestamp <= arrow.now()
672321
public function isPublishNotEnd(PublishEndReadInterface $object, \DateTimeInterface $currentDate = null)
    {
        $endDate = $object->getPublishEndDate();
        $currentDate = $currentDate ?: new \DateTime();

        return null === $endDate || $currentDate < $endDate;
    }
401742
protected function _additionalChecksForArticle()
    {
        $config = \OxidEsales\Eshop\Core\Registry::getConfig();
        $utils = \OxidEsales\Eshop\Core\Registry::getUtils();

        $shouldContinue = true;
        if (!$this->_oProduct->isVisible()) {
            $shouldContinue = false;
        } elseif ($this->_oProduct->oxarticles__oxparentid->value) {
            $parentArticle = $this->_getParentProduct($this->_oProduct->oxarticles__oxparentid->value);
            if (!$parentArticle || !$parentArticle->isVisible()) {
                $shouldContinue = false;
            }
        }

        if (!$shouldContinue) {
            $utils->redirect($config->getShopHomeUrl());
            $utils->showMessageAndExit('');
        }

        $this->_processProduct($this->_oProduct);
        $this->_blIsInitialized = true;
    }
841725
public boolean hasNext()
		throws ArticleReaderException
	{

		try {
			if (!this.lastTaskCompleted) {
				return true;
			}

			this.keywords.reset();

			int b = read();
			while (b != -1) {

				if (keywords.check((char) b)) {
					switch (keywords.getValue()) {
					case KEY_START_PAGE:
						// taskStartPosition = bytePosition;
						return true;
					}
					keywords.reset();
				}

				b = read();
			}

			return false;

		}
		catch (Exception e) {
			throw new ArticleReaderException(e);
		}
	}
971638
public function isValidMetaFile()
	{
		if ( $this->metaFile ) return true;

		$metaFilePath = key( $this->contents ) . "/" . XBRL_TaxonomyPackage::metaFolderName . "/" . XBRL_TaxonomyPackage::taxonomyPackageFilename;

		try
		{
			// The XML should be valid
			$xml = $this->getFileAsXML( $metaFilePath );
			// Can't access the namespace of an element from SimpleXML so use the DOM version
			$dom = dom_import_simplexml( $xml );
			$namespace = $dom->namespaceURI;
			unset( $dom );

			// The root element should be taxonomyPackage
			if ( $xml->getName() != XBRL_TaxonomyPackage::rootElementNme )
			{
				throw XBRL_TaxonomyPackageException::withError( "tpe:invalidMetaDataFile", $ex->getMessage() );
			}

			$this->metaFile = $xml;

			// Now time to read elements and validate the document
			$xmlAttributes = $xml->attributes( 'xml', true );
			$lang = isset( $xmlAttributes['lang'] ) ? (string)$xmlAttributes['lang'] : '';

			foreach ( $xml->children( $namespace ) as $name => $element )
			{
				switch ( $name )
				{
					case 'name':
					case 'description':
					case 'publisher':

						$elementXmlAttributes = $element->attributes( 'xml', true );
						$elementLang = isset( $elementXmlAttributes['lang'] ) ? (string)$elementXmlAttributes['lang'] : $lang;

						if ( empty( $elementLang ) )
						{
							throw XBRL_TaxonomyPackageException::withError( "tpe:missingLanguageAttribute", "The language code must not be empty") ;
						}

						if ( isset( $this->$name[ $elementLang ] ) )
						{
							throw XBRL_TaxonomyPackageException::withError( "tpe:duplicateLanguagesForElement", "The language must be unique across all names");
						}

						$this->$name[ $elementLang ] = (string)$element;

						unset( $elementAttributes );
						break;

					case 'identifier':
					case 'version':
					case 'publisherURL':
					case 'publisherCountry':
					case 'publicationDate':
					case 'publisherCountry':

						// There should be only one instance
						if ( ! is_null( $this->$name ) )
						{
							throw XBRL_TaxonomyPackageException::withError( "tpe:invalidMetaDataFile", "The element '$name' must not be repeated");
						}

						// Check for a valid country code if relevant
						if ( $name == 'publisherCountry' && ( strlen( (string)$element ) != 2 || ! isset( self::$countries[ (string)$element ] ) ) )
						{
							throw XBRL_TaxonomyPackageException::withError( 'tpe:invalidMetaDataFile', "The contry code '$element' is not a valid 2-letter country code" );
						}

						$this->$name = (string)$element;
						break;

					case 'license':

						// There should be only one instance
						if ( ! is_null( $this->$name ) )
						{
							throw XBRL_TaxonomyPackageException::withError( "tpe:invalidMetaDataFile", "The element '$name' must not be repeated");
						}

						$elementAttributes = $xml->attributes();
						$licenseName = isset( $elementAttributes['name'] ) ? (string)$elementAttributes['name'] : '';
						if ( ! $licenseName ) continue;
						$href = isset( $elementAttributes['href'] ) ? (string)$elementAttributes['href'] : '';

						$this->$name['name'] = $licenseName;
						$this->$name['href'] = $href;

						unset( $licenseName );
						unset( $href );
						unset( $elementAttributes );
						break;

					case 'entryPoints':

						$elementXmlAttributes = $element->attributes( 'xml', true );
						$elementLang = isset( $elementXmlAttributes['lang'] ) ? (string)$elementXmlAttributes['lang'] : $lang;

						$entryPoints = array();

						foreach ( $element->children( $namespace ) as $entryPointName => $entryPoint )
						{
							$elementXmlAttributes = $entryPoint->attributes( 'xml', true );
							$elementLang2 = isset( $elementXmlAttributes['lang'] ) ? (string)$elementXmlAttributes['lang'] : $elementLang;

							$entryPoints[] = array();
							$index = count( $entryPoints ) - 1;

							foreach ( $entryPoint->children( $namespace ) as $elementName => $element )
							{
								switch ( $elementName )
								{
									case 'name':
									case 'description':

										$elementXmlAttributes = $element->attributes( 'xml', true );
										$elementLang3 = isset( $elementXmlAttributes['lang'] ) ? (string)$elementXmlAttributes['lang'] : $elementLang2;

										if ( empty( $elementLang3 ) )
										{
											throw XBRL_TaxonomyPackageException::withError( "tpe:missingLanguageAttribute", "The language code must not be empty") ;
										}

										if ( isset( $entryPoints[ $index ][ $elementName ][ $elementLang3 ] ) )
										{
											throw XBRL_TaxonomyPackageException::withError( "tpe:duplicateLanguagesForElement", "The language must be unique across all names");
										}

										$entryPoints[ $index ][ $elementName ][ $elementLang3 ] = (string)$element;

										unset( $elementXmlAttributes );
										break;

									case 'version':

										// There should be only one instance
										if ( isset( $entryPoints[ $index ][ $elementName ] ) )
										{
											throw XBRL_TaxonomyPackageException::withError( "tpe:invalidMetaDataFile", "The element '$elementName' must not be repeated");
										}

										$entryPoints[ $index ][ $elementName ] = (string)$element;
										break;

									case 'entryPointDocument':

										$elementAttributes = $element->attributes();
										if ( ! isset( $elementAttributes->href ) )
										{
											throw XBRL_TaxonomyPackageException::withError( "tpe:invalidMetaDataFile", "Missing the @href on element '$elementName'");
										}

										$href = (string)$elementAttributes->href;
										$entryPoints[ $index ][ $elementName ][] = $href;

										unset( $href );
										unset( $elementAttributes );
										break;

									case 'languages':

										foreach ( $element as $languageElement => $language )
										{
											$entryPoints[ $index ][ $elementName ][] = (string)$language;
										}
										unset( $languageElement );
										unset( $language );
										break;
								}
							}

							unset( $element );
							unset( $elementName );
						}


						$this->entryPoints = $entryPoints;

						unset( $entryPoints );
						unset( $entryPoint );
						unset( $entryPointName );

						break;

					default:

						// supersededTaxonomyPackages
						// versioningReports
						break;
				}
			}

			unset( $element );

		}
		catch ( XBRL_TaxonomyPackageException $ex )
		{
			throw $ex;
		}
		catch ( Exception $ex )
		{
			throw XBRL_TaxonomyPackageException::withError( "tpe:invalidMetaDataFile", $ex->getMessage() );
		}

		return true;
	}
1130020
public function onBeforeWrite() {
		parent::onBeforeWrite();
		
		// dummy initial date
		if (!$this->OriginalPublishedDate) {
			// @TODO Fix this to be correctly localized!!
			$this->OriginalPublishedDate = date('Y-m-d 12:00:00');
		}
		
		$parent = $this->Parent();

		// just in case we've been moved, update our section
		$section = $this->findSection();
		$this->NewsSectionID = $section->ID;

		$newlyCreated = $section->ID == $parent->ID;
		$changedPublishDate = $this->isChanged('OriginalPublishedDate', 2);

		if (($changedPublishDate || $newlyCreated) && ($section->AutoFiling || $section->FilingMode)) {
			if (!$this->Created) {
				$this->Created = date('Y-m-d H:i:s');
			}
			$pp = $this->PartitionParent();
			if ($pp->ID != $this->ParentID) {
				$this->ParentID = $pp->ID;
			}
		}

	}
235600
public function isGranted(StatusableInterface $document, StatusInterface $toStatus)
    {
        $fromStatus = $document->getStatus();
        if ($fromStatus->getId() != $toStatus->getId()) {
            $role = $this->roleRepository->findOneByFromStatusAndToStatus($fromStatus, $toStatus);
            $workflowFunctions = $this->workflowFunctionRepository->findByRole($role);
            foreach ($workflowFunctions as $workflowFunction) {
                if ($this->authorizationChecker->isGranted($workflowFunction->getId(), $document)) {

                    return true;
                }
            }

            return false;
        }

        return true;
    }
294936
public function onPostConvertToDocument(PostConvertToDocumentEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof ArticleViewDocumentInterface) {
            return;
        }

        $structure = $this->structureManager->getStructure($document->getStructureType(), 'article');
        $structure->setUuid($document->getUuid());
        $structure->setLanguageCode($document->getLocale());

        list($content, $view) = $this->getProxies($document->getContentData(), $structure);

        $document->setContent($content);
        $document->setView($view);

        foreach ($document->getPages() as $page) {
            $structure->setUuid($page->uuid);
            list($page->content, $page->view) = $this->getProxies($page->contentData, $structure);
        }
    }
846218
public function getPublished()
    {
        $manager = BaseManager::build('\FelixOnline\Core\ArticlePublication', 'article_publication');

        try {
            $date = $manager->filter('article = %i', array($this->getId()))
                            ->filter('republished = 0')
                            ->one();
        } catch (\FelixOnline\Exceptions\InternalException $e) {
            return null;
        }

        return($date->getPublicationDate());
    }
1290187
public function indexDocumentAfterRemoveDraft(RemoveDraftEvent $event)
    {
        $document = $event->getDocument();

        if ($document instanceof WorkflowStageBehavior) {
            // Set the workflowstage to test for indexing, because the wrong index will be updated otherwise
            $document->setWorkflowStage(WorkflowStage::TEST);
        }

        $this->indexDocument($document);

        if ($document instanceof WorkflowStageBehavior) {
            // Reset the workflowstage to published, because after removing a draft the document will always be in
            // the published state
            $document->setWorkflowStage(WorkflowStage::PUBLISHED);
        }
    }
1034518
public function hasDocument(string $id): bool
    {
        if (isset($this->documents[$id])) {
            return true;
        }

        $path = $this->getDocumentPath($id);

        if ($this->filesystem->has($path)) {
            $info = $this->filesystem->getMetadata($path);

            return $info['type'] === 'file';
        }

        return false;
    }
482207
public function getBannerArticle()
    {
        $sArtId = $this->fetchBannerArticleId();

        if ($sArtId) {
            $oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);

            if ($this->isAdmin()) {
                $oArticle->setLanguage(\OxidEsales\Eshop\Core\Registry::getLang()->getEditLanguage());
            }

            if ($oArticle->load($sArtId)) {
                return $oArticle;
            }
        }

        return null;
    }