mirror of
				https://github.com/Alfresco/alfresco-community-repo.git
				synced 2025-10-29 15:21:53 +00:00 
			
		
		
		
	Compare commits
	
		
			4 Commits
		
	
	
		
			APPS-2000_
			...
			feature/20
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 0a8052d0ab | ||
|  | a996fe2d2f | ||
|  | e0db9362a4 | ||
|  | 63d853750e | 
| @@ -7,7 +7,7 @@ | ||||
|    <parent> | ||||
|       <groupId>org.alfresco</groupId> | ||||
|       <artifactId>alfresco-community-repo-amps</artifactId> | ||||
|       <version>23.1.0.168-SNAPSHOT</version> | ||||
|       <version>23.1.0.167-SNAPSHOT</version> | ||||
|    </parent> | ||||
|  | ||||
|    <modules> | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|    <parent> | ||||
|       <groupId>org.alfresco</groupId> | ||||
|       <artifactId>alfresco-governance-services-community-parent</artifactId> | ||||
|       <version>23.1.0.168-SNAPSHOT</version> | ||||
|       <version>23.1.0.167-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.168-SNAPSHOT</version> | ||||
|       <version>23.1.0.167-SNAPSHOT</version> | ||||
|    </parent> | ||||
|  | ||||
|    <build> | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|    <parent> | ||||
|       <groupId>org.alfresco</groupId> | ||||
|       <artifactId>alfresco-governance-services-community-parent</artifactId> | ||||
|       <version>23.1.0.168-SNAPSHOT</version> | ||||
|       <version>23.1.0.167-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.168-SNAPSHOT</version> | ||||
|       <version>23.1.0.167-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.168-SNAPSHOT</version> | ||||
|         <version>23.1.0.167-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <build> | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo</artifactId> | ||||
|         <version>23.1.0.168-SNAPSHOT</version> | ||||
|         <version>23.1.0.167-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <modules> | ||||
|   | ||||
| @@ -8,7 +8,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo-amps</artifactId> | ||||
|         <version>23.1.0.168-SNAPSHOT</version> | ||||
|         <version>23.1.0.167-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <properties> | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|    <parent> | ||||
|       <groupId>org.alfresco</groupId> | ||||
|       <artifactId>alfresco-community-repo</artifactId> | ||||
|       <version>23.1.0.168-SNAPSHOT</version> | ||||
|       <version>23.1.0.167-SNAPSHOT</version> | ||||
|    </parent> | ||||
|  | ||||
|    <dependencies> | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo</artifactId> | ||||
|         <version>23.1.0.168-SNAPSHOT</version> | ||||
|         <version>23.1.0.167-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <properties> | ||||
|   | ||||
| @@ -39,6 +39,7 @@ public class DirectAccessUrl implements Serializable | ||||
|     private String contentUrl; | ||||
|     private Date expiryTime; | ||||
|     private boolean attachment; | ||||
|     private String fileName; | ||||
|  | ||||
|     public String getContentUrl() | ||||
|     { | ||||
| @@ -70,18 +71,28 @@ 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 attachment == that.attachment && Objects.equals(contentUrl, | ||||
|         return Objects.equals(fileName, that.fileName) && attachment == that.attachment && Objects.equals(contentUrl, | ||||
|                 that.contentUrl) && Objects.equals(expiryTime, that.expiryTime); | ||||
|     } | ||||
|  | ||||
|     @Override public int hashCode() | ||||
|     { | ||||
|         return Objects.hash(contentUrl, expiryTime, attachment); | ||||
|         return Objects.hash(contentUrl, expiryTime, attachment, fileName); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo</artifactId> | ||||
|         <version>23.1.0.168-SNAPSHOT</version> | ||||
|         <version>23.1.0.167-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <dependencies> | ||||
|   | ||||
| @@ -9,6 +9,6 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo-packaging</artifactId> | ||||
|         <version>23.1.0.168-SNAPSHOT</version> | ||||
|         <version>23.1.0.167-SNAPSHOT</version> | ||||
|     </parent> | ||||
| </project> | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo-packaging</artifactId> | ||||
|         <version>23.1.0.168-SNAPSHOT</version> | ||||
|         <version>23.1.0.167-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <properties> | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo</artifactId> | ||||
|         <version>23.1.0.168-SNAPSHOT</version> | ||||
|         <version>23.1.0.167-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <modules> | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo-packaging</artifactId> | ||||
|         <version>23.1.0.168-SNAPSHOT</version> | ||||
|         <version>23.1.0.167-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <modules> | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo-tests</artifactId> | ||||
|         <version>23.1.0.168-SNAPSHOT</version> | ||||
|         <version>23.1.0.167-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <organization> | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo-tests</artifactId> | ||||
|         <version>23.1.0.168-SNAPSHOT</version> | ||||
|         <version>23.1.0.167-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <developers> | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo-tests</artifactId> | ||||
|         <version>23.1.0.168-SNAPSHOT</version> | ||||
|         <version>23.1.0.167-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <developers> | ||||
|   | ||||
| @@ -8,7 +8,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo-tests</artifactId> | ||||
|         <version>23.1.0.168-SNAPSHOT</version> | ||||
|         <version>23.1.0.167-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <properties> | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo-tests</artifactId> | ||||
|         <version>23.1.0.168-SNAPSHOT</version> | ||||
|         <version>23.1.0.167-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <developers> | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo-packaging</artifactId> | ||||
|         <version>23.1.0.168-SNAPSHOT</version> | ||||
|         <version>23.1.0.167-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <properties> | ||||
|   | ||||
| @@ -388,6 +388,12 @@ | ||||
|         <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> | ||||
| @@ -463,6 +469,14 @@ | ||||
|       <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.168-SNAPSHOT</version> | ||||
|     <version>23.1.0.167-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.168-SNAPSHOT</version> | ||||
|         <version>23.1.0.167-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <dependencies> | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo</artifactId> | ||||
|         <version>23.1.0.168-SNAPSHOT</version> | ||||
|         <version>23.1.0.167-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <dependencies> | ||||
|   | ||||
| @@ -655,6 +655,9 @@ 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,9 +101,7 @@ 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 | ||||
| @@ -1070,13 +1068,11 @@ 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(); | ||||
| @@ -1104,7 +1100,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)) | ||||
| @@ -1113,7 +1109,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) | ||||
|         { | ||||
| @@ -1154,7 +1150,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl implements Extens | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|          | ||||
|         // Propagate timestamps | ||||
|         propagateTimeStamps(childAssocRef); | ||||
|  | ||||
| @@ -1203,7 +1199,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl implements Extens | ||||
|                 } | ||||
|                 invokeBeforeDeleteChildAssociation(secondaryParentAssocPair.getSecond()); | ||||
|             } | ||||
|  | ||||
|              | ||||
|             // Primary child associations | ||||
|             if (archive) | ||||
|             { | ||||
| @@ -1211,7 +1207,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl implements Extens | ||||
|             } | ||||
|             invokeBeforeDeleteNode(nodeToDelete.nodeRef); | ||||
|         } | ||||
|  | ||||
|          | ||||
|         // Archive, if necessary | ||||
|         if (archive) | ||||
|         { | ||||
| @@ -1267,18 +1263,8 @@ 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()); | ||||
|             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); | ||||
|             } | ||||
|             nodeDAO.deleteNode(nodeToDelete.id); | ||||
|             invokeOnDeleteNode( | ||||
|                     nodeToDelete.primaryParentAssocPair.getSecond(), | ||||
|                     childNodeTypeQName, childAspectQnames, archive); | ||||
|   | ||||
| @@ -166,34 +166,46 @@ 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); | ||||
|         assertNull(directAccessUrl); | ||||
|         assertEquals("fileName was not set properly on the DirectAccessUrl response", fileNameOverride, directAccessUrl.getFileName()); | ||||
|         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); | ||||
|         assertNull(directAccessUrl); | ||||
|         assertEquals("fileName was not set properly on the DirectAccessUrl response", SOME_FILE_NAME, directAccessUrl.getFileName()); | ||||
|         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, ""); | ||||
|         assertNull(directAccessUrl); | ||||
|         assertEquals("fileName was not set properly on the DirectAccessUrl response", SOME_FILE_NAME, directAccessUrl.getFileName()); | ||||
|         verify(mockContentStore, times(1)).requestContentDirectUrl(anyString(), eq(true), eq(SOME_FILE_NAME), anyString(), anyLong()); | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user