diff --git a/source/java/org/alfresco/rest/api/Sites.java b/source/java/org/alfresco/rest/api/Sites.java index db030416f8..826d21ad77 100644 --- a/source/java/org/alfresco/rest/api/Sites.java +++ b/source/java/org/alfresco/rest/api/Sites.java @@ -77,4 +77,5 @@ public interface Sites String PARAM_SITE_ROLE = "role"; String PARAM_VISIBILITY = "visibility"; + String PARAM_PRESET = "preset"; } diff --git a/source/java/org/alfresco/rest/api/impl/SitesImpl.java b/source/java/org/alfresco/rest/api/impl/SitesImpl.java index 49a70ad457..213869fa2f 100644 --- a/source/java/org/alfresco/rest/api/impl/SitesImpl.java +++ b/source/java/org/alfresco/rest/api/impl/SitesImpl.java @@ -76,7 +76,7 @@ import org.alfresco.rest.framework.resource.parameters.Parameters; import org.alfresco.rest.framework.resource.parameters.SortColumn; import org.alfresco.rest.framework.resource.parameters.where.Query; import org.alfresco.rest.framework.resource.parameters.where.QueryHelper; -import org.alfresco.rest.workflow.api.impl.MapBasedQueryWalker; +import org.alfresco.rest.workflow.api.impl.MapBasedQueryWalkerOrSupported; import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.favourites.FavouritesService; import org.alfresco.service.cmr.model.FileInfo; @@ -144,7 +144,7 @@ public class SitesImpl implements Sites } // list children filtering (via where clause) - private final static Set LIST_SITES_EQUALS_QUERY_PROPERTIES = new HashSet<>(Arrays.asList(new String[] { PARAM_VISIBILITY })); + private final static Set LIST_SITES_EQUALS_QUERY_PROPERTIES = new HashSet<>(Arrays.asList(new String[] { PARAM_VISIBILITY, PARAM_PRESET })); protected Nodes nodes; protected People people; @@ -759,17 +759,22 @@ public class SitesImpl implements Sites Query q = parameters.getQuery(); if (q != null) { - MapBasedQueryWalker propertyWalker = new MapBasedQueryWalker(LIST_SITES_EQUALS_QUERY_PROPERTIES, null); + filterProps = new ArrayList(); + MapBasedQueryWalkerOrSupported propertyWalker = new MapBasedQueryWalkerOrSupported(LIST_SITES_EQUALS_QUERY_PROPERTIES, null); QueryHelper.walk(q, propertyWalker); String siteVisibilityStr = propertyWalker.getProperty(PARAM_VISIBILITY, WhereClauseParser.EQUALS, String.class); if (siteVisibilityStr != null && !siteVisibilityStr.isEmpty()) { SiteVisibility siteVisibility = getSiteVisibilityFromParam(siteVisibilityStr); - - filterProps = new ArrayList(); filterProps.add(new FilterPropString(SiteModel.PROP_SITE_VISIBILITY, siteVisibility.name(), FilterPropString.FilterTypeString.EQUALS)); } + + String sitePreset = propertyWalker.getProperty(PARAM_PRESET, WhereClauseParser.EQUALS, String.class); + if (sitePreset != null && !sitePreset.isEmpty()) + { + filterProps.add(new FilterPropString(SiteModel.PROP_SITE_PRESET, sitePreset, FilterPropString.FilterTypeString.EQUALS)); + } } return filterProps; @@ -779,7 +784,7 @@ public class SitesImpl implements Sites { Map propVals = new HashMap<>(); propVals.put(SiteModel.PROP_SITE_VISIBILITY, siteMembership.getSiteInfo().getVisibility().name()); - + propVals.put(SiteModel.PROP_SITE_PRESET, siteMembership.getSiteInfo().getSitePreset()); return includeFilter(propVals, filterProps); } @@ -1097,7 +1102,7 @@ public class SitesImpl implements Sites SiteInfo siteInfo = null; try { - siteInfo = siteService.createSite("sitePreset", site.getId(), site.getTitle(), site.getDescription(), site.getVisibility()); + siteInfo = siteService.createSite(site.getPreset(), site.getId(), site.getTitle(), site.getDescription(), site.getVisibility()); } catch (SiteServiceException sse) { diff --git a/source/java/org/alfresco/rest/api/model/Site.java b/source/java/org/alfresco/rest/api/model/Site.java index bcf79dd421..39a7f21e20 100644 --- a/source/java/org/alfresco/rest/api/model/Site.java +++ b/source/java/org/alfresco/rest/api/model/Site.java @@ -1,14 +1,14 @@ /* - * #%L - * Alfresco Remote API - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * + * #%L + * Alfresco Remote API + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * * Alfresco is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or @@ -25,7 +25,7 @@ */ package org.alfresco.rest.api.model; -import org.alfresco.rest.framework.resource.UniqueId; +import org.alfresco.rest.framework.resource.UniqueId; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.site.SiteInfo; import org.alfresco.service.cmr.site.SiteVisibility; @@ -44,30 +44,10 @@ public class Site implements Comparable protected String guid; // site nodeId protected String title; protected String description; - - public void setTitle(String title) - { - this.title = title; - } - - public void setDescription(String description) - { - this.description = description; - } - - public void setVisibility(SiteVisibility visibility) - { - this.visibility = visibility; - } - - public void setRole(String role) - { - this.role = role; - } - protected SiteVisibility visibility; + protected String preset; protected String role; - + public Site() { } @@ -83,10 +63,11 @@ public class Site implements Comparable this.title = siteInfo.getTitle(); this.description = siteInfo.getDescription(); this.visibility = siteInfo.getVisibility(); + this.preset = siteInfo.getSitePreset(); this.role = role; } - @UniqueId + @UniqueId public String getId() { return id; @@ -112,16 +93,51 @@ public class Site implements Comparable return title; } + public void setTitle(String title) + { + this.title = title; + } + public String getDescription() { return description; } + public void setDescription(String description) + { + this.description = description; + } + public SiteVisibility getVisibility() { return visibility; } + public void setVisibility(SiteVisibility visibility) + { + this.visibility = visibility; + } + + public String getPreset() + { + return preset; + } + + public void setPreset(String preset) + { + this.preset = preset; + } + + public String getRole() + { + return role; + } + + public void setRole(String role) + { + this.role = role; + } + @Override public boolean equals(Object obj) { @@ -168,8 +184,4 @@ public class Site implements Comparable + "]"; } - public String getRole() - { - return role; - } } \ No newline at end of file diff --git a/source/java/org/alfresco/rest/framework/resource/parameters/where/QueryHelper.java b/source/java/org/alfresco/rest/framework/resource/parameters/where/QueryHelper.java index cb0c68a55c..f0854fd0fb 100644 --- a/source/java/org/alfresco/rest/framework/resource/parameters/where/QueryHelper.java +++ b/source/java/org/alfresco/rest/framework/resource/parameters/where/QueryHelper.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Remote API - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Remote API + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.rest.framework.resource.parameters.where; import java.util.ArrayList; @@ -98,11 +98,11 @@ public abstract class QueryHelper * Default implementation. Override the methods you are interested in. If you don't * override the methods then an InvalidQueryException will be thrown. */ - private static final String UNSUPPORTED_TEXT = "Unsupported Predicate"; - private static final InvalidQueryException UNSUPPORTED = new InvalidQueryException(UNSUPPORTED_TEXT); - public static class WalkerCallbackAdapter implements WalkerCallback { + private static final String UNSUPPORTED_TEXT = "Unsupported Predicate"; + protected static final InvalidQueryException UNSUPPORTED = new InvalidQueryException(UNSUPPORTED_TEXT); + @Override public void exists(String propertyName, boolean negated) { throw UNSUPPORTED;} @Override @@ -166,7 +166,7 @@ public abstract class QueryHelper List children = getChildren(tree); //Don't need the first item because its the property name String[] inVals = new String[children.size()-1]; - for (int i = 1; i < children.size(); i++) + for (int i = 1; i < children.size(); i++) { inVals[i-1] = stripQuotes(children.get(i).getText()); } @@ -200,7 +200,7 @@ public abstract class QueryHelper case WhereClauseParser.OR: callback.or(); List children = getChildren(tree); - for (Tree child : children) + for (Tree child : children) { callbackTree(child, callback, negated); } @@ -208,7 +208,7 @@ public abstract class QueryHelper case WhereClauseParser.AND: callback.and(); List childrenOfAnd = getChildren(tree); - for (Tree child : childrenOfAnd) + for (Tree child : childrenOfAnd) { callbackTree(child, callback, negated); } diff --git a/source/java/org/alfresco/rest/workflow/api/impl/MapBasedQueryWalkerOrSupported.java b/source/java/org/alfresco/rest/workflow/api/impl/MapBasedQueryWalkerOrSupported.java new file mode 100644 index 0000000000..530d98eb4c --- /dev/null +++ b/source/java/org/alfresco/rest/workflow/api/impl/MapBasedQueryWalkerOrSupported.java @@ -0,0 +1,55 @@ +/* + * #%L + * Alfresco Remote API + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.rest.workflow.api.impl; + +import java.util.Set; + +/** + * Query walker extension of MapBasedQueryWalker created to + * add support for OR operation and set AND operation as unsupported. + * + */ +public class MapBasedQueryWalkerOrSupported extends MapBasedQueryWalker +{ + + public MapBasedQueryWalkerOrSupported(Set supportedEqualsParameters, Set supportedMatchesParameters) + { + super(supportedEqualsParameters, supportedMatchesParameters); + } + + @Override + public void or() + { + // We don't need to do anything in this method. However, overriding the + // method indicates that OR is supported. + } + + @Override + public void and() + { + throw UNSUPPORTED; + } +} diff --git a/source/test-java/org/alfresco/rest/api/tests/TestSites.java b/source/test-java/org/alfresco/rest/api/tests/TestSites.java index eefe5d473d..bdf997f82b 100644 --- a/source/test-java/org/alfresco/rest/api/tests/TestSites.java +++ b/source/test-java/org/alfresco/rest/api/tests/TestSites.java @@ -45,6 +45,7 @@ import org.alfresco.rest.api.tests.client.RequestContext; import org.alfresco.rest.api.tests.client.data.*; import org.alfresco.service.cmr.site.SiteVisibility; import org.alfresco.util.GUID; +import org.apache.commons.collections.map.HashedMap; import org.apache.commons.httpclient.HttpStatus; import org.json.simple.JSONArray; import org.json.simple.JSONObject; @@ -97,6 +98,10 @@ public class TestSites extends EnterpriseTestApi private String site6_title = "b_" + GUID.generate(); private String site6_description = "a_" + GUID.generate(); + private String preset = "sitePreset"; + private static final String AND_PREDICATE = " AND "; + private static final String OR_PREDICATE = " OR "; + @Override @Before public void @@ -159,9 +164,11 @@ public class TestSites extends EnterpriseTestApi private void initializeNetwork3WithSites() throws Exception { + String siteDescription = "description"; + if (network3 == null) { - network3 = getRepoService().createNetwork(this.getClass().getName().toLowerCase()+"-2-"+RUNID, true); + network3 = getRepoService().createNetwork(this.getClass().getName().toLowerCase() + "-3-" + RUNID, true); network3.create(); TenantUtil.runAsSystemTenant(new TenantRunAsWork() @@ -178,16 +185,20 @@ public class TestSites extends EnterpriseTestApi Sites sitesProxy = publicApiClient.sites(); - Site site = new SiteImpl("site A" + GUID.generate(), SiteVisibility.PRIVATE.toString()); + Site site = new SiteImpl().withSiteId("a-" + GUID.generate()).withTitle("site A" + GUID.generate()).withDescription(siteDescription) + .withVisibility(SiteVisibility.PRIVATE.toString()).withPreset(preset); site7 = sitesProxy.createSite(site); - site = new SiteImpl("site B" + GUID.generate(), SiteVisibility.PUBLIC.toString()); + site = new SiteImpl().withSiteId("b-" + GUID.generate()).withTitle("site B" + GUID.generate()).withDescription(siteDescription) + .withVisibility(SiteVisibility.PUBLIC.toString()).withPreset(preset); site8 = sitesProxy.createSite(site); - site = new SiteImpl("site C" + GUID.generate(), SiteVisibility.PUBLIC.toString()); + site = new SiteImpl().withSiteId("c-" + GUID.generate()).withTitle("site C" + GUID.generate()).withDescription(siteDescription) + .withVisibility(SiteVisibility.PUBLIC.toString()).withPreset(preset); site9 = sitesProxy.createSite(site); - site = new SiteImpl("site D" + GUID.generate(), SiteVisibility.MODERATED.toString()); + site = new SiteImpl().withSiteId("d-" + GUID.generate()).withTitle("site D" + GUID.generate()).withDescription(siteDescription) + .withVisibility(SiteVisibility.MODERATED.toString()).withPreset("site-dashboard"); site10 = sitesProxy.createSite(site); } } @@ -980,15 +991,25 @@ public class TestSites extends EnterpriseTestApi return sitesProxy.getSites(createParams(paging, params)); } - private ListResponse listSitesWithWhere(final Paging paging, String siteVisibility) throws Exception + private ListResponse listSitesWithWhere(final Paging paging, Map filters, String predicate) throws Exception { final Sites sitesProxy = publicApiClient.sites(); + String visibility = filters.get("visibility"); + String preset = filters.get("preset"); + String pred = predicate; + final Map params = new HashMap<>(); - if (siteVisibility != null) + StringBuilder sb = new StringBuilder(); + if (visibility != null || preset != null) { - params.put("where", "(visibility=" + siteVisibility + ")"); + sb.append("("); + sb.append(visibility != null ? "visibility=" + visibility : ""); + sb.append(pred != null ? pred : ""); + sb.append(preset != null ? "preset='" + preset + "'" : ""); + sb.append(")"); } + params.put("where", sb.toString()); return sitesProxy.getSites(createParams(paging, params)); } @@ -999,8 +1020,11 @@ public class TestSites extends EnterpriseTestApi int totalResults = 1; Paging paging = getPaging(null, null, totalResults, totalResults); + Map filters = new HashMap(); + filters.put("visibility", SiteVisibility.PRIVATE.name()); + // list sites - ListResponse resp = listSitesWithWhere(null, SiteVisibility.PRIVATE.name()); + ListResponse resp = listSitesWithWhere(null, filters, null); // check results List expectedList = new LinkedList<>(); @@ -1015,8 +1039,11 @@ public class TestSites extends EnterpriseTestApi int totalResults = 2; Paging paging = getPaging(null, null, totalResults, totalResults); + Map filters = new HashMap(); + filters.put("visibility", SiteVisibility.PUBLIC.name()); + // list sites - ListResponse resp = listSitesWithWhere(null, SiteVisibility.PUBLIC.name()); + ListResponse resp = listSitesWithWhere(null, filters, null); // check results List expectedList = new LinkedList<>(); @@ -1034,8 +1061,11 @@ public class TestSites extends EnterpriseTestApi int totalResults = 2; Paging paging = getPaging(skipCount, maxItems, totalResults, totalResults); + Map filters = new HashMap(); + filters.put("visibility", SiteVisibility.PUBLIC.name()); + // list sites - ListResponse resp = listSitesWithWhere(paging, SiteVisibility.PUBLIC.name()); + ListResponse resp = listSitesWithWhere(paging, filters, null); // check results List expectedList = new LinkedList<>(); @@ -1050,8 +1080,11 @@ public class TestSites extends EnterpriseTestApi int totalResults = 1; Paging paging = getPaging(null, null, totalResults, totalResults); + Map filters = new HashMap(); + filters.put("visibility", SiteVisibility.MODERATED.name()); + // list sites - ListResponse resp = listSitesWithWhere(null, SiteVisibility.MODERATED.name()); + ListResponse resp = listSitesWithWhere(null, filters, null); // check results List expectedList = new LinkedList<>(); @@ -1064,7 +1097,10 @@ public class TestSites extends EnterpriseTestApi { try { - listSitesWithWhere(null, "invalidVisibility"); + Map filters = new HashMap(); + filters.put("visibility", "invalidVisibility"); + + listSitesWithWhere(null, filters, null); fail(""); } catch (PublicApiException e) @@ -1073,6 +1109,63 @@ public class TestSites extends EnterpriseTestApi } } + public void testListSitesWhereByVisibilityORPreset() throws Exception + { + // paging + int totalResults = 2; + Paging paging = getPaging(null, null, totalResults, totalResults); + + Map filters = new HashMap(); + filters.put("visibility", SiteVisibility.PRIVATE.name()); + filters.put("preset", "site-dashboard"); + + ListResponse resp = listSitesWithWhere(null, filters, OR_PREDICATE); + + // check results + List expectedList = new LinkedList<>(); + expectedList.add((SiteImpl) site7); + expectedList.add((SiteImpl) site10); + + checkList(expectedList, paging.getExpectedPaging(), resp); + } + + public void testListSitesWherePreset() throws Exception + { + // paging + int totalResults = 1; + Paging paging = getPaging(null, null, totalResults, totalResults); + + Map filters = new HashMap(); + filters.put("preset", "site-dashboard"); + ListResponse resp = listSitesWithWhere(null, filters, null); + // check results + List expectedList = new LinkedList<>(); + expectedList.add((SiteImpl) site10); + + checkList(expectedList, paging.getExpectedPaging(), resp); + } + + public void testListSitesWherePresetNonexistent() throws Exception + { + Map filters = new HashMap(); + filters.put("preset", "nonexistentPreset"); + listSitesWithWhere(null, filters, null); + } + + public void testListSitesWhereVisibilityANDPreset() throws Exception + { + try + { + Map filters = new HashMap(); + filters.put("visibility", SiteVisibility.PUBLIC.name()); + filters.put("preset", "sitePreset"); + listSitesWithWhere(null, filters, AND_PREDICATE); + } + catch (PublicApiException e) + { + assertEquals(HttpStatus.SC_BAD_REQUEST, e.getHttpResponse().getStatusCode()); + } + } @Test public void testListSitesWhereExpected() throws Exception { @@ -1084,6 +1177,11 @@ public class TestSites extends EnterpriseTestApi testListSitesWhereSiteVisibilityPublicAndSkipCount(); testListSitesWhereSiteVisibilityModerated(); testListSitesWhereSiteVisibilityInvalid(); + + testListSitesWherePreset(); + testListSitesWherePresetNonexistent(); + testListSitesWhereVisibilityANDPreset(); + testListSitesWhereByVisibilityORPreset(); } diff --git a/source/test-java/org/alfresco/rest/api/tests/client/data/Site.java b/source/test-java/org/alfresco/rest/api/tests/client/data/Site.java index 3e45f5042f..316da16288 100644 --- a/source/test-java/org/alfresco/rest/api/tests/client/data/Site.java +++ b/source/test-java/org/alfresco/rest/api/tests/client/data/Site.java @@ -23,22 +23,33 @@ * along with Alfresco. If not, see . * #L% */ -package org.alfresco.rest.api.tests.client.data; - -import org.json.simple.JSONObject; - -public interface Site extends JSONAble -{ - Boolean getCreated(); - String getGuid(); - String getNetworkId(); - Boolean isCreated(); - String getSiteId(); - String getTitle(); - String getDescription(); - String getVisibility(); - String getType(); - SiteRole getRole(); - void expected(Object o); - JSONObject toJSON(); -} +package org.alfresco.rest.api.tests.client.data; + +import org.json.simple.JSONObject; + +public interface Site extends JSONAble +{ + Boolean getCreated(); + Site withCreated(Boolean created); + String getGuid(); + Site withGuid(String guid); + String getNetworkId(); + Site withNetworkId(String networkId); + Boolean isCreated(); + String getSiteId(); + Site withSiteId(String siteId); + String getTitle(); + Site withTitle(String title); + String getDescription(); + Site withDescription(String description); + String getVisibility(); + Site withVisibility(String visibility); + String getPreset(); + Site withPreset(String preset); + String getType(); + Site withType(String type); + SiteRole getRole(); + Site withRole(SiteRole role); + void expected(Object o); + JSONObject toJSON(); +} diff --git a/source/test-java/org/alfresco/rest/api/tests/client/data/SiteImpl.java b/source/test-java/org/alfresco/rest/api/tests/client/data/SiteImpl.java index 4e541bd284..9ade2cfd38 100644 --- a/source/test-java/org/alfresco/rest/api/tests/client/data/SiteImpl.java +++ b/source/test-java/org/alfresco/rest/api/tests/client/data/SiteImpl.java @@ -54,6 +54,7 @@ public class SiteImpl implements Serializable, Site, Comparable, Expec protected String description; protected SiteRole role; protected String visibility; // one of (PUBLIC,MODERATED,PRIVATE), defaults to PUBLIC + protected String preset; protected String type; public SiteImpl() @@ -124,6 +125,76 @@ public class SiteImpl implements Serializable, Site, Comparable, Expec this.guid = guid; } + @Override + public Site withCreated(Boolean created) + { + this.setCreated(created); + return this; + } + + @Override + public SiteImpl withNetworkId(String networkId) + { + this.setNetworkId(networkId); + return this; + } + + @Override + public SiteImpl withSiteId(String siteId) + { + this.setSiteId(siteId); + return this; + } + + @Override + public SiteImpl withGuid(String guid) + { + this.setGuid(guid); + return this; + } + + @Override + public SiteImpl withTitle(String title) + { + this.setTitle(title); + return this; + } + + @Override + public SiteImpl withDescription(String description) + { + this.setDescription(description); + return this; + } + + @Override + public SiteImpl withRole(SiteRole role) + { + this.setRole(role); + return this; + } + + @Override + public SiteImpl withVisibility(String visibility) + { + this.setVisibility(visibility); + return this; + } + + @Override + public SiteImpl withPreset(String preset) + { + this.setPreset(preset); + return this; + } + + @Override + public SiteImpl withType(String type) + { + this.setType(type); + return this; + } + @Override public void expected(Object o) { @@ -184,7 +255,12 @@ public class SiteImpl implements Serializable, Site, Comparable, Expec { return visibility; } - + + public String getPreset() + { + return preset; + } + public String getType() { return type; @@ -220,6 +296,11 @@ public class SiteImpl implements Serializable, Site, Comparable, Expec this.visibility = visibility; } + public void setPreset(String preset) + { + this.preset = preset; + } + public void setType(String type) { this.type = type; @@ -313,6 +394,10 @@ public class SiteImpl implements Serializable, Site, Comparable, Expec if (getVisibility() != null) { siteJson.put("visibility", getVisibility()); + } + if (getPreset() != null) + { + siteJson.put("preset", getPreset()); } return siteJson; }