manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From piergior...@apache.org
Subject svn commit: r1807957 - in /manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis: ./ connector/src/main/java/org/apache/manifoldcf/agents/output/cmisoutput/ connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/ connector/src/main/n...
Date Sun, 10 Sep 2017 18:39:07 GMT
Author: piergiorgio
Date: Sun Sep 10 18:39:07 2017
New Revision: 1807957

URL: http://svn.apache.org/viewvc?rev=1807957&view=rev
Log:
- added support for content migration functionality in the CMIS Repository Connector for using
the content path as documentURI (CONNECTORS-1356)
- added support for recreating the same path tree for migrated content in the CMIS Output
Connector (CONNECTORS-1356)
- initial implementation for solving the issue with the removeDocument: using the content
path (CONNECTORS-1356)

Modified:
    manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/agents/output/cmisoutput/CmisOutputConnector.java
    manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisConfig.java
    manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java
    manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnectorUtils.java
    manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/cmis/common_en_US.properties
    manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/cmis/common_es_ES.properties
    manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/cmis/editSpecification_CMISQuery.html
    manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/cmis/viewSpecification.html
    manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/pom.xml

Modified: manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/agents/output/cmisoutput/CmisOutputConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/agents/output/cmisoutput/CmisOutputConnector.java?rev=1807957&r1=1807956&r2=1807957&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/agents/output/cmisoutput/CmisOutputConnector.java
(original)
+++ manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/agents/output/cmisoutput/CmisOutputConnector.java
Sun Sep 10 18:39:07 2017
@@ -22,7 +22,6 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.InterruptedIOException;
 import java.math.BigInteger;
-import java.net.URISyntaxException;
 import java.rmi.NotBoundException;
 import java.rmi.RemoteException;
 import java.util.Date;
@@ -55,8 +54,6 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl;
 import org.apache.commons.lang.StringUtils;
-import org.apache.http.NameValuePair;
-import org.apache.http.client.utils.URIBuilder;
 import org.apache.manifoldcf.agents.interfaces.IOutputAddActivity;
 import org.apache.manifoldcf.agents.interfaces.IOutputRemoveActivity;
 import org.apache.manifoldcf.agents.interfaces.RepositoryDocument;
@@ -160,6 +157,11 @@ public class CmisOutputConnector extends
 
 	/** Document remove permanently rejected */
 	private final static String DOCUMENT_DELETION_STATUS_REJECTED = "Remove request rejected";
