|
|
@ -8,15 +8,6 @@ |
|
|
|
|
|
|
|
|
|
|
|
package it.tref.liferay.portos.deployalert.service.impl; |
|
|
|
package it.tref.liferay.portos.deployalert.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import it.tref.liferay.portos.deployalert.NotificationNomePluginException; |
|
|
|
|
|
|
|
import it.tref.liferay.portos.deployalert.NotificationNomeTemplateException; |
|
|
|
|
|
|
|
import it.tref.liferay.portos.deployalert.model.NotificationMail; |
|
|
|
|
|
|
|
import it.tref.liferay.portos.deployalert.service.NotificationMailLocalServiceUtil; |
|
|
|
|
|
|
|
import it.tref.liferay.portos.deployalert.service.base.NotificationMailLocalServiceBaseImpl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.liferay.portal.kernel.dao.orm.Disjunction; |
|
|
|
import com.liferay.portal.kernel.dao.orm.Disjunction; |
|
|
|
import com.liferay.portal.kernel.dao.orm.DynamicQuery; |
|
|
|
import com.liferay.portal.kernel.dao.orm.DynamicQuery; |
|
|
|
import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; |
|
|
|
import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; |
|
|
@ -28,6 +19,15 @@ import com.liferay.portal.kernel.util.Validator; |
|
|
|
import com.liferay.portal.model.User; |
|
|
|
import com.liferay.portal.model.User; |
|
|
|
import com.liferay.portal.service.ServiceContext; |
|
|
|
import com.liferay.portal.service.ServiceContext; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import it.tref.liferay.portos.deployalert.NotificationNomePluginException; |
|
|
|
|
|
|
|
import it.tref.liferay.portos.deployalert.NotificationNomeTemplateException; |
|
|
|
|
|
|
|
import it.tref.liferay.portos.deployalert.model.NotificationMail; |
|
|
|
|
|
|
|
import it.tref.liferay.portos.deployalert.service.NotificationMailLocalServiceUtil; |
|
|
|
|
|
|
|
import it.tref.liferay.portos.deployalert.service.base.NotificationMailLocalServiceBaseImpl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* The implementation of the notification mail local service. |
|
|
|
* The implementation of the notification mail local service. |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
@ -44,9 +44,8 @@ import com.liferay.portal.service.ServiceContext; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class NotificationMailLocalServiceImpl extends NotificationMailLocalServiceBaseImpl { |
|
|
|
public class NotificationMailLocalServiceImpl extends NotificationMailLocalServiceBaseImpl { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public NotificationMail addNotification(String nomePlugin, String nomeTemplate, ServiceContext serviceContext) |
|
|
|
public NotificationMail addNotification(String nomePlugin, String nomeTemplate, ServiceContext serviceContext) |
|
|
|
throws PortalException, SystemException { |
|
|
|
throws PortalException, SystemException { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
User user = userPersistence.findByPrimaryKey(serviceContext.getUserId()); |
|
|
|
User user = userPersistence.findByPrimaryKey(serviceContext.getUserId()); |
|
|
|
Date now = new Date(); |
|
|
|
Date now = new Date(); |
|
|
@ -76,9 +75,8 @@ public class NotificationMailLocalServiceImpl extends NotificationMailLocalServi |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public NotificationMail updateNotification(String nomePlugin, String nomeTemplate, ServiceContext serviceContext, |
|
|
|
public NotificationMail updateNotification(String nomePlugin, String nomeTemplate, ServiceContext serviceContext, |
|
|
|
long notificationId) throws SystemException, PortalException { |
|
|
|
long notificationId) throws SystemException, PortalException { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date now = new Date(); |
|
|
|
Date now = new Date(); |
|
|
|
NotificationMail notification = getNotificationMail(notificationId); |
|
|
|
NotificationMail notification = getNotificationMail(notificationId); |
|
|
@ -91,44 +89,44 @@ public class NotificationMailLocalServiceImpl extends NotificationMailLocalServi |
|
|
|
return notification; |
|
|
|
return notification; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public List<NotificationMail> findNotifications(long companyId, int start, int end) throws SystemException { |
|
|
|
public List<NotificationMail> findNotifications(long companyId, int start, int end) throws SystemException { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DynamicQuery query = dynamicQuery(); |
|
|
|
// return notificationMailPersistence.findBycompanyId(companyId, start, end);
|
|
|
|
query.addOrder(OrderFactoryUtil.asc("nomePlugin")); |
|
|
|
DynamicQuery query = notificationMailLocalService.dynamicQuery(); |
|
|
|
List<NotificationMail> notifications = null; |
|
|
|
query.addOrder(OrderFactoryUtil.asc("nomePlugin")); |
|
|
|
try { |
|
|
|
List<NotificationMail> notifications = null; |
|
|
|
notifications = NotificationMailLocalServiceUtil.dynamicQuery(query); |
|
|
|
try { |
|
|
|
} catch (SystemException e) { |
|
|
|
notifications = NotificationMailLocalServiceUtil.dynamicQuery(query); |
|
|
|
e.printStackTrace(); |
|
|
|
} catch (SystemException e) { |
|
|
|
} |
|
|
|
e.printStackTrace(); |
|
|
|
return notifications; |
|
|
|
} |
|
|
|
} |
|
|
|
return notifications; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public List<NotificationMail> findNotifications(long companyId) throws SystemException { |
|
|
|
public List<NotificationMail> findNotifications(long companyId) throws SystemException { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return notificationMailPersistence.findBycompanyId(companyId); |
|
|
|
return notificationMailPersistence.findBycompanyId(companyId); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public int getNotificationCount(long companyId) throws SystemException { |
|
|
|
public int getNotificationCount(long companyId) throws SystemException { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return notificationMailPersistence.countBycompanyId(companyId); |
|
|
|
return notificationMailPersistence.countBycompanyId(companyId); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public List<NotificationMail> findNotifications(long companyId, String servletContextName) throws SystemException { |
|
|
|
public List<NotificationMail> findNotifications(long companyId, String servletContextName) throws SystemException { |
|
|
|
|
|
|
|
|
|
|
|
DynamicQuery dynamicQuery = notificationMailLocalService.dynamicQuery(); |
|
|
|
DynamicQuery dynamicQuery = dynamicQuery(); |
|
|
|
|
|
|
|
if (Validator.isNull(servletContextName)) { |
|
|
|
if (Validator.isNull(servletContextName)) { |
|
|
|
Disjunction or = RestrictionsFactoryUtil.disjunction(); |
|
|
|
Disjunction or = RestrictionsFactoryUtil.disjunction(); |
|
|
|
or.add(RestrictionsFactoryUtil.isNull("nomePlugin")); |
|
|
|
or.add(RestrictionsFactoryUtil.isNull("nomePlugin")); |
|
|
|
or.add(RestrictionsFactoryUtil.eq("nomePlugin", StringPool.BLANK)); |
|
|
|
or.add(RestrictionsFactoryUtil.eq("nomePlugin", StringPool.BLANK)); |
|
|
|
dynamicQuery.add(or); |
|
|
|
|
|
|
|
} else { |
|
|
|
dynamicQuery.add(or); |
|
|
|
dynamicQuery.add(RestrictionsFactoryUtil.eq("nomePlugin", servletContextName)); |
|
|
|
} else { |
|
|
|
} |
|
|
|
dynamicQuery.add(RestrictionsFactoryUtil.eq("nomePlugin", servletContextName)); |
|
|
|
return notificationMailPersistence.findWithDynamicQuery(dynamicQuery); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return notificationMailPersistence.findWithDynamicQuery(dynamicQuery); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|