Uploaded image for project: 'Service Packs and Hot Fixes'
  1. Service Packs and Hot Fixes
  2. MNT-14151

CMIS Upload/Create in 4.2 adds the sys:hidden and cm:indexControl Aspect to documents starting with a period

    Details

    • Type: Service Pack Request
    • Status: Closed (View Workflow)
    • Resolution: Fixed
    • Affects Version/s: 4.2.4
    • Fix Version/s: 4.2.5
    • Component/s: CMIS
    • Labels:
      None

      Description

      Summary

      In 4.1.X Uploading/Creating documents with the CMIS did not apply the sys:hidden or cm:indexControl aspects. In 4.2.X Uploading/Creating documents via CMIS does add the sys:hidden and cm:indexControl aspect.

      Steps to Reproduce

      • Upload or create a document via cmis in 4.2 that's name starts with a period. (IE .test.txt)
      • Verify in node browser that sys:hidden and cm:indexControl are added

      Expected Behavior
      Behavior is consistent from 4.1.X to 4.2.X and sys:hidden and cm:indexControl are not added to documents with a leading period

      Observed Behavior
      4.2.X does add the sys:hidden and cm:indexControl aspects to documents with a leading period

      Additional Information
      I was able to reproduce the behavior with the following code in 4.1 and changing the binding to http://[host]:[port]/alfresco/api/-default-/public/cmis/versions/1.1/atom for 4.2

      import java.io.File;
      import java.io.FileInputStream;
      import java.util.HashMap;
      import java.util.Map;
      
      import org.apache.chemistry.opencmis.client.api.Document;
      import org.apache.chemistry.opencmis.client.api.Folder;
      import org.apache.chemistry.opencmis.client.api.Repository;
      import org.apache.chemistry.opencmis.client.api.Session;
      import org.apache.chemistry.opencmis.client.api.SessionFactory;
      import org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl;
      import org.apache.chemistry.opencmis.commons.SessionParameter;
      import org.apache.chemistry.opencmis.commons.data.ContentStream;
      import org.apache.chemistry.opencmis.commons.enums.BindingType;
      import org.apache.chemistry.opencmis.commons.exceptions.CmisContentAlreadyExistsException;
      
      
      public class MainClass {
      
      	/**
      	 * @param args
      	 * @return 
      	 */
      	public static void main(String[] args) {
      		// TODO Auto-generated method stub
      		Session cmisSession;
      		SessionFactory factory = SessionFactoryImpl.newInstance();
      		Map parameter = new HashMap();
      		ContentStream contentStream = null;
      		
      		 File file = new File(".test.txt");
      		 Map<String, Object> props = new HashMap<String, Object>();
      		
      		
      		
      		// connection settings
      		parameter.put(SessionParameter.ATOMPUB_URL, "http://localhost:8080/alfresco/cmisatom");
      		parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
      		parameter.put(SessionParameter.AUTH_HTTP_BASIC, "true");
      		parameter.put(SessionParameter.USER, "admin");
      		parameter.put(SessionParameter.PASSWORD, "admin");
      
      		java.util.List<Repository> repositories = factory.getRepositories(parameter);
      		cmisSession=repositories.get(0).createSession();
      		Folder folder = (Folder) cmisSession.getObjectByPath("/");
      		System.out.println(folder);
      		props.put("cmis:objectTypeId", "cmis:document");
      		String fileName = file.getName();
      		props.put("cmis:name", fileName);
      		
      		try{
      		contentStream = cmisSession.getObjectFactory().
      				  createContentStream(
      					fileName,
      					file.length(),
      					"text",
      					new FileInputStream(file)
      				  );
      			// Find
      		}catch(Exception ex){
      			Document document = null;
      			try {
      				document = folder.createDocument(props, contentStream, null);		
      				System.out.println("Created new document: " + document.getId());
      			} catch (CmisContentAlreadyExistsException ccaee) {
      				document = (Document) cmisSession.getObjectByPath(folder.getPath() + "/" + fileName);
      				System.out.println("Document already exists: " + fileName);
      			}
      		}
      	}
      	}
      

        Attachments

          Issue Links

            Structure

              Activity

                People

                • Assignee:
                  closedbugs Closed Bugs (Inactive)
                  Reporter:
                  thines Trevor Hines
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  13 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - 0 minutes
                    0m
                    Logged:
                    Time Spent - 3 days, 3 hours, 45 minutes
                    3d 3h 45m

                      Structure Helper Panel