+	
+	/** The standard Path property for ManifoldCF used for migrate contents **/
+  private static final String CONTENT_MIGRATION_PATH_PROPERTY = "manifoldcf:path";
+
+  private static final char CMIS_PATH_SEP = '/';
 
 	/**
 	 * Constructor
@@ -876,21 +878,21 @@ public class CmisOutputConnector extends
 		return false;
 	}
 	
-	private String getObjectIdFromDocumentURI(String documentURI) throws URISyntaxException
{
-		String objectId = StringUtils.EMPTY;
-		URIBuilder uriBuilder = new URIBuilder(documentURI);
-		List<NameValuePair> params = uriBuilder.getQueryParams();
-		Iterator<NameValuePair> iteratorParams = params.iterator();
-		while (iteratorParams.hasNext()) {
-			NameValuePair nameValuePair = (NameValuePair) iteratorParams.next();
-			String name = nameValuePair.getName();
-			if(StringUtils.equals(name, "id")
-					|| StringUtils.equals(name, PropertyIds.OBJECT_ID)) {
-				objectId = nameValuePair.getValue();
-			}
-		}
-		return objectId;
-	}
+//	private String getObjectIdFromDocumentURI(String documentURI) throws URISyntaxException
{
+//		String objectId = StringUtils.EMPTY;
+//		URIBuilder uriBuilder = new URIBuilder(documentURI);
+//		List<NameValuePair> params = uriBuilder.getQueryParams();
+//		Iterator<NameValuePair> iteratorParams = params.iterator();
+//		while (iteratorParams.hasNext()) {
+//			NameValuePair nameValuePair = (NameValuePair) iteratorParams.next();
+//			String name = nameValuePair.getName();
+//			if(StringUtils.equals(name, "id")
+//					|| StringUtils.equals(name, PropertyIds.OBJECT_ID)) {
+//				objectId = nameValuePair.getValue();
+//			}
+//		}
+//		return objectId;
+//	}
 	
 
 	@Override
@@ -918,6 +920,13 @@ public class CmisOutputConnector extends
 				Long binaryLength = document.getBinaryLength();
 				String objectId = StringUtils.EMPTY;
 				
+				//check if the repository connector includes the content path
+				String primaryPath = StringUtils.EMPTY;
+				if(document.getField(CONTENT_MIGRATION_PATH_PROPERTY) != null) {
+					primaryPath = ((String[]) document.getField(CONTENT_MIGRATION_PATH_PROPERTY))[0];
+				}
+				
+				
 			  // properties
 				// (minimal set: name and object type id)
 				Map<String, Object> properties = new HashMap<String, Object>();
@@ -958,7 +967,7 @@ public class CmisOutputConnector extends
 				    inputStream);
 
 				// create a major version
-				leafParent = getOrCreateLeafParent(parentDropZoneFolder, creationDate, Boolean.valueOf(createTimestampTree));
+				leafParent = getOrCreateLeafParent(parentDropZoneFolder, creationDate, Boolean.valueOf(createTimestampTree),
primaryPath);
 				injectedDocument = leafParent.createDocument(properties, contentStream, VersioningState.MAJOR);
 				resultDescription = DOCUMENT_STATUS_ACCEPTED_DESC;
 				return DOCUMENT_STATUS_ACCEPTED;
@@ -994,7 +1003,7 @@ public class CmisOutputConnector extends
 	 * @param createTimestampTree: this is the flag checked in the ManifoldCF configuration
panel
 	 * @return the target folder created using the creationDate related to the injected content
 	 */
-	private Folder getOrCreateLeafParent(Folder folder, Date creationDate, boolean createTimestampTree)
{
+	private Folder getOrCreateLeafParent(Folder folder, Date creationDate, boolean createTimestampTree,
String primaryPath) {
 		Folder leafParent = folder;
 		if (createTimestampTree) {
 			GregorianCalendar calendar = new GregorianCalendar();
@@ -1009,6 +1018,15 @@ public class CmisOutputConnector extends
 			Folder dayFolder = createFolderIfNotExist(monthFolder, day);
 			
 			leafParent = dayFolder;
+			
+		} else if(StringUtils.isNotEmpty(primaryPath)) {
+			String[] primaryPathArray = StringUtils.split(primaryPath, CMIS_PATH_SEP);
+			leafParent = folder;
+			for (int i = 0; i < primaryPathArray.length - 1; i++) {
+				String pathSegment = primaryPathArray[i];
+				Folder pathSegmentFolder = createFolderIfNotExist(leafParent, pathSegment);
+				leafParent = pathSegmentFolder;
+			}
 		}
 		return leafParent;
 	}
@@ -1044,23 +1062,14 @@ public class CmisOutputConnector extends
 		getSession();
 		long startTime = System.currentTimeMillis();
 		String result = StringUtils.EMPTY;
-		String objectIdValue = StringUtils.EMPTY;
-		try {
-			objectIdValue = getObjectIdFromDocumentURI(documentURI);
-		} catch (URISyntaxException e) {
-			result = DOCUMENT_DELETION_STATUS_REJECTED;
-			throw new ManifoldCFException(e.getMessage(), e);
-		}
-		
-		ObjectId objectId = new ObjectIdImpl(objectIdValue);
 		try {
-			session.delete(objectId);
+			session.deleteByPath(documentURI);
 			result = DOCUMENT_DELETION_STATUS_ACCEPTED;
 		} catch (Exception e) {
 			result = DOCUMENT_DELETION_STATUS_REJECTED;
 			throw new ManifoldCFException(e.getMessage(), e);
 		} finally {
-			activities.recordActivity(startTime, ACTIVITY_DELETE, null, documentURI, objectId.toString(),
result);
+			activities.recordActivity(startTime, ACTIVITY_DELETE, null, documentURI, null, result);
 		}
 	}
 

