<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Error occurs while creating a site in java in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/error-occurs-while-creating-a-site-in-java/m-p/111829#M31197</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/74498"&gt;@abhinavmishra14&lt;/A&gt;&amp;nbsp; for your answer. I read more about it and I decided to have repo webscript.&lt;/P&gt;&lt;P&gt;In link you sent me I found what to do&amp;nbsp; in case I chose surf webscript, but It is not clear to me what to do when I want to use repo webscript. Can you help me?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 31 Aug 2020 07:49:12 GMT</pubDate>
    <dc:creator>alfresco_lover</dc:creator>
    <dc:date>2020-08-31T07:49:12Z</dc:date>
    <item>
      <title>Error occurs while creating a site in java</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/error-occurs-while-creating-a-site-in-java/m-p/111827#M31195</link>
      <description>&lt;P&gt;Hi, My problem occured during the creation of a site using java webscript . I can create a site with this code.&lt;/P&gt;&lt;PRE&gt;    protected Map&amp;lt;String, Object&amp;gt; executeImpl(WebScriptRequest req, Status status, Cache cache) {

    	String siteID =  "site_test";
    	SiteInfo siteinfo = null;
    	try {
    		siteinfo = createSite(siteID);
        	System.out.println(siteinfo);
    	}
		catch (SiteServiceException e2 ) {
			
			//e2.printStackTrace();
	    	System.out.println("SITE: " + siteID + " already exists!");
		}
    	
    	Map&amp;lt;String, Object&amp;gt; model = new HashMap&amp;lt;String, Object&amp;gt;();
        model.put("result", "true");
        
    	//System.out.println("end");
        
        return model;

    }&lt;/PRE&gt;&lt;P&gt;After the execution of the webscript, using above code, site is created but only in repo.&lt;/P&gt;&lt;P&gt;Problem is that when I sign in into alfresco share this error occures in command line:&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="2.PNG" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Image"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/828iF008FF0E4886B092/image-size/large?v=v2&amp;amp;px=999" role="button" title="Image" alt="Image" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;and this appers in share:&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="1.PNG" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/824iEEE0C3894E3B4B82/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;and the site I created in repo did not show up in share.&lt;/P&gt;&lt;P&gt;I am using Alfresco 6.2. Can somebody help me fix this error and create a functional site in share as well as in repo ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Do I need to add some code to different files? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Or is there any other way to create a site in java that will appear in alfresco share?&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2020 13:21:43 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/error-occurs-while-creating-a-site-in-java/m-p/111827#M31195</guid>
      <dc:creator>alfresco_lover</dc:creator>
      <dc:date>2020-08-28T13:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: Error occurs while creating a site in java</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/error-occurs-while-creating-a-site-in-java/m-p/111828#M31196</link>
      <description>&lt;P&gt;The error is expected as site also expect surf objects based on the site preset you are using. These are also called site data.&lt;/P&gt;
&lt;P&gt;Creating site via java backed webscript would create the site node but would setup site data for the site you just created.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Take a look at this thread and see if it helps:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://hub.alfresco.com/t5/alfresco-content-services-forum/creating-site-using-webscript/m-p/300165/highlight/true#M20141" target="_blank" rel="nofollow noopener noreferrer"&gt;https://hub.alfresco.com/t5/alfresco-content-services-forum/creating-site-using-webscript/m-p/300165/highlight/true#M20141&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2020 13:39:09 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/error-occurs-while-creating-a-site-in-java/m-p/111828#M31196</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2020-08-28T13:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: Error occurs while creating a site in java</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/error-occurs-while-creating-a-site-in-java/m-p/111829#M31197</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/74498"&gt;@abhinavmishra14&lt;/A&gt;&amp;nbsp; for your answer. I read more about it and I decided to have repo webscript.&lt;/P&gt;&lt;P&gt;In link you sent me I found what to do&amp;nbsp; in case I chose surf webscript, but It is not clear to me what to do when I want to use repo webscript. Can you help me?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Aug 2020 07:49:12 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/error-occurs-while-creating-a-site-in-java/m-p/111829#M31197</guid>
      <dc:creator>alfresco_lover</dc:creator>
      <dc:date>2020-08-31T07:49:12Z</dc:date>
    </item>
    <item>
      <title>Re: Error occurs while creating a site in java</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/error-occurs-while-creating-a-site-in-java/m-p/111830#M31198</link>
      <description>&lt;P&gt;&lt;SPAN&gt;You would have to write logic to import the surf-config from within your java backed webscript.&amp;nbsp;SiteService allows to create site but it doesn't setup surf-config which is required for every site.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Check the surf config used for default site preset here: &lt;A href="https://github.com/Alfresco/alfresco-repository/tree/master/src/main/resources/alfresco/bootstrap/site" target="_blank" rel="noopener nofollow noreferrer"&gt;https://github.com/Alfresco/alfresco-repository/tree/master/src/main/resources/alfresco/bootstrap/site&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Make sure you have appropriate surf-config setup for your site presets. Check the link given above. If you use the above given surf-config as is, it will setup surf config for default site preset always. so make sure you make changes accordingly and bootstrap the surf-config.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Check this class and bean definition which is used to import surf-config for default site.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/Alfresco/alfresco-remote-api/blob/master/src/main/java/org/alfresco/rest/api/impl/SiteSurfConfig.java" target="_blank" rel="noopener nofollow noreferrer"&gt;https://github.com/Alfresco/alfresco-remote-api/blob/master/src/main/java/org/alfresco/rest/api/impl/SiteSurfConfig.java&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/Alfresco/alfresco-remote-api/blob/master/src/main/resources/alfresco/public-rest-context.xml#L768" target="_blank" rel="noopener nofollow noreferrer"&gt;https://github.com/Alfresco/alfresco-remote-api/blob/master/src/main/resources/alfresco/public-rest-context.xml#L768&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN&gt;If you are using default site preset (i.e. 'site-dashboard') provided by alfresco, you can use this OOTB rest api which creates the site and setup surf-config by default.&amp;nbsp; If you are using default site preset, then writing a custom webscript for creating site is not required.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://docs.alfresco.com/6.1/concepts/dev-api-by-language-alf-rest-manage-sites-create.html" target="_blank" rel="noopener nofollow noreferrer"&gt;https://docs.alfresco.com/6.1/concepts/dev-api-by-language-alf-rest-manage-sites-create.html&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;POST: http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/sites?alf_ticket=TICKET_4ad80403182aac65b38d69efa88998814c6d80be&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Payload:&lt;/P&gt;
&lt;PRE&gt;{
  "id": "test-site",
  "title": "Test site",
  "description": "Test site desc",
  "visibility": "PUBLIC"
}&lt;/PRE&gt;</description>
      <pubDate>Mon, 31 Aug 2020 14:21:23 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/error-occurs-while-creating-a-site-in-java/m-p/111830#M31198</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2020-08-31T14:21:23Z</dc:date>
    </item>
  </channel>
</rss>

