05-14-2009 09:12 PM
      SiteInfo siteInfo = this.serviceRegistry.getSiteService().createSite("TestSite", "1234567", "for-santhana", "description", true);
      System.out.println("successful site, and the details are "+" preset= "+siteInfo.getSitePreset()+" shortname= "+siteInfo.getShortName());
05-15-2009 03:31 AM
05-15-2009 01:50 PM
05-15-2009 05:58 PM
05-18-2009 10:01 AM
05-18-2009 04:45 PM
05-25-2009 04:03 AM
05-26-2009 11:44 AM
         UserTransaction tx = null;
         final TransactionService transactionService = serviceRegistry
               .getTransactionService();
         try {
            tx = transactionService.getUserTransaction();
            tx.begin();
            if(repositoryAuthenticationDao.getUserOrNull(username) != null) {
               setStatus(model, com.onepoint.businesshr.model.Status.USER_EXISTS, status);
               tx.rollback();
            }
            else {
               password = genPassword(password);
               NodeRef personNodeRef = createUser(email, username, firstName,
                     lastName, password);
               setStatus(model, com.onepoint.businesshr.model.Status.SUCCESS, status);
               model.put(PERSON_REF_PARAM, personNodeRef);
               createDashBoard(clientName, res);
               tx.commit();
            }
         } catch (Throwable t) {
            LOG.error("Could not create user.", t);
            setStatus(model, com.onepoint.businesshr.model.Status.ERROR, status);
            if (tx != null) {
               try {
                  tx.rollback();
               } catch (Exception e) {
                  LOG.warn("Could not rollback transaction.", e);
               }
            }
         }
       /**
    * Creates the dashboard.
    * @param userName The user name.
    * @param res The webscript response.
    * @throws IOException Thrown in case the dashboard cannot be created.
    */
   private void createDashBoard(String userName, WebScriptResponse res) throws IOException {
      
      final String dashboardTitle = String.format(dashboardPathTemplate, userName);
      final Resource dashboardResource = new ClassPathResource("alfresco/module/businesshr/templates/dashboard.xml");
      final InputStream dashboardIn = dashboardResource.getInputStream();
      if(dashboardIn != null) {
         avmRemoteStore.createDocument(res, SITE_STORE, 
               dashboardTitle, dashboardIn);
         for(FreeMarkerProcessor processor : freeMarkerProcessorList) {
            final StringBuilder pathBuilder = new StringBuilder(100);
            try {
               final ByteArrayInputStream renderedTemplateIn = processor.render(userName, pathBuilder);
               avmRemoteStore.createDocument(res, SITE_STORE, 
                     pathBuilder.toString(), renderedTemplateIn);
            } catch (TransformerException e) {
               LOG.warn("Could not transform part. " +
                     "Some parts of the user interface will not be available for " + userName, e);
            }
            
         }
      }
   }
<?xml version="1.0" encoding="UTF-8"?>
<page>
  <title>Collaboration Site Dashboard</title>
  <description>Collaboration site's dashboard page</description>
  <authentication>user</authentication>
  <template-instance>dashboard-1-column</template-instance>
  <properties>
    <sitePages>[{"pageId":"wiki-page"}, {"pageId":"blog-postlist"}, {"pageId":"documentlibrary"}, {"pageId":"calendar"},{"pageId":"links"}, {"pageId":"discussions-topiclist"}]</sitePages>
  </properties>
</page>
<?xml version="1.0" encoding="UTF-8"?>
<component>
  <guid>page.title.site~${siteid}~dashboard</guid>
  <scope>page</scope>
  <region-id>title</region-id>
  <source-id>site/${siteid}/dashboard</source-id>
  <url>/components/title/collaboration-title</url>
</component>/alfresco/site-data/components/page.title.site~%s~dashboard.xml   // Create the site 
   var site = siteService.createSite(sitePreset, shortName, title, description, isPublic);
   …
   
   site.setMembership(userName, "SiteManager");
					
				
			
			
				
			
			
			
			
			
			
			
		06-22-2009 07:34 PM
06-22-2009 07:39 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.