diff --git a/remote-api/src/main/java/org/alfresco/rest/api/ContentStorageClasses.java b/remote-api/src/main/java/org/alfresco/rest/api/ContentStorageClasses.java
new file mode 100644
index 0000000000..83eeb7ff56
--- /dev/null
+++ b/remote-api/src/main/java/org/alfresco/rest/api/ContentStorageClasses.java
@@ -0,0 +1,42 @@
+/*
+ * #%L
+ * Alfresco Remote API
+ * %%
+ * Copyright (C) 2005 - 2021 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.api;
+
+import org.alfresco.rest.api.model.StorageClass;
+import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
+import org.alfresco.rest.framework.resource.parameters.Paging;
+
+/**
+ * Storage Classes API
+ */
+public interface ContentStorageClasses
+{
+ /**
+ * Lists supported storage classes
+ */
+ CollectionWithPagingInfo getStorageClasses(Paging paging);
+}
diff --git a/remote-api/src/main/java/org/alfresco/rest/api/impl/ContentStorageClassesImpl.java b/remote-api/src/main/java/org/alfresco/rest/api/impl/ContentStorageClassesImpl.java
new file mode 100644
index 0000000000..ce06f27b52
--- /dev/null
+++ b/remote-api/src/main/java/org/alfresco/rest/api/impl/ContentStorageClassesImpl.java
@@ -0,0 +1,57 @@
+/*
+ * #%L
+ * Alfresco Remote API
+ * %%
+ * Copyright (C) 2005 - 2021 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.api.impl;
+
+import org.alfresco.rest.api.ContentStorageClasses;
+import org.alfresco.rest.api.model.StorageClass;
+import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
+import org.alfresco.rest.framework.resource.parameters.Paging;
+import org.alfresco.service.cmr.repository.ContentService;
+
+import java.util.Collections;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * Centralises access to storage classes functionality
+ */
+public class ContentStorageClassesImpl implements ContentStorageClasses
+{
+ private ContentService contentService;
+
+ public void setContentService(ContentService contentService)
+ {
+ this.contentService = contentService;
+ }
+
+ @Override
+ public CollectionWithPagingInfo getStorageClasses(Paging paging)
+ {
+ Set storageClasses = contentService.getSupportedStorageClasses();
+ return CollectionWithPagingInfo.asPaged(paging, storageClasses.stream().map(StorageClass::new).collect(Collectors.toList()));
+ }
+}
diff --git a/remote-api/src/main/java/org/alfresco/rest/api/model/StorageClass.java b/remote-api/src/main/java/org/alfresco/rest/api/model/StorageClass.java
new file mode 100644
index 0000000000..af67b033bf
--- /dev/null
+++ b/remote-api/src/main/java/org/alfresco/rest/api/model/StorageClass.java
@@ -0,0 +1,53 @@
+/*
+ * #%L
+ * Alfresco Remote API
+ * %%
+ * Copyright (C) 2005 - 2021 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.api.model;
+
+/**
+ * Represents a storage class.
+ */
+public class StorageClass
+{
+ private String id;
+
+ public StorageClass(String id)
+ {
+ this.id = id;
+ }
+
+ public StorageClass()
+ {
+ }
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+}
diff --git a/remote-api/src/main/java/org/alfresco/rest/api/storageclasses/StorageClassesEntityResource.java b/remote-api/src/main/java/org/alfresco/rest/api/storageclasses/StorageClassesEntityResource.java
new file mode 100644
index 0000000000..7b57c97e15
--- /dev/null
+++ b/remote-api/src/main/java/org/alfresco/rest/api/storageclasses/StorageClassesEntityResource.java
@@ -0,0 +1,57 @@
+/*
+ * #%L
+ * Alfresco Remote API
+ * %%
+ * Copyright (C) 2005 - 2021 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.api.storageclasses;
+
+import org.alfresco.rest.api.ContentStorageClasses;
+import org.alfresco.rest.api.model.StorageClass;
+import org.alfresco.rest.framework.WebApiDescription;
+import org.alfresco.rest.framework.resource.EntityResource;
+import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction;
+import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
+import org.alfresco.rest.framework.resource.parameters.Parameters;
+
+/**
+ * An implementation of an Entity Resource for handling storage classes.
+ */
+@EntityResource(name = "storage-classes", title = "Storage Classes")
+public class StorageClassesEntityResource implements EntityResourceAction.Read
+{
+ private ContentStorageClasses contentStorageClasses;
+
+ public void setContentStorageClasses(ContentStorageClasses contentStorageClasses)
+ {
+ this.contentStorageClasses = contentStorageClasses;
+ }
+
+ @Override
+ @WebApiDescription(title = "Get List of Storage Classes", description = "Get List of Storage Classes")
+ public CollectionWithPagingInfo readAll(Parameters params)
+ {
+ return contentStorageClasses.getStorageClasses(params.getPaging());
+ }
+
+}
diff --git a/remote-api/src/main/java/org/alfresco/rest/api/storageclasses/package-info.java b/remote-api/src/main/java/org/alfresco/rest/api/storageclasses/package-info.java
new file mode 100644
index 0000000000..0d81a89121
--- /dev/null
+++ b/remote-api/src/main/java/org/alfresco/rest/api/storageclasses/package-info.java
@@ -0,0 +1,30 @@
+/*
+ * #%L
+ * Alfresco Remote API
+ * %%
+ * Copyright (C) 2005 - 2021 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%
+ */
+
+@WebApi(name="alfresco", scope= Api.SCOPE.PUBLIC, version=1)
+package org.alfresco.rest.api.storageclasses;
+import org.alfresco.rest.framework.Api;
+import org.alfresco.rest.framework.WebApi;
\ No newline at end of file
diff --git a/remote-api/src/main/resources/alfresco/public-rest-context.xml b/remote-api/src/main/resources/alfresco/public-rest-context.xml
index 8c965e2a36..b939c00ba8 100644
--- a/remote-api/src/main/resources/alfresco/public-rest-context.xml
+++ b/remote-api/src/main/resources/alfresco/public-rest-context.xml
@@ -798,6 +798,24 @@
+
+
+
+
+
+
+
+ org.alfresco.rest.api.ContentStorageClasses
+
+
+
+
+
+
+
+
+
+
@@ -987,6 +1005,10 @@
+
+
+
+
diff --git a/remote-api/src/test/java/org/alfresco/AppContext02TestSuite.java b/remote-api/src/test/java/org/alfresco/AppContext02TestSuite.java
index 9d18221209..dfde2647c1 100644
--- a/remote-api/src/test/java/org/alfresco/AppContext02TestSuite.java
+++ b/remote-api/src/test/java/org/alfresco/AppContext02TestSuite.java
@@ -55,6 +55,7 @@ import org.junit.runners.Suite;
org.alfresco.rest.api.tests.QueriesNodesApiTest.class,
org.alfresco.rest.api.tests.QueriesPeopleApiTest.class,
org.alfresco.rest.api.tests.QueriesSitesApiTest.class,
+ org.alfresco.rest.api.tests.StorageClassesTest.class,
org.alfresco.rest.api.tests.TestActivities.class,
org.alfresco.rest.api.tests.TestDownloads.class,
org.alfresco.rest.api.tests.TestFavouriteSites.class,
diff --git a/remote-api/src/test/java/org/alfresco/rest/api/tests/ApiTest.java b/remote-api/src/test/java/org/alfresco/rest/api/tests/ApiTest.java
index 5a2191b711..a99183b89f 100644
--- a/remote-api/src/test/java/org/alfresco/rest/api/tests/ApiTest.java
+++ b/remote-api/src/test/java/org/alfresco/rest/api/tests/ApiTest.java
@@ -78,7 +78,8 @@ import org.junit.runners.Suite;
TestPublicApi128.class,
TestPublicApiCaching.class,
TestDownloads.class,
- AuditAppTest.class,
+ AuditAppTest.class,
+ StorageClassesTest.class,
TempOutputStreamTest.class,
BufferedResponseTest.class
})
diff --git a/remote-api/src/test/java/org/alfresco/rest/api/tests/StorageClassesTest.java b/remote-api/src/test/java/org/alfresco/rest/api/tests/StorageClassesTest.java
new file mode 100644
index 0000000000..4fc1399fd5
--- /dev/null
+++ b/remote-api/src/test/java/org/alfresco/rest/api/tests/StorageClassesTest.java
@@ -0,0 +1,112 @@
+/*
+ * #%L
+ * Alfresco Remote API
+ * %%
+ * Copyright (C) 2005 - 2021 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.api.tests;
+
+import org.alfresco.repo.content.ContentStore;
+import org.alfresco.repo.security.authentication.AuthenticationUtil;
+import org.alfresco.rest.AbstractSingleNetworkSiteTest;
+import org.alfresco.rest.api.model.StorageClass;
+import org.alfresco.rest.api.tests.client.HttpResponse;
+import org.alfresco.rest.api.tests.client.PublicApiClient;
+import org.alfresco.service.cmr.repository.ContentService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.springframework.test.util.ReflectionTestUtils;
+
+import java.util.List;
+import java.util.Set;
+
+import static org.alfresco.rest.api.tests.util.RestApiUtil.parseRestApiEntries;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.when;
+
+/**
+ * V1 REST API tests for Storage Classes
+ *
+ *
+ * - {@literal :/alfresco/api//public/alfresco/versions/1/storage-classes}
+ *
+ */
+public class StorageClassesTest extends AbstractSingleNetworkSiteTest
+{
+ private static final String STORAGE_CLASSES = "storage-classes";
+ private ContentService contentService;
+ private ContentStore originalStore;
+ @Mock
+ private ContentStore mockStore;
+
+
+ @Override
+ @Before
+ public void setup() throws Exception
+ {
+ super.setup();
+ contentService = applicationContext.getBean("contentService", ContentService.class);
+ originalStore = (ContentStore) ReflectionTestUtils.getField(contentService, "store");
+
+ setRequestContext(user1);
+ AuthenticationUtil.setFullyAuthenticatedUser(user1);
+ }
+
+ @Override
+ @After
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ ReflectionTestUtils.setField(contentService, "store", originalStore);
+ }
+
+ @Test
+ public void testGetDefaultStorageClasses() throws Exception
+ {
+ PublicApiClient.Paging paging = getPaging(0, 100);
+
+ HttpResponse response = getAll(STORAGE_CLASSES, paging, 200);
+ List nodes = parseRestApiEntries(response.getJsonResponse(), StorageClass.class);
+
+ assertNotNull(nodes);
+ }
+
+ @Test
+ public void testGetStorageClasses() throws Exception
+ {
+ ReflectionTestUtils.setField(contentService, "store", mockStore);
+
+ Set expectedStorageClasses = Set.of("default", "archive", "worm");
+ when(mockStore.getSupportedStorageClasses()).thenReturn(expectedStorageClasses);
+
+ PublicApiClient.Paging paging = getPaging(0, 100);
+ HttpResponse response = getAll(STORAGE_CLASSES, paging, 200);
+ List nodes = parseRestApiEntries(response.getJsonResponse(), StorageClass.class);
+
+ assertNotNull(nodes);
+ assertEquals(3, nodes.size());
+ }
+}
\ No newline at end of file
diff --git a/repository/src/main/resources/alfresco/public-services-security-context.xml b/repository/src/main/resources/alfresco/public-services-security-context.xml
index be6815a99c..fbdcb80c95 100644
--- a/repository/src/main/resources/alfresco/public-services-security-context.xml
+++ b/repository/src/main/resources/alfresco/public-services-security-context.xml
@@ -481,7 +481,7 @@
-
+
@@ -490,7 +490,10 @@
org.alfresco.service.cmr.repository.ContentService.getStoreTotalSpace=ACL_ALLOW
- org.alfresco.service.cmr.repository.ContentService.getStoreFreeSpace=ACL_ALLOW
+ org.alfresco.service.cmr.repository.ContentService.getStoreFreeSpace=ACL_ALLOW
+ org.alfresco.service.cmr.repository.ContentService.getSupportedStorageClasses=ACL_ALLOW
+ org.alfresco.service.cmr.repository.ContentService.isStorageClassesSupported=ACL_ALLOW
+ org.alfresco.service.cmr.repository.ContentService.getStorageClassesTransitions=ACL_ALLOW
org.alfresco.service.cmr.repository.ContentService.getRawReader=ACL_METHOD.ROLE_ADMINISTRATOR
org.alfresco.service.cmr.repository.ContentService.getReader=ACL_NODE.0.sys:base.ReadContent
org.alfresco.service.cmr.repository.ContentService.getWriter=ACL_NODE.0.sys:base.WriteContent