Merged 5.2.N (5.2.1) to HEAD (5.2)

131463 cturlica: REPO-1416: Allow Discovery to be disabled - implement
      - implemented changes


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@132261 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2016-11-03 13:51:41 +00:00
parent ed96d6387c
commit 4417a239b3
2 changed files with 20 additions and 0 deletions

View File

@@ -31,6 +31,7 @@ import org.alfresco.rest.api.model.RepositoryInfo;
import org.alfresco.rest.api.model.RepositoryInfo.LicenseInfo;
import org.alfresco.rest.api.model.RepositoryInfo.StatusInfo;
import org.alfresco.rest.api.model.RepositoryInfo.VersionInfo;
import org.alfresco.rest.framework.core.exceptions.DisabledServiceException;
import org.alfresco.rest.framework.jacksonextensions.JacksonHelper;
import org.alfresco.rest.framework.tools.ApiAssistant;
import org.alfresco.rest.framework.tools.RecognizedParamsExtractor;
@@ -65,6 +66,9 @@ public class DiscoveryApiWebscript extends AbstractWebScript implements Recogniz
private ModuleService moduleService;
private ApiAssistant assistant;
private boolean enabled = true;
private final static String DISABLED = "Not Implemented";
public void setDescriptorService(DescriptorService descriptorService)
{
this.descriptorService = descriptorService;
@@ -111,6 +115,8 @@ public class DiscoveryApiWebscript extends AbstractWebScript implements Recogniz
{
try
{
checkEnabled();
DiscoveryDetails discoveryDetails = new DiscoveryDetails(getRepositoryInfo());
// Write response
setResponse(webScriptResponse, DEFAULT_SUCCESS);
@@ -165,4 +171,17 @@ public class DiscoveryApiWebscript extends AbstractWebScript implements Recogniz
objectMapper.writeValue(generator, obj);
});
}
public void setEnabled(boolean enabled)
{
this.enabled = enabled;
}
private void checkEnabled()
{
if (!enabled)
{
throw new DisabledServiceException(DISABLED);
}
}
}