org.alfresco.repo.googledocs
Class GoogleDocsServiceImpl

java.lang.Object
  extended by org.alfresco.repo.transaction.TransactionListenerAdapter
      extended by org.alfresco.repo.googledocs.GoogleDocsServiceImpl
All Implemented Interfaces:
GoogleDocsModel, GoogleDocsService, TransactionListener

public class GoogleDocsServiceImpl
extends TransactionListenerAdapter
implements GoogleDocsService, GoogleDocsModel

Google docs integration service implementation


Field Summary
static java.lang.String TYPE_DOCUMENT
          Google document types
static java.lang.String TYPE_PDF
           
static java.lang.String TYPE_PRESENTATION
           
static java.lang.String TYPE_SPREADSHEET
           
 
Fields inherited from interface org.alfresco.repo.googledocs.GoogleDocsModel
ASPECT_GOOGLEEDITABLE, ASPECT_GOOGLERESOURCE, GOOGLE_DOCS_MODEL_1_0_URI, GOOGLE_DOCS_PREFIX, PROP_RESOURCE_ID, PROP_RESOURCE_TYPE, PROP_URL
 
Constructor Summary
GoogleDocsServiceImpl()
           
 
Method Summary
 void afterCommit()
          Invoked after transaction commit.
 void afterRollback()
          Invoked after transaction rollback.
 void createGoogleDoc(org.alfresco.service.cmr.repository.NodeRef nodeRef, GoogleDocsPermissionContext permissionContext)
          Create a google doc from a given node.
 void deleteGoogleResource(org.alfresco.service.cmr.repository.NodeRef nodeRef)
          Deletes the google resource associated with the node reference.
 com.google.gdata.client.docs.DocsService getDocumentService()
          Get a new instance of a document service
 java.io.InputStream getGoogleDocContent(org.alfresco.service.cmr.repository.NodeRef nodeRef)
          Gets the content as an input stream of google doc associated with the given node.
 com.google.gdata.client.media.MediaService getMediaService(java.lang.String serviceName)
           
 com.google.gdata.client.media.MediaService getSpreadSheetService()
          Get a new instance of the spread sheet service
 boolean isEnabled()
          Indicates whether the GoogleDocs service is enabled or not.
 boolean isSupportedMimetype(java.lang.String mimetype)
          Indicates whether the mimetype is supported for creation in google docs.
 void setApplicationName(java.lang.String applicationName)
           
 void setAuthorityService(AuthorityService authorityService)
           
 void setContentService(ContentService contentService)
           
 void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
           
 void setDownloadUrl(java.lang.String downloadUrl)
           
 void setEnabled(boolean enabled)
          Set whether the service is enabled or not.
 void setMimetypeService(org.alfresco.service.cmr.repository.MimetypeService mimetypeService)
           
 void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
           
 void setOwnableService(OwnableService ownableService)
           
 void setPassword(java.lang.String password)
           
 void setPermissionMap(java.util.Map permissionMap)
           
 void setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)
           
 void setPersonService(PersonService personService)
           
 void setSpreadsheetDownloadUrl(java.lang.String spreadsheetDownloadUrl)
           
 void setSpreadSheetServiceName(java.lang.String spreadSheetServiceName)
           
 void setUrl(java.lang.String url)
           
 void setUsername(java.lang.String username)
           
 
Methods inherited from class org.alfresco.repo.transaction.TransactionListenerAdapter
beforeCommit, beforeCompletion, flush
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_DOCUMENT

public static final java.lang.String TYPE_DOCUMENT
Google document types

See Also:
Constant Field Values

TYPE_SPREADSHEET

public static final java.lang.String TYPE_SPREADSHEET
See Also:
Constant Field Values

TYPE_PRESENTATION

public static final java.lang.String TYPE_PRESENTATION
See Also:
Constant Field Values

TYPE_PDF

public static final java.lang.String TYPE_PDF
See Also:
Constant Field Values
Constructor Detail

GoogleDocsServiceImpl

public GoogleDocsServiceImpl()
Method Detail

getSpreadSheetService

public com.google.gdata.client.media.MediaService getSpreadSheetService()
Get a new instance of the spread sheet service

Returns:
spreadsheet service

getDocumentService

public com.google.gdata.client.docs.DocsService getDocumentService()
Get a new instance of a document service

Returns:
document service

getMediaService

public com.google.gdata.client.media.MediaService getMediaService(java.lang.String serviceName)
Parameters:
serviceName -
Returns:

setNodeService

public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
Parameters:
nodeService - node service

setContentService

public void setContentService(ContentService contentService)
Parameters:
contentService - content service

setPersonService

