diff --git a/config/alfresco/bootstrap-context.xml b/config/alfresco/bootstrap-context.xml
index 0ac2642858..deca0b7235 100644
--- a/config/alfresco/bootstrap-context.xml
+++ b/config/alfresco/bootstrap-context.xml
@@ -575,15 +575,6 @@
true
-
-
-
diff --git a/config/alfresco/slingshot-context.xml b/config/alfresco/slingshot-context.xml
index 274be16aba..c0280730b8 100644
--- a/config/alfresco/slingshot-context.xml
+++ b/config/alfresco/slingshot-context.xml
@@ -41,8 +41,6 @@
-
-
slingshotDocLib
@@ -52,9 +50,6 @@
-
-
-
diff --git a/config/alfresco/subsystems/googledocs/default/googledocs-context.xml b/config/alfresco/subsystems/googledocs/default/googledocs-context.xml
deleted file mode 100755
index 05ffc3a7f8..0000000000
--- a/config/alfresco/subsystems/googledocs/default/googledocs-context.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
-
-
- alfresco/subsystems/googledocs/default/googledocs-model.xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/config/alfresco/subsystems/googledocs/default/googledocs-model.xml b/config/alfresco/subsystems/googledocs/default/googledocs-model.xml
deleted file mode 100755
index d8b650348e..0000000000
--- a/config/alfresco/subsystems/googledocs/default/googledocs-model.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-
-
-
-
-
-
-
- Google Docs Model
- unknown
- 1.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Google Editable
-
-
- Property who's only purpose is to allow the marker aspect to be automatically added.
- d:boolean
- true
- true
-
-
-
-
-
- Google Document
-
-
- GoogleDocs URL
- d:text
- false
-
-
- GoogleDocs id
- d:text
- false
-
-
- GoogleDocs Type
- d:text
- false
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/config/alfresco/subsystems/googledocs/default/googledocs.properties b/config/alfresco/subsystems/googledocs/default/googledocs.properties
deleted file mode 100755
index fcafc00d4d..0000000000
--- a/config/alfresco/subsystems/googledocs/default/googledocs.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-
-# Enables GoogleDocsV1 functionality
-googledocs.googleeditable.enabled=false
-
-# Google docs application name
-googledocs.application.name=Alfresco ECM system
-
-# Google docs URL
-googledocs.url=https://docs.google.com/feeds/default/private/full
-googledocs.downloadurl=https://docs.google.com/feeds/download
-
-# System google docs authentication credentials
-googledocs.username=
-googledocs.password=
-
-# Google docs spreadsheet service name
-googledocs.spreadsheet.service.name=wise
-googledocs.spreadsheet.downloadurl=https://spreadsheet.google.com/feeds/download
\ No newline at end of file
diff --git a/config/alfresco/subsystems/googledocs/default/test.docx b/config/alfresco/subsystems/googledocs/default/test.docx
deleted file mode 100755
index e04a931e44..0000000000
Binary files a/config/alfresco/subsystems/googledocs/default/test.docx and /dev/null differ
diff --git a/config/alfresco/subsystems/googledocs/default/test.xlsx b/config/alfresco/subsystems/googledocs/default/test.xlsx
deleted file mode 100644
index 64d4a40495..0000000000
Binary files a/config/alfresco/subsystems/googledocs/default/test.xlsx and /dev/null differ
diff --git a/config/alfresco/subsystems/googledocs/default/testBook.xls b/config/alfresco/subsystems/googledocs/default/testBook.xls
deleted file mode 100644
index 15d493339d..0000000000
Binary files a/config/alfresco/subsystems/googledocs/default/testBook.xls and /dev/null differ
diff --git a/config/alfresco/templates/following-email-templates.xml b/config/alfresco/templates/following-email-templates.xml
index 7fe18b5870..2890f12552 100644
--- a/config/alfresco/templates/following-email-templates.xml
+++ b/config/alfresco/templates/following-email-templates.xml
@@ -1,7 +1,7 @@
-
+
${spaces.templates.email.following.name}
${spaces.templates.email.following.name}
diff --git a/config/alfresco/templates/invite-email-templates.xml b/config/alfresco/templates/invite-email-templates.xml
index 89c8719290..ccc6afaa37 100644
--- a/config/alfresco/templates/invite-email-templates.xml
+++ b/config/alfresco/templates/invite-email-templates.xml
@@ -3,7 +3,7 @@
/app:company_home/app:dictionary/app:email_templates/cm:invite
-
+
@@ -19,7 +19,7 @@
-
+
@@ -35,7 +35,7 @@
-
+
@@ -51,7 +51,7 @@
-
+
@@ -67,7 +67,7 @@
-
+
@@ -83,7 +83,7 @@
-
+
@@ -99,7 +99,7 @@
-
+
diff --git a/config/alfresco/templates/new-user-templates.xml b/config/alfresco/templates/new-user-templates.xml
index 2bd4c2217b..238e0b05da 100644
--- a/config/alfresco/templates/new-user-templates.xml
+++ b/config/alfresco/templates/new-user-templates.xml
@@ -3,7 +3,7 @@
/app:company_home/app:dictionary/app:email_templates/cm:invite
-
+
@@ -19,7 +19,7 @@
-
+
@@ -35,7 +35,7 @@
-
+
@@ -51,7 +51,7 @@
-
+
@@ -67,7 +67,7 @@
-
+
@@ -83,7 +83,7 @@
-
+
@@ -99,7 +99,7 @@
-
+
diff --git a/config/alfresco/templates/notify_email_templates.xml b/config/alfresco/templates/notify_email_templates.xml
index bae5de53d2..83f0799ca5 100644
--- a/config/alfresco/templates/notify_email_templates.xml
+++ b/config/alfresco/templates/notify_email_templates.xml
@@ -1,6 +1,6 @@
-
+
@@ -15,7 +15,7 @@
-
+
@@ -30,7 +30,7 @@
-
+
@@ -45,7 +45,7 @@
-
+
@@ -60,7 +60,7 @@
-
+
@@ -75,7 +75,7 @@
-
+
@@ -90,7 +90,7 @@
-
+
diff --git a/source/java/org/alfresco/repo/googledocs/GoogleDocsModel.java b/source/java/org/alfresco/repo/googledocs/GoogleDocsModel.java
deleted file mode 100755
index bd13306260..0000000000
--- a/source/java/org/alfresco/repo/googledocs/GoogleDocsModel.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-* Copyright (C) 2005-2010 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.googledocs;
-
-import org.alfresco.service.namespace.QName;
-
-/**
- * Google docs model constants
- */
-public interface GoogleDocsModel
-{
- static final String GOOGLE_DOCS_PREFIX = "gd";
- static final String GOOGLE_DOCS_MODEL_1_0_URI = "http://www.alfresco.org/model/googledocs/1.0";
-
- static final QName ASPECT_GOOGLEEDITABLE = QName.createQName(GOOGLE_DOCS_MODEL_1_0_URI, "googleEditable");
-
- static final QName ASPECT_GOOGLERESOURCE = QName.createQName(GOOGLE_DOCS_MODEL_1_0_URI, "googleResource");
- static final QName PROP_URL = QName.createQName(GOOGLE_DOCS_MODEL_1_0_URI, "url");
- static final QName PROP_RESOURCE_ID = QName.createQName(GOOGLE_DOCS_MODEL_1_0_URI, "resourceId");
- static final QName PROP_RESOURCE_TYPE = QName.createQName(GOOGLE_DOCS_MODEL_1_0_URI, "resourceType");
-}
diff --git a/source/java/org/alfresco/repo/googledocs/GoogleDocsPermissionContext.java b/source/java/org/alfresco/repo/googledocs/GoogleDocsPermissionContext.java
deleted file mode 100644
index d5e13def06..0000000000
--- a/source/java/org/alfresco/repo/googledocs/GoogleDocsPermissionContext.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-* Copyright (C) 2005-2010 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.googledocs;
-
-/**
- * Google docs permission context
- */
-public enum GoogleDocsPermissionContext
-{
- PRIVATE,
- SHARE_READ,
- SHARE_WRITE,
- SHARE_READWRITE
-}
diff --git a/source/java/org/alfresco/repo/googledocs/GoogleDocsService.java b/source/java/org/alfresco/repo/googledocs/GoogleDocsService.java
deleted file mode 100755
index 12b473aac0..0000000000
--- a/source/java/org/alfresco/repo/googledocs/GoogleDocsService.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
-* Copyright (C) 2005-2010 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.googledocs;
-
-import java.io.InputStream;
-
-import org.alfresco.service.cmr.repository.NodeRef;
-
-/**
- * Google docs integration service interface
- */
-public interface GoogleDocsService
-{
- /**
- * Indicates whether the GoogleDocs service is enabled or not.
- * @return boolean true if enabled, false otherwise
- */
- boolean isEnabled();
-
- /**
- * Indicates whether the mimetype is supported for creation in google docs.
- *
- * NOTE: This method presumes that the account being used is not for a "premium" customer
- *
- * @param mimetype mimetype
- * @return boolean true if mimetype is supported, false otherwise
- */
- boolean isSupportedMimetype(String mimetype);
-
- /**
- * Create a google doc from a given node. The content of the node will be used
- * as a basis of the associated google doc. If the node has no content a new, empty google
- * doc of the correct type will be created.
- *
- * The permission context provides information about how google sharing permissions should be
- * set on the created google doc.
- *
- * @param nodeRef node reference
- * @param permissionContext permission context
- * @throws GoogleDocsUnsupportedMimetypeException
- */
- void createGoogleDoc(NodeRef nodeRef, GoogleDocsPermissionContext permissionContext);
-
- /**
- * Deletes the google resource associated with the node reference. This could be a folder or
- * document.
- *
- * @param nodeRef node reference
- */
- void deleteGoogleResource(NodeRef nodeRef);
-
- /**
- * Gets the content as an input stream of google doc associated with the given node. The
- * node must have the google resource aspect and the associated resource should not be a
- * folder.
- *
- * @param nodeRef node reference
- * @return InputStream the content of the associated google doc
- */
- InputStream getGoogleDocContent(NodeRef nodeRef);
-
-}
\ No newline at end of file
diff --git a/source/java/org/alfresco/repo/googledocs/GoogleDocsServiceImpl.java b/source/java/org/alfresco/repo/googledocs/GoogleDocsServiceImpl.java
deleted file mode 100755
index c5d27e5c87..0000000000
--- a/source/java/org/alfresco/repo/googledocs/GoogleDocsServiceImpl.java
+++ /dev/null
@@ -1,1347 +0,0 @@
-/*
-* Copyright (C) 2005-2014 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.googledocs;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Serializable;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.alfresco.error.AlfrescoRuntimeException;
-import org.alfresco.model.ContentModel;
-import org.alfresco.repo.security.authentication.AuthenticationUtil;
-import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
-import org.alfresco.repo.transaction.RetryingTransactionHelper;
-import org.alfresco.repo.transaction.TransactionListener;
-import org.alfresco.repo.transaction.TransactionListenerAdapter;
-import org.alfresco.service.cmr.dictionary.DictionaryService;
-import org.alfresco.service.cmr.repository.ContentData;
-import org.alfresco.service.cmr.repository.ContentReader;
-import org.alfresco.service.cmr.repository.ContentService;
-import org.alfresco.service.cmr.repository.MimetypeService;
-import org.alfresco.service.cmr.repository.NodeRef;
-import org.alfresco.service.cmr.repository.NodeService;
-import org.alfresco.service.cmr.security.AccessPermission;
-import org.alfresco.service.cmr.security.AuthorityService;
-import org.alfresco.service.cmr.security.AuthorityType;
-import org.alfresco.service.cmr.security.OwnableService;
-import org.alfresco.service.cmr.security.PermissionService;
-import org.alfresco.service.cmr.security.PersonService;
-import org.alfresco.service.namespace.QName;
-import org.alfresco.util.ParameterCheck;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import com.google.gdata.client.GoogleAuthTokenFactory.UserToken;
-import com.google.gdata.client.docs.DocsService;
-import com.google.gdata.client.media.MediaService;
-import com.google.gdata.data.IEntry;
-import com.google.gdata.data.MediaContent;
-import com.google.gdata.data.PlainTextConstruct;
-import com.google.gdata.data.acl.AclEntry;
-import com.google.gdata.data.acl.AclFeed;
-import com.google.gdata.data.acl.AclRole;
-import com.google.gdata.data.acl.AclScope;
-import com.google.gdata.data.docs.DocumentEntry;
-import com.google.gdata.data.docs.DocumentListEntry;
-import com.google.gdata.data.docs.FolderEntry;
-import com.google.gdata.data.docs.PdfEntry;
-import com.google.gdata.data.docs.PresentationEntry;
-import com.google.gdata.data.docs.SpreadsheetEntry;
-import com.google.gdata.data.docs.DocumentListEntry.MediaType;
-import com.google.gdata.data.media.MediaSource;
-import com.google.gdata.data.media.MediaStreamSource;
-import com.google.gdata.util.AuthenticationException;
-import com.google.gdata.util.ContentType;
-import com.google.gdata.util.ServiceException;
-
-/**
- * Google docs integration service implementation
- */
-public class GoogleDocsServiceImpl extends TransactionListenerAdapter
- implements GoogleDocsService, GoogleDocsModel
-{
- /** Log */
- private static Log logger = LogFactory.getLog(GoogleDocsServiceImpl.class);
-
- /** Google document types */
- public static final String TYPE_DOCUMENT = "document";
- public static final String TYPE_SPREADSHEET = "spreadsheet";
- public static final String TYPE_PRESENTATION = "presentation";
- public static final String TYPE_PDF = "pdf";
-
- /** Transaction resource keys */
- private final static String KEY_MARKED_CREATE = "google_doc_service.marked_resources";
- private final static String KEY_MARKED_DELETE = "google_doc_service.marked_delete";
-
- /** Services */
- private NodeService nodeService;
- private ContentService contentService;
- private PersonService personService;
- private MimetypeService mimetypeService;
- private PermissionService permissionService;
- private OwnableService ownableService;
- private AuthorityService authorityService;
- private DictionaryService dictionaryService;
-
- /** Indicates whether the GDoc integration is enabled or not */
- private boolean enabled = false;
-
- /** GoogleDoc base feed url */
- private String url = "https://docs.google.com/feeds/default/private/full";
- private String downloadUrl = "https://docs.google.com/feeds/download";
- private String spreadsheetDownloadUrl = "https://spreadsheet.google.com/feeds/download";
-
- /** Authentication credentials */
- private String applicationName;
- private String spreadSheetServiceName;
- private String username;
- private String password;
-
- /** Cached service tokens */
- private Map serviceTokens = new HashMap(2);
-
- /** Permission map */
- private Map permissionMap;
-
- // TODO: need a way of indicating if a customer is a premium user or not
-
- /**
- * List of supported GoogleDoc supported mimetypes.
- * Taken from list found at http://code.google.com/apis/documents/faq.html#WhatKindOfFilesCanIUpload
- * NOTE: this restriction only applies to non-premium users.
- */
- // TODO make this list configurable
- private List supportedMimetypes = Arrays.asList(
- "text/csv",
- "text/tab-separated-values",
- "text/html",
- "application/msword",
- "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
- "application/x-vnd.oasis.opendocument.spreadsheet",
- "application/vnd.oasis.opendocument.text",
- "application/rtf",
- "application/vnd.sun.xml.writer",
- "text/plain",
- "application/vnd.ms-excel",
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
- "application/pdf",
- "application/vnd.ms-powerpoint",
- "image/x-wmf"
- );
-
- /**
- * Get a new instance of the spread sheet service
- *
- * @return spreadsheet service
- */
- public MediaService getSpreadSheetService()
- {
- if (spreadSheetServiceName == null)
- {
- throw new GoogleDocsServiceInitException("No Google Docs spreadsheet service has been specified.");
- }
-
- return getMediaService(spreadSheetServiceName);
- }
-
- /**
- * Get a new instance of a document service
- *
- * @return document service
- */
- public DocsService getDocumentService()
- {
- return (DocsService)getMediaService(DocsService.DOCS_SERVICE);
- }
-
- /**
- *
- * @param serviceName
- * @return
- */
- public MediaService getMediaService(String serviceName)
- {
- if (applicationName == null)
- {
- throw new GoogleDocsServiceInitException("Google Docs service " + serviceName + " could not be initialised, because no Google Doc application name has been specified.");
- }
-
- MediaService service = null;
- if (serviceName.equals(DocsService.DOCS_SERVICE) == true)
- {
- service = new DocsService(applicationName);
- }
- else
- {
- service = new MediaService(serviceName, applicationName);
-
- // MNT-11647: Changes in Google Docs API lead to setting 'Domain: .docs.google.com' cookie. This setting is causing the following exception:
- // 'java.lang.IllegalArgumentException: Trying to set foreign cookie'. Operations with spreadsheets cannot be completed
- if (serviceName.equals(spreadSheetServiceName) == true)
- {
- if (logger.isDebugEnabled())
- {
- logger.debug("Disabling handling cookies for '" + serviceName + "' Google Docs service");
- }
-
- service.setHandlesCookies(false);
- }
- }
- service.setChunkedMediaUpload(-1);
-
- String token = serviceTokens.get(serviceName);
- if (token == null)
- {
- try
- {
- if (username == null ||username.length() == 0 || password == null)
- {
- throw new GoogleDocsServiceInitException("No Google Docs credentials found. Please set the Google Docs authentication configuration.");
- }
-
- if (logger.isDebugEnabled() == true)
- {
- logger.debug("Setting user credentials for GDoc service. (serviceName=" + serviceName + ", userName=" + username + ", password=" + password + ")");
- }
-
- service.setUserCredentials(username, password);
- serviceTokens.put(serviceName, ((UserToken)service.getAuthTokenFactory().getAuthToken()).getValue());
- }
- catch (AuthenticationException e)
- {
- throw new GoogleDocsServiceInitException("Unable to connect to Google Docs. Please check the Google Docs authentication configuration.", e);
- }
- }
- else
- {
- service.setUserToken(token);
- }
-
- return service;
- }
-
- /**
- * @param nodeService node service
- */
- public void setNodeService(NodeService nodeService)
- {
- this.nodeService = nodeService;
- }
-
- /**
- * @param contentService content service
- */
- public void setContentService(ContentService contentService)
- {
- this.contentService = contentService;
- }
-
- /**
- * @param personService person service
- */
- public void setPersonService(PersonService personService)
- {
- this.personService = personService;
- }
-
- /**
- * @param mimetypeService mime type service
- */
- public void setMimetypeService(MimetypeService mimetypeService)
- {
- this.mimetypeService = mimetypeService;
- }
-
- /**
- * @param permissionService permission service
- */
- public void setPermissionService(PermissionService permissionService)
- {
- this.permissionService = permissionService;
- }
-
- /**
- * @param ownableService ownable service
- */
- public void setOwnableService(OwnableService ownableService)
- {
- this.ownableService = ownableService;
- }
-
- /**
- * @param authorityService authority service
- */
- public void setAuthorityService(AuthorityService authorityService)
- {
- this.authorityService = authorityService;
- }
-
- /**
- * @param dictionaryService dictionary service
- */
- public void setDictionaryService(DictionaryService dictionaryService)
- {
- this.dictionaryService = dictionaryService;
- }
-
- /**
- * @param url root googleDoc URL
- */
- public void setUrl(String url)
- {
- this.url = url;
- }
-
- /**
- * @param downloadUrl root download URL
- */
- public void setDownloadUrl(String downloadUrl)
- {
- this.downloadUrl = downloadUrl;
- }
-
- /**
- * @param spreadsheetDownloadUrl root spreadsheet download URL
- */
- public void setSpreadsheetDownloadUrl(String spreadsheetDownloadUrl)
- {
- this.spreadsheetDownloadUrl = spreadsheetDownloadUrl;
- }
-
- /**
- * @param applicationName GDoc application name
- */
- public void setApplicationName(String applicationName)
- {
- this.applicationName = applicationName;
- }
-
- /**
- * @param spreadSheetServiceName GDoc spread sheet service name
- */
- public void setSpreadSheetServiceName(String spreadSheetServiceName)
- {
- this.spreadSheetServiceName = spreadSheetServiceName;
- }
-
- /**
- * @param username google service user name
- */
- public void setUsername(String username)
- {
- this.username = username;
- updatedAuthenticationCredentials();
- }
-
- /**
- * @param password google service password
- */
- public void setPassword(String password)
- {
- this.password = password;
- updatedAuthenticationCredentials();
- }
-
- /**
- * @param permissionMap permission map
- */
- public void setPermissionMap(Map permissionMap)
- {
- this.permissionMap = permissionMap;
- }
-
- /**
- * Set whether the service is enabled or not.
- * @param enabled true if enabled, false otherwise
- */
- public void setEnabled(boolean enabled)
- {
- this.enabled = enabled;
- updatedAuthenticationCredentials();
- }
-
- /**
- * @see org.alfresco.repo.googledocs.GoogleDocsService#isEnabled()
- */
- public boolean isEnabled()
- {
- return enabled;
- }
-
- /**
- * @see org.alfresco.repo.googledocs.GoogleDocsService#isSupportedMimetype(java.lang.String)
- */
- @Override
- public boolean isSupportedMimetype(String mimetype)
- {
- return supportedMimetypes.contains(mimetype);
- }
-
- /**
- * @throws GoogleDocsUnsupportedMimetypeException
- * @see org.alfresco.google.docs.GoogleDocsService#upload(org.alfresco.service.cmr.repository.NodeRef)
- */
- public void createGoogleDoc(NodeRef nodeRef, GoogleDocsPermissionContext permissionContext)
- {
- // Check for mandatory parameters
- ParameterCheck.mandatory("nodeRef", nodeRef);
-
- // Get property values
- String name = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
-
- // TODO should be checking to make sure this doesn't already have an associated google doc
-
- // Get content reader
- String mimetype = null;
- InputStream is = null;
- ContentReader contentReader = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT);
- if (contentReader == null)
- {
- // Determine the mimetype from the file extension only
- // (We've no content so we can't include that in our check)
- mimetype = mimetypeService.guessMimetype(name);
- }
- else
- {
- // Get the mime type and input stream from the content reader
- mimetype = contentReader.getMimetype();
- if (contentReader.getSize() != 0)
- {
- is = contentReader.getContentInputStream();
- }
- }
-
- // Hack to modify the mimetype of ods file so GDoc upload works
- if ("application/vnd.oasis.opendocument.spreadsheet".equals(mimetype) == true)
- {
- mimetype = "application/x-vnd.oasis.opendocument.spreadsheet";
- }
-
- // Check that we support the mimetype
- if (isSupportedMimetype(mimetype) == false)
- {
- throw new GoolgeDocsUnsupportedMimetypeException(nodeRef, ContentModel.PROP_CONTENT, mimetype);
- }
-
- // Get the parent folder id
- DocumentListEntry parentFolder = getParentFolder(nodeRef);
-
- if (logger.isDebugEnabled() == true)
- {
- logger.debug("Creating google document (" + name + "," + mimetype + ")");
- }
-
- // Create the new google document
- DocumentListEntry document = createGoogleDocument(name, mimetype, parentFolder, is);
-
- // Set permissions
- setGoogleResourcePermissions(nodeRef, document, permissionContext);
-
- // Set the google document details
- setResourceDetails(nodeRef, document);
- }
-
- /**
- * @see org.alfresco.google.docs.GoogleDocsService#deleteGoogleResource(org.alfresco.service.cmr.repository.NodeRef)
- */
- public void deleteGoogleResource(NodeRef nodeRef)
- {
- // Check for mandatory parameters
- ParameterCheck.mandatory("nodeRef", nodeRef);
-
- if (nodeService.hasAspect(nodeRef, ASPECT_GOOGLERESOURCE) == true)
- {
- // Get the entry
- DocumentListEntry entry = getDocumentListEntry(nodeRef);
- if (entry != null)
- {
- // Mark the resource for deletion upon completion of the transaction
- markResource(KEY_MARKED_DELETE, entry.getResourceId());
- }
-
- // Remove the aspect from the node
- nodeService.removeAspect(nodeRef, ASPECT_GOOGLERESOURCE);
- }
- }
-
- /**
- * Set a google permission on a specified resource
- *
- * @param nodeRef node reference
- * @param resource document resource
- * @param permissionContext permission context
- */
- private void setGoogleResourcePermissions(NodeRef nodeRef, DocumentListEntry resource, GoogleDocsPermissionContext permissionContext)
- {
- if (GoogleDocsPermissionContext.PRIVATE.equals(permissionContext) == false)
- {
- Set accessPermissions = permissionService.getAllSetPermissions(nodeRef);
- for (AccessPermission accessPermission : accessPermissions)
- {
- String authorityName = accessPermission.getAuthority();
- AuthorityType authorityType = accessPermission.getAuthorityType();
- String permission = accessPermission.getPermission();
- if (permissionMap.containsKey(permission) == true)
- {
- String aclRole = permissionMap.get(permission);
- if (GoogleDocsPermissionContext.SHARE_READ.equals(permissionContext) == true &&
- ("reader".equals(aclRole) == true || "writer".equals(aclRole) == true))
- {
- // Set the permission to read
- setGoogleResourcePermission(resource, authorityType, authorityName, "reader");
- }
- else if (GoogleDocsPermissionContext.SHARE_WRITE.equals(permissionContext) == true &&
- "writer".equals(aclRole) == true)
- {
- // Set the permission to write
- setGoogleResourcePermission(resource, authorityType, authorityName, "writer");
- }
- else if (GoogleDocsPermissionContext.SHARE_READWRITE.equals(permissionContext) == true &&
- ("reader".equals(aclRole) == true || "writer".equals(aclRole) == true))
- {
- // Set the permission to the current acl
- setGoogleResourcePermission(resource, authorityType, authorityName, aclRole);
- }
- }
- }
- }
-
- // Always make sure the owner has write permissions on the document
- String owner = ownableService.getOwner(nodeRef);
- setGoogleResourcePermission(resource, AuthorityType.USER, owner, "writer");
- }
-
- /**
- * Set a google permission on a specified resource
- *
- * @param resource document resource
- * @param authorityType authority type
- * @param authorityName authority name
- * @param role role
- */
- private void setGoogleResourcePermission(DocumentListEntry resource, AuthorityType authorityType, String authorityName, String role)
- {
- if (AuthorityType.USER.equals(authorityType) == true)
- {
- // Set the user permissions on the resource
- String userEMail = getUserEMail(authorityName);
- if (userEMail != null && userEMail.length() != 0)
- {
- setGoogleResourcePermission(resource, userEMail, role);
- }
- }
- else if (AuthorityType.GROUP.equals(authorityType) == true)
- {
- Set childAuthorities = authorityService.getContainedAuthorities(AuthorityType.USER, authorityName, false);
- for (String childAuthority : childAuthorities)
- {
- setGoogleResourcePermission(resource, AuthorityType.USER, childAuthority, role);
- }
- }
- }
-
- /**
- * Gets the users email used to identify their google account.
- *
- * @param userName user name
- * @return String google account email, null if none
- */
- private String getUserEMail(String userName)
- {
- String email = null;
- NodeRef personNodeRef = personService.getPerson(userName);
- if (personNodeRef != null)
- {
- // First see if the google user information has been set
- email = (String)nodeService.getProperty(personNodeRef, ContentModel.PROP_GOOGLEUSERNAME);
-
- // If no google user information then default back to the user's email
- if (email == null || email.length() == 0)
- {
- email = (String) nodeService.getProperty(personNodeRef, ContentModel.PROP_EMAIL);
- }
- }
- return email;
- }
-
- /**
- * Gets the nodes parent folder google resource.
- *
- * @param nodeRef node reference
- * @return DocumentList Entry folder resource
- */
- private DocumentListEntry getParentFolder(final NodeRef nodeRef)
- {
- DocumentListEntry folder = null;
-
- NodeRef parentNodeRef = nodeService.getPrimaryParent(nodeRef).getParentRef();
- if (parentNodeRef != null)
- {
- if (nodeService.hasAspect(parentNodeRef, ASPECT_GOOGLERESOURCE) == true)
- {
- String resourceType = (String)nodeService.getProperty(parentNodeRef, PROP_RESOURCE_TYPE);
- String resourceId = (String)nodeService.getProperty(parentNodeRef, PROP_RESOURCE_ID);
- folder = getDocumentListEntry(resourceType + ":" + resourceId);
-
- if (logger.isDebugEnabled() == true)
- {
- logger.debug("Found existing google folder + " + resourceId);
- }
- }
- else
- {
- // Get the parent folder
- DocumentListEntry parentFolder = getParentFolder(parentNodeRef);
-
- // Determine the name of the new google folder
- String name = null;
- QName parentNodeType = nodeService.getType(parentNodeRef);
- if (dictionaryService.isSubClass(parentNodeType, ContentModel.TYPE_STOREROOT) == true)
- {
- name = parentNodeRef.getStoreRef().getIdentifier();
- }
- else
- {
- name = (String)nodeService.getProperty(parentNodeRef, ContentModel.PROP_NAME);
- }
-
- // Create the folder and set the meta data in Alfresco
- folder = createGoogleFolder(name, parentFolder);
- setResourceDetails(parentNodeRef, folder);
- }
- }
-
- return folder;
- }
-
- /**
- * Sets the resource details on the node reference
- *
- * @param nodeRef node reference
- * @param documentListEntry document list entry
- */
- private void setResourceDetails(final NodeRef nodeRef, final DocumentListEntry documentListEntry)
- {
- AuthenticationUtil.RunAsWork