RM: Fix up HEAD so RM module UI reliably works

* extended site service Java API so that the *type* of site can be optionally specified.  This must be a sub-type of st:site
  * extend site service JScript API to allow site type to be optionally specified
  * extend site service REST API to allow site type to optionally specified
  * add the site type rm:rmsite to the RM model
  * modify the RM web script to create the RM site with type rm:rmsite
  * added behaviour listening to the creation of rm:rmsite.  This creates the documentlibrary with the correct rm:fileplan type
  * tested

Note:  this is an issue that has been noted before (need to track down the JIRA), but became significantly worse with the move to HEAD.



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28443 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2011-06-17 06:39:48 +00:00
parent 1c2b677a47
commit 82d89f89d4
4 changed files with 60 additions and 4 deletions

View File

@@ -117,6 +117,7 @@ public class SiteServiceImpl implements SiteServiceInternal, SiteModel
private static final String MSG_DO_NOT_CHANGE_MGR = "site_service.do_not_change_manager";
private static final String MSG_CAN_NOT_CHANGE_MSHIP="site_service.can_not_change_membership";
private static final String MSG_SITE_CONTAINER_NOT_FOLDER = "site_service.site_container_not_folder";
private static final String MSG_INVALID_SITE_TYPE = "site_service.invalid_site_type";
/* Services */
private NodeService nodeService;
@@ -356,6 +357,23 @@ public class SiteServiceImpl implements SiteServiceInternal, SiteModel
final String description,
final SiteVisibility visibility)
{
return createSite(sitePreset, passedShortName, title, description, visibility, SiteModel.TYPE_SITE);
}
public SiteInfo createSite(final String sitePreset,
String passedShortName,
final String title,
final String description,
final SiteVisibility visibility,
final QName siteType)
{
// Check that the provided site type is a subtype of TYPE_SITE
if (SiteModel.TYPE_SITE.equals(siteType) == false &&
dictionaryService.isSubClass(siteType, TYPE_SITE) == false)
{
throw new SiteServiceException(MSG_INVALID_SITE_TYPE, new Object[]{siteType});
}
// Remove spaces from shortName
final String shortName = passedShortName.replaceAll(" ", "");
@@ -388,9 +406,9 @@ public class SiteServiceImpl implements SiteServiceInternal, SiteModel
final NodeRef siteNodeRef = this.nodeService.createNode(
siteParent,
ContentModel.ASSOC_CONTAINS,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,
shortName), SiteModel.TYPE_SITE, properties)
.getChildRef();
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, shortName),
siteType,
properties).getChildRef();
// Make the new site a tag scope
this.taggingService.addTagScope(siteNodeRef);

View File

@@ -30,6 +30,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.site.SiteInfo;
import org.alfresco.service.cmr.site.SiteService;
import org.alfresco.service.cmr.site.SiteVisibility;
import org.alfresco.service.namespace.QName;
import org.springframework.extensions.surf.util.ParameterCheck;
@@ -108,6 +109,28 @@ public class ScriptSiteService extends BaseScopableProcessorExtension
return new Site(siteInfo, this.serviceRegistry, this.siteService, getScope());
}
/**
* Create a new site.
* <p>
* The site short name will be used to uniquely identify the site so it must be unique.
*
* @param sitePreset site preset
* @param shortName site short name
* @param title site title
* @param description site description
* @param visibility visibility of the site (public|moderated|private)
* @param siteType qname of site type to create
* @return Site the created site
*/
public Site createSite(String sitePreset, String shortName, String title, String description, String visibility, String siteType)
{
ParameterCheck.mandatoryString("visibility", visibility);
SiteVisibility siteVisibility = SiteVisibility.valueOf(visibility);
QName siteTypeQName = QName.createQName(siteType);
SiteInfo siteInfo = this.siteService.createSite(sitePreset, shortName, title, description, siteVisibility, siteTypeQName);
return new Site(siteInfo, this.serviceRegistry, this.siteService, getScope());
}
/**
* This method checks if the currently authenticated user has permission to create sites.
*

View File

@@ -68,6 +68,20 @@ public interface SiteService
@Auditable(parameters = {"sitePreset", "shortName"})
SiteInfo createSite(String sitePreset, String shortName, String title, String description, SiteVisibility visibility);
/**
* Create a new site.
*
* @param sitePreset site preset name
* @param shortName site short name, must be unique
* @param title site title
* @param description site description
* @param visibility site visibility (public|moderated|private)
* @param siteType type of site to create, must be a sub-type of st:site
* @return SiteInfo information about the created site
*/
@Auditable(parameters = {"sitePreset", "shortName"})
SiteInfo createSite(String sitePreset, String shortName, String title, String description, SiteVisibility visibility, QName siteType);
/**
* This method checks if the currently authenticated user has permission to create sites.
*