cancel
Showing results for 
Search instead for 
Did you mean: 

how to retrieve DataList items' content for a site? :(

sandhya25186
Champ in-the-making
Champ in-the-making
so far ive tried CMIS
http://localhost:8080/alfresco/s/cmis/s/workspaceSmiley FrustratedpacesStore/i/fc9545c6-c5cb-40f4-a174-fa71869e2a12/c...
but the link gives me 404 page not found error (Im successfully reahcing the DataList item node identifiers)

then i tried WebScript APIs

POST /alfresco/service/slingshot/datalists/data/site/{site}/{container}/{list} becomes :-
http://localhost:8080/alfresco/service/slingshot/datalists/data/site/test/dataLists/list/f84c2510-f0...

but this is also giving me null pointer exception Smiley Sad
will somebody tell me where i am going wrong? or an alternative way to access the contents of a datalist's items…
13 REPLIES 13

mikeh
Star Contributor
Star Contributor
There's a JSON body that needs to be POSTed. Use Firebug or Web Inspector on Share's datalist page to see the format.

Thanks,
Mike

richard_im
Champ in-the-making
Champ in-the-making
Mike, Thanks!

Here's what it expects in the post body:
{"fields":["cm_title","cm_description","dl_ganttStartDate","dl_ganttEndDate","dl_taskAssignee","dl_taskPriority","dl_taskStatus","dl_ganttPercentComplete","dl_taskComments","cm_attachments"],"filter":{"filterData":"","filterId":"all"}}

I wish you luck in your quest!

sandhya25186
Champ in-the-making
Champ in-the-making
yess!!!!!

Just the Post body had to be sent and it was all there !!!
first the
field items in the Json Body needed to be determined by :-
http://localhost:8080/share/service/components/data-lists/config/columns?itemType={dl: datalist type e.g. dl:location}

then  the field Items to be populated in the Post body as
{"fields":["cm_title","dl_locationAddress1","dl_locationAddress2","dl_locationAddress3","dl_locationZip","dl_locationState","dl_locationCountry","cm_description","cm_attachments"],"filter":{"filterData":"","filterId":"all"}}

Result : DataItems in The datalist.

Thanks a bunch Richard and Mike !!! u guys rock  😎  😎  😎

http
Champ in-the-making
Champ in-the-making
hi all,

https://issues.alfresco.com/jira/browse/ALF-3172 was closed with a comment that it works as designed and when modelling the attachment as a cm:content, the relations should show up in the getRelationships CMIS request.

this does not seem to work. possibly i've messed up something in the configuration.

i've got following model:

<?xml version="1.0" encoding="UTF-8"?>
<!– Definition of new Model –>
<model name="mycorp:myMeetingDataListModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <!– Optional meta-data about the model –>
   <description>my Meeting Data List Model</description>
   <author>corporate</author>
   <version>1.0</version>

   <!– Imports are required to allow references to definitions in other models –>
   <imports>
      <!– Import Alfresco Dictionary Definitions –>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
      <!– Import Alfresco Content Domain Model Definitions –>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
      <import uri="http://www.alfresco.org/model/system/1.0" prefix="sys" />
      <import uri="http://www.alfresco.org/model/datalist/1.0" prefix="dl" />
   </imports>

   <!– Introduction of new namespaces defined by this model –>
   <namespaces>
      <namespace uri="http://www.corporate.ch/model/myMeetingDataList/1.0" prefix="mycorp" />
   </namespaces>

   <types>
      <type name="mycorp:myMeetingList">
         <title>my Meeting Agenda</title>
         <parent>dl:dataListItem</parent>
         <properties>
            <property name="mycorp:order">
               <title>Order</title>
               <type>d:int</type>
               <mandatory>false</mandatory>
            </property>
            <property name="mycorp:title">
               <title>Title</title>
               <type>d:text</type>
               <mandatory>true</mandatory>
            </property>
            <property name="mycorp:presenters">
               <title>Presenters</title>
               <type>d:text</type>
               <mandatory>false</mandatory>
            </property>
         </properties>

         <associations>
            <association name="mycorp:docattachments">
               <title>Attachmentsmycorp</title>
               <source>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </source>
               <target>
                  <class>cm:content</class>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
            </association>
         </associations>

      </type>
   </types>
</model>

with one data list with one item with two attachments created in share.

the request to http://localhost:8080/alfresco/s/cmis/p/sites/corporate/dataLists/6b09a5c6-bcc2-4155-8271-60591a71fb... does not return the attachments as relations:


<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/" xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/" xmlns:alf="http://www.alfresco.org" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
  <author><name>admin</name></author>
  <generator version="4.0.0 (4003)">Alfresco (Community)</generator>
  <icon>http://localhost:8080/alfresco/images/logo/AlfrescoLogo16.ico</icon>
  <id>urn:uuid:3455fa61-1b00-4674-8f6a-f19db8a93c9e-relationships</id>
  <link rel="service" href="http://localhost:8080/alfresco/s/cmis'/>
  <link rel="self" href="http://localhost:8080/alfresco/s/cmis/p/sites/corporate/dataLists/6b09a5c6-bcc2-4155-8271-60591a71fb...>
  <link rel="via" href="http://localhost:8080/alfresco/s/cmis/s/workspace:SpacesStore/i/3455fa61-1b00-4674-8f6a-f19db8a93c9e...>
  <title>c7c27116-4e31-4ecd-a526-ab4e98f06e07 Relationships</title>
  <updated>2012-03-26T12:38:21.623+02:00</updated>
  <opensearch:totalResults>0</opensearch:totalResults>
  <opensearch:startIndex>0</opensearch:startIndex>
  <opensearch:itemsPerPage>-1</opensearch:itemsPerPage>
  <cmisra:numItems>0</cmisra:numItems>
</feed>

in a request determining all descendants of the site, to http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/08a25680-3a38-475b-8bff-598fa1..., the attachments show up fine.

what am i doing wrong?

thanks in advance for your help.
cheers,
gabor