org.sakaiproject.archive.impl
Class SiteMerger

java.lang.Object
  extended by org.sakaiproject.archive.impl.SiteMerger

public class SiteMerger
extends Object


Field Summary
protected  org.sakaiproject.authz.api.AuthzGroupService m_authzGroupService
           
protected  org.sakaiproject.authz.api.SecurityService m_securityService
           
protected  org.sakaiproject.site.api.SiteService m_siteService
           
protected  org.sakaiproject.user.api.UserDirectoryService m_userDirectoryService
           
protected static HashMap userIdTrans
           
protected  HashSet<String> usersListAllowImport
           
 
Constructor Summary
SiteMerger()
           
 
Method Summary
protected  boolean checkSakaiService(boolean m_filterSakaiServices, String[] m_filteredSakaiServices, String serviceName)
           
protected  boolean checkSystemRole(String system, String roleId, boolean filterSakaiRoles, String[] filteredSakaiRoles)
          When Sakai is importing a role in site.xml, check if it is a qualified role.
 String merge(String fileName, String siteId, String creatorId, String m_storagePath, boolean filterSakaiServices, String[] filteredSakaiServices, boolean filterSakaiRoles, String[] filteredSakaiRoles)
          Process a merge for the file, or if it's a directory, for all contained files (one level deep).
protected  void mergeSite(String siteId, String fromSiteId, Element element, HashMap useIdTrans, String creatorId, boolean filterSakaiRoles, String[] filteredSakaiRoles)
          Merge the site definition from the site part of the archive file into the site service.
protected  void mergeSiteInfo(Element el, String siteId)
          Merge the site info like description from the site part of the archive file into the site service.
protected  void mergeSiteRoles(Element el, String siteId, HashMap useIdTrans, boolean filterSakaiRoles, String[] filteredSakaiRoles)
          Merge the the permission-roles settings into the site
protected  void processMerge(String fileName, String siteId, StringBuilder results, Map attachmentNames, String creatorId, boolean filterSakaiService, String[] filteredSakaiService, boolean filterSakaiRoles, String[] filteredSakaiRoles)
          Read in an archive file and merge the entries into the specified site.
 void setAuthzGroupService(org.sakaiproject.authz.api.AuthzGroupService service)
           
 void setSecurityService(org.sakaiproject.authz.api.SecurityService service)
           
 void setSiteService(org.sakaiproject.site.api.SiteService service)
           
 void setUserDirectoryService(org.sakaiproject.user.api.UserDirectoryService service)
           
protected  String translateServiceName(String name)
          Old archives have the old CHEF 1.2 service names...
protected  void unlock(String lock, String reference)
          Check security permission.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

userIdTrans

protected static HashMap userIdTrans

m_authzGroupService

protected org.sakaiproject.authz.api.AuthzGroupService m_authzGroupService

m_userDirectoryService

protected org.sakaiproject.user.api.UserDirectoryService m_userDirectoryService

m_siteService

protected org.sakaiproject.site.api.SiteService m_siteService

m_securityService

protected org.sakaiproject.authz.api.SecurityService m_securityService

usersListAllowImport

protected HashSet<String> usersListAllowImport
Constructor Detail

SiteMerger

public SiteMerger()
Method Detail

setAuthzGroupService

public void setAuthzGroupService(org.sakaiproject.authz.api.AuthzGroupService service)

setUserDirectoryService

public void setUserDirectoryService(org.sakaiproject.user.api.UserDirectoryService service)

setSiteService

public void setSiteService(org.sakaiproject.site.api.SiteService service)

setSecurityService

public void setSecurityService(org.sakaiproject.authz.api.SecurityService service)

merge

public String merge(String fileName,
                    String siteId,
                    String creatorId,
                    String m_storagePath,
                    boolean filterSakaiServices,
                    String[] filteredSakaiServices,
                    boolean filterSakaiRoles,
                    String[] filteredSakaiRoles)
Process a merge for the file, or if it's a directory, for all contained files (one level deep).

Parameters:
fileName - The site name (for the archive file) to read from.
mergeId - The id string to use to make ids in the merge consistent and unique.
creatorId - The creator id If null or blank, the date/time string of the merge is used.

processMerge

protected void processMerge(String fileName,
                            String siteId,
                            StringBuilder results,
                            Map attachmentNames,
                            String creatorId,
                            boolean filterSakaiService,
                            String[] filteredSakaiService,
                            boolean filterSakaiRoles,
                            String[] filteredSakaiRoles)
Read in an archive file and merge the entries into the specified site.

Parameters:
fileName - The site name (for the archive file) to read from.
siteId - The id of the site to merge the content into.
results - A buffer to accumulate result messages.
attachmentNames - A map of old to new attachment names.
useIdTrans - A map of old WorkTools id to new Ctools id
creatorId - The creator id

mergeSite

protected void mergeSite(String siteId,
                         String fromSiteId,
                         Element element,
                         HashMap useIdTrans,
                         String creatorId,
                         boolean filterSakaiRoles,
                         String[] filteredSakaiRoles)
Merge the site definition from the site part of the archive file into the site service. Translate the id to the siteId.

Parameters:
siteId - The id of the site getting imported into.
fromSiteId - The id of the site the archive was made from.
element - The XML DOM tree of messages to merge.
creatorId - The creator id

mergeSiteInfo

protected void mergeSiteInfo(Element el,
                             String siteId)
                      throws org.sakaiproject.exception.IdInvalidException,
                             org.sakaiproject.exception.IdUsedException,
                             org.sakaiproject.exception.PermissionException,
                             org.sakaiproject.exception.IdUnusedException,
                             org.sakaiproject.exception.InUseException
Merge the site info like description from the site part of the archive file into the site service.

Parameters:
element - The XML DOM tree of messages to merge.
siteId - The id of the site getting imported into.
Throws:
org.sakaiproject.exception.IdInvalidException
org.sakaiproject.exception.IdUsedException
org.sakaiproject.exception.PermissionException
org.sakaiproject.exception.IdUnusedException
org.sakaiproject.exception.InUseException

mergeSiteRoles

protected void mergeSiteRoles(Element el,
                              String siteId,
                              HashMap useIdTrans,
                              boolean filterSakaiRoles,
                              String[] filteredSakaiRoles)
                       throws org.sakaiproject.exception.PermissionException
Merge the the permission-roles settings into the site

Parameters:
element - The XML DOM tree of messages to merge.
siteId - The id of the site getting imported into.
Throws:
org.sakaiproject.exception.PermissionException

translateServiceName

protected String translateServiceName(String name)
Old archives have the old CHEF 1.2 service names...


checkSakaiService

protected boolean checkSakaiService(boolean m_filterSakaiServices,
                                    String[] m_filteredSakaiServices,
                                    String serviceName)

unlock

protected void unlock(String lock,
                      String reference)
               throws org.sakaiproject.exception.PermissionException
Check security permission.

Parameters:
lock - The lock id string.
reference - The resource's reference string, or null if no resource is involved.
Throws:
org.sakaiproject.exception.PermissionException - thrown if the user does not have access

checkSystemRole

protected boolean checkSystemRole(String system,
                                  String roleId,
                                  boolean filterSakaiRoles,
                                  String[] filteredSakaiRoles)
When Sakai is importing a role in site.xml, check if it is a qualified role.

Parameters:
roleId -
Returns:
boolean value - true: the role is accepted for importing; otherwise, not;


Copyright © 2006-2012 Sakai Project. All Rights Reserved.