Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile.tomcat
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ LABEL name="Entando App" \
summary="Entando Application" \
description="This Entando app engine application provides APIs and composition for Entando applications"

#COPY target/generated-resources/licenses /licenses
#COPY target/generated-resources/licenses.xml /
COPY target/generated-resources/licenses /licenses
COPY target/generated-resources/licenses.xml /

COPY --chown=185:0 webapp/target/*.war /usr/local/tomcat/webapps/
# Copy CookieProcessor JAR if it exists
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,6 @@ The general log level is controlled by the variable `ROOT_LOG_LEVEL`, that in te
|| ENTANDO_BUNDLE_CLI_ETC | ${ENTANDO_BUNDLE_CLI_ETC}/hub/credentials | Credentials/parameters saved within JSON files under this path for ent bundle add hub command
|| ENTANDO_APP_ENGINE_HEALTH_CHECK_TYPE | db.migration.strategy | [auto], skip, disabled, generate_sql | Liquibase strategy
|| LOG_CONFIG_FILE_PATH | | to use the logback composable feature |
|| ENTANDO_DOCKER_REGISTRY_OVERRIDE | | Deprecated-for v1 bundles, to propagate to CM for plugins |
|| ENTANDO_DOCKER_REGISTRY_OVERRIDE | | Deprecated-for v1 bundles, to propagate to CM for plugins |
| Feature Flags | ENTANDO_FEATURE_FLAGS | comma-separated list of tags | Enable experimental features. Example: `CACHE_PIPELINE` |
|| ENTANDO_FF_DEEP_DEBUG | comma-separated list of tags | Enable deep debug logging for specific components. Example: `service-reload` |
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@
</a>
</li>
</c:if>
<s:set var="appBuilderIntegrationEnabledVar" ><wp:info key="systemParam" paramName="appBuilderIntegrationEnabled" /></s:set>
<c:if test="${isSuperUser}">
<s:if test="#appBuilderIntegrationEnabled == 'true'">
<wpsa:pluginsSubMenu objectName="pluginsSubMenusVar" />
<s:iterator value="#pluginsSubMenusVar" var="pluginSubMenuVar">
<s:if test="#pluginSubMenuVar.pluginCode == 'jpcontentscheduler'">
<s:include value="%{#pluginSubMenuVar.subMenuFilePath}" />
</s:if>
</s:iterator>
</s:if>
</c:if>
<c:if test="${isSuperUser}">
<li class="list-group-item">
<a href="<s:url action="initViewEntityTypes" namespace="/do/Entity"><s:param name="entityManagerName">jacmsContentManager</s:param></s:url>">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,47 +21,47 @@
*/
package org.entando.entando.plugins.jpcontentscheduler.aps.system.services.content;


import com.agiletec.aps.system.ApsSystemUtils;
import com.agiletec.aps.system.common.entity.model.AttributeFieldError;
import com.agiletec.aps.system.common.entity.model.AttributeTracer;
import com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface;
import com.agiletec.aps.system.services.category.Category;
import com.agiletec.aps.system.services.category.ICategoryManager;
import com.agiletec.aps.system.services.lang.ILangManager;
import com.agiletec.aps.system.services.page.IPage;
import com.agiletec.aps.system.services.page.IPageManager;
import com.agiletec.aps.system.services.page.Widget;
import com.agiletec.aps.util.ApsProperties;
import com.agiletec.plugins.jacms.aps.system.services.content.IContentManager;
import com.agiletec.plugins.jacms.aps.system.services.content.model.Content;
import com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModel;
import com.agiletec.plugins.jacms.aps.system.services.contentmodel.IContentModelManager;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import com.agiletec.aps.system.services.lang.ILangManager;
import org.entando.entando.ent.exception.EntException;
import org.entando.entando.ent.util.EntLogging.EntLogger;
import org.entando.entando.ent.util.EntLogging.EntLogFactory;
import org.entando.entando.plugins.jpcontentscheduler.aps.system.services.ContentThreadConstants;
import org.entando.entando.plugins.jpcontentscheduler.aps.system.services.content.model.ContentState;
import org.entando.entando.plugins.jpcontentscheduler.aps.system.services.content.model.ContentSuspendMove;
import org.entando.entando.plugins.jpcontentscheduler.aps.system.services.content.util.Utils;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.scheduling.quartz.QuartzJobBean;

