SilverHoodCorp / gdata-java-client

Automatically exported from code.google.com/p/gdata-java-client
Apache License 2.0
0 stars 0 forks source link

com.google.gdata.util.InvalidEntryException: Unexpected resource version ID #378

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I'm trying to modify ACL permissions on a shared object and a object that is 
common to the local domain. The error is displayed in the subject of this post 
and the method is listed below.

Any thoughts would be helpful - thanks paul...

-----code listing (it ain't pretty yet ;)

public void takeOwnershipOnAllEntries(DocumentListFeed allEntries, DocsService 
client){
          int i=1;        
          for (DocumentListEntry entry : allEntries.getEntries()) {
              System.out.println("takeOwnershipOnAllEntries - entry -> " + entry.getTitle().getPlainText() + " ");
              try {
                @SuppressWarnings("unused")
                AclFeed feed = client.getFeed(new URL(entry.getAclFeedLink().getHref()), AclFeed.class);

                for (AclEntry aentry : feed.getEntries()){
                    System.out.println(" Scope Value " + aentry.getScope().getValue() + " Scope Type (" + aentry.getScope().getType() + ") : Role Value - " + aentry.getRole().getValue());
                    if (aentry.getScope().getValue().contains("compoundthoughts.com")){
                        //aentry.getScope().setValue("paul.ford@mwgdemo.com");
                        //aentry.setScope("writer");
                        AclRole role = new AclRole("writer");
                        AclScope scope = new AclScope(AclScope.Type.USER, "paul.ford@mwgdemo.com");

                        AclEntry aclEntry = new AclEntry();

                        aclEntry.setRole(role);
                        aclEntry.setScope(scope);

                        //client.insert(new URL(entry.getAclFeedLink().getHref()), aclEntry);
                        client.update(new URL(entry.getAclFeedLink().getHref()), aclEntry);

                    } else {
                        AclRole role = new AclRole("reader");
                        AclScope scope = new AclScope(AclScope.Type.USER, "paul.ford@mwgdemo.com");

                        AclEntry aclEntry = new AclEntry();

                        aclEntry.setRole(role);
                        aclEntry.setScope(scope);

                        //client.insert(new URL(entry.getAclFeedLink().getHref()), aclEntry);
                        client.update(new URL(entry.getAclFeedLink().getHref()), aclEntry);

                    }
                    System.out.println(" Scope Value " + aentry.getScope().getValue() + " Scope Type (" + aentry.getScope().getType() + ") : Role Value - " + aentry.getRole().getValue());
                }
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            i++;
          }
      }

Original issue reported on code.google.com by paul.f...@mwgdemo.com on 1 Feb 2012 at 9:08