use of org.alfresco.repo.site.SiteServiceException in project alfresco-remote-api by Alfresco.
the class SitesImpl method createSite.
/**
* Create default/fixed preset (Share) site - with DocLib container/component
*
* @param site
* @return
*/
public Site createSite(Site site, Parameters parameters) {
// note: if site id is null then will be generated from the site title
site = validateSite(site);
SiteInfo siteInfo = null;
try {
siteInfo = createSite(site);
} catch (SiteServiceException sse) {
if (sse.getMsgId().equals("site_service.unable_to_create")) {
throw new ConstraintViolatedException(sse.getMessage());
} else {
throw sse;
}
}
String siteId = siteInfo.getShortName();
NodeRef siteNodeRef = siteInfo.getNodeRef();
// default false (if not provided)
boolean skipShareSurfConfig = Boolean.valueOf(parameters.getParameter(PARAM_SKIP_SURF_CONFIGURATION));
if (skipShareSurfConfig == false) {
// import default/fixed preset Share surf config
importSite(siteId, siteNodeRef);
}
// pre-create doclib
siteService.createContainer(siteId, SiteService.DOCUMENT_LIBRARY, ContentModel.TYPE_FOLDER, null);
// default false (if not provided)
boolean skipAddToFavorites = Boolean.valueOf(parameters.getParameter(PARAM_SKIP_ADDTOFAVORITES));
if (skipAddToFavorites == false) {
String personId = AuthenticationUtil.getFullyAuthenticatedUser();
// ignore result
favouritesService.addFavourite(personId, siteNodeRef);
}
return getSite(siteInfo, true);
}
Aggregations