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
2 changes: 1 addition & 1 deletion Dockerfile.tomcat
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LABEL name="Entando App" \
maintainer="dev@entando.com" \
vendor="Entando Inc." \
version="${VERSION}" \
release="7.3.0-fix.2" \
release="7.3.0-fix.4" \
summary="Entando Application" \
description="This Entando app engine application provides APIs and composition for Entando applications"

Expand Down
2 changes: 1 addition & 1 deletion admin-console/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.entando</groupId>
<artifactId>app-engine</artifactId>
<version>7.3.0-fix.2</version>
<version>7.3.0-fix.4</version>
</parent>
<groupId>org.entando.entando</groupId>
<artifactId>entando-admin-console</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion cds-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.entando</groupId>
<artifactId>app-engine</artifactId>
<version>7.3.0-fix.2</version>
<version>7.3.0-fix.4</version>
</parent>
<artifactId>entando-plugin-jpcds</artifactId>
<groupId>org.entando.entando.plugins</groupId>
Expand Down
2 changes: 1 addition & 1 deletion cms-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.entando</groupId>
<artifactId>app-engine</artifactId>
<version>7.3.0-fix.2</version>
<version>7.3.0-fix.4</version>
</parent>
<groupId>org.entando.entando.plugins</groupId>
<artifactId>entando-plugin-jacms</artifactId>
Expand Down
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
2 changes: 1 addition & 1 deletion contentscheduler-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.entando</groupId>
<artifactId>app-engine</artifactId>
<version>7.3.0-fix.2</version>
<version>7.3.0-fix.4</version>
</parent>
<artifactId>entando-plugin-jpcontentscheduler</artifactId>
<groupId>org.entando.entando.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,11 @@
*/
package org.entando.entando.plugins.jpcontentscheduler.aps.system.services.content;

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.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;
Expand All @@ -58,10 +36,31 @@
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 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.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.scheduling.quartz.QuartzJobBean;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;



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 +69,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 +94,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 +114,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 +128,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 +145,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 +162,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 +201,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 +211,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 +226,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 +761,7 @@ public void setContentModelManager(IContentModelManager contentModelManager) {
this._contentModelManager = contentModelManager;
}

public ILangManager getLangManager() { return _langManager; }

public void setLangManager(ILangManager langManager) { this._langManager = langManager; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import com.agiletec.aps.system.common.AbstractService;
import com.agiletec.aps.system.common.entity.model.EntitySearchFilter;
import com.agiletec.aps.system.common.entity.model.attribute.ITextAttribute;
import com.agiletec.aps.system.exception.ApsSystemException;
import com.agiletec.aps.system.services.authorization.IApsAuthority;
import com.agiletec.aps.system.services.authorization.IAuthorizationManager;
import com.agiletec.aps.system.services.baseconfig.ConfigInterface;
Expand Down Expand Up @@ -213,7 +212,7 @@ public List<ContentSuspendMove> getContentAttrDataFine() throws EntException {
*/
@Override
public void sendMailWithResults(List<ContentState> publishedContents, List<ContentState> suspendedContents, List<ContentState> movedContents, Date startJobDate,
Date endJobDate) throws EntException, ApsSystemException {
Date endJobDate) throws EntException {
// TODO send to groups
// sendToGroups(publishedContents, suspendedContents);
sendToUsers(publishedContents, suspendedContents, movedContents, startJobDate, endJobDate);
Expand All @@ -229,19 +228,18 @@ public void sendMailWithResults(List<ContentState> publishedContents, List<Conte
* @throws EntException
*/
private void sendToUsers(List<ContentState> publishedContents, List<ContentState> suspendedContents, List<ContentState> moveContents, Date startJobDate, Date endJobDate)
throws EntException, ApsSystemException {
throws EntException {
Map<String, List<String>> mapUsers = this.getConfig().getUsersContentType();
Set<String> keys = mapUsers.keySet();
for (Iterator<String> i = keys.iterator(); i.hasNext();) {
String key = i.next();
for (String key : keys) {
List<String> typesList = mapUsers.get(key);
List<ContentState> contentPList = contentOfTypes(publishedContents, typesList);
List<ContentState> contentSList = contentOfTypes(suspendedContents, typesList);
List<ContentState> contentMList = contentOfTypes(moveContents, typesList);
if ((contentPList != null && contentPList.size() > 0) || (contentSList != null && contentSList.size() > 0) || (contentMList != null && contentMList.size() > 0)) {
UserDetails user = this.getUserManager().getUser(key);
if (user == null) {
ApsSystemUtils.getLogger().error(ContentThreadConstants.USER_IS_NULL + key);
_logger.error(ContentThreadConstants.USER_IS_NULL + "{}", key);
continue;
} else {
UserProfile profile = (UserProfile) user.getProfile();
Expand All @@ -251,28 +249,24 @@ private void sendToUsers(List<ContentState> publishedContents, List<ContentState
if (null != mailAttribute && mailAttribute.getText().trim().length() > 0) {
email[0] = mailAttribute.getText();
String simpleText = Utils.prepareMailText(contentPList, contentSList, contentMList, this.getConfig(), startJobDate, endJobDate);
boolean issent = false;
if (this.getConfig().isAlsoHtml()) {
String applBaseUrl = this.getConfigManager().getParam(SystemConstants.PAR_APPL_BASE_URL);
String htmlText = Utils.prepareMailHtml(contentPList, contentSList, contentMList, this.getConfig(), startJobDate, endJobDate, applBaseUrl);
boolean issent = this.getMailManager().sendMixedMail(simpleText, htmlText, config.getSubject(), null, email, null, null, config.getSenderCode());
issent = this.getMailManager().sendMixedMail(simpleText, htmlText, config.getSubject(), null, email, null, null, config.getSenderCode());
// System.out.println("***MAIL html");
if (issent) {
ApsSystemUtils.getLogger().info(ContentThreadConstants.MAIL_SENT + key);
} else {
ApsSystemUtils.getLogger().error(ContentThreadConstants.SEND_ERROR + key);
}
} else {
// System.out.println("***MAIL simple");
boolean issent = this.getMailManager().sendMail(simpleText, config.getSubject(), email, null, null, config.getSenderCode());
if (issent) {
ApsSystemUtils.getLogger().info(ContentThreadConstants.MAIL_SENT + key);
} else {
ApsSystemUtils.getLogger().error(ContentThreadConstants.SEND_ERROR + key);
}
issent = this.getMailManager().sendMail(simpleText, config.getSubject(), email, null, null, config.getSenderCode());
}
if (issent) {
_logger.info(ContentThreadConstants.MAIL_SENT + "{}", key);
} else {
_logger.error(ContentThreadConstants.SEND_ERROR + "{}", key);
}
}
} else {
ApsSystemUtils.getLogger().error(ContentThreadConstants.PROFILE_IS_NULL + key);
_logger.error(ContentThreadConstants.PROFILE_IS_NULL + "{}", key);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/
package org.entando.entando.plugins.jpcontentscheduler.aps.system.services.content;

import com.agiletec.aps.system.exception.ApsSystemException;
import java.util.Date;
import java.util.List;

Expand Down Expand Up @@ -65,7 +64,7 @@ public interface IContentSchedulerManager {
public void updateConfig(ContentThreadConfig config) throws EntException;

public void sendMailWithResults(List<ContentState> publishedContents, List<ContentState> suspendedContents, List<ContentState> moveContents, Date startJobDate, Date endJobDate)
throws EntException, ApsSystemException;
throws EntException;

/**
* Return the desired system parameter
Expand Down
Loading
Loading