org.sakaiproject.component.app.syllabus
Class SyllabusServiceImpl

java.lang.Object
  extended byorg.sakaiproject.component.app.syllabus.SyllabusServiceImpl
All Implemented Interfaces:
EntityProducer, SyllabusService

public class SyllabusServiceImpl
extends Object
implements SyllabusService

Author:
rshastri TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates

Nested Class Summary
 class SyllabusServiceImpl.BaseResourceEdit
           
 
Nested classes inherited from class org.sakaiproject.service.legacy.entity.EntityProducer
EntityProducer.ChangeType
 
Field Summary
protected  String m_relativeAccessPoint
           
protected  NotificationService notificationService
           
 
Fields inherited from interface org.sakaiproject.api.app.syllabus.SyllabusService
EVENT_SYLLABUS_DELETE_POST, EVENT_SYLLABUS_POST_CHANGE, EVENT_SYLLABUS_POST_NEW, REFERENCE_ROOT, SERVICE_NAME, SYLLABUS_SERVICE_NAME
 
Constructor Summary
SyllabusServiceImpl()
           
 
Method Summary
protected  void addLiveSyllabusProperties(SyllabusServiceImpl.BaseResourceEdit r)
           
 String archive(String siteId, Document doc, Stack stack, String arg3, List attachments)
          Archive the resources for the given site.
 void deletePostedSyllabus(SyllabusData data)
           
 void destroy()
           
protected  String getAccessPoint(boolean relative)
           
 Entity getEntity(Reference ref)
          Access the referenced Entity - the entity will belong to the service.
 Collection getEntityAuthzGroups(Reference ref)
          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.
 HttpAccess getHttpAccess()
          Get the HttpAccess object that supports entity access via the access servlet for my entities.
 String getLabel()
           
 List getMessages(String id)
           
 void importEntities(String fromSiteId, String toSiteId, List resourceIds)
          import Entites from the source context into the destination context
 void init()
           
 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.
 boolean parseEntityReference(String reference, Reference ref)
          If the service recognizes the reference as its own, parse it and fill in the Reference
 void postChangeSyllabus(SyllabusData data)
           
 void postNewSyllabus(SyllabusData data)
           
 void setLogger(Logger logger)
          Establish logger component dependency.
 void setNotificationService(NotificationService notificationService)
           
 void setSyllabusManager(SyllabusManager syllabusManager)
          Dependency: a SyllabusManager component.
protected  String[] split(String source, String splitter)
          from StringUtil.java
 void syncWithSiteChange(Site site, EntityProducer.ChangeType change)
          Synchronize any entities related to the Site given this change in the Site, possibly a structural change where a tool is added or removed, or the site is new, or being deleted.
 String trimToNull(String value)
           
 boolean willArchiveMerge()
          
 boolean willImport()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

notificationService

protected NotificationService notificationService

m_relativeAccessPoint

protected String m_relativeAccessPoint
Constructor Detail

SyllabusServiceImpl

public SyllabusServiceImpl()
Method Detail

init

public void init()

destroy

public void destroy()

setLogger

public void setLogger(Logger logger)
Establish logger component dependency.

Parameters:
logger - the logger component.

setSyllabusManager

public void setSyllabusManager(SyllabusManager syllabusManager)
Dependency: a SyllabusManager component.


getLabel

public String getLabel()
Specified by:
getLabel in interface EntityProducer
Returns:
a short string identifying the resources kept here, good for a file name or label.

willArchiveMerge

public boolean willArchiveMerge()

Specified by:
willArchiveMerge in interface EntityProducer
Returns:
true if the serice wants to be part of archive / merge, false if not.

willImport

public boolean willImport()

Specified by:
willImport in interface EntityProducer
Returns:
true if the serice wants to be part of import, false if not.

getHttpAccess

public HttpAccess getHttpAccess()
Get the HttpAccess object that supports entity access via the access servlet for my entities.

Specified by:
getHttpAccess in interface EntityProducer
Returns:
The HttpAccess object for my entities, or null if I do not support access.

split

protected String[] split(String source,
                         String splitter)
from StringUtil.java


parseEntityReference

public boolean parseEntityReference(String reference,
                                    Reference ref)
If the service recognizes the reference as its own, parse it and fill in the Reference

