mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-22 15:12:38 +00:00
Compare commits
9 Commits
feature/20
...
APPS-2000_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c406c1301 | ||
|
|
693f8cd5c9 | ||
|
|
32bdf67969 | ||
|
|
083bd3ce35 | ||
|
|
aef7febbf5 | ||
|
|
db1644dbb2 | ||
|
|
b5076c6fdd | ||
|
|
78359d396f | ||
|
|
bcba412d73 |
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-amps</artifactId>
|
||||
<version>23.1.0.167-SNAPSHOT</version>
|
||||
<version>23.1.0.168-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
||||
<version>23.1.0.167-SNAPSHOT</version>
|
||||
<version>23.1.0.168-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-automation-community-repo</artifactId>
|
||||
<version>23.1.0.167-SNAPSHOT</version>
|
||||
<version>23.1.0.168-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
||||
<version>23.1.0.167-SNAPSHOT</version>
|
||||
<version>23.1.0.168-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
||||
<version>23.1.0.167-SNAPSHOT</version>
|
||||
<version>23.1.0.168-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
||||
<version>23.1.0.167-SNAPSHOT</version>
|
||||
<version>23.1.0.168-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>23.1.0.167-SNAPSHOT</version>
|
||||
<version>23.1.0.168-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-amps</artifactId>
|
||||
<version>23.1.0.167-SNAPSHOT</version>
|
||||
<version>23.1.0.168-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>23.1.0.167-SNAPSHOT</version>
|
||||
<version>23.1.0.168-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>23.1.0.167-SNAPSHOT</version>
|
||||
<version>23.1.0.168-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
||||
@@ -39,7 +39,6 @@ public class DirectAccessUrl implements Serializable
|
||||
private String contentUrl;
|
||||
private Date expiryTime;
|
||||
private boolean attachment;
|
||||
private String fileName;
|
||||
|
||||
public String getContentUrl()
|
||||
{
|
||||
@@ -71,28 +70,18 @@ public class DirectAccessUrl implements Serializable
|
||||
this.attachment = attachment;
|
||||
}
|
||||
|
||||
public String getFileName()
|
||||
{
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public void setFileName(String fileName)
|
||||
{
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
@Override public boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj) return true;
|
||||
if (obj == null || getClass() != obj.getClass()) return false;
|
||||
|
||||
DirectAccessUrl that = (DirectAccessUrl) obj;
|
||||
return Objects.equals(fileName, that.fileName) && attachment == that.attachment && Objects.equals(contentUrl,
|
||||
return attachment == that.attachment && Objects.equals(contentUrl,
|
||||
that.contentUrl) && Objects.equals(expiryTime, that.expiryTime);
|
||||
}
|
||||
|
||||
@Override public int hashCode()
|
||||
{
|
||||
return Objects.hash(contentUrl, expiryTime, attachment, fileName);
|
||||
return Objects.hash(contentUrl, expiryTime, attachment);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>23.1.0.167-SNAPSHOT</version>
|
||||
<version>23.1.0.168-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -9,6 +9,6 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>23.1.0.167-SNAPSHOT</version>
|
||||
<version>23.1.0.168-SNAPSHOT</version>
|
||||
</parent>
|
||||
</project>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>23.1.0.167-SNAPSHOT</version>
|
||||
<version>23.1.0.168-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>23.1.0.167-SNAPSHOT</version>
|
||||
<version>23.1.0.168-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>23.1.0.167-SNAPSHOT</version>
|
||||
<version>23.1.0.168-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>23.1.0.167-SNAPSHOT</version>
|
||||
<version>23.1.0.168-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<organization>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>23.1.0.167-SNAPSHOT</version>
|
||||
<version>23.1.0.168-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>23.1.0.167-SNAPSHOT</version>
|
||||
<version>23.1.0.168-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>23.1.0.167-SNAPSHOT</version>
|
||||
<version>23.1.0.168-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>23.1.0.167-SNAPSHOT</version>
|
||||
<version>23.1.0.168-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>23.1.0.167-SNAPSHOT</version>
|
||||
<version>23.1.0.168-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
||||
@@ -388,12 +388,6 @@
|
||||
<load-on-startup>8</load-on-startup>
|
||||
</servlet>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>cmistck</servlet-name>
|
||||
<servlet-class>org.apache.chemistry.opencmis.tck.runner.WebRunnerServlet</servlet-class>
|
||||
<load-on-startup>8</load-on-startup>
|
||||
</servlet>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>publicapiServlet</servlet-name>
|
||||
<servlet-class>org.alfresco.rest.api.PublicApiWebScriptServlet</servlet-class>
|
||||
@@ -469,14 +463,6 @@
|
||||
<servlet-name>publicapiServlet</servlet-name>
|
||||
<url-pattern>/api/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<!-- The CMIS TCK is deactivated by default. -->
|
||||
<!-- CMISTCK
|
||||
<servlet-mapping>
|
||||
<servlet-name>cmistck</servlet-name>
|
||||
<url-pattern>/cmistck</url-pattern>
|
||||
</servlet-mapping>
|
||||
CMISTCK -->
|
||||
|
||||
<!-- Enterprise servlet-mapping placeholder -->
|
||||
|
||||
|
||||
2
pom.xml
2
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>23.1.0.167-SNAPSHOT</version>
|
||||
<version>23.1.0.168-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Alfresco Community Repo Parent</name>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>23.1.0.167-SNAPSHOT</version>
|
||||
<version>23.1.0.168-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>23.1.0.167-SNAPSHOT</version>
|
||||
<version>23.1.0.168-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -655,9 +655,6 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa
|
||||
try
|
||||
{
|
||||
directAccessUrl = store.requestContentDirectUrl(contentUrl, attachment, fileName, contentMimetype, validFor);
|
||||
if (directAccessUrl != null) {
|
||||
directAccessUrl.setFileName(fileName);
|
||||
}
|
||||
}
|
||||
catch (UnsupportedOperationException ex)
|
||||
{
|
||||
|
||||
@@ -101,7 +101,9 @@ import org.alfresco.util.PropertyMap;
|
||||
import org.alfresco.util.transaction.TransactionListenerAdapter;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.dao.ConcurrencyFailureException;
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* Node service using database persistence layer to fulfill functionality
|
||||
@@ -1068,11 +1070,13 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl implements Extens
|
||||
* @param allowArchival <tt>true</tt> if normal archival may occur or
|
||||
* <tt>false</tt> if the node must be forcibly deleted
|
||||
*/
|
||||
@Transactional
|
||||
private void deleteNode(NodeRef nodeRef, boolean allowArchival)
|
||||
{
|
||||
|
||||
// The node(s) involved may not be pending deletion
|
||||
checkPendingDelete(nodeRef);
|
||||
|
||||
|
||||
// Pair contains NodeId, NodeRef
|
||||
Pair<Long, NodeRef> nodePair = getNodePairNotNull(nodeRef);
|
||||
Long nodeId = nodePair.getFirst();
|
||||
@@ -1100,7 +1104,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl implements Extens
|
||||
// Gather information about the hierarchy
|
||||
NodeHierarchyWalker walker = new NodeHierarchyWalker(nodeDAO);
|
||||
walker.walkHierarchy(nodePair, childAssocPair);
|
||||
|
||||
|
||||
// Protect the nodes from being link/unlinked for the remainder of the process
|
||||
Set<NodeRef> nodesPendingDelete = new HashSet<NodeRef>(walker.getNodes(false).size());
|
||||
for (VisitedNode visitedNode : walker.getNodes(true))
|
||||
@@ -1109,7 +1113,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl implements Extens
|
||||
}
|
||||
Set<NodeRef> nodesPendingDeleteTxn = TransactionalResourceHelper.getSet(KEY_PENDING_DELETE_NODES);
|
||||
nodesPendingDeleteTxn.addAll(nodesPendingDelete); // We need to remove these later, again
|
||||
|
||||
|
||||
// Work out whether we need to archive or delete the node.
|
||||
if (!allowArchival)
|
||||
{
|
||||
@@ -1150,7 +1154,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl implements Extens
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Propagate timestamps
|
||||
propagateTimeStamps(childAssocRef);
|
||||
|
||||
@@ -1199,7 +1203,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl implements Extens
|
||||
}
|
||||
invokeBeforeDeleteChildAssociation(secondaryParentAssocPair.getSecond());
|
||||
}
|
||||
|
||||
|
||||
// Primary child associations
|
||||
if (archive)
|
||||
{
|
||||
@@ -1207,7 +1211,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl implements Extens
|
||||
}
|
||||
invokeBeforeDeleteNode(nodeToDelete.nodeRef);
|
||||
}
|
||||
|
||||
|
||||
// Archive, if necessary
|
||||
if (archive)
|
||||
{
|
||||
@@ -1263,8 +1267,18 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl implements Extens
|
||||
QName childNodeTypeQName = nodeDAO.getNodeType(nodeToDelete.id);
|
||||
Set<QName> childAspectQnames = nodeDAO.getNodeAspects(nodeToDelete.id);
|
||||
// Delete the node
|
||||
|
||||
nodeDAO.deleteChildAssoc(nodeToDelete.primaryParentAssocPair.getFirst());
|
||||
nodeDAO.deleteNode(nodeToDelete.id);
|
||||
for (VisitedNode assocRefRemoved : nodesToDelete)
|
||||
{
|
||||
if (!nodeDAO.exists(assocRefRemoved.id))
|
||||
{
|
||||
throw new ConcurrencyFailureException("Child association not found : " + assocRefRemoved.id);
|
||||
}
|
||||
nodeDAO.deleteChildAssoc(assocRefRemoved.id);
|
||||
invokeOnDeleteNode(assocRefRemoved.primaryParentAssocPair.getSecond(),
|
||||
childNodeTypeQName, childAspectQnames, archive);
|
||||
}
|
||||
invokeOnDeleteNode(
|
||||
nodeToDelete.primaryParentAssocPair.getSecond(),
|
||||
childNodeTypeQName, childAspectQnames, archive);
|
||||
|
||||
@@ -166,46 +166,34 @@ public class ContentServiceImplUnitTest
|
||||
@Test
|
||||
public void testRequestContentDirectUrl_StoreRequestContentDirectUrlIsCalledWithFileNameOverride()
|
||||
{
|
||||
DirectAccessUrl mockDirectAccessUrl = new DirectAccessUrl();
|
||||
mockDirectAccessUrl.setAttachment(true);
|
||||
mockDirectAccessUrl.setContentUrl(SOME_CONTENT_URL);
|
||||
final String fileNameOverride = "fileNameOverride.txt";
|
||||
setupSystemWideDirectAccessConfig(ENABLED);
|
||||
when(mockContentStore.isContentDirectUrlEnabled()).thenReturn(ENABLED);
|
||||
when(mockContentStore.requestContentDirectUrl(anyString(), eq(true), eq(fileNameOverride), anyString(), anyLong())).thenReturn(mockDirectAccessUrl);
|
||||
|
||||
DirectAccessUrl directAccessUrl = contentService.requestContentDirectUrl(NODE_REF, PROP_CONTENT_QNAME, true, 20L, fileNameOverride);
|
||||
assertEquals("fileName was not set properly on the DirectAccessUrl response", fileNameOverride, directAccessUrl.getFileName());
|
||||
assertNull(directAccessUrl);
|
||||
verify(mockContentStore, times(1)).requestContentDirectUrl(anyString(), eq(true), eq(fileNameOverride), anyString(), anyLong());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRequestContentDirectUrl_StoreRequestContentDirectUrlIsCalledWithNodeNamePropertyWhenFileNameOverrideIsNull()
|
||||
{
|
||||
DirectAccessUrl mockDirectAccessUrl = new DirectAccessUrl();
|
||||
mockDirectAccessUrl.setAttachment(true);
|
||||
mockDirectAccessUrl.setContentUrl(SOME_CONTENT_URL);
|
||||
setupSystemWideDirectAccessConfig(ENABLED);
|
||||
when(mockContentStore.isContentDirectUrlEnabled()).thenReturn(ENABLED);
|
||||
when(mockContentStore.requestContentDirectUrl(anyString(), eq(true), eq(SOME_FILE_NAME), anyString(), anyLong())).thenReturn(mockDirectAccessUrl);
|
||||
|
||||
DirectAccessUrl directAccessUrl = contentService.requestContentDirectUrl(NODE_REF, PROP_CONTENT_QNAME, true, 20L, null);
|
||||
assertEquals("fileName was not set properly on the DirectAccessUrl response", SOME_FILE_NAME, directAccessUrl.getFileName());
|
||||
assertNull(directAccessUrl);
|
||||
verify(mockContentStore, times(1)).requestContentDirectUrl(anyString(), eq(true), eq(SOME_FILE_NAME), anyString(), anyLong());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRequestContentDirectUrl_StoreRequestContentDirectUrlIsCalledWithNodeNamePropertyWhenFileNameOverrideIsEmpty()
|
||||
{
|
||||
DirectAccessUrl mockDirectAccessUrl = new DirectAccessUrl();
|
||||
mockDirectAccessUrl.setAttachment(true);
|
||||
mockDirectAccessUrl.setContentUrl(SOME_CONTENT_URL);
|
||||
setupSystemWideDirectAccessConfig(ENABLED);
|
||||
when(mockContentStore.isContentDirectUrlEnabled()).thenReturn(ENABLED);
|
||||
when(mockContentStore.requestContentDirectUrl(anyString(), eq(true), eq(SOME_FILE_NAME), anyString(), anyLong())).thenReturn(mockDirectAccessUrl);
|
||||
|
||||
DirectAccessUrl directAccessUrl = contentService.requestContentDirectUrl(NODE_REF, PROP_CONTENT_QNAME, true, 20L, "");
|
||||
assertEquals("fileName was not set properly on the DirectAccessUrl response", SOME_FILE_NAME, directAccessUrl.getFileName());
|
||||
assertNull(directAccessUrl);
|
||||
verify(mockContentStore, times(1)).requestContentDirectUrl(anyString(), eq(true), eq(SOME_FILE_NAME), anyString(), anyLong());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user