public class OutlookServiceImpl extends Object implements OutlookService, org.picocontainer.Startable
| Modifier and Type | Class and Description |
|---|---|
protected class |
OutlookServiceImpl.OutlookSpaceImpl
The Class OutlookSpaceImpl.
|
protected class |
OutlookServiceImpl.PersonalDocuments
The Class PersonalDocuments.
|
protected class |
OutlookServiceImpl.UserFile
The Class UserFile.
|
protected class |
OutlookServiceImpl.UserFolder
The Class UserFolder.
|
protected class |
OutlookServiceImpl.UserImpl
The Class UserImpl.
|
| Modifier and Type | Field and Description |
|---|---|
protected static com.ibm.icu.text.Transliterator |
accentsConverter
The Constant accentsConverter.
|
protected org.owasp.html.PolicyFactory |
activityPolicy
Custom policy to allow supported elements in activity text as described in
Platform User Guide
|
protected org.exoplatform.services.cms.documents.DocumentService |
documentService
The resource document service.
|
protected org.exoplatform.services.cms.drives.ManageDriveService |
driveService
The drive service.
|
protected static String |
EXO_PRIVILEGEABLE
The Constant EXO_PRIVILEGEABLE.
|
protected NodeFinder |
finder
The finder.
|
protected org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator |
hierarchyCreator
The hierarchy creator.
|
protected org.owasp.html.PolicyFactory |
htmlPolicy
The html policy.
|
protected org.exoplatform.services.jcr.RepositoryService |
jcrService
The jcr service.
|
protected Pattern |
linkNotLocal
The link with href not a hash in local document target.
|
protected Pattern |
linkWithoutTarget
The link without target.
|
protected Pattern |
linkWithTarget
The link with target.
|
protected org.exoplatform.services.listener.ListenerService |
listenerService
The listener service.
|
protected static org.exoplatform.services.log.Log |
LOG
The Constant LOG.
|
static String |
MAILSERVER_URL
The Constant MAILSERVER_URL.
|
protected MailAPI |
mailserverApi
The mailserver api.
|
protected static String[] |
MANAGER_PERMISSION
The Constant MANAGER_PERMISSION.
|
protected org.exoplatform.services.organization.OrganizationService |
organization
The organization.
|
protected static String |
OUTLOOK_MESSAGES_NAME
The Constant OUTLOOK_MESSAGES_NAME.
|
protected static String |
OUTLOOK_MESSAGES_TITLE
The Constant OUTLOOK_MESSAGES_TITLE.
|
protected static String |
PERSONAL_DOCUMENTS
The Constant PERSONAL_DOCUMENTS.
|
protected static Random |
RANDOM
The Constant RANDOM.
|
protected static String[] |
READER_PERMISSION
The Constant READER_PERMISSION.
|
protected org.exoplatform.services.resources.ResourceBundleService |
resourceBundleService
The resource bundle service.
|
protected static String |
ROOT_USER
The Constant ROOT_USER.
|
protected org.exoplatform.services.jcr.ext.app.SessionProviderService |
sessionProviders
The session providers.
|
protected ConcurrentHashMap<String,OutlookServiceImpl.OutlookSpaceImpl> |
spaces
Spaces cache.
|
protected static String |
SPACES_HOME
The Constant SPACES_HOME.
|
protected org.owasp.html.PolicyFactory |
textPolicy
The text policy.
|
protected String |
trashHomePath
The trash home path.
|
protected org.exoplatform.services.cms.documents.TrashService |
trashService
The trash service.
|
protected static String |
UPLAODS_FOLDER_TITLE
The Constant UPLAODS_FOLDER_TITLE.
|
GROUP_DRIVE_PARRTEN, MESSAGE_NODETYPE, PERSONAL_DRIVE_PARRTEN| Constructor and Description |
|---|
OutlookServiceImpl(org.exoplatform.services.jcr.RepositoryService jcrService,
org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviders,
org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator hierarchyCreator,
NodeFinder finder,
org.exoplatform.services.organization.OrganizationService organization,
org.exoplatform.services.listener.ListenerService listenerService,
org.exoplatform.services.cms.drives.ManageDriveService driveService,
org.exoplatform.services.cms.documents.TrashService trashService,
org.exoplatform.services.resources.ResourceBundleService resourceBundleService,
org.exoplatform.container.xml.InitParams params,
org.exoplatform.services.cms.documents.DocumentService documentService)
Outlook service with storage in JCR and with managed features.
|
| Modifier and Type | Method and Description |
|---|---|
protected javax.jcr.Node |
addFile(javax.jcr.Node parent,
String title,
String contentType,
InputStream content)
Add nt:file node for given content stream and title.
|
protected javax.jcr.Node |
addFolder(javax.jcr.Node parent,
String title,
boolean forceNew)
Add nt:folder node with given title.
|
protected javax.jcr.Node |
addMessageFile(javax.jcr.Node parent,
OutlookMessage message)
Adds the message file.
|
OutlookMessage |
buildMessage(String id,
OutlookUser user,
OutlookEmail from,
List<OutlookEmail> to,
Calendar created,
Calendar modified,
String title,
String subject,
String body)
Build Outlook message object.
|
protected boolean |
checkout(javax.jcr.Node node)
Checkout.
|
protected boolean |
checkRootFolderExistence(org.exoplatform.social.core.space.model.Space socialSpace)
Checks the root folder existence.
|
static String |
cleanName(String name)
Make JCR compatible item name.
|
protected String |
currentUserId()
Current user id.
|
protected Locale |
currentUserLocale()
Current user locale.
|
protected javax.jcr.Property |
data(javax.jcr.Node content)
Data.
|
protected void |
fetchQuery(javax.jcr.query.QueryResult qr,
int limit,
Set<File> res)
Fetch query.
|
protected void |
fetchQuery(javax.jcr.query.QueryResult qr,
int limit,
Set<File> res,
Predicate<javax.jcr.Node> acceptNode)
Fetch query.
|
protected UUID |
generateId(String workspace,
String path)
Generate id.
|
OutlookEmail |
getAddress(String email,
String displayName)
Build Outlook Email address object.
|
protected org.exoplatform.services.organization.User |
getExoUser(String userName)
Gets the exo user.
|
OutlookMessage |
getMessage(OutlookUser user,
String messageId,
String messageToken)
Read Outlook message from server.
|
OutlookSpace |
getSpace(String groupId)
Return Office space handler.
|
OutlookUser |
getUser(String email,
String displayName,
String ewsUrl)
Build Outlook user object and associate it with current user in eXo
organization.
|
UserDocuments |
getUserDocuments()
Gets current user Personal Documents.
|
List<OutlookSpace> |
getUserSpaces()
Gets the user spaces.
|
protected String |
groupDocsPath(String groupId)
Generate the group documents (as
/Groups/spaces/$SPACE_GROUP_ID/Documents).
|
protected String |
groupPath(String groupId)
Generate the group node path (as /Groups/spaces/$SPACE_GROUP_ID).
|
protected void |
initDocumentLink(OutlookServiceImpl.PersonalDocuments personalDocuments,
HierarchyNode file)
Inits the document link.
|
protected void |
initDocumentLink(OutlookSpace space,
HierarchyNode file)
Inits the document link.
|
protected void |
initDocumentLink(org.exoplatform.portal.mop.SiteType siteType,
String driveName,
String portalName,
String nodeURI,
HierarchyNode node)
Inits the document link.
|
protected void |
initWebDAVLink(HierarchyNode node)
Inits the web DAV link.
|
protected boolean |
isHTML(String content)
Try detect is it a HTML content in the string.
|
protected boolean |
isNotNull(org.exoplatform.ws.frameworks.json.value.JsonValue json)
Checks if is not null.
|
protected boolean |
isNull(org.exoplatform.ws.frameworks.json.value.JsonValue json)
Checks if is null.
|
protected String |
makeLinksOpenNewWindow(String text)
Make links open new window.
|
protected javax.jcr.Node |
messagesFolder(javax.jcr.Node parent,
String... identity)
Messages folder.
|
protected String |
messageSummary(OutlookMessage message)
Generate message summary text.
|
protected String |
mimeType(javax.jcr.Node content)
Mime type.
|
protected javax.jcr.Node |
node(String nodePath)
Node.
|
protected javax.jcr.Node |
node(String workspace,
String path)
Node.
|
protected javax.jcr.Node |
nodeContent(javax.jcr.Node node)
Node content.
|
protected Calendar |
nodeCreated(javax.jcr.Node node)
Node created.
|
protected String |
nodeTitle(javax.jcr.Node node)
Node title.
|
protected org.exoplatform.social.core.activity.model.ExoSocialActivity |
postAttachmentActivity(Folder destFolder,
List<File> files,
OutlookUser user,
String comment)
Post attachment activity.
|
protected OutlookEmail |
readEmail(org.exoplatform.ws.frameworks.json.value.JsonValue vElem)
Read email.
|
protected String |
safeActivityMessage(String text)
Allow only activity tags as described in
https://www.exoplatform.com/docs/PLF43/PLFUserGuide.GettingStarted.ActivitiesInActivityStream.HTMLTags.
|
protected String |
safeHtml(String content)
Allow full rage of HTML text and structures.
|
protected String |
safeText(String content)
Allow only plain text.
|
List<File> |
saveAttachment(Folder destFolder,
OutlookUser user,
String comment,
String messageId,
String attachmentToken,
String... attachmentIds)
Save attachment.
|
List<File> |
saveAttachment(OutlookSpace space,
Folder destFolder,
OutlookUser user,
String comment,
String messageId,
String attachmentToken,
String... attachmentIds)
Save attachment.
|
protected void |
setPermissions(javax.jcr.Node node,
boolean deep,
boolean forcePrivilegeable,
String... identities)
Set read permissions on the target node to all given identities (e.g.
|
protected void |
setPermissions(javax.jcr.Node node,
String... identities)
Set read permissions on the target node to all given identities (e.g.
|
protected org.exoplatform.social.core.manager.ActivityManager |
socialActivityManager()
Social activity manager.
|
protected org.exoplatform.social.core.manager.IdentityManager |
socialIdentityManager()
Social identity manager.
|
protected org.exoplatform.social.core.manager.RelationshipManager |
socialRelationshipManager()
Social relationship manager.
|
protected javax.jcr.Node |
spaceDocumentsNode(String groupId)
Find given group Documents folder using current user session.
|
protected org.exoplatform.social.core.space.spi.SpaceService |
spaceService()
Space service.
|
void |
start()
On-start initializer.
|
void |
stop()
On-stop finalizer.
|
protected javax.jcr.Node |
systemNode(String workspace,
String path)
System node.
|
protected String |
userDocsPath(String userId)
Generate the user documents (as /Users/${userId}/Private/Documents).
|
protected javax.jcr.Node |
userDocumentsNode(String userName)
Find given user Personal Documents folder using user session.
|
protected List<OutlookSpace> |
userSpaces(String userId)
User spaces.
|
public static final String MAILSERVER_URL
protected static final String EXO_PRIVILEGEABLE
protected static final String OUTLOOK_MESSAGES_TITLE
protected static final String OUTLOOK_MESSAGES_NAME
protected static final String UPLAODS_FOLDER_TITLE
protected static final String SPACES_HOME
protected static final String ROOT_USER
protected static final String PERSONAL_DOCUMENTS
protected static final String[] READER_PERMISSION
protected static final String[] MANAGER_PERMISSION
protected static final org.exoplatform.services.log.Log LOG
protected static final Random RANDOM
protected static final com.ibm.icu.text.Transliterator accentsConverter
protected final org.exoplatform.services.jcr.RepositoryService jcrService
protected final org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviders
protected final NodeFinder finder
protected final org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator hierarchyCreator
protected final org.exoplatform.services.organization.OrganizationService organization
protected final org.exoplatform.services.cms.drives.ManageDriveService driveService
protected final org.exoplatform.services.listener.ListenerService listenerService
protected final org.exoplatform.services.cms.documents.TrashService trashService
protected final org.exoplatform.services.resources.ResourceBundleService resourceBundleService
protected final org.exoplatform.services.cms.documents.DocumentService documentService
protected final org.owasp.html.PolicyFactory htmlPolicy
protected final org.owasp.html.PolicyFactory textPolicy
protected final org.owasp.html.PolicyFactory activityPolicy
protected final Pattern linkNotLocal
protected final Pattern linkWithTarget
protected final Pattern linkWithoutTarget
protected final ConcurrentHashMap<String,OutlookServiceImpl.OutlookSpaceImpl> spaces
protected MailAPI mailserverApi
protected String trashHomePath
public OutlookServiceImpl(org.exoplatform.services.jcr.RepositoryService jcrService,
org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviders,
org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator hierarchyCreator,
NodeFinder finder,
org.exoplatform.services.organization.OrganizationService organization,
org.exoplatform.services.listener.ListenerService listenerService,
org.exoplatform.services.cms.drives.ManageDriveService driveService,
org.exoplatform.services.cms.documents.TrashService trashService,
org.exoplatform.services.resources.ResourceBundleService resourceBundleService,
org.exoplatform.container.xml.InitParams params,
org.exoplatform.services.cms.documents.DocumentService documentService)
throws org.exoplatform.container.configuration.ConfigurationException,
MailServerException
jcrService - RepositoryServicesessionProviders - SessionProviderServicehierarchyCreator - NodeHierarchyCreatorfinder - NodeFinderorganization - OrganizationServicelistenerService - ListenerServicedriveService - ManageDriveServicetrashService - TrashServiceresourceBundleService - ResourceBundleServiceparams - InitParamsorg.exoplatform.container.configuration.ConfigurationException - when parameters configuration errorMailServerException - when Mail server API errorpublic List<File> saveAttachment(OutlookSpace space, Folder destFolder, OutlookUser user, String comment, String messageId, String attachmentToken, String... attachmentIds) throws OutlookException, javax.jcr.RepositoryException
saveAttachment in interface OutlookServicespace - the spacedestFolder - the folderuser - the usercomment - the commentmessageId - the message idattachmentToken - the attachment tokenattachmentIds - the attachment idsOutlookException - the outlook exceptionjavax.jcr.RepositoryException - the repository exceptionpublic List<File> saveAttachment(Folder destFolder, OutlookUser user, String comment, String messageId, String attachmentToken, String... attachmentIds) throws OutlookException, javax.jcr.RepositoryException
saveAttachment in interface OutlookServicedestFolder - the dest folderuser - the usercomment - the commentmessageId - the message idattachmentToken - the attachment tokenattachmentIds - the attachment idsOutlookException - the outlook exceptionjavax.jcr.RepositoryException - the repository exceptionpublic OutlookEmail getAddress(String email, String displayName) throws OutlookException
getAddress in interface OutlookServiceemail - emaildisplayName - user display nameOutlookException - when errorpublic OutlookUser getUser(String email, String displayName, String ewsUrl) throws OutlookException, javax.jcr.RepositoryException
getUser in interface OutlookServiceemail - the emaildisplayName - the user nameewsUrl - the Exchange server web-service URLOutlookUser object to access Outlook Mail APIOutlookException - Outlook exceptionjavax.jcr.RepositoryException - storage exceptionpublic OutlookMessage buildMessage(String id, OutlookUser user, OutlookEmail from, List<OutlookEmail> to, Calendar created, Calendar modified, String title, String subject, String body) throws OutlookException
buildMessage in interface OutlookServiceid - String email message IDuser - OutlookUserfrom - OutlookEmailto - OutlookEmailcreated - Calendarmodified - Calendartitle - the titlesubject - String message subjectbody - String message bodyOutlookMessageOutlookException - when errorpublic OutlookMessage getMessage(OutlookUser user, String messageId, String messageToken) throws OutlookException
getMessage in interface OutlookServiceuser - OutlookUsermessageId - String email message IDmessageToken - String secure token to access message on
Exchange serverOutlookMessageOutlookException - when errorpublic void start()
start in interface org.picocontainer.Startablepublic void stop()
stop in interface org.picocontainer.Startablepublic OutlookSpace getSpace(String groupId) throws OutlookSpaceException, javax.jcr.RepositoryException, OutlookException
getSpace in interface OutlookServicegroupId - String email message IDOutlookSpaceOutlookSpaceException - when space access error happenjavax.jcr.RepositoryException - when storage errorOutlookException - when errorpublic List<OutlookSpace> getUserSpaces() throws OutlookSpaceException
getUserSpaces in interface OutlookServiceOutlookSpaceException - the outlook space exceptionpublic UserDocuments getUserDocuments() throws javax.jcr.RepositoryException, OutlookException
getUserDocuments in interface OutlookServicejavax.jcr.RepositoryException - the repository exceptionOutlookException - the outlook exceptionprotected String nodeTitle(javax.jcr.Node node) throws javax.jcr.RepositoryException
node - the nodejavax.jcr.RepositoryException - the repository exceptionprotected javax.jcr.Node nodeContent(javax.jcr.Node node)
throws javax.jcr.RepositoryException
node - the nodejavax.jcr.RepositoryException - the repository exceptionprotected Calendar nodeCreated(javax.jcr.Node node) throws javax.jcr.RepositoryException
node - the nodejavax.jcr.RepositoryException - the repository exceptionprotected String mimeType(javax.jcr.Node content) throws javax.jcr.RepositoryException
content - the contentjavax.jcr.RepositoryException - the repository exceptionprotected javax.jcr.Property data(javax.jcr.Node content)
throws javax.jcr.RepositoryException
content - the contentjavax.jcr.RepositoryException - the repository exceptionprotected UUID generateId(String workspace, String path)
workspace - the workspacepath - the pathprotected org.exoplatform.services.organization.User getExoUser(String userName) throws OutlookException
userName - the user nameOutlookException - the outlook exceptionprotected javax.jcr.Node node(String nodePath) throws BadParameterException, javax.jcr.RepositoryException
nodePath - the node pathBadParameterException - the bad parameter exceptionjavax.jcr.RepositoryException - the repository exceptionprotected javax.jcr.Node node(String workspace, String path) throws BadParameterException, javax.jcr.RepositoryException
workspace - the workspacepath - the pathBadParameterException - the bad parameter exceptionjavax.jcr.RepositoryException - the repository exceptionprotected javax.jcr.Node systemNode(String workspace, String path) throws BadParameterException, javax.jcr.RepositoryException
workspace - the workspacepath - the pathBadParameterException - the bad parameter exceptionjavax.jcr.RepositoryException - the repository exceptionprotected boolean checkout(javax.jcr.Node node)
throws javax.jcr.RepositoryException
node - the nodejavax.jcr.RepositoryException - the repository exceptionprotected boolean isNull(org.exoplatform.ws.frameworks.json.value.JsonValue json)
json - the jsonprotected boolean isNotNull(org.exoplatform.ws.frameworks.json.value.JsonValue json)
json - the jsonprotected Locale currentUserLocale()
protected javax.jcr.Node addFile(javax.jcr.Node parent,
String title,
String contentType,
InputStream content)
throws javax.jcr.RepositoryException
parent - Nodetitle - StringcontentType - Stringcontent - InputStreamNodejavax.jcr.RepositoryException - when storage errorprotected javax.jcr.Node addFolder(javax.jcr.Node parent,
String title,
boolean forceNew)
throws javax.jcr.RepositoryException
forceNew is true a new name will be generated by
adding a numerical index to the end, otherwise existing node will be
returned.parent - Nodetitle - StringforceNew - if true then a new folder will be created with
index in suffix, if false then existing folder will
be returnedNodejavax.jcr.RepositoryException - when storage errorprotected String currentUserId()
protected org.exoplatform.social.core.space.spi.SpaceService spaceService()
protected org.exoplatform.social.core.manager.IdentityManager socialIdentityManager()
protected org.exoplatform.social.core.manager.ActivityManager socialActivityManager()
protected org.exoplatform.social.core.manager.RelationshipManager socialRelationshipManager()
protected List<OutlookSpace> userSpaces(String userId) throws OutlookSpaceException
userId - the user idOutlookSpaceException - the outlook space exceptionprotected boolean checkRootFolderExistence(org.exoplatform.social.core.space.model.Space socialSpace)
throws javax.jcr.RepositoryException,
BadParameterException
socialSpace - the social spacejavax.jcr.RepositoryExceptionBadParameterExceptionprotected String groupDocsPath(String groupId)
protected String userDocsPath(String userId)
protected String groupPath(String groupId) throws Exception
protected void initWebDAVLink(HierarchyNode node) throws OutlookException
node - the nodeOutlookException - the outlook exceptionprotected void initDocumentLink(org.exoplatform.portal.mop.SiteType siteType,
String driveName,
String portalName,
String nodeURI,
HierarchyNode node)
throws OutlookException
siteType - the site typedriveName - the drive nameportalName - the portal namenodeURI - the node URInode - the nodeOutlookException - the outlook exceptionprotected void initDocumentLink(OutlookSpace space, HierarchyNode file) throws OutlookException
space - the spacefile - the fileOutlookException - the outlook exceptionprotected void initDocumentLink(OutlookServiceImpl.PersonalDocuments personalDocuments, HierarchyNode file) throws OutlookException
personalDocuments - the personal documentsfile - the fileOutlookException - the outlook exceptionprotected javax.jcr.Node userDocumentsNode(String userName) throws Exception
protected javax.jcr.Node spaceDocumentsNode(String groupId) throws Exception
protected void setPermissions(javax.jcr.Node node,
String... identities)
throws AccessControlException,
javax.jcr.RepositoryException
exo:privilegeable it will add
such mixin to allow set the permissions first. Requested permissions will
not be set to the children nodes.node - Node link target nodeidentities - array of String with user identifiers (names or
memberships)AccessControlException - when access errorjavax.jcr.RepositoryException - when storage errorprotected void setPermissions(javax.jcr.Node node,
boolean deep,
boolean forcePrivilegeable,
String... identities)
throws AccessControlException,
javax.jcr.RepositoryException
exo:privilegeable and forcePrivilegeable is
false. If deep is true the target
children nodes will be checked also for a need to set the requested
permissions. node - Node link target nodedeep - Boolean if true then also children nodes
will be set to the requested permissionsforcePrivilegeable - Boolean if true and node not
yet exo:privilegeable it will add such mixin to allow
set the permissions.identities - array of String with user identifiers (names or
memberships)AccessControlException - when access errorjavax.jcr.RepositoryException - when storage errorprotected javax.jcr.Node messagesFolder(javax.jcr.Node parent,
String... identity)
throws javax.jcr.RepositoryException
parent - the parentidentity - the identityjavax.jcr.RepositoryException - the repository exceptionprotected javax.jcr.Node addMessageFile(javax.jcr.Node parent,
OutlookMessage message)
throws javax.jcr.RepositoryException,
UnsupportedEncodingException,
IOException
parent - the parentmessage - the messagejavax.jcr.RepositoryException - the repository exceptionUnsupportedEncodingException - the unsupported encoding exceptionIOException - Signals that an I/O exception has occurred.protected org.exoplatform.social.core.activity.model.ExoSocialActivity postAttachmentActivity(Folder destFolder, List<File> files, OutlookUser user, String comment) throws javax.jcr.RepositoryException
destFolder - the dest folderfiles - the filesuser - the usercomment - the commentjavax.jcr.RepositoryException - the repository exceptionprotected OutlookEmail readEmail(org.exoplatform.ws.frameworks.json.value.JsonValue vElem) throws OutlookException
vElem - the v elemOutlookException - the outlook exceptionprotected void fetchQuery(javax.jcr.query.QueryResult qr,
int limit,
Set<File> res)
throws javax.jcr.RepositoryException,
OutlookException
qr - the qrlimit - the limitres - the resjavax.jcr.RepositoryException - the repository exceptionOutlookException - the outlook exceptionprotected void fetchQuery(javax.jcr.query.QueryResult qr,
int limit,
Set<File> res,
Predicate<javax.jcr.Node> acceptNode)
throws javax.jcr.RepositoryException,
OutlookException
qr - the qrlimit - the limitres - the resacceptNode - the accept nodejavax.jcr.RepositoryException - the repository exceptionOutlookException - the outlook exceptionprotected String messageSummary(OutlookMessage message)
protected boolean isHTML(String content)
content - Stringprotected String safeActivityMessage(String text)
protected String makeLinksOpenNewWindow(String text)
text - the textCopyright © 2003–2020 eXo Platform SAS. All rights reserved.