import com.agiletec.aps.system.ApsSystemUtils;
import com.agiletec.aps.system.common.entity.model.AttributeFieldError;
import com.agiletec.aps.system.common.entity.model.AttributeTracer;
import com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface;
import com.agiletec.aps.system.exception.ApsSystemException;
import com.agiletec.aps.system.services.category.Category;
import com.agiletec.aps.system.services.category.ICategoryManager;
import com.agiletec.aps.system.services.page.IPage;
import com.agiletec.aps.system.services.page.IPageManager;
import com.agiletec.aps.system.services.page.Widget;
import com.agiletec.aps.util.ApsProperties;
import com.agiletec.plugins.jacms.aps.system.services.content.IContentManager;
import com.agiletec.plugins.jacms.aps.system.services.content.model.Content;
import com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModel;
import com.agiletec.plugins.jacms.aps.system.services.contentmodel.IContentModelManager;


public class ContentJobs extends QuartzJobBean implements ApplicationContextAware {

private static final Logger _logger = LoggerFactory.getLogger(ContentJobs.class);
private static final EntLogger _logger = EntLogFactory.getSanitizedLogger(ContentJobs.class);

private static final String APPLICATION_CONTEXT_KEY = "applicationContext";

Expand All @@ -70,12 +70,10 @@ public class ContentJobs extends QuartzJobBean implements ApplicationContextAwar
private ICategoryManager _categoryManager;
private IPageManager _pageManager;
private IContentModelManager _contentModelManager;
private ILangManager _langManager;

private ApplicationContext _ctx;

@Autowired
private ILangManager langManager;

@Override
public void setApplicationContext(ApplicationContext ac) throws BeansException {
this._ctx = ac;
Expand All @@ -97,6 +95,7 @@ private void initBeans(ApplicationContext appCtx) {
this.setContentModelManager((IContentModelManager) appCtx.getBean("jacmsContentModelManager"));
this.setCategoryManager((ICategoryManager) appCtx.getBean("CategoryManager"));
this.setPageManager((IPageManager) appCtx.getBean("PageManager"));
this.setLangManager((ILangManager) appCtx.getBean("LangManager"));
}

@Override
Expand All @@ -116,7 +115,7 @@ public void executeJob(ApplicationContext appCtx) throws JobExecutionException {
if (this.getContentSchedulerManager().getConfig()
.isActive()/* && isCurrentSiteAllowed() */) {
Date startJobDate = new Date();
_logger.info(ContentThreadConstants.START_TIME_LOG + Utils.printTimeStamp(startJobDate));
_logger.info(ContentThreadConstants.START_TIME_LOG + "{}", Utils.printTimeStamp(startJobDate));
List<ContentState> removedContents = new ArrayList<ContentState>();
List<ContentState> publishedContents = new ArrayList<ContentState>();
List<ContentState> moveContents = new ArrayList<ContentState>();
Expand All @@ -130,11 +129,11 @@ public void executeJob(ApplicationContext appCtx) throws JobExecutionException {
Collections.sort(removedContents);
Collections.sort(moveContents);
Date endJobDate = new Date();
_logger.info(ContentThreadConstants.END_TIME_LOG + Utils.printTimeStamp(endJobDate));
_logger.info(ContentThreadConstants.END_TIME_LOG + "{}", Utils.printTimeStamp(endJobDate));
this.getContentSchedulerManager().sendMailWithResults(publishedContents, removedContents,
moveContents, startJobDate, endJobDate);
} catch (Throwable t) {
throw new ApsSystemException(ContentThreadConstants.ERROR_ON_MAIL, t);
throw new EntException(ContentThreadConstants.ERROR_ON_MAIL, t);
}
} catch (Throwable t) {
ApsSystemUtils.logThrowable(t, this, t.getMessage());
Expand All @@ -147,7 +146,7 @@ public void executeJob(ApplicationContext appCtx) throws JobExecutionException {
}
}

private void publishContentsJob(List<ContentState> publishedContents) throws ApsSystemException {
private void publishContentsJob(List<ContentState> publishedContents) throws EntException {
try {
// Restituisce gli id dei contenuti che hanno un attributo con nome
// key Data_inizio e valore la data corrente
Expand All @@ -164,39 +163,35 @@ private void publishContentsJob(List<ContentState> publishedContents) throws Aps
if (null == contentToPublish) {
publishedContents.add(new ContentState(contentId, "null", "null",
ContentThreadConstants.PUBLISH_ACTION, ContentThreadConstants.NULL_CONTENT));
_logger.info("Pubblicazione automatica non riuscita: " + contentId + " - "
+ ContentThreadConstants.NULL_CONTENT);
_logger.info("Pubblicazione automatica non riuscita: {} - " + ContentThreadConstants.NULL_CONTENT, contentId);
continue;
}
if (contentToPublish.isOnLine()) {
publishedContents.add(new ContentState(contentToPublish.getId(), contentToPublish.getTypeCode(),
contentToPublish.getDescription(), ContentThreadConstants.PUBLISH_ACTION,
ContentThreadConstants.ISALREADYONLINE));
_logger.info("Pubblicazione automatica non riuscita: " + contentToPublish.getId() + " - "
+ ContentThreadConstants.ISALREADYONLINE);
_logger.info("Pubblicazione automatica non riuscita: {} - " + ContentThreadConstants.ISALREADYONLINE, contentToPublish.getId());
continue;
}
if (!Content.STATUS_READY.equals(contentToPublish.getStatus())) {
publishedContents.add(new ContentState(contentToPublish.getId(), contentToPublish.getTypeCode(),
contentToPublish.getDescription(), ContentThreadConstants.PUBLISH_ACTION,
ContentThreadConstants.NOTREADYSTATUS));
_logger.info("Pubblicazione automatica non riuscita: " + contentToPublish.getId() + " - "
+ ContentThreadConstants.NOTREADYSTATUS);
_logger.info("Pubblicazione automatica non riuscita: {} - " + ContentThreadConstants.NOTREADYSTATUS, contentToPublish.getId());
continue;
}
boolean validation = this.scanEntity(contentToPublish);
if (!validation) {
publishedContents.add(new ContentState(contentToPublish.getId(), contentToPublish.getTypeCode(),
contentToPublish.getDescription(), ContentThreadConstants.PUBLISH_ACTION,
ContentThreadConstants.CONTENTWITHERRORS));
_logger.info("Pubblicazione automatica non riuscita: " + contentToPublish.getId() + " - "
+ ContentThreadConstants.CONTENTWITHERRORS);
_logger.info("Pubblicazione automatica non riuscita: {} - " + ContentThreadConstants.CONTENTWITHERRORS, contentToPublish.getId());
continue;
}
// pubblicazione on line del contenuto e modifica data di
// ultima modifica
this.getContentManager().insertOnLineContent(contentToPublish);
_logger.info("Pubblicato automaticamente contenuto " + contentToPublish.getId());
_logger.info("Pubblicato automaticamente contenuto {}", contentToPublish.getId());
publishedContents.add(new ContentState(contentToPublish.getId(), contentToPublish.getTypeCode(),
contentToPublish.getDescription(), ContentThreadConstants.PUBLISH_ACTION,
ContentThreadConstants.ACTION_SUCCESS));
Expand All @@ -207,7 +202,7 @@ private void publishContentsJob(List<ContentState> publishedContents) throws Aps
}
}
} catch (Throwable t) {
throw new ApsSystemException(ContentThreadConstants.ERROR_ON_PUBLISH, t);
throw new EntException(ContentThreadConstants.ERROR_ON_PUBLISH, t);
}
}

Expand All @@ -217,7 +212,7 @@ public boolean scanEntity(Content currentContent) {
for (int i = 0; i < attributes.size(); i++) {
AttributeInterface entityAttribute = attributes.get(i);
if (entityAttribute.isActive()) {
List<AttributeFieldError> errors = entityAttribute.validate(new AttributeTracer(), langManager);
List<AttributeFieldError> errors = entityAttribute.validate(new AttributeTracer(), this.getLangManager());
if (null != errors && errors.size() > 0) {
return false;
}
Expand All @@ -232,7 +227,7 @@ public boolean scanEntity(Content currentContent) {

@SuppressWarnings("unchecked")
private void suspendOrMoveContentsJob(List<ContentState> removedContents, List<ContentState> moveContents,
ApplicationContext appCtx) throws ApsSystemException {
ApplicationContext appCtx) throws EntException {
try {
// Restituisce gli id dei contenuti che hanno un attributo con nome
// key Data_fine e valore la data corrente
Expand Down Expand Up @@ -767,4 +762,9 @@ public void setContentModelManager(IContentModelManager contentModelManager) {
this._contentModelManager = contentModelManager;
}

public ILangManager getLangManager() { return _langManager; }

public void setLangManager(ILangManager langManager) { this._langManager = langManager; }


}
Loading
Loading