commit
d362632a78
11 changed files with 89 additions and 4 deletions
|
|
@ -23,6 +23,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.libreplan.business.common.daos.IIntegrationEntityDAO;
|
import org.libreplan.business.common.daos.IIntegrationEntityDAO;
|
||||||
import org.libreplan.business.logs.entities.IssueLog;
|
import org.libreplan.business.logs.entities.IssueLog;
|
||||||
|
import org.libreplan.business.orders.entities.Order;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contract for {@link IssueLogDAO}
|
* Contract for {@link IssueLogDAO}
|
||||||
|
|
@ -37,4 +38,11 @@ public interface IIssueLogDAO extends IIntegrationEntityDAO<IssueLog> {
|
||||||
* @return a list of {@link IssueLog} objects
|
* @return a list of {@link IssueLog} objects
|
||||||
*/
|
*/
|
||||||
List<IssueLog> getIssueLogs();
|
List<IssueLog> getIssueLogs();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of {@link IssueLog} for a specified {@link Order}
|
||||||
|
*
|
||||||
|
* @param order parent element for IssueLogs
|
||||||
|
*/
|
||||||
|
List<IssueLog> getByParent(Order order);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.libreplan.business.common.daos.IIntegrationEntityDAO;
|
import org.libreplan.business.common.daos.IIntegrationEntityDAO;
|
||||||
import org.libreplan.business.logs.entities.RiskLog;
|
import org.libreplan.business.logs.entities.RiskLog;
|
||||||
|
import org.libreplan.business.orders.entities.Order;
|
||||||
|
|
||||||
public interface IRiskLogDAO extends IIntegrationEntityDAO<RiskLog> {
|
public interface IRiskLogDAO extends IIntegrationEntityDAO<RiskLog> {
|
||||||
|
|
||||||
|
|
@ -33,4 +34,11 @@ public interface IRiskLogDAO extends IIntegrationEntityDAO<RiskLog> {
|
||||||
*/
|
*/
|
||||||
List<RiskLog> getRiskLogs();
|
List<RiskLog> getRiskLogs();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of {@link RiskLog} for a specified {@link Order}
|
||||||
|
*
|
||||||
|
* @param order parent element for RiskLogs
|
||||||
|
*/
|
||||||
|
List<RiskLog> getByParent(Order order);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,10 @@ package org.libreplan.business.logs.daos;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hibernate.criterion.Restrictions;
|
||||||
import org.libreplan.business.common.daos.IntegrationEntityDAO;
|
import org.libreplan.business.common.daos.IntegrationEntityDAO;
|
||||||
import org.libreplan.business.logs.entities.IssueLog;
|
import org.libreplan.business.logs.entities.IssueLog;
|
||||||
|
import org.libreplan.business.orders.entities.Order;
|
||||||
import org.springframework.beans.factory.config.BeanDefinition;
|
import org.springframework.beans.factory.config.BeanDefinition;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
@ -42,5 +44,12 @@ public class IssueLogDAO extends IntegrationEntityDAO<IssueLog> implements
|
||||||
return list(IssueLog.class);
|
return list(IssueLog.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<IssueLog> getByParent(Order order) {
|
||||||
|
return getSession()
|
||||||
|
.createCriteria(IssueLog.class)
|
||||||
|
.add(Restrictions.eq("project", order))
|
||||||
|
.list();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,10 @@ package org.libreplan.business.logs.daos;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hibernate.criterion.Restrictions;
|
||||||
import org.libreplan.business.common.daos.IntegrationEntityDAO;
|
import org.libreplan.business.common.daos.IntegrationEntityDAO;
|
||||||
import org.libreplan.business.logs.entities.RiskLog;
|
import org.libreplan.business.logs.entities.RiskLog;
|
||||||
|
import org.libreplan.business.orders.entities.Order;
|
||||||
import org.springframework.beans.factory.config.BeanDefinition;
|
import org.springframework.beans.factory.config.BeanDefinition;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
@ -43,4 +45,12 @@ public class RiskLogDAO extends IntegrationEntityDAO<RiskLog> implements
|
||||||
return list(RiskLog.class);
|
return list(RiskLog.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RiskLog> getByParent(Order order) {
|
||||||
|
return getSession()
|
||||||
|
.createCriteria(RiskLog.class)
|
||||||
|
.add(Restrictions.eq("project", order))
|
||||||
|
.list();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
package org.libreplan.importers.notifications;
|
package org.libreplan.importers.notifications;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.libreplan.business.common.entities.ConnectorProperty;
|
import org.libreplan.business.common.entities.ConnectorProperty;
|
||||||
import org.libreplan.business.email.entities.EmailNotification;
|
import org.libreplan.business.email.entities.EmailNotification;
|
||||||
import org.libreplan.business.email.entities.EmailTemplate;
|
import org.libreplan.business.email.entities.EmailTemplate;
|
||||||
|
|
@ -83,6 +85,8 @@ public class ComposeMessage {
|
||||||
|
|
||||||
private Properties properties;
|
private Properties properties;
|
||||||
|
|
||||||
|
private static final Log LOG = LogFactory.getLog(ComposeMessage.class);
|
||||||
|
|
||||||
|
|
||||||
public boolean composeMessageForUser(EmailNotification notification) {
|
public boolean composeMessageForUser(EmailNotification notification) {
|
||||||
// Gather data about EmailTemplate needs to be used
|
// Gather data about EmailTemplate needs to be used
|
||||||
|
|
@ -102,6 +106,11 @@ public class ComposeMessage {
|
||||||
|
|
||||||
EmailTemplate currentEmailTemplate = findCurrentEmailTemplate(type, locale);
|
EmailTemplate currentEmailTemplate = findCurrentEmailTemplate(type, locale);
|
||||||
|
|
||||||
|
if (currentEmailTemplate == null) {
|
||||||
|
LOG.error("Email template is null");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Modify text that will be composed
|
// Modify text that will be composed
|
||||||
String text = currentEmailTemplate.getContent();
|
String text = currentEmailTemplate.getContent();
|
||||||
text = replaceKeywords(text, currentWorker, notification);
|
text = replaceKeywords(text, currentWorker, notification);
|
||||||
|
|
|
||||||
|
|
@ -115,5 +115,12 @@ public interface IIssueLogModel {
|
||||||
*/
|
*/
|
||||||
void remove(IssueLog issueLog);
|
void remove(IssueLog issueLog);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of {@link IssueLog} for a specified {@link Order}
|
||||||
|
*
|
||||||
|
* @param order parent element for IssueLogs
|
||||||
|
*/
|
||||||
|
List<IssueLog> getByParent(Order order);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -115,5 +115,12 @@ public interface IRiskLogModel {
|
||||||
*/
|
*/
|
||||||
void remove(RiskLog riskLog);
|
void remove(RiskLog riskLog);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of {@link RiskLog} for a specified {@link Order}
|
||||||
|
*
|
||||||
|
* @param order parent element for RiskLogs
|
||||||
|
*/
|
||||||
|
List<RiskLog> getByParent(Order order);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,11 @@ public class IssueLogModel extends IntegrationEntityModel implements IIssueLogMo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<IssueLog> getByParent(Order order) {
|
||||||
|
return issueLogDAO.getByParent(order);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityNameEnum getEntityName() {
|
public EntityNameEnum getEntityName() {
|
||||||
return EntityNameEnum.ISSUE_LOG;
|
return EntityNameEnum.ISSUE_LOG;
|
||||||
|
|
|
||||||
|
|
@ -140,6 +140,11 @@ public class RiskLogModel extends IntegrationEntityModel implements IRiskLogMode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RiskLog> getByParent(Order order) {
|
||||||
|
return riskLogDAO.getByParent(order);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityNameEnum getEntityName() {
|
public EntityNameEnum getEntityName() {
|
||||||
return EntityNameEnum.RISK_LOG;
|
return EntityNameEnum.RISK_LOG;
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,6 @@ import org.libreplan.business.orders.entities.Order;
|
||||||
import org.libreplan.business.orders.entities.OrderElement;
|
import org.libreplan.business.orders.entities.OrderElement;
|
||||||
import org.libreplan.business.orders.entities.OrderLineGroup;
|
import org.libreplan.business.orders.entities.OrderLineGroup;
|
||||||
import org.libreplan.business.orders.entities.OrderStatusEnum;
|
import org.libreplan.business.orders.entities.OrderStatusEnum;
|
||||||
import org.libreplan.business.orders.entities.OrderFile;
|
|
||||||
import org.libreplan.business.planner.entities.PositionConstraintType;
|
import org.libreplan.business.planner.entities.PositionConstraintType;
|
||||||
import org.libreplan.business.qualityforms.daos.IQualityFormDAO;
|
import org.libreplan.business.qualityforms.daos.IQualityFormDAO;
|
||||||
import org.libreplan.business.qualityforms.entities.QualityForm;
|
import org.libreplan.business.qualityforms.entities.QualityForm;
|
||||||
|
|
@ -85,6 +84,8 @@ import org.libreplan.business.users.entities.UserRole;
|
||||||
import org.libreplan.web.calendars.BaseCalendarModel;
|
import org.libreplan.web.calendars.BaseCalendarModel;
|
||||||
import org.libreplan.web.common.IntegrationEntityModel;
|
import org.libreplan.web.common.IntegrationEntityModel;
|
||||||
import org.libreplan.web.common.concurrentdetection.OnConcurrentModification;
|
import org.libreplan.web.common.concurrentdetection.OnConcurrentModification;
|
||||||
|
import org.libreplan.web.logs.IIssueLogModel;
|
||||||
|
import org.libreplan.web.logs.IRiskLogModel;
|
||||||
import org.libreplan.web.orders.files.IOrderFileModel;
|
import org.libreplan.web.orders.files.IOrderFileModel;
|
||||||
import org.libreplan.web.orders.labels.LabelsOnConversation;
|
import org.libreplan.web.orders.labels.LabelsOnConversation;
|
||||||
import org.libreplan.web.planner.order.ISaveCommand.IBeforeSaveActions;
|
import org.libreplan.web.planner.order.ISaveCommand.IBeforeSaveActions;
|
||||||
|
|
@ -174,6 +175,12 @@ public class OrderModel extends IntegrationEntityModel implements IOrderModel {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IOrderFileModel orderFileModel;
|
private IOrderFileModel orderFileModel;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IRiskLogModel riskLogModel;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IIssueLogModel issueLogModel;
|
||||||
|
|
||||||
private List<Order> orderList = new ArrayList<>();
|
private List<Order> orderList = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -514,8 +521,9 @@ public class OrderModel extends IntegrationEntityModel implements IOrderModel {
|
||||||
public void remove(Order detachedOrder) {
|
public void remove(Order detachedOrder) {
|
||||||
Order order = orderDAO.findExistingEntity(detachedOrder.getId());
|
Order order = orderDAO.findExistingEntity(detachedOrder.getId());
|
||||||
|
|
||||||
List<OrderFile> orderFiles = orderFileModel.findByParent(order);
|
removeFiles(order);
|
||||||
orderFiles.forEach((orderFile -> orderFileModel.delete(orderFile)));
|
|
||||||
|
removeLogs(order);
|
||||||
|
|
||||||
removeVersions(order);
|
removeVersions(order);
|
||||||
|
|
||||||
|
|
@ -524,6 +532,15 @@ public class OrderModel extends IntegrationEntityModel implements IOrderModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void removeLogs(Order order) {
|
||||||
|
riskLogModel.getByParent(order).forEach(riskLog -> riskLogModel.remove(riskLog));
|
||||||
|
issueLogModel.getByParent(order).forEach(issueLog -> issueLogModel.remove(issueLog));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeFiles(Order order) {
|
||||||
|
orderFileModel.findByParent(order).forEach(orderFile -> orderFileModel.delete(orderFile));
|
||||||
|
}
|
||||||
|
|
||||||
private void removeVersions(Order order) {
|
private void removeVersions(Order order) {
|
||||||
Map<Long, OrderVersion> versionsRemovedById = new HashMap<>();
|
Map<Long, OrderVersion> versionsRemovedById = new HashMap<>();
|
||||||
List<Scenario> currentAndDerived = currentAndDerivedScenarios();
|
List<Scenario> currentAndDerived = currentAndDerivedScenarios();
|
||||||
|
|
|
||||||
2
pom.xml
2
pom.xml
|
|
@ -605,7 +605,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.zkoss.zkforge</groupId>
|
<groupId>org.zkoss.zkforge</groupId>
|
||||||
<artifactId>timeplotz</artifactId>
|
<artifactId>timeplotz</artifactId>
|
||||||
<version>1.1_50</version>
|
<version>1.1_50_1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue