To make the exercise more concise we will execute each request in a synchronous way.
Alfresco Java Client is currently in Early Access mode. It evolves as you use them, as you give feedback, and as the developers update and add file. We like to think app & lib development as services that grow and evolve with the involvement of the community.
//Create a public Site SitesAPI sitesAPI = client.getSitesAPI();
//Create public site SiteBodyCreate siteBodyCreate =newSiteBodyCreate("queriesSearchSite","Queries and Search Site","Site created for queries and search blog post", SiteVisibilityEnum.PUBLIC); Response<SiteRepresentation> siteRepresentationResponse = sitesAPI.createSiteCall(siteBodyCreate).execute(); SiteRepresentation siteRepresentation = siteRepresentationResponse.body(); Assert.assertEquals(siteRepresentation.getId(),"queriesSearchSite"); Assert.assertEquals(siteRepresentation.getVisibilityEnum(), SiteVisibilityEnum.PUBLIC);
RequestQuery facetQuery = new RequestQuery().query("(name:\"test*\" OR title:\"test*\") AND TYPE:\"cm:content\"");
List<RequestFacetQuery> facetsQuery = Arrays.asList( new RequestFacetQuery().query("content.size:[0 TO 10240]").label("Small Files"), new RequestFacetQuery().query("content.mimetype:'text/plain'").label("Plain Text"), new RequestFacetQuery().query("content.mimetype:'image/jpeg' OR content.mimetype:'image/png' OR content.mimetype:'image/gif'").label("Images"), new RequestFacetQuery().query("content.mimetype:'application/msword' OR content.mimetype:'application/vnd.ms-excel'").label("Office") );
RequestFacetFields facetFields = new RequestFacetFields().facets(Arrays.asList(new RequestFacetFieldsFacets().field("creator")));