Modified: manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisConfig.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisConfig.java?rev=1807957&r1=1807956&r2=1807957&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisConfig.java
(original)
+++ manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisConfig.java
Sun Sep 10 18:39:07 2017
@@ -52,6 +52,9 @@ public class CmisConfig {
   /** CMIS Query */
   public static final String CMIS_QUERY_PARAM = "cmisQuery";
   
+  /** Content Migration Flag */
+  public static final String CONTENT_MIGRATION_PARAM = "contentMigration";
+  
   //default values
   public static final String USERNAME_DEFAULT_VALUE = "dummyuser";
   public static final String PASSWORD_DEFAULT_VALUE = "dummysecrect";

Modified: manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java?rev=1807957&r1=1807956&r2=1807957&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java
(original)
+++ manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java
Sun Sep 10 18:39:07 2017
@@ -21,13 +21,9 @@ package org.apache.manifoldcf.crawler.co
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InterruptedIOException;
-import java.math.BigDecimal;
-import java.math.BigInteger;
 import java.rmi.NotBoundException;
 import java.rmi.RemoteException;
-import java.text.SimpleDateFormat;
 import java.util.Date;
-import java.util.GregorianCalendar;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
@@ -37,7 +33,6 @@ import org.apache.chemistry.opencmis.cli
 import org.apache.chemistry.opencmis.client.api.Document;
 import org.apache.chemistry.opencmis.client.api.Folder;
 import org.apache.chemistry.opencmis.client.api.ItemIterable;
-import org.apache.chemistry.opencmis.client.api.Property;
 import org.apache.chemistry.opencmis.client.api.QueryResult;
 import org.apache.chemistry.opencmis.client.api.Repository;
 import org.apache.chemistry.opencmis.client.api.Session;
@@ -46,28 +41,25 @@ import org.apache.chemistry.opencmis.cli
 import org.apache.chemistry.opencmis.commons.PropertyIds;
 import org.apache.chemistry.opencmis.commons.SessionParameter;
 import org.apache.chemistry.opencmis.commons.enums.BindingType;
-import org.apache.chemistry.opencmis.commons.enums.PropertyType;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
-import org.apache.chemistry.opencmis.commons.impl.Constants;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
-
+import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
 import org.apache.commons.io.input.NullInputStream;
 import org.apache.commons.lang.StringUtils;
 import org.apache.manifoldcf.agents.interfaces.RepositoryDocument;
 import org.apache.manifoldcf.agents.interfaces.ServiceInterruption;
 import org.apache.manifoldcf.core.interfaces.ConfigParams;
-import org.apache.manifoldcf.core.interfaces.Specification;
 import org.apache.manifoldcf.core.interfaces.IHTTPOutput;
 import org.apache.manifoldcf.core.interfaces.IPasswordMapperActivity;
 import org.apache.manifoldcf.core.interfaces.IPostParameters;
 import org.apache.manifoldcf.core.interfaces.IThreadContext;
 import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
+import org.apache.manifoldcf.core.interfaces.Specification;
 import org.apache.manifoldcf.core.interfaces.SpecificationNode;
 import org.apache.manifoldcf.crawler.connectors.BaseRepositoryConnector;
+import org.apache.manifoldcf.crawler.interfaces.IExistingVersions;
 import org.apache.manifoldcf.crawler.interfaces.IProcessActivity;
 import org.apache.manifoldcf.crawler.interfaces.ISeedingActivity;
-import org.apache.manifoldcf.crawler.interfaces.IExistingVersions;
 import org.apache.manifoldcf.crawler.system.Logging;
 
 /**
@@ -84,8 +76,6 @@ public class CmisRepositoryConnector ext
 
   private static final String CMIS_FOLDER_BASE_TYPE = "cmis:folder";
   private static final String CMIS_DOCUMENT_BASE_TYPE = "cmis:document";
-  private static final SimpleDateFormat ISO8601_DATE_FORMATTER = new SimpleDateFormat(
-      "yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT);
 
   // Tab name properties
 
@@ -113,7 +103,6 @@ public class CmisRepositoryConnector ext
   /** Forward to the template to view the specification parameters for the job */
   private static final String VIEW_SPEC_FORWARD = "viewSpecification.html";
 
-
   /**
    * CMIS Session handle
    */
@@ -144,6 +133,10 @@ public class CmisRepositoryConnector ext
 
   protected static final long timeToRelease = 300000L;
   protected long lastSessionFetch = -1L;
+  
+  private boolean enableContentMigration = false;
+  
+  private static final char SLASH = '/';
 
   /**
    * Constructor
@@ -667,6 +660,9 @@ public class CmisRepositoryConnector ext
       SpecificationNode sn = spec.getChild(i);
       if (sn.getType().equals(JOB_STARTPOINT_NODE_TYPE)) {
         cmisQuery = sn.getAttributeValue(CmisConfig.CMIS_QUERY_PARAM);
+        if(StringUtils.isNotEmpty(sn.getAttributeValue(CmisConfig.CONTENT_MIGRATION_PARAM))){
+        	enableContentMigration = Boolean.valueOf(sn.getAttributeValue(CmisConfig.CONTENT_MIGRATION_PARAM));
+        }
         break;
       }
     }
@@ -676,18 +672,18 @@ public class CmisRepositoryConnector ext
       ItemIterable<CmisObject> cmisObjects = session.getRootFolder()
           .getChildren();
       for (CmisObject cmisObject : cmisObjects) {
-        activities.addSeedDocument(cmisObject.getId());
-      }
+          activities.addSeedDocument(cmisObject.getId());
+      	}
     } else {
       cmisQuery = CmisRepositoryConnectorUtils.getCmisQueryWithObjectId(cmisQuery);
       ItemIterable<QueryResult> results = session.query(cmisQuery, false).getPage(1000000000);
       for (QueryResult result : results) {
-        String id = result.getPropertyValueById(PropertyIds.OBJECT_ID);
-        activities.addSeedDocument(id);
-      }
+      		String id = result.getPropertyValueById(PropertyIds.OBJECT_ID);
+          activities.addSeedDocument(id);
+      	}
     }
 
-    return "";
+    return StringUtils.EMPTY;
   }
 
 
@@ -919,15 +915,19 @@ public class CmisRepositoryConnector ext
   private static void fillInCMISQuerySpecificationMap(Map<String,String> newMap, Specification
ds)
   {
     int i = 0;
-    String cmisQuery = "";
+    String cmisQuery = StringUtils.EMPTY;
+    String contentMigration = StringUtils.EMPTY;
     while (i < ds.getChildCount()) {
       SpecificationNode sn = ds.getChild(i);
       if (sn.getType().equals(JOB_STARTPOINT_NODE_TYPE)) {
         cmisQuery = sn.getAttributeValue(CmisConfig.CMIS_QUERY_PARAM);
+        contentMigration = sn.getAttributeValue(CmisConfig.CONTENT_MIGRATION_PARAM);
       }
       i++;
     }
     newMap.put(CmisConfig.CMIS_QUERY_PARAM, cmisQuery);
+    newMap.put(CmisConfig.CONTENT_MIGRATION_PARAM, contentMigration);
+
   }
 
   /** View specification.
@@ -973,7 +973,8 @@ public class CmisRepositoryConnector ext
     String seqPrefix = "s"+connectionSequenceNumber+"_";
 
     String cmisQuery = variableContext.getParameter(seqPrefix + CmisConfig.CMIS_QUERY_PARAM);
-    if (cmisQuery != null) {
+    String contentMigration = variableContext.getParameter(seqPrefix + CmisConfig.CONTENT_MIGRATION_PARAM);
+    if (cmisQuery != null || contentMigration != null) {
       int i = 0;
       while (i < ds.getChildCount()) {
         SpecificationNode oldNode = ds.getChild(i);
@@ -983,9 +984,24 @@ public class CmisRepositoryConnector ext
         }
         i++;
       }
+  
       SpecificationNode node = new SpecificationNode(JOB_STARTPOINT_NODE_TYPE);
       node.setAttribute(CmisConfig.CMIS_QUERY_PARAM, cmisQuery);
       variableContext.setParameter(CmisConfig.CMIS_QUERY_PARAM, cmisQuery);
+      
+      //Content Migration
+      if(StringUtils.isEmpty(contentMigration)
+      		|| StringUtils.equalsIgnoreCase(contentMigration, Boolean.FALSE.toString()) ){
+      	contentMigration = Boolean.FALSE.toString();
+      	enableContentMigration = false;
+      } else {
+      	contentMigration = Boolean.TRUE.toString();
+      	enableContentMigration = true;
+      }
+
+      node.setAttribute(CmisConfig.CONTENT_MIGRATION_PARAM, contentMigration);
+      variableContext.setParameter(CmisConfig.CONTENT_MIGRATION_PARAM, contentMigration);
+      
       ds.addChild(ds.getChildCount(), node);
     }
     return null;
@@ -1093,7 +1109,6 @@ public class CmisRepositoryConnector ext
       }
 
       if (cmisObject == null) {
-        //System.out.println(" doesn't exist");
         activities.deleteDocument(documentIdentifier);
         continue;
       }
@@ -1119,8 +1134,8 @@ public class CmisRepositoryConnector ext
             long lmdSeconds = document.getLastModificationDate().getTimeInMillis();
             versionString = documentIdentifier + lmdSeconds + ":" + cmisQuery;
         } else {
-          //System.out.println(" is NOT latest vrersion");
-          activities.deleteDocument(documentIdentifier);
+          //System.out.println(" is NOT latest version");
+        	activities.deleteDocument(documentIdentifier);
           continue;
         }
       } else {
@@ -1159,41 +1174,51 @@ public class CmisRepositoryConnector ext
             String fileName = document.getContentStreamFileName();
             String mimeType = document.getContentStreamMimeType();
             //documentURI
-            String documentURI = CmisRepositoryConnectorUtils.getDocumentURL(document, session);
-
-            // Do any filtering (which will save us work)
-            if (!activities.checkURLIndexable(documentURI))
-            {
-              activities.noDocument(documentIdentifier,versionString);
-              errorCode = activities.EXCLUDED_URL;
-              errorDesc = "Excluding due to URL ('"+documentURI+"')";
-              continue;
-            }
-
-            if (!activities.checkMimeTypeIndexable(mimeType))
-            {
-              activities.noDocument(documentIdentifier,versionString);
-              errorCode = activities.EXCLUDED_MIMETYPE;
-              errorDesc = "Excluding due to mime type ("+mimeType+")";
-              continue;
+            String documentURI = StringUtils.EMPTY;
+            if(enableContentMigration) {
+            	String path = document.getPropertyValue(PropertyIds.PATH);
+            	String name = document.getName();
+            	String fullContentPath = path + SLASH + name;
+            	documentURI = fullContentPath;
+            } else {
+            	documentURI = CmisRepositoryConnectorUtils.getDocumentURL(document, session);
             }
 
-            if (!activities.checkLengthIndexable(fileLength))
-            {
-              activities.noDocument(documentIdentifier,versionString);
-              errorCode = activities.EXCLUDED_LENGTH;
-              errorDesc = "Excluding due to length ("+fileLength+")";
-              continue;
-            }
-
-            if (!activities.checkDateIndexable(modifiedDate))
-            {
-              activities.noDocument(documentIdentifier,versionString);
-              errorCode = activities.EXCLUDED_DATE;
-              errorDesc = "Excluding due to date ("+modifiedDate+")";
-              continue;
+            // Do any filtering (which will save us work)
+            if(!enableContentMigration) {
+	            if (!activities.checkURLIndexable(documentURI))
+	            {
+	              activities.noDocument(documentIdentifier,versionString);
+	              errorCode = IProcessActivity.EXCLUDED_URL;
+	              errorDesc = "Excluding due to URL ('"+documentURI+"')";
+	              continue;
+	            }
+	
+	            if (!activities.checkMimeTypeIndexable(mimeType))
+	            {
+	              activities.noDocument(documentIdentifier,versionString);
+	              errorCode = IProcessActivity.EXCLUDED_MIMETYPE;
+	              errorDesc = "Excluding due to mime type ("+mimeType+")";
+	              continue;
+	            }
+	
+	            if (!activities.checkLengthIndexable(fileLength))
+	            {
+	              activities.noDocument(documentIdentifier,versionString);
+	              errorCode = IProcessActivity.EXCLUDED_LENGTH;
+	              errorDesc = "Excluding due to length ("+fileLength+")";
+	              continue;
+	            }
+	
+	            if (!activities.checkDateIndexable(modifiedDate))
+	            {
+	              activities.noDocument(documentIdentifier,versionString);
+	              errorCode = IProcessActivity.EXCLUDED_DATE;
+	              errorDesc = "Excluding due to date ("+modifiedDate+")";
+	              continue;
+	            }
             }
-
+            
             RepositoryDocument rd = new RepositoryDocument();
             rd.setFileName(fileName);
             rd.setMimeType(mimeType);
@@ -1208,8 +1233,9 @@ public class CmisRepositoryConnector ext
                 is = null;
             } catch (CmisObjectNotFoundException e) {
               // Document gone
-              activities.deleteDocument(documentIdentifier);
+            	activities.deleteDocument(documentIdentifier);
               continue;
+
             }
 
             try {
@@ -1224,7 +1250,7 @@ public class CmisRepositoryConnector ext
               String modifiedQuery = CmisRepositoryConnectorUtils.getCmisQueryWithObjectId(cmisQuery);
 
               //filter the fields selected in the query
-              CmisRepositoryConnectorUtils.addValuesOfProperties(cmisObject.getProperties(),
rd, modifiedQuery);
+              CmisRepositoryConnectorUtils.addValuesOfProperties(document, rd, modifiedQuery);
               //ingestion
 
               try {

Modified: manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnectorUtils.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnectorUtils.java?rev=1807957&r1=1807956&r2=1807957&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnectorUtils.java
(original)
+++ manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnectorUtils.java
Sun Sep 10 18:39:07 2017
@@ -55,6 +55,9 @@ public class CmisRepositoryConnectorUtil
     private static final String SELECT_CLAUSE_TERM_SEP = ",";
     private static final String SELECT_PREFIX = "select ";
     private final static String TOKENIZER_SEP = ",\n\t";
+    
+    /** The standard Path property for ManifoldCF used for migrate contents **/
+    private static final String CONTENT_MIGRATION_PATH_PROPERTY = "manifoldcf:path";
 
     public static final String getDocumentURL(final Document document, final Session session)
             throws ManifoldCFException {
@@ -168,7 +171,18 @@ public class CmisRepositoryConnectorUtil
      * @param rd : object that contains the properties to pass to connector
      * @param cmisQuery : cmis query
      */
-    public static void addValuesOfProperties(final List<Property<?>> props, RepositoryDocument
rd, String cmisQuery) {
+    public static void addValuesOfProperties(Document document, RepositoryDocument rd, String
cmisQuery) {
+    		String primaryPath = StringUtils.EMPTY;
+    		if(document.getPaths() != null) {
+    			primaryPath = document.getPaths().get(0);
+    			try {
+						rd.addField(CONTENT_MIGRATION_PATH_PROPERTY, primaryPath);
+					} catch (ManifoldCFException e) {
+            Logging.connectors.error("Error when adding property[" + CONTENT_MIGRATION_PATH_PROPERTY
+ "] msg=[" + e.getMessage() + "]", e);
+					}
+    		}
+    		
+    		List<Property<?>> props = document.getProperties();
         Map<String, String> cmisQueryColumns = CmisRepositoryConnectorUtils.getSelectMap(cmisQuery);
         boolean isWildcardQuery = CmisRepositoryConnectorUtils.isWildcardQuery(cmisQuery);
         addValuesOfProperty(props, isWildcardQuery, cmisQueryColumns, rd);

Modified: manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/cmis/common_en_US.properties
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/cmis/common_en_US.properties?rev=1807957&r1=1807956&r2=1807957&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/cmis/common_en_US.properties
(original)
+++ manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/cmis/common_en_US.properties
Sun Sep 10 18:39:07 2017
@@ -15,7 +15,7 @@
 
 CmisAuthorityConnector.Endpoint=Endpoint:
 CmisAuthorityConnector.RepositoryID=Repository ID:
-CmisAuthorityConnector.UserMapping=User mapping:
+CmisAuthorityConnector.UserMapping=User Mapping
 CmisAuthorityConnector.TheEndpointMustBeNotNull=The endpoint must be not null
 CmisAuthorityConnector.Parameters=Parameters:
 
@@ -41,8 +41,11 @@ CmisRepositoryConnector.TheServerPortMus
 CmisRepositoryConnector.PathMustNotBeNull=Path must be not null
 
 CmisRepositoryConnector.CMISQuery=CMIS Query
+CmisRepositoryConnector.ContentMigration=Enable Content Migration
 
 CmisRepositoryConnector.CMISQueryColon=CMIS Query:
+CmisRepositoryConnector.ContentMigrationColon=Enable Content Migration:
+
 
 CmisRepositoryConnector.ParametersColon=Parameters:
 CmisRepositoryConnector.UsernameEquals=username=
@@ -55,5 +58,4 @@ CmisRepositoryConnector.PathEquals=path=
 CmisRepositoryConnector.RepositoryIdEquals=repositoryId=
 
 CmisAuthorityConnector.Repository=Repository
-CmisAuthorityConnector.UserMapping=User Mapping
 

Modified: manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/cmis/common_es_ES.properties
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/cmis/common_es_ES.properties?rev=1807957&r1=1807956&r2=1807957&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/cmis/common_es_ES.properties
(original)
+++ manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/cmis/common_es_ES.properties
Sun Sep 10 18:39:07 2017
@@ -16,7 +16,7 @@
 
 CmisAuthorityConnector.Endpoint=Punto final:
 CmisAuthorityConnector.RepositoryID=Identificaciòn de Depósito:
-CmisAuthorityConnector.UserMapping=Trazar un mapa de usuario:
+CmisAuthorityConnector.UserMapping=Trazar un mapa de usuario
 CmisAuthorityConnector.TheEndpointMustBeNotNull=El punto final no debe ser nulo
 CmisAuthorityConnector.Parameters=Parámetros:
 
@@ -42,8 +42,11 @@ CmisRepositoryConnector.TheServerPortMus
 CmisRepositoryConnector.PathMustNotBeNull=El camino debe ser no nulo
 
 CmisRepositoryConnector.CMISQuery=CMIS consulta
+CmisRepositoryConnector.ContentMigration=Habilitar la migración de contenido
 
 CmisRepositoryConnector.CMISQueryColon=CMIS consulta:
+CmisRepositoryConnector.ContentMigrationColon=Habilitar la migración de contenido:
+
 
 CmisRepositoryConnector.ParametersColon=Parámetros:
 CmisRepositoryConnector.UsernameEquals=nombre de usuario=
@@ -56,5 +59,4 @@ CmisRepositoryConnector.PathEquals=camin
 CmisRepositoryConnector.RepositoryIdEquals=Identificaciòn de Depósito=
 
 CmisAuthorityConnector.Repository=Depósito
-CmisAuthorityConnector.UserMapping=Trazar un mapa de usuario
 

Modified: manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/cmis/editSpecification_CMISQuery.html
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/cmis/editSpecification_CMISQuery.html?rev=1807957&r1=1807956&r2=1807957&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/cmis/editSpecification_CMISQuery.html
(original)
+++ manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/cmis/editSpecification_CMISQuery.html
Sun Sep 10 18:39:07 2017
@@ -35,10 +35,28 @@
       </nobr>
     </td>
   </tr>
+  <tr>
+    <td class="description">
+      <nobr>
+        $Encoder.bodyEscape($ResourceBundle.getString('CmisRepositoryConnector.ContentMigrationColon'))
+      </nobr>
+    </td>
+    <td class="value">
+      <nobr>
+        <input type="checkbox" 
+               name="s${SEQNUM}_contentMigration" 
+               value="true" 
+               #if($CONTENTMIGRATION==true) checked 
+               #end
+               />
+      </nobr>
+    </td>
+  </tr>
 </table>
 
 #else
 
 <input type="hidden" name="s${SEQNUM}_cmisQuery" value="$Encoder.attributeEscape($CMISQUERY)"
/>
+<input type="hidden" name="s${SEQNUM}_contentMigration" value="$CONTENTMIGRATION" />
 
 #end

Modified: manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/cmis/viewSpecification.html
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/cmis/viewSpecification.html?rev=1807957&r1=1807956&r2=1807957&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/cmis/viewSpecification.html
(original)
+++ manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/cmis/viewSpecification.html
Sun Sep 10 18:39:07 2017
@@ -26,4 +26,14 @@
       $Encoder.bodyEscape($CMISQUERY)
     </td>
   </tr>
+  <tr>
+    <td class="description">
+      <nobr>
+        $Encoder.bodyEscape($ResourceBundle.getString('CmisRepositoryConnector.ContentMigrationColon'))
+      </nobr>
+    </td>
+    <td class="value">
+      $CONTENTMIGRATION
+    </td>
+  </tr>
 </table>

Modified: manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/pom.xml
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/pom.xml?rev=1807957&r1=1807956&r2=1807957&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/pom.xml (original)
+++ manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/pom.xml Sun Sep 10 18:39:07
2017
@@ -131,7 +131,7 @@
                 <artifactItem>
                   <groupId>org.apache.chemistry.opencmis</groupId>
                   <artifactId>chemistry-opencmis-server-inmemory</artifactId>
-                  <version>0.13.0</version>
+                  <version>1.1.0</version>
                   <type>war</type>
                   <overWrite>false</overWrite>
                   <destFileName>chemistry-opencmis-server-inmemory.war</destFileName>
@@ -257,7 +257,7 @@
     <dependency>
         <groupId>org.apache.chemistry.opencmis</groupId>
         <artifactId>chemistry-opencmis-client-impl</artifactId>
-        <version>0.13.0</version>
+        <version>1.1.0</version>
      </dependency>
      <dependency>
         <groupId>commons-lang</groupId>
@@ -307,7 +307,7 @@
     <dependency>
       <groupId>org.apache.chemistry.opencmis</groupId>
       <artifactId>chemistry-opencmis-server-inmemory</artifactId>
-      <version>0.13.0</version>
+      <version>1.1.0</version>
       <type>war</type>
       <scope>test</scope>
     </dependency>



Mime
View raw message