public void setPersonService(PersonService personService)
Parameters:
personService - person service

setMimetypeService

public void setMimetypeService(org.alfresco.service.cmr.repository.MimetypeService mimetypeService)
Parameters:
mimetypeService - mime type service

setPermissionService

public void setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)
Parameters:
permissionService - permission service

setOwnableService

public void setOwnableService(OwnableService ownableService)
Parameters:
ownableService - ownable service

setAuthorityService

public void setAuthorityService(AuthorityService authorityService)
Parameters:
authorityService - authority service

setDictionaryService

public void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
Parameters:
dictionaryService - dictionary service

setUrl

public void setUrl(java.lang.String url)
Parameters:
url - root googleDoc URL

setDownloadUrl

public void setDownloadUrl(java.lang.String downloadUrl)
Parameters:
downloadUrl - root download URL

setSpreadsheetDownloadUrl

public void setSpreadsheetDownloadUrl(java.lang.String spreadsheetDownloadUrl)
Parameters:
spreadsheetDownloadUrl - root spreadsheet download URL

setApplicationName

public void setApplicationName(java.lang.String applicationName)
Parameters:
applicationName - GDoc application name

setSpreadSheetServiceName

public void setSpreadSheetServiceName(java.lang.String spreadSheetServiceName)
Parameters:
spreadSheetServiceName - GDoc spread sheet service name

setUsername

public void setUsername(java.lang.String username)
Parameters:
username - google service user name

setPassword

public void setPassword(java.lang.String password)
Parameters:
password - google service password

setPermissionMap

public void setPermissionMap(java.util.Map permissionMap)
Parameters:
permissionMap - permission map

setEnabled

public void setEnabled(boolean enabled)
Set whether the service is enabled or not.

Parameters:
enabled - true if enabled, false otherwise

isEnabled

public boolean isEnabled()
Description copied from interface: GoogleDocsService
Indicates whether the GoogleDocs service is enabled or not.

Specified by:
isEnabled in interface GoogleDocsService
Returns:
boolean true if enabled, false otherwise
See Also:
GoogleDocsService.isEnabled()

isSupportedMimetype

public boolean isSupportedMimetype(java.lang.String mimetype)
Description copied from interface: GoogleDocsService
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

Specified by:
isSupportedMimetype in interface GoogleDocsService
Parameters:
mimetype - mimetype
Returns:
boolean true if mimetype is supported, false otherwise
See Also:
GoogleDocsService.isSupportedMimetype(java.lang.String)

createGoogleDoc

public void createGoogleDoc(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                            GoogleDocsPermissionContext permissionContext)
Description copied from interface: GoogleDocsService
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.

Specified by:
createGoogleDoc in interface GoogleDocsService
Parameters:
nodeRef - node reference
permissionContext - permission context
Throws:
GoogleDocsUnsupportedMimetypeException
See Also:
org.alfresco.google.docs.GoogleDocsService#upload(org.alfresco.service.cmr.repository.NodeRef)

deleteGoogleResource

public void deleteGoogleResource(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Description copied from interface: GoogleDocsService
Deletes the google resource associated with the node reference. This could be a folder or document.

Specified by:
deleteGoogleResource in interface GoogleDocsService
Parameters:
nodeRef - node reference
See Also:
org.alfresco.google.docs.GoogleDocsService#deleteGoogleResource(org.alfresco.service.cmr.repository.NodeRef)

getGoogleDocContent

public java.io.InputStream getGoogleDocContent(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Description copied from interface: GoogleDocsService
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.

Specified by:
getGoogleDocContent in interface GoogleDocsService
Parameters:
nodeRef - node reference
Returns:
InputStream the content of the associated google doc
See Also:
org.alfresco.google.docs.GoogleDocsService#getGoogleDocContent(org.alfresco.service.cmr.repository.NodeRef)

afterCommit

public void afterCommit()
Description copied from class: TransactionListenerAdapter
Invoked after transaction commit.

Any exceptions generated here will cause the transaction to rollback.

Although all transaction resources are still available, this method should be used only for cleaning up resources after a commit has occured.

Specified by:
afterCommit in interface TransactionListener
Overrides:
afterCommit in class TransactionListenerAdapter
See Also:
TransactionListenerAdapter.afterCommit()

afterRollback

public void afterRollback()
Description copied from class: TransactionListenerAdapter
Invoked after transaction rollback.

Although all transaction resources are still available, this method should be used only for cleaning up resources after a rollback has occured.

Specified by:
afterRollback in interface TransactionListener
Overrides:
afterRollback in class TransactionListenerAdapter
See Also:
TransactionListenerAdapter.afterRollback()


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.