manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1481661 - /manifoldcf/branches/CONNECTORS-688/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java
Date Sun, 12 May 2013 22:13:18 GMT
Author: kwright
Date: Sun May 12 22:13:18 2013
New Revision: 1481661

URL: http://svn.apache.org/r1481661
Log:
Code which hopefully skips documents in the recycle bin

Modified:
    manifoldcf/branches/CONNECTORS-688/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java

Modified: manifoldcf/branches/CONNECTORS-688/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-688/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java?rev=1481661&r1=1481660&r2=1481661&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-688/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java
(original)
+++ manifoldcf/branches/CONNECTORS-688/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java
Sun May 12 22:13:18 2013
@@ -1132,100 +1132,138 @@ public class LivelinkConnector extends o
           {
             // We were able to get rights, so object still exists.
 
-            // I rearranged this on 11/7/2006 so that it would be more parseable, since
-            // we want to pull the transient information out of the version string where
-            // possible (so there is no mismatch between version checking and ingestion).
-
-            StringBuilder sb = new StringBuilder();
-
-            // On 1/17/2008 I changed the version generation code to NOT include metadata,
view info, etc. for folders, since
-            // folders make absolutely no use of this info.
+            // Check to be sure the object is not owned by the recycle bin.
+            boolean recycleBin;
             if (!isFolder)
             {
-              if (includeAllMetadata)
+              Integer owner = value.getOwner();
+              if (owner == null)
+                recycleBin = false;
+              else
               {
-                // Find all the metadata associated with this object, and then
-                // find the set of category pathnames that correspond to it.
-                int[] catIDs = getObjectCategoryIDs(vol,objID);
-                String[] categoryPaths = catAccum.getCategoryPathsAttributeNames(catIDs);
-                // Sort!
-                java.util.Arrays.sort(categoryPaths);
-                // Build the metadata string piece now
-                packList(sb,categoryPaths,'+');
+                if (owner.intValue() >= 0)
+                  recycleBin = false;
+                else
+                {
+                  ObjectInformation ownerInfo = llc.getObjectInformation(0,-owner.intValue());
+                  if (ownerInfo == null)
+                    recycleBin = false;
+                  else
+                  {
+                    Integer subtype = ownerInfo.getSubType();
+                    if (subtype == null || subtype.intValue() != 3030)
+                      recycleBin = false;
+                    else
+                      recycleBin = true;
+                  }
+                }
               }
-              else
-                sb.append(metadataString);
-            }
-
-            String[] actualAcls;
-            String denyAcl;
-            if (acls != null && acls.length == 0)
-            {
-              // No forced acls.  Read the actual acls from livelink, as a set of rights.
-              // We need also to add in support for the special rights objects.  These are:
-              // -1: RIGHT_WORLD
-              // -2: RIGHT_SYSTEM
-              // -3: RIGHT_OWNER
-              // -4: RIGHT_GROUP
-              //
-              // RIGHT_WORLD means guest access.
-              // RIGHT_SYSTEM is "Public Access".
-              // RIGHT_OWNER is access by the owner of the object.
-              // RIGHT_GROUP is access by a member of the base group containing the owner
-              //
-              // These objects are returned by the GetObjectRights() call made above, and
NOT
-              // returned by LLUser.ListObjects().  We have to figure out how to map these
to
-              // things that are
-              // the equivalent of acls.
-
-              actualAcls = lookupTokens(rights, value);
-              java.util.Arrays.sort(actualAcls);
-              // If security is on, no deny acl is needed for the local authority, since
the repository does not support "deny".  But this was added
-              // to be really really really sure.
-              denyAcl = denyToken;
-
-            }
-            else if (acls != null && acls.length > 0)
-            {
-              // Forced acls
-              actualAcls = acls;
-              denyAcl = defaultAuthorityDenyToken;
             }
             else
+              recycleBin = false;
+            
+            if (!recycleBin)
             {
-              // Security is OFF
-              actualAcls = acls;
-              denyAcl = null;
-            }
+              // I rearranged this on 11/7/2006 so that it would be more parseable, since
+              // we want to pull the transient information out of the version string where
+              // possible (so there is no mismatch between version checking and ingestion).
+
+              StringBuilder sb = new StringBuilder();
+
+              // On 1/17/2008 I changed the version generation code to NOT include metadata,
view info, etc. for folders, since
+              // folders make absolutely no use of this info.
+              if (!isFolder)
+              {
+                if (includeAllMetadata)
+                {
+                  // Find all the metadata associated with this object, and then
+                  // find the set of category pathnames that correspond to it.
+                  int[] catIDs = getObjectCategoryIDs(vol,objID);
+                  String[] categoryPaths = catAccum.getCategoryPathsAttributeNames(catIDs);
+                  // Sort!
+                  java.util.Arrays.sort(categoryPaths);
+                  // Build the metadata string piece now
+                  packList(sb,categoryPaths,'+');
+                }
+                else
+                  sb.append(metadataString);
+              }
 
-            // Now encode the acls.  If null, we write a special value.
-            if (actualAcls == null)
-              sb.append('-');
-            else
-            {
-              sb.append('+');
-              packList(sb,actualAcls,'+');
-              // This was added on 4/21/2008 to support forced acls working with the global
default authority.
-              pack(sb,denyAcl,'+');
-            }
+              String[] actualAcls;
+              String denyAcl;
+              if (acls != null && acls.length == 0)
+              {
+                // No forced acls.  Read the actual acls from livelink, as a set of rights.
+                // We need also to add in support for the special rights objects.  These
are:
+                // -1: RIGHT_WORLD
+                // -2: RIGHT_SYSTEM
+                // -3: RIGHT_OWNER
+                // -4: RIGHT_GROUP
+                //
+                // RIGHT_WORLD means guest access.
+                // RIGHT_SYSTEM is "Public Access".
+                // RIGHT_OWNER is access by the owner of the object.
+                // RIGHT_GROUP is access by a member of the base group containing the owner
+                //
+                // These objects are returned by the GetObjectRights() call made above, and
NOT
+                // returned by LLUser.ListObjects().  We have to figure out how to map these
to
+                // things that are
+                // the equivalent of acls.
+
+                actualAcls = lookupTokens(rights, value);
+                java.util.Arrays.sort(actualAcls);
+                // If security is on, no deny acl is needed for the local authority, since
the repository does not support "deny".  But this was added
+                // to be really really really sure.
+                denyAcl = denyToken;
 
-            // The date does not need to be parseable
-            sb.append(dt.toString());
+              }
+              else if (acls != null && acls.length > 0)
+              {
+                // Forced acls
+                actualAcls = acls;
+                denyAcl = defaultAuthorityDenyToken;
+              }
+              else
+              {
+                // Security is OFF
+                actualAcls = acls;
+                denyAcl = null;
+              }
 
-            if (!isFolder)
-            {
-              // PathNameAttributeVersion comes completely from the spec, so we don't
-              // have to worry about it changing.  No need, therefore, to parse it during
-              // processDocuments.
-              sb.append("=").append(pathNameAttributeVersion);
+              // Now encode the acls.  If null, we write a special value.
+              if (actualAcls == null)
+                sb.append('-');
+              else
+              {
+                sb.append('+');
+                packList(sb,actualAcls,'+');
+                // This was added on 4/21/2008 to support forced acls working with the global
default authority.
+                pack(sb,denyAcl,'+');
+              }
 
-              // Tack on ingestCgiPath, to insulate us against changes to the repository
connection setup.  Added 9/7/07.
-              sb.append("_").append(viewBasePath);
-            }
+              // The date does not need to be parseable
+              sb.append(dt.toString());
 
-            rval[i] = sb.toString();
-            if (Logging.connectors.isDebugEnabled())
-              Logging.connectors.debug("Livelink: Successfully calculated version string
for object "+Integer.toString(vol)+":"+Integer.toString(objID)+" : '"+rval[i]+"'");
+              if (!isFolder)
+              {
+                // PathNameAttributeVersion comes completely from the spec, so we don't
+                // have to worry about it changing.  No need, therefore, to parse it during
+                // processDocuments.
+                sb.append("=").append(pathNameAttributeVersion);
+
+                // Tack on ingestCgiPath, to insulate us against changes to the repository
connection setup.  Added 9/7/07.
+                sb.append("_").append(viewBasePath);
+              }
+
+              rval[i] = sb.toString();
+              if (Logging.connectors.isDebugEnabled())
+                Logging.connectors.debug("Livelink: Successfully calculated version string
for object "+Integer.toString(vol)+":"+Integer.toString(objID)+" : '"+rval[i]+"'");
+            }
+            else
+            {
+              if (Logging.connectors.isDebugEnabled())
+                Logging.connectors.debug("Livelink: Recycle bin object "+Integer.toString(vol)+":"+Integer.toString(objID)+"
- deleting");
+            }
           }
           else
           {
@@ -5704,6 +5742,28 @@ public class LivelinkConnector extends o
       return new Integer(elem.toInteger("ParentId")); 
     }
 
+    /* Get owner.
+    */
+    public Integer getOwner()
+      throws ServiceInterruption, ManifoldCFException
+    {
+      LLValue elem = getObjectValue();
+      if (elem == null)
+        return null;
+      return new Integer(elem.toInteger("OWNER")); 
+    }
+
+    /** Get the subtype
+    */
+    public Integer getSubType()
+      throws ServiceInterruption, ManifoldCFException
+    {
+      LLValue elem = getObjectValue();
+      if (elem == null)
+        return null;
+      return new Integer(elem.toInteger("SubType")); 
+    }
+        
     /** Get owner ID.
     */
     public Integer getOwnerId()



Mime
View raw message