Specified by:
parseEntityReference in interface EntityProducer
Parameters:
reference - The reference string to examine.
ref - The Reference object to set with the results of the parse from a recognized reference.
Returns:
true if the reference belonged to the service, false if not.

getEntityDescription

public String getEntityDescription(Reference ref)
Create an entity description for the entity referenced - the entity will belong to the service.

Specified by:
getEntityDescription in interface EntityProducer
Parameters:
ref - The entity reference.
Returns:
The entity description, or null if one cannot be made.

getEntityResourceProperties

public ResourceProperties getEntityResourceProperties(Reference ref)
Access the resource properties for the referenced entity - the entity will belong to the service.

Specified by:
getEntityResourceProperties in interface EntityProducer
Parameters:
ref - The entity reference.
Returns:
The ResourceProperties object for the entity, or null if it has none.

getEntity

public Entity getEntity(Reference ref)
Access the referenced Entity - the entity will belong to the service.

Specified by:
getEntity in interface EntityProducer
Parameters:
ref - The entity reference.
Returns:
The Entity, or null if not found.

getEntityAuthzGroups

public Collection getEntityAuthzGroups(Reference ref)
Access a collection of authorization group ids for security on the for the referenced entity - the entity will belong to the service.

Specified by:
getEntityAuthzGroups in interface EntityProducer
Parameters:
ref - The entity reference.
Returns:
The entity's collection of authorization group ids, or null if this cannot be done.

getEntityUrl

public String getEntityUrl(Reference ref)
Access a URL for the referenced entity - the entity will belong to the service.

Specified by:
getEntityUrl in interface EntityProducer
Parameters:
ref - The entity reference.
Returns:
The entity's URL, or null if it does not have one.

syncWithSiteChange

public void syncWithSiteChange(Site site,
                               EntityProducer.ChangeType change)
Synchronize any entities related to the Site given this change in the Site, possibly a structural change where a tool is added or removed, or the site is new, or being deleted.

Specified by:
syncWithSiteChange in interface EntityProducer
Parameters:
site - The site that has just changed.
change - The ChangeType for the site (newly added, updated, or just removed).

archive

public String archive(String siteId,
                      Document doc,
                      Stack stack,
                      String arg3,
                      List attachments)
Description copied from interface: EntityProducer
Archive the resources for the given site.

Specified by:
archive in interface EntityProducer
Parameters:
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.
arg3 - The path to the folder where we are writing auxilary files.
attachments - A list of attachments - add to this if any attachments need to be included in the archive.
Returns:
A log of status messages from the archive.

merge

public String merge(String siteId,
                    Element root,
                    String archivePath,
                    String fromSiteId,
                    Map attachmentNames,
                    Map userIdTrans,
                    Set userListAllowImport)
Description copied from interface: EntityProducer
Merge the resources from the archive into the given site.

Specified by:
merge in interface EntityProducer
Parameters:
siteId - The id of the site getting imported into.
root - The XML DOM tree of content to merge.
attachmentNames - A map of old attachment name (as found in the DOM) to new attachment name.
Returns:
A log of status messages from the merge.

importEntities

public void importEntities(String fromSiteId,
                           String toSiteId,
                           List resourceIds)
Description copied from interface: EntityProducer
import Entites from the source context into the destination context

Specified by:
importEntities in interface EntityProducer
Parameters:
fromSiteId - The source context
toSiteId - The destination context
resourceIds - when null, all entities will be imported; otherwise, only entities with those ids will be imported

setNotificationService

public void setNotificationService(NotificationService notificationService)

getAccessPoint

protected String getAccessPoint(boolean relative)

postNewSyllabus

public void postNewSyllabus(SyllabusData data)
Specified by:
postNewSyllabus in interface SyllabusService

addLiveSyllabusProperties

protected void addLiveSyllabusProperties(SyllabusServiceImpl.BaseResourceEdit r)

postChangeSyllabus

public void postChangeSyllabus(SyllabusData data)
Specified by:
postChangeSyllabus in interface SyllabusService

deletePostedSyllabus

public void deletePostedSyllabus(SyllabusData data)
Specified by:
deletePostedSyllabus in interface SyllabusService

trimToNull

public String trimToNull(String value)

getMessages

public List getMessages(String id)
Specified by:
getMessages in interface SyllabusService