mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Compare commits
10 Commits
14.38
...
ACS-2222-A
Author | SHA1 | Date | |
---|---|---|---|
|
d54e666d79 | ||
|
a1151d2918 | ||
|
fb37f18e57 | ||
|
9fefc17eef | ||
|
17ad517268 | ||
|
4468faae99 | ||
|
414a13dd8d | ||
|
ff80318068 | ||
|
4fb119c3fb | ||
|
5b7029b130 |
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-amps</artifactId>
|
||||
<version>14.38</version>
|
||||
<version>14.42-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
||||
<version>14.38</version>
|
||||
<version>14.42-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-automation-community-repo</artifactId>
|
||||
<version>14.38</version>
|
||||
<version>14.42-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
||||
<version>14.38</version>
|
||||
<version>14.42-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
||||
<version>14.38</version>
|
||||
<version>14.42-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
||||
<version>14.38</version>
|
||||
<version>14.42-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<build>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.38</version>
|
||||
<version>14.42-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-amps</artifactId>
|
||||
<version>14.38</version>
|
||||
<version>14.42-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.38</version>
|
||||
<version>14.42-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.38</version>
|
||||
<version>14.42-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -192,6 +192,8 @@ public class MimetypeMap implements MimetypeService
|
||||
|
||||
public static final String MIMETYPE_IMAGE_DWT = "image/x-dwt";
|
||||
|
||||
public static final String MIMETYPE_IMAGE_ICNS = "image/icns";
|
||||
|
||||
public static final String MIMETYPE_APPLICATION_EPS = "application/eps";
|
||||
|
||||
public static final String MIMETYPE_APPLICATION_PS = "application/postscript";
|
||||
|
@@ -611,6 +611,10 @@
|
||||
<mimetype mimetype="application/vnd.apple.numbers" display="Apple iWork Numbers">
|
||||
<extension>numbers</extension>
|
||||
</mimetype>
|
||||
<!-- Apple ICNS files -->
|
||||
<mimetype mimetype="image/icns" display="Apple Icon">
|
||||
<extension>icns</extension>
|
||||
</mimetype>
|
||||
|
||||
<!-- Markdown -->
|
||||
<mimetype mimetype="text/x-markdown" display="Markdown">
|
||||
|
@@ -94,7 +94,8 @@ public class MimetypeMapTest extends TestCase
|
||||
// other text forms
|
||||
assertEquals("text/csv", mimetypesByExtension.get("csv"));
|
||||
assertEquals("text/html", mimetypesByExtension.get("html"));
|
||||
|
||||
assertEquals("image/icns", mimetypesByExtension.get("icns"));
|
||||
|
||||
// JPEG
|
||||
assertEquals("jpg", extensionsByMimetype.get("image/jpeg"));
|
||||
assertEquals("image/jpeg", mimetypesByExtension.get("jpg"));
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.38</version>
|
||||
<version>14.42-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@@ -9,6 +9,6 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.38</version>
|
||||
<version>14.42-SNAPSHOT</version>
|
||||
</parent>
|
||||
</project>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.38</version>
|
||||
<version>14.42-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.38</version>
|
||||
<version>14.42-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.38</version>
|
||||
<version>14.42-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.38</version>
|
||||
<version>14.42-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.38</version>
|
||||
<version>14.42-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.38</version>
|
||||
<version>14.42-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.38</version>
|
||||
<version>14.42-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.38</version>
|
||||
<version>14.42-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -198,4 +198,15 @@ public class UnlockFileTests extends WebDavTest
|
||||
.then().unlock()
|
||||
.and().assertThat().hasStatus(HttpStatus.NO_CONTENT.value()).and().assertThat().isUnlocked();
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.PROTOCOLS, TestGroup.WEBDAV}, executionType= ExecutionType.SANITY,
|
||||
description ="Checks no existent file is not locked (and status 404)")
|
||||
@Test(groups = {TestGroup.PROTOCOLS, TestGroup.WEBDAV, TestGroup.SANITY})
|
||||
public void checkLockStatusForNonExistentFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, content);
|
||||
webDavProtocol.authenticateUser(dataUser.getAdminUser()).
|
||||
usingResource(testFile).
|
||||
assertThat().isUnlocked().assertThat().hasStatus(HttpStatus.NOT_FOUND.value());
|
||||
}
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.38</version>
|
||||
<version>14.42-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#%L
|
||||
Alfresco Repository WAR Community
|
||||
%%
|
||||
Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
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
|
||||
@@ -35,15 +35,6 @@
|
||||
<%@ page import="org.alfresco.service.cmr.module.ModuleInstallState" %>
|
||||
<%@ page import="java.util.Calendar" %>
|
||||
|
||||
<!-- Enterprise index-jsp placeholder -->
|
||||
<%
|
||||
// route WebDAV requests
|
||||
if (request.getMethod().equalsIgnoreCase("PROPFIND") || request.getMethod().equalsIgnoreCase("OPTIONS"))
|
||||
{
|
||||
response.sendRedirect(request.getContextPath() + "/webdav/");
|
||||
}
|
||||
%>
|
||||
|
||||
<%
|
||||
WebApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationContext(session.getServletContext());
|
||||
SysAdminParams sysAdminParams = (SysAdminParams)context.getBean("sysAdminParams");
|
||||
|
4
pom.xml
4
pom.xml
@@ -2,7 +2,7 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.38</version>
|
||||
<version>14.42-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Alfresco Community Repo Parent</name>
|
||||
|
||||
@@ -143,7 +143,7 @@
|
||||
<connection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</connection>
|
||||
<developerConnection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</developerConnection>
|
||||
<url>https://github.com/Alfresco/alfresco-community-repo</url>
|
||||
<tag>14.38</tag>
|
||||
<tag>HEAD</tag>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.38</version>
|
||||
<version>14.42-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* #%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 <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api;
|
||||
|
||||
import org.alfresco.rest.api.model.ContentStorageInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.service.Experimental;
|
||||
|
||||
/**
|
||||
* Storage information for content API.
|
||||
* Note: Currently marked as experimental and subject to change.
|
||||
*
|
||||
* @author mpichura
|
||||
*/
|
||||
@Experimental
|
||||
public interface ContentStorageInformation
|
||||
{
|
||||
/**
|
||||
* Note: Currently marked as experimental and subject to change.
|
||||
* @param nodeId Identifier of the node
|
||||
* @param contentPropName Qualified name of content property (e.g. 'cm_content')
|
||||
* @param parameters {@link Parameters} object to get the parameters passed into the request
|
||||
* @return {@link ContentStorageInfo} object consisting of qualified name of content property and a map of storage properties
|
||||
*/
|
||||
@Experimental
|
||||
ContentStorageInfo getStorageInfo(String nodeId, String contentPropName, Parameters parameters);
|
||||
}
|
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* #%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 <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.impl;
|
||||
|
||||
import org.alfresco.rest.api.ContentStorageInformation;
|
||||
import org.alfresco.rest.api.model.ContentStorageInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.service.Experimental;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
import java.util.Map;
|
||||
/**
|
||||
* Default implementation for {@link ContentStorageInformation}
|
||||
* Note: Currently marked as experimental and subject to change.
|
||||
*
|
||||
* @author mpichura
|
||||
*/
|
||||
@Experimental
|
||||
public class ContentStorageInformationImpl implements ContentStorageInformation
|
||||
{
|
||||
|
||||
public static final char PREFIX_SEPARATOR = '_';
|
||||
|
||||
private final ContentService contentService;
|
||||
private final NamespaceService namespaceService;
|
||||
|
||||
public ContentStorageInformationImpl(ContentService contentService, NamespaceService namespaceService)
|
||||
{
|
||||
this.contentService = contentService;
|
||||
this.namespaceService = namespaceService;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
@Experimental
|
||||
public ContentStorageInfo getStorageInfo(String nodeId, String contentPropName, Parameters parameters)
|
||||
{
|
||||
final NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, nodeId);
|
||||
final QName propQName = getQName(contentPropName);
|
||||
final Map<String, String> storageProperties = contentService.getStorageProperties(nodeRef, propQName);
|
||||
final ContentStorageInfo storageInfo = new ContentStorageInfo();
|
||||
storageInfo.setId(propQName.toPrefixString(namespaceService));
|
||||
storageInfo.setStorageProperties(storageProperties);
|
||||
return storageInfo;
|
||||
}
|
||||
|
||||
private QName getQName(final String contentPropName)
|
||||
{
|
||||
final String properContentPropName = contentPropName.replace(PREFIX_SEPARATOR, QName.NAMESPACE_PREFIX);
|
||||
return QName.resolveToQName(namespaceService, properContentPropName);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* #%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 <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Representation of storage information for content.
|
||||
*
|
||||
* @author mpichura
|
||||
*/
|
||||
public class ContentStorageInfo
|
||||
{
|
||||
|
||||
/**
|
||||
* Qualified name of content property
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* Key-value (String-String) collection representing storage properties of given content
|
||||
*/
|
||||
private Map<String, String> storageProperties;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Map<String, String> getStorageProperties()
|
||||
{
|
||||
if (storageProperties == null) {
|
||||
storageProperties = new HashMap<>();
|
||||
}
|
||||
return storageProperties;
|
||||
}
|
||||
|
||||
public void setStorageProperties(Map<String, String> storageProperties)
|
||||
{
|
||||
this.storageProperties = storageProperties;
|
||||
}
|
||||
}
|
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* #%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 <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.nodes;
|
||||
|
||||
import org.alfresco.rest.api.ContentStorageInformation;
|
||||
import org.alfresco.rest.api.model.ContentStorageInfo;
|
||||
import org.alfresco.rest.framework.WebApiDescription;
|
||||
import org.alfresco.rest.framework.core.exceptions.RelationshipResourceNotFoundException;
|
||||
import org.alfresco.rest.framework.resource.RelationshipResource;
|
||||
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.service.Experimental;
|
||||
import org.alfresco.util.PropertyCheck;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* Node storage information.
|
||||
* Note: Currently marked as experimental and subject to change.
|
||||
*
|
||||
* @author mpichura
|
||||
*/
|
||||
@Experimental
|
||||
@RelationshipResource(name = "storage-info", entityResource = NodesEntityResource.class, title = "Node's content storage information")
|
||||
public class NodeStorageInfoRelation implements RelationshipResourceAction.ReadById<ContentStorageInfo>, InitializingBean
|
||||
{
|
||||
|
||||
private final ContentStorageInformation storageInformation;
|
||||
|
||||
public NodeStorageInfoRelation(ContentStorageInformation storageInformation)
|
||||
{
|
||||
this.storageInformation = storageInformation;
|
||||
}
|
||||
|
||||
@WebApiDescription(title = "Get storage properties",
|
||||
description = "Retrieves storage properties for given node's content",
|
||||
successStatus = HttpServletResponse.SC_OK)
|
||||
@Override
|
||||
public ContentStorageInfo readById(String entityResourceId, String id, Parameters parameters)
|
||||
throws RelationshipResourceNotFoundException
|
||||
{
|
||||
return storageInformation.getStorageInfo(entityResourceId, id, parameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception
|
||||
{
|
||||
PropertyCheck.mandatory(this, "storageInformation", storageInformation);
|
||||
}
|
||||
}
|
@@ -606,6 +606,26 @@
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="contentStorageInformation" class="org.alfresco.rest.api.impl.ContentStorageInformationImpl">
|
||||
<constructor-arg name="contentService" ref="ContentService"/>
|
||||
<constructor-arg name="namespaceService" ref="NamespaceService"/>
|
||||
</bean>
|
||||
|
||||
<bean id="ContentStorageInformation" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="proxyInterfaces">
|
||||
<value>org.alfresco.rest.api.ContentStorageInformation</value>
|
||||
</property>
|
||||
<property name="target">
|
||||
<ref bean="contentStorageInformation" />
|
||||
</property>
|
||||
<property name="interceptorNames">
|
||||
<list>
|
||||
<idref bean="legacyExceptionInterceptor" />
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="deletedNodes" class="org.alfresco.rest.api.impl.DeletedNodesImpl">
|
||||
<property name="nodes" ref="Nodes" />
|
||||
<property name="nodeService" ref="NodeService" />
|
||||
@@ -977,7 +997,11 @@
|
||||
<property name="behaviourFilter" ref="policyBehaviourFilter"/>
|
||||
<property name="directAccessUrlHelper" ref="directAccessUrlHelper" />
|
||||
</bean>
|
||||
|
||||
|
||||
<bean class="org.alfresco.rest.api.nodes.NodeStorageInfoRelation">
|
||||
<constructor-arg name="storageInformation" ref="ContentStorageInformation" />
|
||||
</bean>
|
||||
|
||||
<bean class="org.alfresco.rest.api.nodes.NodeSecondaryChildrenRelation" parent="baseNodeRelation"/>
|
||||
|
||||
<bean class="org.alfresco.rest.api.nodes.NodeParentsRelation" parent="baseNodeRelation"/>
|
||||
|
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* #%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 <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.impl;
|
||||
|
||||
import org.alfresco.rest.api.model.ContentStorageInfo;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class ContentStorageInformationImplTest
|
||||
{
|
||||
@Mock
|
||||
private ContentService contentService;
|
||||
@Mock
|
||||
private NamespaceService namespaceService;
|
||||
|
||||
@InjectMocks
|
||||
private ContentStorageInformationImpl objectUnderTest;
|
||||
|
||||
@Test
|
||||
public void shouldReturnStorageInfoResponseWithNonEmptyStorageProps()
|
||||
{
|
||||
|
||||
final String nodeId = "dummy-node-id";
|
||||
final NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, nodeId);
|
||||
final String contentPropName = "cm:content";
|
||||
|
||||
final Map<String, String> storageProps = Map.of("x-amz-storage-class", "INTELLIGENT_TIERING", "x-alf-archived", "false");
|
||||
Mockito.when(contentService.getStorageProperties(Mockito.eq(nodeRef), Mockito.any())).thenReturn(storageProps);
|
||||
Mockito.when(namespaceService.getNamespaceURI(NamespaceService.CONTENT_MODEL_PREFIX))
|
||||
.thenReturn(NamespaceService.CONTENT_MODEL_1_0_URI);
|
||||
Mockito.when(namespaceService.getPrefixes(NamespaceService.CONTENT_MODEL_1_0_URI))
|
||||
.thenReturn(List.of(NamespaceService.CONTENT_MODEL_PREFIX));
|
||||
|
||||
final ContentStorageInfo storageInfo = objectUnderTest.getStorageInfo(nodeId, contentPropName, null);
|
||||
|
||||
Assert.assertEquals(storageProps, storageInfo.getStorageProperties());
|
||||
Assert.assertEquals(storageInfo.getId(), contentPropName);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldReturnStorageInfoResponseWithEmptyStorageProps()
|
||||
{
|
||||
final String nodeId = "dummy-node-id";
|
||||
final NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, nodeId);
|
||||
final String contentPropName = "cm:content";
|
||||
|
||||
Mockito.when(contentService.getStorageProperties(Mockito.eq(nodeRef), Mockito.any())).thenCallRealMethod();
|
||||
Mockito.when(namespaceService.getNamespaceURI(NamespaceService.CONTENT_MODEL_PREFIX))
|
||||
.thenReturn(NamespaceService.CONTENT_MODEL_1_0_URI);
|
||||
Mockito.when(namespaceService.getPrefixes(NamespaceService.CONTENT_MODEL_1_0_URI))
|
||||
.thenReturn(List.of(NamespaceService.CONTENT_MODEL_PREFIX));
|
||||
|
||||
final ContentStorageInfo storageInfo = objectUnderTest.getStorageInfo(nodeId, contentPropName, null);
|
||||
|
||||
Assert.assertEquals(Collections.emptyMap(), storageInfo.getStorageProperties());
|
||||
Assert.assertEquals(storageInfo.getId(), contentPropName);
|
||||
}
|
||||
}
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.38</version>
|
||||
<version>14.42-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@@ -72,6 +72,14 @@ public class MimetypeMapContentTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
public void testGuessAppleIconsMimetype() throws Exception
|
||||
{
|
||||
assertEquals(
|
||||
"image/icns",
|
||||
mimetypeService.guessMimetype("something.icns", openQuickTestFile("quick.icns"))
|
||||
);
|
||||
}
|
||||
|
||||
public void testGuessMimetypeForFile() throws Exception
|
||||
{
|
||||
// Correct ones
|
||||
|
BIN
repository/src/test/resources/quick/quick.icns
Normal file
BIN
repository/src/test/resources/quick/quick.icns
Normal file
Binary file not shown.
Reference in New Issue
Block a user