public abstract class BaseMessage extends Object implements MessageService, DoubleStorageUser
Modifier and Type | Class and Description |
---|---|
class |
BaseMessage.BaseMessageChannelEdit<T extends MessageEdit>
MessageChannel implementation
|
class |
BaseMessage.BaseMessageEdit
MessageEdit implementation
|
class |
BaseMessage.BaseMessageHeaderEdit
MessageHeaderEdit implementation
|
protected class |
BaseMessage.MessagePermissionFilter
filter
|
protected class |
BaseMessage.MessageSelectionFilter |
protected class |
BaseMessage.NotifyThread
Class that starts a session to import XML data.
|
protected class |
BaseMessage.PublicFilter
A filter that will reject messages which are draft or not public
|
protected static interface |
BaseMessage.Storage
Storage implementation
|
Modifier and Type | Field and Description |
---|---|
protected AuthzGroupService |
m_authzGroupService
Dependency: AuthzGroupService.
|
protected EntityManager |
m_entityManager
Dependency: EntityManager.
|
protected EventTrackingService |
m_eventTrackingService
Dependency: EventTrackingService.
|
protected IdManager |
m_idManager
Dependency: IdManager.
|
protected MemoryService |
m_memoryService
Dependency: MemoryService.
|
protected SecurityService |
m_securityService
Dependency: SecurityService.
|
protected ServerConfigurationService |
m_serverConfigurationService
Dependency: ServerConfigurationService.
|
protected SessionManager |
m_sessionManager
Dependency: SessionManager.
|
protected SiteService |
m_siteService
Dependency: SiteService.
|
protected BaseMessage.Storage |
m_storage
A Storage object for persistent storage.
|
protected ThreadLocalManager |
m_threadLocalManager
Dependency: ThreadLocalManager.
|
protected TimeService |
m_timeService
Dependency: TimeService.
|
protected UserDirectoryService |
m_userDirectoryService
Dependency: UserDirectoryService.
|
REF_TYPE_CHANNEL, REF_TYPE_MESSAGE, SECURE_ADD, SECURE_ALL_GROUPS, SECURE_CREATE, SECURE_READ, SECURE_READ_DRAFT, SECURE_REMOVE_ANY, SECURE_REMOVE_OWN, SECURE_UPDATE_ANY, SECURE_UPDATE_OWN
Constructor and Description |
---|
BaseMessage() |
Modifier and Type | Method and Description |
---|---|
MessageChannelEdit |
addChannel(String ref)
Add a new channel.
|
boolean |
allowAddChannel(String ref)
check permissions for addChannel().
|
boolean |
allowEditChannel(String ref)
check permissions for editChannel()
|
boolean |
allowGetChannel(String ref)
check permissions for getChannel().
|
protected boolean |
allowGetMessage(String channelRef,
String msgRef)
Check the message read permission for the message
|
protected boolean |
allowGetMessage(String channelRef,
String msgRef,
boolean isDraft)
Check the message read permission for the message
|
boolean |
allowRemoveChannel(String ref)
Check permissions for removeChannel().
|
String |
archive(String siteId,
Document doc,
Stack stack,
String archivePath,
List attachments)
Archive the resources for the given site.
|
void |
archiveSynopticOptions(String siteId,
Document doc,
Element element)
try to add synoptic options for this tool to the archive, if they exist
|
void |
cancelChannel(MessageChannelEdit edit)
Cancel the changes made to a MessageChannelEdit object, and release the lock.
|
void |
cancelMessage(MessageEdit edit)
Cancel the changes made to a MessageEdit object, and release the lock.
|
protected boolean |
canSeeAllGroups(String userId,
Site site) |
String |
channelReference(String context,
String id)
Access the internal reference which can be used to access the channel from within the system.
|
void |
commitChannel(MessageChannelEdit edit)
Commit the changes made to a MessageChannelEdit object, and release the lock.
|
void |
destroy()
Destroy
|
protected void |
disableMessageChannel(String siteId)
Remove the main message channel for a site.
|
MessageChannelEdit |
editChannel(String ref)
Return a specific channel, as specified by channel id, locked for update.
|
protected void |
enableMessageChannel(String siteId)
Setup a main message channel for a site.
|
protected abstract String |
eventId(String secure)
Form a tracking event string based on a security function string.
|
List<Message> |
filterGroupAccess(List<Message> msgs,
String context,
String reference)
Filter messages based on group access
|
protected MessageChannel |
findChannel(String ref)
Find the channel, in cache or info store - cache it if newly found.
|
protected String |
getAccessPoint(boolean relative)
Access the partial URL that forms the root of resource URLs.
|
MessageChannel |
getChannel(String ref)
Return a specific channel.
|
List<String> |
getChannelIds(String context)
Access a list of channel ids that are defined related to the context.
|
MessageChannel |
getChannelPublic(String ref)
Return a specific channel
Warning: No check is made on channel permissions -- caller should filter for public messages
|
List<MessageChannel> |
getChannels()
Deprecated.
since 8 April 2014 (Sakai 10), this is not useful and would perform very badly
|
Entity |
getEntity(Reference ref)
Access the referenced Entity - the entity will belong to the service.
|
Collection<String> |
getEntityAuthzGroups(Reference ref,
String userId)
Access a collection of authorization group ids for security on the for the referenced entity - the entity will belong to the service.
|
String |
getEntityDescription(Reference ref)
Create an entity description for the entity referenced - the entity will belong to the service.
|
ResourceProperties |
getEntityResourceProperties(Reference ref)
Access the resource properties for the referenced entity - the entity will belong to the service.
|
String |
getEntityUrl(Reference ref)
Access a URL for the referenced entity - the entity will belong to the service.
|
protected Collection<Group> |
getGroupsAllowFunction(String function,
String m_context,
String reference)
Get the groups of this channel's contex-site that the end user has permission to "function" in.
|
HttpAccess |
getHttpAccess()
Get the HttpAccess object that supports entity access via the access servlet for my entities.
|
Message |
getMessage(Reference ref)
Get a message, given a reference.
|
List<Message> |
getMessages(String channelRef,
Time afterDate,
int limitedToLatest,
boolean ascending,
boolean includeDrafts,
boolean pubViewOnly)
Access a list of messages in the channel, that are after the date, limited to just the n latest messages, ordered as specified, including drafts if specified.
|
protected abstract String |
getReferenceRoot()
Return the reference rooot for use in resource references and urls.
|
String |
getSummarizableReference(String siteId,
String toolIdentifier)
Get a summerizable reference for the siteId and toolIdentifier
|
Map |
getSummary(String channel,
int items,
int days)
getSummary implementation
|
protected String |
getSummaryFromHeader(Message item,
MessageHeader header) |
void |
init()
Final initialization, once all dependencies are set.
|
protected boolean |
isIntersectionGroupRefsToGroups(Collection groupRefs,
Collection groups)
See if the collection of group reference strings has at least one group that is in the collection of Group objects.
|
String |
merge(String siteId,
Element root,
String archivePath,
String fromSiteId,
Map attachmentNames,
Map userIdTrans,
Set userListAllowImport)
Merge the resources from the archive into the given site.
|
String |
messageReference(String channelRef,
String id)
Access the internal reference which can be used to access the message from within the system.
|
String |
messageReference(String context,
String channelId,
String id)
Access the internal reference which can be used to access the message from within the system.
|
protected abstract MessageHeaderEdit |
newMessageHeader(Message msg,
Element el)
Construct a new message header from XML in a DOM element.
|
protected abstract MessageHeaderEdit |
newMessageHeader(Message msg,
MessageHeader other)
Construct a new message header as a copy of another.
|
protected abstract MessageHeaderEdit |
newMessageHeader(Message msg,
String id)
Construct a new message header from XML in a DOM element.
|
protected abstract BaseMessage.Storage |
newStorage()
Construct a Storage object.
|
protected void |
parseMergeChannelExtra(Element element3,
String channelRef)
Handle the extra "categtories" stuff in the channel part of the merge xml.
|
void |
removeChannel(MessageChannelEdit channel)
Remove a channel.
|
protected BaseMessage |
service()
Access this service from the inner classes.
|
protected abstract String |
serviceName()
Report the Service API name being implemented.
|
void |
setAuthzGroupService(AuthzGroupService service)
Dependency: AuthzGroupService.
|
void |
setCaching(String value)
Deprecated.
7 April 2014 - this should be removed in sakai 11
|
void |
setEntityManager(EntityManager service)
Dependency: EntityManager.
|
void |
setEventTrackingService(EventTrackingService service)
Dependency: EventTrackingService.
|
void |
setIdManager(IdManager service)
Dependency: IdManager.
|
void |
setMemoryService(MemoryService service)
Dependency: MemoryService.
|
void |
setSecurityService(SecurityService service)
Dependency: SecurityService.
|
void |
setServerConfigurationService(ServerConfigurationService service)
Dependency: ServerConfigurationService.
|
void |
setSessionManager(SessionManager service)
Dependency: SessionManager.
|
void |
setSiteService(SiteService service)
Dependency: SiteService.
|
void |
setThreadLocalManager(ThreadLocalManager service)
Dependency: ThreadLocalManager.
|
void |
setTimeService(TimeService service)
Dependency: TimeService.
|
void |
setUserDirectoryService(UserDirectoryService service)
Dependency: UserDirectoryService.
|
void |
transferSynopticOptions(String fromContext,
String toContext)
Import the synoptic tool options from another site
|
protected void |
unlock(String lock,
String resource)
Check security permission.
|
protected void |
unlock2(String lock1,
String lock2,
String resource)
Check security permission.
|
protected void |
unlock3(String lock1,
String lock2,
String lock3,
String resource)
Check security permission.
|
protected boolean |
unlockCheck(String lock,
String resource)
Check security permission.
|
protected boolean |
unlockCheck2(String lock1,
String lock2,
String resource)
Check security permission, for either of two locks/
|
protected boolean |
unlockCheck3(String lock1,
String lock2,
String lock3,
String resource)
Check security permission, for any of three locks/
|
boolean |
willArchiveMerge() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLabel, parseEntityReference
summarizableToolIds
getDate, getOwnerId, isDraft, newContainer, newContainer, newContainer, newContainerEdit, newContainerEdit, newContainerEdit
newResource, newResource, newResource, newResourceEdit, newResourceEdit, newResourceEdit, storageFields
protected BaseMessage.Storage m_storage
protected MemoryService m_memoryService
protected ServerConfigurationService m_serverConfigurationService
protected SessionManager m_sessionManager
protected AuthzGroupService m_authzGroupService
protected SecurityService m_securityService
protected TimeService m_timeService
protected EventTrackingService m_eventTrackingService
protected IdManager m_idManager
protected SiteService m_siteService
protected UserDirectoryService m_userDirectoryService
protected ThreadLocalManager m_threadLocalManager
protected EntityManager m_entityManager
protected BaseMessage service()
public void setMemoryService(MemoryService service)
service
- The MemoryService.public void setServerConfigurationService(ServerConfigurationService service)
service
- The ServerConfigurationService.public void setSessionManager(SessionManager service)
service
- The SessionManager.public void setAuthzGroupService(AuthzGroupService service)
service
- The AuthzGroupService.public void setSecurityService(SecurityService service)
service
- The SecurityService.public void setTimeService(TimeService service)
service
- The TimeService.public void setEventTrackingService(EventTrackingService service)
service
- The EventTrackingService.public void setIdManager(IdManager service)
service
- The IdManager.public void setSiteService(SiteService service)
service
- The SiteService.public void setUserDirectoryService(UserDirectoryService service)
service
- The UserDirectoryService.public void setThreadLocalManager(ThreadLocalManager service)
service
- The ThreadLocalManager.public void setCaching(String value)
path
- The storage path.public void setEntityManager(EntityManager service)
service
- The EntityManager.public void init()
public void destroy()
protected abstract String serviceName()
protected abstract BaseMessage.Storage newStorage()
protected abstract MessageHeaderEdit newMessageHeader(Message msg, String id)
msg
- The message to own this header.id
- The message Id.protected abstract MessageHeaderEdit newMessageHeader(Message msg, Element el)
msg
- The message to own this header.el
- The XML DOM element that has the header information.protected abstract MessageHeaderEdit newMessageHeader(Message msg, MessageHeader other)
msg
- The message to own this header.other
- The other header to copy.protected abstract String eventId(String secure)
secure
- The security function string.protected abstract String getReferenceRoot()
protected String getAccessPoint(boolean relative)
relative
- if true, form within the access path only (i.e. starting with /msg)public String channelReference(String context, String id)
channelReference
in interface MessageService
context
- The context.id
- The channel id.public String messageReference(String context, String channelId, String id)
messageReference
in interface MessageService
context
- The context.channelId
- The channel id.id
- The message id.public String messageReference(String channelRef, String id)
messageReference
in interface MessageService
channelRef
- The channel reference.id
- The message id.protected boolean unlockCheck(String lock, String resource)
lock
- The lock id string.resource
- The resource reference string, or null if no resource is involved.protected boolean unlockCheck2(String lock1, String lock2, String resource)
lock1
- The lock id string.lock2
- The lock id string.resource
- The resource reference string, or null if no resource is involved.protected boolean unlockCheck3(String lock1, String lock2, String lock3, String resource)
lock1
- The lock id string.lock2
- The lock id string.resource
- The resource reference string, or null if no resource is involved.protected void unlock(String lock, String resource) throws PermissionException
lock
- The lock id string.resource
- The resource reference string, or null if no resource is involved.PermissionException
- Thrown if the user does not have accessprotected void unlock2(String lock1, String lock2, String resource) throws PermissionException
lock1
- The lock id string.lock2
- The lock id string.resource
- The resource reference string, or null if no resource is involved.PermissionException
- Thrown if the user does not have access to either.protected void unlock3(String lock1, String lock2, String lock3, String resource) throws PermissionException
lock1
- The lock id string.lock2
- The lock id string.lock3
- The lock id string.resource
- The resource reference string, or null if no resource is involved.PermissionException
- Thrown if the user does not have access to either.public List<MessageChannel> getChannels()
getChannels
in interface MessageService
public boolean allowGetChannel(String ref)
allowGetChannel
in interface MessageService
ref
- The channel reference.public MessageChannel getChannel(String ref) throws IdUnusedException, PermissionException
getChannel
in interface MessageService
ref
- The channel reference.IdUnusedException
- If this name is not defined for any channel.PermissionException
- If the user does not have any permissions to the channel.public MessageChannel getChannelPublic(String ref)
getChannelPublic
in interface MessageService
ref
- The channel reference.protected MessageChannel findChannel(String ref)
ref
- The channel reference.public boolean allowAddChannel(String ref)
allowAddChannel
in interface MessageService
ref
- The channel reference.public MessageChannelEdit addChannel(String ref) throws IdUsedException, IdInvalidException, PermissionException
addChannel
in interface MessageService
ref
- The channel reference.IdUsedException
- if the id is not unique.IdInvalidException
- if the id is not made up of valid characters.PermissionException
- if the user does not have permission to add a channel.public boolean allowEditChannel(String ref)
allowEditChannel
in interface MessageService
ref
- The channel reference.public MessageChannelEdit editChannel(String ref) throws IdUnusedException, PermissionException, InUseException
editChannel
in interface MessageService
ref
- The channel reference.IdUnusedException
- If this name is not a defined channel.PermissionException
- If the user does not have any permissions to edit the channel.InUseException
- if the channel is locked for edit by someone else.public void commitChannel(MessageChannelEdit edit)
commitChannel
in interface MessageService
user
- The MessageChannelEdit object to commit.public void cancelChannel(MessageChannelEdit edit)
cancelChannel
in interface MessageService
user
- The MessageChannelEdit object to commit.public boolean allowRemoveChannel(String ref)
allowRemoveChannel
in interface MessageService
ref
- The channel reference.public void removeChannel(MessageChannelEdit channel) throws PermissionException
removeChannel
in interface MessageService
channel
- The channel to remove.PermissionException
- if the user does not have permission to remove a channel.public Message getMessage(Reference ref) throws IdUnusedException, PermissionException
getMessage
in interface MessageService
ref
- The message referenceIdUnusedException
- If this reference does not identify a message.PermissionException
- If the user does not have any permissions to the message.protected boolean allowGetMessage(String channelRef, String msgRef)
ref
- The Reference (assumed to be to a message).protected boolean allowGetMessage(String channelRef, String msgRef, boolean isDraft)
ref
- The Reference (assumed to be to a message).
isDraft
Whether or not the message is in draftpublic void cancelMessage(MessageEdit edit)
cancelMessage
in interface MessageService
user
- The MessageEdit object to cancel.public List<Message> getMessages(String channelRef, Time afterDate, int limitedToLatest, boolean ascending, boolean includeDrafts, boolean pubViewOnly) throws PermissionException
getMessages
in interface MessageService
afterDate
- if null, no date limit, else limited to only messages after this date.limitedToLatest
- if 0, no count limit, else limited to only the latest this number of messages.ascending
- if true, sort oldest first, else sort latest first.includeDrafts
- if true, include drafts (if the user has draft permission), else leave them out.pubViewOnly
- if true, include only messages marked pubview, else include any.PermissionException
- If the current user does not have channel read permission.public List<Message> filterGroupAccess(List<Message> msgs, String context, String reference)
msgs
- Messages to filtercontext
- The context for this channelreference
- The internal reference for this channelprotected boolean isIntersectionGroupRefsToGroups(Collection groupRefs, Collection groups)
groupRefs
- The collection (String) of group references.groups
- The collection (Group) of group objects.protected Collection<Group> getGroupsAllowFunction(String function, String m_context, String reference)
function
- The function to checkpublic List<String> getChannelIds(String context)
getChannelIds
in interface MessageService
context
- The context in which to searchpublic boolean willArchiveMerge()
willArchiveMerge
in interface EntityProducer
public HttpAccess getHttpAccess()
getHttpAccess
in interface EntityProducer
public String getEntityDescription(Reference ref)
getEntityDescription
in interface EntityProducer
ref
- The entity reference.public ResourceProperties getEntityResourceProperties(Reference ref)
getEntityResourceProperties
in interface EntityProducer
ref
- The entity reference.public Entity getEntity(Reference ref)
getEntity
in interface EntityProducer
ref
- The entity reference.public Collection<String> getEntityAuthzGroups(Reference ref, String userId)
getEntityAuthzGroups
in interface EntityProducer
ref
- The entity reference.userId
- The userId for a user-specific set of groups, or null for the generic set.public String getEntityUrl(Reference ref)
getEntityUrl
in interface EntityProducer
ref
- The entity reference.public String archive(String siteId, Document doc, Stack stack, String archivePath, List attachments)
archive
in interface EntityProducer
siteId
- the id of the site.doc
- The document to contain the xml.stack
- The stack of elements, the top of which will be the containing element of the "service.name" element.archivePath
- The path to the folder where we are writing auxilary files.attachments
- This should be an empty List into which the implementation will put any attachments that are needed to support the
archived content. Implementation will may use List.contains(Object)
so choice of implementation should reflect this.public void archiveSynopticOptions(String siteId, Document doc, Element element)
siteId
- doc
- element
- public String merge(String siteId, Element root, String archivePath, String fromSiteId, Map attachmentNames, Map userIdTrans, Set userListAllowImport)
merge
in interface EntityProducer
siteId
- The id of the site getting imported into.root
- The XML DOM tree of content to merge.archivePath
- The path to the folder where we are reading auxilary files.fromSiteId
- The site id from which these items were archived.attachmentNames
- An empty map should be supplied and during the merge and any attachments that are renamed will be put into this map the key is the old
attachment name (as found in the DOM) and the value is the new attachment name.userIdTrans
- A map supplied by the called containing keys of old user IDs and values of new user IDs that the content should be attributed to.userListAllowImport
- A list of user IDs for which the content should be imported. An importer should ignore content if the user ID of the creator isn't in this
set.public void transferSynopticOptions(String fromContext, String toContext)
fromContext
- toContext
- protected void parseMergeChannelExtra(Element element3, String channelRef)
element
- The "channel" node child.channelRef
- The message channel ref.protected void enableMessageChannel(String siteId)
siteId
- The site id.protected void disableMessageChannel(String siteId)
site
- The site.protected String getSummaryFromHeader(Message item, MessageHeader header)
public Map getSummary(String channel, int items, int days) throws IdUsedException, IdInvalidException, PermissionException
getSummary
in interface EntitySummary
getSummary
in interface MessageService
channel
- The channel reference.items
- Maximum number of items to returndays
- Maximum number of days to peer backIdUsedException
- if the id is not unique.IdInvalidException
- if the id is not made up of valid characters.PermissionException
- if the user does not have permission to add a channel.public String getSummarizableReference(String siteId, String toolIdentifier)
EntitySummary
getSummarizableReference
in interface EntitySummary
siteId
- The site ID to get the summary for.toolIdentifier
- The tool ID, eg "sakai.announcement".EntitySummary.getSummary(String, int, int)
.Copyright © 2003–2019 The Sakai Foundation. All rights reserved.