Commits

Daniel Blezek committed 2bd3d3a

Checkpoint

Comments (0)

Files changed (3)

Source/org/xnat/xnatfs/webdav/Project.java

     mElementURL = mURL + "subjects?format=json";
     mVerboseDirectoryName = "Subjects";
     mExtraChildren.add ( sResources );
+    if ( name.equals ( mVerboseDirectoryName ) ) {
+      logger.debug ( "Directory is: " + tail ( dirname ( mAbsolutePath ) ) );
+      mFallbackChildKeys.add ( "sub_project_identifier_" + tail ( dirname ( mAbsolutePath ) ).toLowerCase () );
+    } else {
+      mFallbackChildKeys.add ( "sub_project_identifier_" + name.toLowerCase () );
+    }
   }
 
   /*

Source/org/xnat/xnatfs/webdav/Scan.java

    */
   public Scan ( XNATFS x, String path, String name, String url ) {
     super ( x, path, name, url );
+    mElementURL = mURL + mName.toLowerCase () + "?format=json";
     mElementURL = mURL + "resources?format=json";
     mChildKey = "label";
     mFallbackChildKey = "xnat_abstractresource_id";
+    mFallbackChildKeys.add ( "id" );
     mVerboseDirectoryName = "Resources";
   }
 

Source/org/xnat/xnatfs/webdav/VirtualDirectory.java

   String mURL;
   String mElementURL;
   String mFallbackChildKey = "xnat_abstractresource_id";
+  ArrayList<String> mFallbackChildKeys = new ArrayList<String> ();
 
   // Verbose directory and mExtraChildren are added when the hierarchy is
   // verbose.
         String id = null;
         if ( inKey != null && subjects.getJSONObject ( idx ).has ( inKey ) ) {
           id = subjects.getJSONObject ( idx ).getString ( inKey );
-          // logger.debug ( "Found " + id + " from " + inKey );
+          logger.debug ( "Found " + id + " from " + inKey );
+        }
+        for ( String k : mFallbackChildKeys ) {
+          logger.debug ( "Checking " + k );
+          if ( subjects.getJSONObject ( idx ).has ( k ) ) {
+            id = subjects.getJSONObject ( idx ).getString ( k );
+            break;
+          }
         }
         if ( id == null && subjects.getJSONObject ( idx ).has ( mChildKey ) ) {
           id = subjects.getJSONObject ( idx ).getString ( mChildKey );
         if ( id == null || id.equals ( "" ) && mFallbackChildKey != null && subjects.getJSONObject ( idx ).has ( mFallbackChildKey ) ) {
           id = subjects.getJSONObject ( idx ).getString ( mFallbackChildKey );
         }
+
         if ( id != null ) {
           list.add ( id );
         }