From 0cb9a6b9f75f67ab8a6093d900406d3f03a924a7 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Wed, 13 Jul 2011 17:12:04 +0000 Subject: [PATCH] ALF-9156 Start on the calendar entry canned query, with date filtering, based on the Blog one git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28998 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/calendar-services-context.xml | 11 +- .../repo/calendar/CalendarServiceImpl.java | 47 ++-- .../cannedqueries/CalendarEntity.java | 141 ++++++++++ .../GetCalendarEntriesCannedQuery.java | 266 ++++++++++++++++++ .../GetCalendarEntriesCannedQueryFactory.java | 195 +++++++++++++ .../GetCalendarEntriesCannedQueryParams.java | 61 ++++ 6 files changed, 701 insertions(+), 20 deletions(-) create mode 100644 source/java/org/alfresco/repo/calendar/cannedqueries/CalendarEntity.java create mode 100644 source/java/org/alfresco/repo/calendar/cannedqueries/GetCalendarEntriesCannedQuery.java create mode 100644 source/java/org/alfresco/repo/calendar/cannedqueries/GetCalendarEntriesCannedQueryFactory.java create mode 100644 source/java/org/alfresco/repo/calendar/cannedqueries/GetCalendarEntriesCannedQueryParams.java diff --git a/config/alfresco/calendar-services-context.xml b/config/alfresco/calendar-services-context.xml index 75cb97ea32..4afc104654 100644 --- a/config/alfresco/calendar-services-context.xml +++ b/config/alfresco/calendar-services-context.xml @@ -52,11 +52,20 @@ + + + + + + + + + + - diff --git a/source/java/org/alfresco/repo/calendar/CalendarServiceImpl.java b/source/java/org/alfresco/repo/calendar/CalendarServiceImpl.java index 48cb70999e..f26d045e34 100644 --- a/source/java/org/alfresco/repo/calendar/CalendarServiceImpl.java +++ b/source/java/org/alfresco/repo/calendar/CalendarServiceImpl.java @@ -32,6 +32,8 @@ import org.alfresco.query.CannedQueryFactory; import org.alfresco.query.CannedQueryResults; import org.alfresco.query.PagingRequest; import org.alfresco.query.PagingResults; +import org.alfresco.repo.calendar.cannedqueries.GetCalendarEntriesCannedQuery; +import org.alfresco.repo.calendar.cannedqueries.GetCalendarEntriesCannedQueryFactory; import org.alfresco.repo.node.getchildren.GetChildrenCannedQuery; import org.alfresco.repo.node.getchildren.GetChildrenCannedQueryFactory; import org.alfresco.repo.security.authentication.AuthenticationUtil; @@ -67,6 +69,7 @@ public class CalendarServiceImpl implements CalendarService private static final int MAX_QUERY_ENTRY_COUNT = 10000; private static final String CANNED_QUERY_GET_CHILDREN = "calendarGetChildrenCannedQueryFactory"; + private static final String CANNED_QUERY_GET_ENTRIES = "calendarGetCalendarEntriesCannedQueryFactory"; /** * The logger @@ -75,11 +78,10 @@ public class CalendarServiceImpl implements CalendarService private NodeService nodeService; private SiteService siteService; - private SearchService searchService; // TODO Temp only private TaggingService taggingService; private PermissionService permissionService; private TransactionService transactionService; - private NamedObjectRegistry> cannedQueryRegistry; + private NamedObjectRegistry> cannedQueryRegistry; public void setNodeService(NodeService nodeService) { @@ -91,14 +93,6 @@ public class CalendarServiceImpl implements CalendarService this.siteService = siteService; } - /** - * TODO Temp only - */ - public void setSearchService(SearchService searchService) - { - this.searchService = searchService; - } - public void setTaggingService(TaggingService taggingService) { this.taggingService = taggingService; @@ -117,7 +111,7 @@ public class CalendarServiceImpl implements CalendarService /** * Set the registry of {@link CannedQueryFactory canned queries} */ - public void setCannedQueryRegistry(NamedObjectRegistry> cannedQueryRegistry) + public void setCannedQueryRegistry(NamedObjectRegistry> cannedQueryRegistry) { this.cannedQueryRegistry = cannedQueryRegistry; } @@ -360,9 +354,6 @@ public class CalendarServiceImpl implements CalendarService nodeService.deleteNode(entry.getNodeRef()); } - /** - * TODO Switch to delegating - */ @Override public PagingResults listCalendarEntries( String siteShortName, PagingRequest paging) @@ -402,17 +393,35 @@ public class CalendarServiceImpl implements CalendarService { return listCalendarEntries(siteShortNames[0], paging); } - - // TODO Use search for now - return null; + + // Use the date one with no dates + return listCalendarEntries(siteShortNames, null, null, paging); } @Override public PagingResults listCalendarEntries( String[] siteShortNames, Date from, Date to, PagingRequest paging) { - // TODO Use search for now - return null; + // Get the containers + List containersL = new ArrayList(); + for(String siteShortName : siteShortNames) + { + NodeRef container = getSiteCalendarContainer(siteShortName, false); + if(container != null) + { + containersL.add(container); + } + } + NodeRef[] containers = containersL.toArray(new NodeRef[containersL.size()]); + + // Run the canned query + GetCalendarEntriesCannedQueryFactory cqFactory = (GetCalendarEntriesCannedQueryFactory)cannedQueryRegistry.getNamedObject(CANNED_QUERY_GET_ENTRIES); + GetCalendarEntriesCannedQuery cq = (GetCalendarEntriesCannedQuery)cqFactory.getCannedQuery( + containers, from, to, paging + ); + + // Execute the canned query + return cq.execute(); } /** diff --git a/source/java/org/alfresco/repo/calendar/cannedqueries/CalendarEntity.java b/source/java/org/alfresco/repo/calendar/cannedqueries/CalendarEntity.java new file mode 100644 index 0000000000..0d96a4c751 --- /dev/null +++ b/source/java/org/alfresco/repo/calendar/cannedqueries/CalendarEntity.java @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2005-2011 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.calendar.cannedqueries; + +import org.alfresco.repo.domain.node.NodeEntity; +import org.alfresco.service.cmr.calendar.CalendarEntry; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Calendar Entity - low level representation of parts of a + * {@link CalendarEntry} - used by GetCalendarEntries Canned Query + * + * @author Nick Burch + * @since 4.0 + */ +public class CalendarEntity +{ + private Long id; // node id + + private NodeEntity node; + + private String name; + + private String fromDate; + private String toDate; + + // Supplemental query-related parameters + private Long parentNodeId; + private Long nameQNameId; + + /** + * Default constructor + */ + public CalendarEntity() + { + } + + public CalendarEntity(Long parentNodeId, Long nameQNameId) + { + this.parentNodeId = parentNodeId; + this.nameQNameId = nameQNameId; + } + + public Long getId() + { + return id; + } + + public void setId(Long id) + { + this.id = id; + } + + // helper + public NodeRef getNodeRef() + { + return (node != null ? node.getNodeRef() : null); + } + + // helper (ISO 8061) + public String getCreatedDate() + { + return ((node != null && node.getAuditableProperties() != null) ? node.getAuditableProperties().getAuditCreated() : null); + } + + // helper + public String getCreator() + { + return ((node != null && node.getAuditableProperties() != null) ? node.getAuditableProperties().getAuditCreator() : null); + } + + public NodeEntity getNode() + { + return node; + } + + public void setNode(NodeEntity childNode) + { + this.node = childNode; + } + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + // (ISO-8061) + public String getFromDate() + { + return fromDate; + } + + public void setFromDate(String fromISO8601) + { + this.fromDate = fromISO8601; + } + + // (ISO-8061) + public String getToDate() + { + return toDate; + } + + public void setToDate(String toISO8061) + { + this.toDate = toISO8061; + } + + // Supplemental query-related parameters + + public Long getParentNodeId() + { + return parentNodeId; + } + + public Long getNameQNameId() + { + return nameQNameId; + } +} diff --git a/source/java/org/alfresco/repo/calendar/cannedqueries/GetCalendarEntriesCannedQuery.java b/source/java/org/alfresco/repo/calendar/cannedqueries/GetCalendarEntriesCannedQuery.java new file mode 100644 index 0000000000..9736f33beb --- /dev/null +++ b/source/java/org/alfresco/repo/calendar/cannedqueries/GetCalendarEntriesCannedQuery.java @@ -0,0 +1,266 @@ +/* + * Copyright (C) 2005-2011 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.calendar.cannedqueries; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.List; + +import org.alfresco.model.ContentModel; +import org.alfresco.query.CannedQuery; +import org.alfresco.query.CannedQueryParameters; +import org.alfresco.query.CannedQuerySortDetails.SortOrder; +import org.alfresco.repo.calendar.CalendarModel; +import org.alfresco.repo.domain.query.CannedQueryDAO; +import org.alfresco.repo.security.permissions.impl.acegi.AbstractCannedQueryPermissions; +import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityBean; +import org.alfresco.service.cmr.calendar.CalendarEntry; +import org.alfresco.service.cmr.calendar.CalendarService; +import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.Pair; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * This class provides support for {@link CannedQuery canned queries} used by the + * {@link CalendarService}. + * + * @author Nick Burch + * @since 4.0 + */ +public class GetCalendarEntriesCannedQuery extends AbstractCannedQueryPermissions +{ + private Log logger = LogFactory.getLog(getClass()); + + private static final String QUERY_NAMESPACE = "alfresco.query.calendar"; + private static final String QUERY_SELECT_GET_BLOGS = "select_GetCalendarEntriesCannedQuery"; + + private final CannedQueryDAO cannedQueryDAO; + + public GetCalendarEntriesCannedQuery( + CannedQueryDAO cannedQueryDAO, + MethodSecurityBean methodSecurity, + CannedQueryParameters params) + { + super(params, methodSecurity); + this.cannedQueryDAO = cannedQueryDAO; + } + + @Override + protected List queryAndFilter(CannedQueryParameters parameters) + { + Long start = (logger.isDebugEnabled() ? System.currentTimeMillis() : null); + + Object paramBeanObj = parameters.getParameterBean(); + if (paramBeanObj == null) + throw new NullPointerException("Null GetCalendarEntries query params"); + + GetCalendarEntriesCannedQueryParams paramBean = (GetCalendarEntriesCannedQueryParams) paramBeanObj; + Date entriesFromDate = paramBean.getEntriesFromDate(); + Date entriesToDate = paramBean.getEntriesToDate(); + + // note: refer to SQL for specific DB filtering (eg.parent nodes etc) + List results = cannedQueryDAO.executeQuery(QUERY_NAMESPACE, QUERY_SELECT_GET_BLOGS, paramBean, 0, Integer.MAX_VALUE); + + List filtered = new ArrayList(results.size()); + for (CalendarEntity result : results) + { + boolean nextNodeIsAcceptable = true; + + Date fromDate = DefaultTypeConverter.INSTANCE.convert(Date.class, result.getFromDate()); + Date toDate = DefaultTypeConverter.INSTANCE.convert(Date.class, result.getToDate()); + if(toDate == null) + { + toDate = fromDate; + } + + // Only return entries in the right period + if(entriesFromDate != null) + { + // Needs to end on or after the Filter From date + if(toDate == null || toDate.before(entriesFromDate)) + { + nextNodeIsAcceptable = false; + } + } + if(entriesToDate != null) + { + // Needs to start on or after the Filter End date + if(fromDate == null || fromDate.after(entriesToDate)) + { + nextNodeIsAcceptable = false; + } + } + + if (nextNodeIsAcceptable) + { + filtered.add(result); + } + } + + List> sortPairs = parameters.getSortDetails().getSortPairs(); + + // For now, the BlogService only sorts by a single property. + if (sortPairs != null && !sortPairs.isEmpty()) + { + List, SortOrder>> comparators = + new ArrayList,SortOrder>>(); + for(Pair sortPair : sortPairs) + { + QName sortProperty = (QName) sortPair.getFirst(); + final PropertyBasedComparator comparator = new PropertyBasedComparator(sortProperty); + comparators.add(new Pair, SortOrder>(comparator, sortPair.getSecond())); + } + NestedComparator comparator = new NestedComparator(comparators); + + // Sort + Collections.sort(filtered, comparator); + } + + List calendarEntries = new ArrayList(filtered.size()); + for (CalendarEntity result : filtered) + { + calendarEntries.add(new CalendarEntryImpl(result)); + } + + if (start != null) + { + logger.debug("Base query: "+calendarEntries.size()+" in "+(System.currentTimeMillis()-start)+" msecs"); + } + + return calendarEntries; + } + + @Override + protected boolean isApplyPostQuerySorting() + { + // No post-query sorting. It's done within the queryAndFilter() method above. + return false; + } + + private class CalendarEntryImpl extends org.alfresco.repo.calendar.CalendarEntryImpl + { + private CalendarEntryImpl(CalendarEntity entity) + { + super(entity.getNodeRef(), entity.getName()); + } + } + + /** + * Utility class to sort {@link CalendarEntry}s on the basis of a Comparable property. + * Comparisons of two null properties are considered 'equal' by this comparator. + * Comparisons involving one null and one non-null property will return the null property as + * being 'before' the non-null property. + * + * Note that it is the responsibility of the calling code to ensure that the specified + * property values actually implement Comparable themselves. + */ + protected static class PropertyBasedComparator implements Comparator + { + private QName comparableProperty; + + public PropertyBasedComparator(QName comparableProperty) + { + this.comparableProperty = comparableProperty; + } + + @SuppressWarnings("unchecked") + @Override + public int compare(CalendarEntity nr1, CalendarEntity nr2) + { + Comparable prop1 = null; + Comparable prop2 = null; + if (comparableProperty.equals(CalendarModel.PROP_FROM_DATE)) + { + prop1 = nr1.getFromDate(); + prop2 = nr2.getFromDate(); + } + else if (comparableProperty.equals(CalendarModel.PROP_TO_DATE)) + { + prop1 = nr1.getToDate(); + prop2 = nr2.getToDate(); + } + else if (comparableProperty.equals(ContentModel.PROP_CREATED)) + { + prop1 = nr1.getCreatedDate(); + prop2 = nr2.getCreatedDate(); + } + else + { + throw new IllegalArgumentException("Unsupported calendar sort property: "+comparableProperty); + } + + if (prop1 == null && prop2 == null) + { + return 0; + } + else if (prop1 == null && prop2 != null) + { + return -1; + } + else if (prop1 != null && prop2 == null) + { + return 1; + } + else + { + return prop1.compareTo(prop2); + } + } + } + + protected static class NestedComparator implements Comparator + { + private List, SortOrder>> comparators; + + private NestedComparator(List, SortOrder>> comparators) + { + this.comparators = comparators; + } + + @Override + public int compare(CalendarEntity entry1, CalendarEntity entry2) { + for(Pair, SortOrder> pc : comparators) + { + int result = pc.getFirst().compare(entry1, entry2); + if(result != 0) + { + // Sorts differ, return + if(pc.getSecond() == SortOrder.ASCENDING) + { + return result; + } + else + { + return 0 - result; + } + } + else + { + // Sorts are the same, try the next along + } + } + // No difference on any + return 0; + } + } +} diff --git a/source/java/org/alfresco/repo/calendar/cannedqueries/GetCalendarEntriesCannedQueryFactory.java b/source/java/org/alfresco/repo/calendar/cannedqueries/GetCalendarEntriesCannedQueryFactory.java new file mode 100644 index 0000000000..fbfa6559d7 --- /dev/null +++ b/source/java/org/alfresco/repo/calendar/cannedqueries/GetCalendarEntriesCannedQueryFactory.java @@ -0,0 +1,195 @@ +/* + * Copyright (C) 2005-2011 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.calendar.cannedqueries; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.alfresco.model.ContentModel; +import org.alfresco.query.AbstractCannedQueryFactory; +import org.alfresco.query.CannedQuery; +import org.alfresco.query.CannedQueryFactory; +import org.alfresco.query.CannedQueryPageDetails; +import org.alfresco.query.CannedQueryParameters; +import org.alfresco.query.CannedQuerySortDetails; +import org.alfresco.query.PagingRequest; +import org.alfresco.query.CannedQuerySortDetails.SortOrder; +import org.alfresco.repo.calendar.CalendarModel; +import org.alfresco.repo.domain.node.NodeDAO; +import org.alfresco.repo.domain.qname.QNameDAO; +import org.alfresco.repo.domain.query.CannedQueryDAO; +import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityBean; +import org.alfresco.repo.tenant.TenantService; +import org.alfresco.service.cmr.calendar.CalendarEntry; +import org.alfresco.service.cmr.calendar.CalendarService; +import org.alfresco.service.cmr.repository.InvalidNodeRefException; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.Pair; +import org.alfresco.util.ParameterCheck; +import org.alfresco.util.PropertyCheck; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * A {@link CannedQueryFactory} for various queries relating to {@link CalendarEntry calendar entries}. + * + * @author Nick Burch + * @since 4.0 + * + * @see CalendarService#listCalendarEntries(String, PagingRequest) + * @see CalendarService#listCalendarEntries(String[], PagingRequest) + * @see CalendarService#listCalendarEntries(String[], Date, Date, PagingRequest) + */ +public class GetCalendarEntriesCannedQueryFactory extends AbstractCannedQueryFactory +{ + private Log logger = LogFactory.getLog(getClass()); + + protected MethodSecurityBean methodSecurity; + protected NodeDAO nodeDAO; + protected QNameDAO qnameDAO; + protected CannedQueryDAO cannedQueryDAO; + protected TenantService tenantService; + + public void setNodeDAO(NodeDAO nodeDAO) + { + this.nodeDAO = nodeDAO; + } + + public void setQnameDAO(QNameDAO qnameDAO) + { + this.qnameDAO = qnameDAO; + } + + public void setCannedQueryDAO(CannedQueryDAO cannedQueryDAO) + { + this.cannedQueryDAO = cannedQueryDAO; + } + + public void setTenantService(TenantService tenantService) + { + this.tenantService = tenantService; + } + + public void setMethodSecurity(MethodSecurityBean methodSecurity) + { + this.methodSecurity = methodSecurity; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + + PropertyCheck.mandatory(this, "methodSecurity", methodSecurity); + PropertyCheck.mandatory(this, "nodeDAO", nodeDAO); + PropertyCheck.mandatory(this, "qnameDAO", qnameDAO); + PropertyCheck.mandatory(this, "cannedQueryDAO", cannedQueryDAO); + PropertyCheck.mandatory(this, "tenantService", tenantService); + } + + @Override + public CannedQuery getCannedQuery(CannedQueryParameters parameters) + { + final GetCalendarEntriesCannedQuery cq = new GetCalendarEntriesCannedQuery(cannedQueryDAO, methodSecurity, parameters); + + return (CannedQuery) cq; + } + + public CannedQuery getCannedQuery(NodeRef[] containerNodes, Date fromDate, Date toDate, PagingRequest pagingReq) + { + ParameterCheck.mandatory("containerNodes", containerNodes); + ParameterCheck.mandatory("pagingReq", pagingReq); + + int requestTotalCountMax = pagingReq.getRequestTotalCountMax(); + + Long[] containerIds = new Long[containerNodes.length]; + for(int i=0; i> sort = new ArrayList>(); + sort.add(new Pair(CalendarModel.PROP_FROM_DATE, SortOrder.DESCENDING)); + sort.add(new Pair(CalendarModel.PROP_TO_DATE, SortOrder.DESCENDING)); + + return new CannedQuerySortDetails(sort); + } + + protected CannedQueryPageDetails createCQPageDetails(PagingRequest pagingReq) + { + int skipCount = pagingReq.getSkipCount(); + if (skipCount == -1) + { + skipCount = CannedQueryPageDetails.DEFAULT_SKIP_RESULTS; + } + + int maxItems = pagingReq.getMaxItems(); + if (maxItems == -1) + { + maxItems = CannedQueryPageDetails.DEFAULT_PAGE_SIZE; + } + + // page details + CannedQueryPageDetails cqpd = new CannedQueryPageDetails(skipCount, maxItems); + return cqpd; + } + + protected Long getQNameId(QName qname) + { + Pair qnamePair = qnameDAO.getQName(qname); + if (qnamePair == null) + { + if (logger.isTraceEnabled()) + { + logger.trace("QName does not exist: " + qname); // possible ... eg. blg:blogPost if a blog has never been posted externally + } + return null; + } + return qnamePair.getFirst(); + } + + protected Long getNodeId(NodeRef nodeRef) + { + Pair nodePair = nodeDAO.getNodePair(tenantService.getName(nodeRef)); + if (nodePair == null) + { + throw new InvalidNodeRefException("Node ref does not exist: " + nodeRef, nodeRef); + } + return nodePair.getFirst(); + } +} diff --git a/source/java/org/alfresco/repo/calendar/cannedqueries/GetCalendarEntriesCannedQueryParams.java b/source/java/org/alfresco/repo/calendar/cannedqueries/GetCalendarEntriesCannedQueryParams.java new file mode 100644 index 0000000000..3c495ed5b7 --- /dev/null +++ b/source/java/org/alfresco/repo/calendar/cannedqueries/GetCalendarEntriesCannedQueryParams.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2005-2011 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.calendar.cannedqueries; + +import java.util.Date; + +/** + * Parameter objects for {@link GetCalendarEntriesCannedQuery}. + * + * @author Nick Burch + * @since 4.0 + */ +public class GetCalendarEntriesCannedQueryParams extends CalendarEntity +{ + private final Long[] siteContainerNodeIds; + private final Date entriesFromDate; + private final Date entriesToDate; + + public GetCalendarEntriesCannedQueryParams(Long[] siteContainerNodeIds, + Long nameQNameId, + Date entriesFromDate, + Date entriesToDate) + { + super(null, nameQNameId); + + this.siteContainerNodeIds = siteContainerNodeIds; + this.entriesFromDate = entriesFromDate; + this.entriesToDate = entriesToDate; + } + + public Long[] getSiteContainerNodeIds() + { + return siteContainerNodeIds; + } + + public Date getEntriesFromDate() + { + return entriesFromDate; + } + + public Date getEntriesToDate() + { + return entriesToDate; + } +}