MichaelDaum / cmis-perl

cmis bindings for perl
http://foswiki.org/Extensions/CmisPlugin
6 stars 3 forks source link

$entry->getContentLink gets all links in a folder #6

Open jbueren opened 9 years ago

jbueren commented 9 years ago

If I iterate over all entries in a given folder, like this:

while ((my $entry = $child_content->getNext())){ a) Dump($entry) b) my $link = $entry->getContentLink(); }

a) if I dump just the entry, I get only the name of the doc (cmis:title = mydoc):

              'cmis:name' => bless( {
                                                     'queryName' => 'cmis:name',
                                                     'propertyDefinitionId' => 'cmis:name',
                                                     'localName' => 'name',
                                                     'value' => "Auswertung Januar.pdf",
                                                     'displayName' => 'Name'
                                                   }, 'WebService::Cmis::Property::String' ),

That's great and this is what I expect, but:

b) gives me all links concated for all entries in this folder like this (just showing the first three):

2014-11-11 13:50:07 887 [6886] : link: http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.0/atom/content/Auswertung%20Januar?id=259f2aab-4ffb-43ff-8538-76b145dd56b6%3B1.0http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.0/atom/content/Linet%20201400174.pdf?id=bda076b2-1d20-4121-81d2-423d71ea9084%3B1.0http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.0/atom/content/Bildband_323%20Januar%202014.pdf?id=37bcf690-0d0c-483c-807d-bccc7c570867%3B1.0http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.0/atom/content/Jahresbereicht%2014.02.2014.pdf?id=6ad3e2bc-9cb1-4e4c-a2af-dcb73e3db917%3B1.0http://localhost:8080/

I connect to the atom repo with localhost:8080, maybe the domain with the corresponding port is somewhere not escaped / interpolated or regexed correctly?

Here is my binding URL for Alfresco 4.2f: http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.0/atom

Thanks!

jbueren commented 9 years ago

Hi, I wrote a short script to clarify this issue. The problem is indeed that I get more than one: "content src" xml-entry in the server reply.

Here are my params: I connect against Alfresco 4.2f, with the atom pub binding 1.0:

 my $source_folder = $repo->getObjectByPath("/Benutzer-Homes/kopierer/eingescannte Belege/");

  # simple return if we can't find a folder
  if (!$source_folder) {
    exit;
  }

  my $child_content = $source_folder->getChildren();
  # iterate all entries
  while ((my $entry = $child_content->getNext())){
    # for now we skip folders
    next if ($entry->isa("WebService::Cmis::Folder"));

    print "entry: " . Dumper($entry);
    # this entry has all the "content src"-entries in the xml answer
    # for all documents in the folder

    my $entry_object_id = $entry->getProperty("cmis:objectId");

    my $single_entry         = $repo->getObject($entry_object_id);
    print "mein einfacher eintrag:" . Dumper($single_entry);
    # this entry is fine

  }

Therefore my first idea (wrong regex etc) is plain wrong. Something else is mixed up.

Just a guess: It seems, that $child_content->getNext, gets all the correct attributes, but is not getting the 'new' atom feed (just for this single element).

I can upload the script or do a test against a official repo or whatever might be helpful.

Thanks,

Jan