diff --git a/config/alfresco/application-context-highlevel.xml b/config/alfresco/application-context-highlevel.xml index c00d80c396..3641baae8e 100644 --- a/config/alfresco/application-context-highlevel.xml +++ b/config/alfresco/application-context-highlevel.xml @@ -9,6 +9,7 @@ + diff --git a/config/alfresco/calendar-services-context.xml b/config/alfresco/calendar-services-context.xml new file mode 100644 index 0000000000..143b3104bd --- /dev/null +++ b/config/alfresco/calendar-services-context.xml @@ -0,0 +1,50 @@ + + + + + + + + + org.alfresco.service.cmr.calendar.CalendarService + + + + + + + + + + + + + + + + + + + + + + ${server.transaction.mode.default} + + + + + + + + + + + + + + + + + diff --git a/source/java/org/alfresco/repo/calendar/CalendarEntryImpl.java b/source/java/org/alfresco/repo/calendar/CalendarEntryImpl.java index dc3633ce27..164110e844 100644 --- a/source/java/org/alfresco/repo/calendar/CalendarEntryImpl.java +++ b/source/java/org/alfresco/repo/calendar/CalendarEntryImpl.java @@ -58,31 +58,54 @@ import org.alfresco.util.registry.NamedObjectRegistry; public class CalendarEntryImpl implements CalendarEntry { private NodeRef nodeRef; - private NodeService nodeService; + private NodeRef parentNodeRef; + private Map properties; /** - * Creates an empty Calendar Entry + * Creates an empty Calendar Entry, to be stored in the + * given parent */ - public CalendarEntryImpl() - {} + public CalendarEntryImpl(NodeRef parentNodeRef) + { + this.parentNodeRef = parentNodeRef; + this.properties = new HashMap(); + } /** * Wraps an existing Calendar Entry node */ - public CalendarEntryImpl(NodeRef nodeRef, NodeService nodeService) + public CalendarEntryImpl(NodeRef nodeRef, NodeRef parentNodeRef, Map properties) { this.nodeRef = nodeRef; - this.nodeService = nodeService; + this.parentNodeRef = parentNodeRef; + this.properties = properties; } - protected void recordStorageDetails(NodeRef nodeRef, NodeService nodeService) + protected void recordStorageDetails(NodeRef nodeRef) { this.nodeRef = nodeRef; - this.nodeService = nodeService; } + /** + * Returns the NodeRef of the parent where this calendar entry + * lives, or will live + */ + public NodeRef getParentNodeRef() + { + return parentNodeRef; + } + + /** + * Returns the current set of properties + */ + public Map getProperties() + { + return properties; + } + @Override - public NodeRef getNodeRef() { + public NodeRef getNodeRef() + { return nodeRef; } @@ -110,9 +133,8 @@ public class CalendarEntryImpl implements CalendarEntry } @Override - public void setDescription() { + public void setDescription(String description) { // TODO Auto-generated method stub - } @Override @@ -121,18 +143,36 @@ public class CalendarEntryImpl implements CalendarEntry return null; } + @Override + public void setStart(Date start) { + // TODO Auto-generated method stub + + } + @Override public Date getEnd() { // TODO Auto-generated method stub return null; } + @Override + public void setEnd(Date end) { + // TODO Auto-generated method stub + + } + @Override public String getLocation() { // TODO Auto-generated method stub return null; } + @Override + public void setLocation(String location) { + // TODO Auto-generated method stub + + } + @Override public List getTags() { // TODO Auto-generated method stub diff --git a/source/java/org/alfresco/repo/calendar/CalendarModel.java b/source/java/org/alfresco/repo/calendar/CalendarModel.java new file mode 100644 index 0000000000..7b64015a85 --- /dev/null +++ b/source/java/org/alfresco/repo/calendar/CalendarModel.java @@ -0,0 +1,51 @@ +/* + * 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; + +import org.alfresco.service.namespace.QName; + +/** + * Calendar models constants + * + * @author Nick Burch + */ +public interface CalendarModel +{ + /** Calendar Model */ + public static final String CALENDAR_MODEL_URL = "http://www.alfresco.org/model/calendar"; + public static final String CALENDAR_MODEL_PREFIX = "ia"; + + /** Event */ + public static final QName TYPE_EVENT = QName.createQName(CALENDAR_MODEL_URL, "calendarEvent"); + public static final QName PROP_WHAT = QName.createQName(CALENDAR_MODEL_URL, "whatEvent"); + public static final QName PROP_FROM_DATE = QName.createQName(CALENDAR_MODEL_URL, "fromDate"); + public static final QName PROP_TO_DATE = QName.createQName(CALENDAR_MODEL_URL, "toDate"); + public static final QName PROP_WHERE = QName.createQName(CALENDAR_MODEL_URL, "whereEvent"); + public static final QName PROP_DESCRIPTION = QName.createQName(CALENDAR_MODEL_URL, "descriptionEvent"); + public static final QName PROP_COLOR = QName.createQName(CALENDAR_MODEL_URL, "colorEvent"); + public static final QName PROP_RECURRENCE_RULE = QName.createQName(CALENDAR_MODEL_URL, "recurrenceRule"); + public static final QName PROP_RECURRENCE_LAST_MEETING = QName.createQName(CALENDAR_MODEL_URL, "recurrenceLastMeeting"); + public static final QName PROP_IS_OUTLOOK = QName.createQName(CALENDAR_MODEL_URL, "isOutlook"); + public static final QName PROP_OUTLOOK_UID = QName.createQName(CALENDAR_MODEL_URL, "outlookUID"); + public static final QName ASSOC_IGNORE_EVENT_LIST = QName.createQName(CALENDAR_MODEL_URL, "ignoreEventList"); + + /** Ignored Event */ + public static final QName TYPE_IGNORE_EVENT = QName.createQName(CALENDAR_MODEL_URL, "ignoreEvent"); + public static final QName PROP_IGNORE_EVENT_DATE = QName.createQName(CALENDAR_MODEL_URL, "date"); +} \ No newline at end of file diff --git a/source/java/org/alfresco/repo/calendar/CalendarServiceImpl.java b/source/java/org/alfresco/repo/calendar/CalendarServiceImpl.java index a64232fb77..a339e68810 100644 --- a/source/java/org/alfresco/repo/calendar/CalendarServiceImpl.java +++ b/source/java/org/alfresco/repo/calendar/CalendarServiceImpl.java @@ -20,35 +20,22 @@ package org.alfresco.repo.calendar; import java.io.Serializable; import java.util.Date; -import java.util.HashMap; import java.util.Map; import org.alfresco.model.ContentModel; -import org.alfresco.query.CannedQueryFactory; -import org.alfresco.query.CannedQueryResults; -import org.alfresco.query.PagingRequest; -import org.alfresco.query.PagingResults; -import org.alfresco.repo.blog.cannedqueries.DraftsAndPublishedBlogPostsCannedQuery; -import org.alfresco.repo.blog.cannedqueries.DraftsAndPublishedBlogPostsCannedQueryFactory; -import org.alfresco.repo.blog.cannedqueries.GetBlogPostsCannedQuery; -import org.alfresco.repo.blog.cannedqueries.GetBlogPostsCannedQueryFactory; -import org.alfresco.repo.content.MimetypeMap; import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; import org.alfresco.service.cmr.calendar.CalendarEntry; import org.alfresco.service.cmr.calendar.CalendarService; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.ContentService; -import org.alfresco.service.cmr.repository.ContentWriter; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.cmr.site.SiteInfo; import org.alfresco.service.cmr.site.SiteService; import org.alfresco.service.cmr.tagging.TaggingService; -import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; -import org.alfresco.util.ParameterCheck; -import org.alfresco.util.registry.NamedObjectRegistry; +import org.alfresco.service.transaction.TransactionService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * @author Nick Burch (based on existing webscript controllers in the REST API) @@ -60,15 +47,21 @@ public class CalendarServiceImpl implements CalendarService /** * For backwards compatibility with pre-Swift, we are asking the query to give us an accurate total count of how many - * blog-post nodes there are. This may need to change in the future - certainly if the current 'brute force' query + * calendar nodes there are. This may need to change in the future - certainly if the current 'brute force' query * is replaced by a database query. */ private static final int MAX_QUERY_ENTRY_COUNT = 10000; + /** + * The logger + */ + private static Log logger = LogFactory.getLog(CalendarServiceImpl.class); + private NodeService nodeService; private SiteService siteService; private TaggingService taggingService; private PermissionService permissionService; + private TransactionService transactionService; public void setNodeService(NodeService nodeService) { @@ -90,54 +83,159 @@ public class CalendarServiceImpl implements CalendarService this.permissionService = permissionService; } + public void setTransactionService(TransactionService transactionService) + { + this.transactionService = transactionService; + } + /** - * Fetches the Calendar Container on a site, creating as required. + * Fetches the Calendar Container on a site, creating as required if requested. */ - private NodeRef getSiteCalendarContainer(SiteInfo site) + private NodeRef getSiteCalendarContainer(final String siteShortName, boolean create) { - if(! siteService.hasContainer(site.getShortName(), CALENDAR_COMPONENT)) + if(! siteService.hasContainer(siteShortName, CALENDAR_COMPONENT)) { - // TODO RunAs + Transaction - siteService.createContainer( - site.getShortName(), CALENDAR_COMPONENT, null, null - ); + if(create) + { + // Have the site container created + if(logger.isDebugEnabled()) + { + logger.debug("Creating " + CALENDAR_COMPONENT + " container in site " + siteShortName); + } + + NodeRef container = AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() { + public NodeRef doWork() throws Exception + { + return transactionService.getRetryingTransactionHelper().doInTransaction( + new RetryingTransactionCallback() { + public NodeRef execute() throws Throwable { + // Create the site container + NodeRef container = siteService.createContainer( + siteShortName, CALENDAR_COMPONENT, null, null + ); + + // Done + return container; + } + }, false, true + ); + } + }, AuthenticationUtil.getSystemUserName()); + + if(logger.isDebugEnabled()) + { + logger.debug("Created " + CALENDAR_COMPONENT + " as " + container + " for " + siteShortName); + } + + // Container is setup and ready to use + return container; + } + else + { + // No container for this site, and not allowed to create + // Have the site container created + if(logger.isDebugEnabled()) + { + logger.debug("No " + CALENDAR_COMPONENT + " component in " + siteShortName + " and not creating"); + } + return null; + } + } + else + { + // Container is already there + final NodeRef container = siteService.getContainer(siteShortName, CALENDAR_COMPONENT); + + // Ensure the calendar container has the tag scope aspect applied to it + if(! taggingService.isTagScope(container)) + { + if(logger.isDebugEnabled()) + { + logger.debug("Attaching tag scope to " + CALENDAR_COMPONENT + " " + container.toString() + " for " + siteShortName); + } + AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() { + public Void doWork() throws Exception + { + transactionService.getRetryingTransactionHelper().doInTransaction( + new RetryingTransactionCallback() { + public Void execute() throws Throwable { + // Add the tag scope aspect + taggingService.addTagScope(container); + return null; + } + }, false, true + ); + return null; + } + }, AuthenticationUtil.getSystemUserName()); + } + + // Container is appropriately setup and configured + return container; + } + } + + @Override + public CalendarEntry getCalendarEntry(String siteShortName, String entryName) { + NodeRef container = getSiteCalendarContainer(siteShortName, false); + if(container == null) + { + // No events + return null; } - NodeRef container = siteService.getContainer(site.getShortName(), CALENDAR_COMPONENT); - if(! taggingService.isTagScope(container)) + NodeRef event = nodeService.getChildByName(container, ContentModel.ASSOC_CONTAINS, entryName); + if(event != null) { - // TODO RunAs + Transaction - taggingService.addTagScope(container); + return new CalendarEntryImpl(event, container, nodeService.getProperties(event)); } + return null; + } + + @Override + public CalendarEntry createCalendarEntry(String siteShortName, + String eventTitle, String eventDescription, Date eventStart, Date eventEnd) { + NodeRef container = getSiteCalendarContainer(siteShortName, true); - return container; + CalendarEntry entry = new CalendarEntryImpl(container); + entry.setTitle(eventTitle); + entry.setDescription(eventDescription); + entry.setStart(eventStart); + entry.setEnd(eventEnd); + return entry; } @Override - public CalendarEntry getCalendarEntry(SiteInfo site, String name) - { - // TODO Auto-generated method stub - return null; + public void saveCalendarEntry(CalendarEntry entry) { + CalendarEntryImpl entryImpl = (CalendarEntryImpl)entry; + Map properties = entryImpl.getProperties(); + + if(entry.getNodeRef() == null) + { + // Generate a name + String name = "123.ics"; // TODO + properties.put(ContentModel.PROP_NAME, name); + + // Add the entry + NodeRef nodeRef = nodeService.createNode( + entryImpl.getParentNodeRef(), + ContentModel.ASSOC_CONTAINS, + QName.createQName(name), + CalendarModel.TYPE_EVENT, + properties + ).getChildRef(); + entryImpl.recordStorageDetails(nodeRef); + } + else + { + // Update the existing one + nodeService.setProperties(entry.getNodeRef(), properties); + } } @Override - public String createCalendarEntry(SiteInfo site, CalendarEntry entry) - { - // TODO Auto-generated method stub - return null; - } + public void deleteCalendarEntry(CalendarEntry entry) { + // TODO Auto-generated method stub - @Override - public void updateCalendarEntry(SiteInfo site, CalendarEntry entry) - { - // TODO Auto-generated method stub - - } - - @Override - public void deleteCalendarEntry(SiteInfo site, CalendarEntry entry) - { - // TODO Auto-generated method stub - } } diff --git a/source/java/org/alfresco/repo/calendar/CalendarServiceImplTest.java b/source/java/org/alfresco/repo/calendar/CalendarServiceImplTest.java new file mode 100644 index 0000000000..c19d68f3f9 --- /dev/null +++ b/source/java/org/alfresco/repo/calendar/CalendarServiceImplTest.java @@ -0,0 +1,288 @@ +/* + * 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; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.alfresco.model.ContentModel; +import org.alfresco.query.PagingRequest; +import org.alfresco.query.PagingResults; +import org.alfresco.repo.blog.BlogService.BlogPostInfo; +import org.alfresco.repo.policy.BehaviourFilter; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.site.SiteModel; +import org.alfresco.repo.transaction.RetryingTransactionHelper; +import org.alfresco.service.cmr.calendar.CalendarEntry; +import org.alfresco.service.cmr.calendar.CalendarService; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.dictionary.PropertyDefinition; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.security.MutableAuthenticationService; +import org.alfresco.service.cmr.security.PersonService; +import org.alfresco.service.cmr.site.SiteInfo; +import org.alfresco.service.cmr.site.SiteService; +import org.alfresco.service.cmr.site.SiteVisibility; +import org.alfresco.service.cmr.tagging.TaggingService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.ApplicationContextHelper; +import org.alfresco.util.Pair; +import org.alfresco.util.PropertyMap; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.springframework.context.ApplicationContext; + +/** + * Test cases for {@link CalendarServiceImpl}. + * + * @author Nick Burch + * @since 4.0 + */ +public class CalendarServiceImplTest +{ + + private static final ApplicationContext testContext = ApplicationContextHelper.getApplicationContext(); + + // injected services + private static MutableAuthenticationService AUTHENTICATION_SERVICE; + private static BehaviourFilter BEHAVIOUR_FILTER; + private static CalendarService CALENDAR_SERVICE; + private static DictionaryService DICTIONARY_SERVICE; + private static NodeService NODE_SERVICE; + private static PersonService PERSON_SERVICE; + private static RetryingTransactionHelper TRANSACTION_HELPER; + private static SiteService SITE_SERVICE; + private static TaggingService TAGGING_SERVICE; + + private static final String TEST_USER = CalendarServiceImplTest.class.getSimpleName() + "_testuser"; + private static final String ADMIN_USER = AuthenticationUtil.getAdminUserName(); + + private static SiteInfo CALENDAR_SITE; + + /** + * Temporary test nodes (created during a test method) that need deletion after the test method. + */ + private List testNodesToTidy = new ArrayList(); + /** + * Temporary test nodes (created BeforeClass) that need deletion after this test class. + */ + private static List CLASS_TEST_NODES_TO_TIDY = new ArrayList(); + + @BeforeClass public static void initTestsContext() throws Exception + { + AUTHENTICATION_SERVICE = (MutableAuthenticationService)testContext.getBean("authenticationService"); + BEHAVIOUR_FILTER = (BehaviourFilter)testContext.getBean("policyBehaviourFilter"); + CALENDAR_SERVICE = (CalendarService)testContext.getBean("CalendarService"); + DICTIONARY_SERVICE = (DictionaryService)testContext.getBean("dictionaryService"); + NODE_SERVICE = (NodeService)testContext.getBean("nodeService"); + PERSON_SERVICE = (PersonService)testContext.getBean("personService"); + TRANSACTION_HELPER = (RetryingTransactionHelper)testContext.getBean("retryingTransactionHelper"); + SITE_SERVICE = (SiteService)testContext.getBean("siteService"); + TAGGING_SERVICE = (TaggingService)testContext.getBean("TaggingService"); + + AuthenticationUtil.setFullyAuthenticatedUser(ADMIN_USER); + createUser(TEST_USER); + + // We need to create the test site as the test user so that they can contribute content to it in tests below. + AuthenticationUtil.setFullyAuthenticatedUser(TEST_USER); + createTestSite(); + } + + @Test public void createNewEntry() throws Exception + { + CalendarEntry entry; + + // TODO List to check there aren't any yet + + // Get with an arbitrary name gives nothing + entry = CALENDAR_SERVICE.getCalendarEntry(CALENDAR_SITE.getShortName(), "madeUp"); + assertEquals(null, entry); + + entry = CALENDAR_SERVICE.getCalendarEntry(CALENDAR_SITE.getShortName(), "madeUp2"); + assertEquals(null, entry); + + + // Create one + entry = CALENDAR_SERVICE.createCalendarEntry( + CALENDAR_SITE.getShortName(), "Title", + "Description", new Date(1), new Date(1234) + ); + + // Can't be got until saved + assertEquals(null, entry.getSystemName()); + assertEquals(null, entry.getNodeRef()); + + // But we do know where it'll go + assertNotNull( ((CalendarEntryImpl)entry).getParentNodeRef() ); + + + // Have it saved + + // TODO + } + + @Test public void createUpdateDeleteEntry() throws Exception + { + // TODO + } + + /** + * Ensures that when we try to write an entry to the + * container of a new site, it is correctly setup for us + */ + @Test public void newContainerSetup() throws Exception + { + // TODO + } + + @Test public void calendarListing() throws Exception + { + // TODO + } + + private static void createTestSite() throws Exception + { + CALENDAR_SITE = TRANSACTION_HELPER.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() + { + @Override + public SiteInfo execute() throws Throwable + { + SiteInfo site = SITE_SERVICE.createSite("CalendarSiteTest", CalendarServiceImplTest.class.getSimpleName() + "_testSite" + System.currentTimeMillis(), + "test site title", "test site description", SiteVisibility.PUBLIC); + CLASS_TEST_NODES_TO_TIDY.add(site.getNodeRef()); + return site; + } + }); + } + + /** + * By default, all tests are run as the admin user. + */ + @Before public void setAdminUser() + { + AuthenticationUtil.setFullyAuthenticatedUser(ADMIN_USER); + } + + @After public void deleteTestNodes() throws Exception + { + performDeletionOfNodes(testNodesToTidy); + } + + @AfterClass public static void deleteClassTestNodesAndUsers() throws Exception + { + performDeletionOfNodes(CLASS_TEST_NODES_TO_TIDY); + deleteUser(TEST_USER); + } + + /** + * Deletes the specified NodeRefs, if they exist. + * @param nodesToDelete + */ + private static void performDeletionOfNodes(final List nodesToDelete) + { + TRANSACTION_HELPER.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() + { + @Override + public Void execute() throws Throwable + { + AuthenticationUtil.setFullyAuthenticatedUser(ADMIN_USER); + + for (NodeRef node : nodesToDelete) + { + if (NODE_SERVICE.exists(node)) + { + // st:site nodes can only be deleted via the SiteService + if (NODE_SERVICE.getType(node).equals(SiteModel.TYPE_SITE)) + { + + SiteInfo siteInfo = SITE_SERVICE.getSite(node); + SITE_SERVICE.deleteSite(siteInfo.getShortName()); + } + else + { + NODE_SERVICE.deleteNode(node); + } + } + } + + return null; + } + }); + } + + private static void createUser(final String userName) + { + TRANSACTION_HELPER.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() + { + @Override + public Void execute() throws Throwable + { + if (!AUTHENTICATION_SERVICE.authenticationExists(userName)) + { + AUTHENTICATION_SERVICE.createAuthentication(userName, "PWD".toCharArray()); + } + + if (!PERSON_SERVICE.personExists(userName)) + { + PropertyMap ppOne = new PropertyMap(); + ppOne.put(ContentModel.PROP_USERNAME, userName); + ppOne.put(ContentModel.PROP_FIRSTNAME, "firstName"); + ppOne.put(ContentModel.PROP_LASTNAME, "lastName"); + ppOne.put(ContentModel.PROP_EMAIL, "email@email.com"); + ppOne.put(ContentModel.PROP_JOBTITLE, "jobTitle"); + + PERSON_SERVICE.createPerson(ppOne); + } + + return null; + } + }); + } + + private static void deleteUser(final String userName) + { + TRANSACTION_HELPER.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() + { + @Override + public Void execute() throws Throwable + { + if (PERSON_SERVICE.personExists(userName)) + { + PERSON_SERVICE.deletePerson(userName); + } + + return null; + } + }); + } +} diff --git a/source/java/org/alfresco/service/cmr/calendar/CalendarEntry.java b/source/java/org/alfresco/service/cmr/calendar/CalendarEntry.java index b4cbf04cab..14b7fda7e8 100644 --- a/source/java/org/alfresco/service/cmr/calendar/CalendarEntry.java +++ b/source/java/org/alfresco/service/cmr/calendar/CalendarEntry.java @@ -59,31 +59,44 @@ public interface CalendarEntry extends Serializable { /** * Sets the Description of the event */ - void setDescription(); + void setDescription(String description); /** * @return the Location of the event */ String getLocation(); - - // TODO More setters - + /** - * @return the Tags associated with the event + * Sets the Location of the event */ - List getTags(); + void setLocation(String location); /** * @return the Start date and time */ Date getStart(); + /** + * Sets the event start date and time + */ + void setStart(Date start); + /** * @return the End date and time */ Date getEnd(); - // TODO All Date + /** + * Sets the event end date and time + */ + void setEnd(Date end); + + /** + * @return the Tags associated with the event + */ + List getTags(); + + // TODO All Day events // TODO Doc folder diff --git a/source/java/org/alfresco/service/cmr/calendar/CalendarService.java b/source/java/org/alfresco/service/cmr/calendar/CalendarService.java index 5242fcac34..701edaed42 100644 --- a/source/java/org/alfresco/service/cmr/calendar/CalendarService.java +++ b/source/java/org/alfresco/service/cmr/calendar/CalendarService.java @@ -18,6 +18,8 @@ */ package org.alfresco.service.cmr.calendar; +import java.util.Date; + import org.alfresco.service.NotAuditable; import org.alfresco.service.cmr.site.SiteInfo; @@ -31,29 +33,30 @@ import org.alfresco.service.cmr.site.SiteInfo; */ public interface CalendarService { /** - * Creates a new {@link CalendarEntry} in the repository for the - * specified site. + * Creates a new {@link CalendarEntry} for the given site, but + * doesn't save it to the repository. * - * @return The System Assigned Name for the new entry + * @return The newly cre */ @NotAuditable - String createCalendarEntry(SiteInfo site, CalendarEntry entry); + CalendarEntry createCalendarEntry(String siteShortName, String eventTitle, + String eventDescription, Date from, Date to); /** - * Updates an existing {@link CalendarEntry} in the repository + * Saves a {@link CalendarEntry} in the repository. */ @NotAuditable - void updateCalendarEntry(SiteInfo site, CalendarEntry entry); + void saveCalendarEntry(CalendarEntry entry); /** * Deletes an existing {@link CalendarEntry} from the repository */ @NotAuditable - void deleteCalendarEntry(SiteInfo site, CalendarEntry entry); + void deleteCalendarEntry(CalendarEntry entry); /** * Retrieves an existing {@link CalendarEntry} from the repository */ @NotAuditable - CalendarEntry getCalendarEntry(SiteInfo site, String name); + CalendarEntry getCalendarEntry(String siteShortName, String entryName); }