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

nancyg
Champ in-the-making
Champ in-the-making
Hello -

Have you seen the wiki page, http://wiki.alfresco.com/wiki/CMIS#Data_Lists_Access_Via_CMIS. It has some data list examples.

Nancy

sandhya25186
Champ in-the-making
Champ in-the-making
Hello Nancy,
Thanks for replying.
I was following the sane wiki and i am able to access

1) List of datalist within a site
2) List of Items within a data list

When I reach the page showing the datalist Items
b55ce555-9d27-463f-8d2c-33dd4dc3ab19 Children
b55ce555-9d27-463f-8d2c-33dd4dc3ab19 Children
  
3e72f5e0-2050-41fd-9dc9-b17a4221f808
Monday, June 07, 2010 11:43 AM
testing description
Media files
content

I dont know what I am doing wrong because when i access the datalist through share site, I am able to view it
Also im not making any modifications anywhere., just clicking on the content link mentioned above Smiley Sad

with the "content" part linking to URL : http://localhost:8080/alfresco/s/cmis/s/workspaceSmiley FrustratedpacesStore/i/80cc85f3-39cb-4b03-aa45-f051e7fa50fe/c...

which gives following exception :
404 Description:    Requested resource is not available.

Message:   05070005 Unable to find NodeIdReference[storeRef=workspace://SpacesStore,id=80cc85f3-39cb-4b03-aa45-f051e7fa50fe]
   
Exception:   org.springframework.extensions.webscripts.WebScriptException - 05070005 Unable to find NodeIdReference[storeRef=workspace://SpacesStore,id=80cc85f3-39cb-4b03-aa45-f051e7fa50fe]
   
   org.alfresco.repo.web.scripts.content.ContentGet.execute(ContentGet.java:135)
   org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:367)
   org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:321)
   org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:417)
   org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:434)
   org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:298)
   org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:319)
   org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:177)
   org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:116)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
   org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
   org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
   org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
   java.lang.Thread.run(Thread.java:595)
   

richard_im
Champ in-the-making
Champ in-the-making
I am not sure exactly what you are after, but I was able to gain access to the datalistitem through CMIS

http://localhost:8080/alfresco/s/cmis/p/sites/corporate/dataLists/e4dbd2b5-7f6c-467c-bf5b-c7bb948271...

Abstracting this ends up becoming
http://localhost:8080/alfresco/s/cmis/p/sites/[sitename]/dataLists/[datalistname]/[datalistitemname]

datalistname: this ends up being the name of the folder created for the datalist.  this is the container to the datalistitems that are stored.
datalistitemname: this is the actual content node created, which infact is 0 byte node.  however, it's the properties on this node which become the actual attributes of the item.

You can see what the actual names are in Alfresco Explorer by going to the /Sites/[sitename]/dataLists/ folder.

sandhya25186
Champ in-the-making
Champ in-the-making
Hello Richard,

I was aiming at gaining access to exactly the same thing u described , i.e. the Data List items contents.Earlier I was accessing the datalist items using the same URL u gave,but when i am looking at the xml file generated through your way , i.e.
http://localhost:8080/alfresco/s/cmis/p/sites/ac/dataLists/7f35869e-7dc3-4f7d-b81b-527b796f8438/ce96...
I noticed that a few fields were missing.Let me give u an example of what I am doing.
1) created a site with site URL = ac
2) create datalist with name = myIssues, type = dl:issue

The columns are IssueId,Title,AssignedTo,status,Priority,Description,Due Date,comments,Attachments.

Now all these fields Values I am getting from the resulting file of above URL but the bold lettered fields : {Assigned To,Attachments} are not there.May be because they are of Type {Person,File}.
So u see I need all the contents of the datalist Items including the Assigned To {Person} and Attachment{file} types.

Ive seen the section "Data List Advanced Capabilities" in http://wiki.alfresco.com/wiki/CMIS where it is referring to document attachments and person assignments using the url
http://localhost:8080/alfresco/s/cmis/p/sites/ac/dataLists/7f35869e-7dc3-4f7d-b81b-527b796f8438/ce96...

but im getting following result
<?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="3.3.0 (g 2852)">Alfresco (Community)</generator>
<icon>http://localhost:8080/alfresco/images/logo/AlfrescoLogo16.ico</icon>
<id>urn:uuid:5b0a6ff6-aa91-45c2-87fe-0bdb9a2610b2-relationships</id>
<link rel="service" href="http://localhost:8080/alfresco/s/cmis'/>
<link rel="self" href="http://localhost:8080/alfresco/s/cmis/p/Sites/ac/dataLists/7f35869e-7dc3-4f7d-b81b-527b796f8438/ce96...>
<link rel="via" href="http://localhost:8080/alfresco/s/cmis/s/workspace:SpacesStore/i/5b0a6ff6-aa91-45c2-87fe-0bdb9a2610b2...>
<title>ce9605fc-1636-4bbc-81c9-c219b323ee8c Relationships</title>
<updated>2010-06-07T12:49:13.474Z</updated>
<opensearch:totalResults>0</opensearch:totalResults>
<opensearch:startIndex>0</opensearch:startIndex>
<opensearch:itemsPerPage>-1</opensearch:itemsPerPage>
<cmisra:numItems>0</cmisra:numItems>
</feed>
Am I wrong somewhere? :? pleassse help

richard_im
Champ in-the-making
Champ in-the-making
So, I spent some time investigating (couple hours) and my conclusion is that with the existing call you are making, which is a CMIS endpoint, you won't be able to retrieve the data you are after.  Mainly because of this
Note: Only associations between items of type folder and document are exposed (as limited by CMIS domain model), so associations to people are not exposed.
Since a dataListItem is a subclass of cm:content, and the CMIS endpoint only returns folder/document relationships, a cm:content:cm:content (Attachment) wouldn't get returned.

Hopefully, we're just doing something incorrect and another person has an answer…

You can, however utilize our standard data lists endpoint, which requires a HTTP POST to get back the associated attachments and people, instead.  I tried with CURL, but failed, but I'm sure you can dig into it and figure it out.

*EDIT* I've filed a JIRA to see what may be occurring since it should return document->document relationships https://issues.alfresco.com/jira/browse/ALF-3172

sandhya25186
Champ in-the-making
Champ in-the-making
Hello Richard,
Thanks I'll follow up if they are able to resolve this issue https://issues.alfresco.com/jira/browse/ALF-3172

However I couldnt understand your line  "You can, however utilize our standard data lists endpoint, which requires a HTTP POST to get back the associated attachments and people, instead"  Smiley Surprisedops:  Smiley Happy  Smiley Surprisedops:

If you could elaborate the method you are referring to… Smiley Happy

richard_im
Champ in-the-making
Champ in-the-making
Since Alfresco Share is an n-tier UI application, it uses the Alfresco Repository as a data repository layer and the way it accesses it is through REST endpoints, developed as webscripts.  So, if you go to http://localhost:8080/alfresco/service/index/package/org/alfresco/slingshot/datalists , you will see the webscripts called by Share to perform the CRUD operations on the datalists/items.

sandhya25186
Champ in-the-making
Champ in-the-making
Ok..Richard,I have ALREADY tried that and got an Exception there too, if you could check my very first post, this was the second option which I tried and failed.

I created a service to call this Post URL :-
http://localhost:8080/alfresco/service/slingshot/datalists/data/site/ac/dataLists/6891d42a-d1e9-40b8...
which is analogous to :-
POST /alfresco/service/slingshot/datalists/data/site/{site}/{container}/{list}
given in the  service details Page :-
http://localhost:8080/alfresco/service/index/package/org/alfresco/slingshot/datalists

and got the following result :-
 {
    "status" :
  {
    "code" : 500,
    "name" : "Internal Error",
    "description" : "An error inside the HTTP server which prevented it from fulfilling the request."
  }, 
 
  "message" : "05100006 Wrapped Exception (with status template): 05100003 Error during processing of the template 'Expression data is undefined on line 4, column 22 in org\/alfresco\/slingshot\/datalists\/data.post.json.ftl.'. Please contact your system administrator.", 
  "exception" : "org.springframework.extensions.webscripts.WebScriptException - 05100006 Wrapped Exception (with status template): 05100003 Error during processing of the template 'Expression data is undefined on line 4, column 22 in org\/alfresco\/slingshot\/datalists\/data.post.json.ftl.'. Please contact your system administrator.",
 
  "callstack" :
  [
       ""      ,"freemarker.core.InvalidReferenceException: Expression data is undefined on line 4, column 22 in org\/alfresco\/slingshot\/datalists\/data.post.json.ftl."
      ,"freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)"
      ,"freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:134)"
      ,"freemarker.core.Dot._getAsTemplateModel(Dot.java:78)"
      ,"freemarker.core.Expression.getAsTemplateModel(Expression.java:89)"
      ,"freemarker.core.Dot._getAsTemplateModel(Dot.java:74)"
      ,"freemarker.core.Expression.getAsTemplateModel(Expression.java:89)"
      ,"freemarker.core.NumericalBuiltins$cBI._getAsTemplateModel(NumericalBuiltins.java:156)"
      ,"freemarker.core.Expression.getAsTemplateModel(Expression.java:89)"
      ,"freemarker.core.ListLiteral.getModelList(ListLiteral.java:119)"
      ,"freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:89)"
      ,"freemarker.core.Expression.getAsTemplateModel(Expression.java:89)"
      ,"freemarker.core.Expression.getStringValue(Expression.java:93)"
      ,"freemarker.core.DollarVariable.accept(DollarVariable.java:76)"
      ,"freemarker.core.Environment.visit(Environment.java:208)"
      ,"freemarker.core.MixedContent.accept(MixedContent.java:92)"
      ,"freemarker.core.Environment.visit(Environment.java:208)"
      ,"freemarker.core.EscapeBlock.accept(EscapeBlock.java:84)"
      ,"freemarker.core.Environment.visit(Environment.java:208)"
      ,"freemarker.core.MixedContent.accept(MixedContent.java:92)"
      ,"freemarker.core.Environment.visit(Environment.java:208)"
      ,"freemarker.core.Environment.process(Environment.java:188)"
      ,"freemarker.template.Template.process(Template.java:237)"
      ,"org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:197)"
      ,"org.springframework.extensions.webscripts.AbstractWebScript.renderTemplate(AbstractWebScript.java:578)"
      ,"org.springframework.extensions.webscripts.DeclarativeWebScript.renderFormatTemplate(DeclarativeWebScript.java:263)"
      ,"org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:143)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:367)"
      ,"org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:321)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:417)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:434)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:298)"
      ,"org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:319)"
      ,"org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:177)"
      ,"org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:116)"
      ,"javax.servlet.http.HttpServlet.service(HttpServlet.java:717)"
      ,"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)"
      ,"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)"
      ,"org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)"
      ,"org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)"
      ,"org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)"
      ,"org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)"
      ,"org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)"
      ,"org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)"
      ,"org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)"
      ,"org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)"
      ,"org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)"
      ,"java.lang.Thread.run(Thread.java:595)"
      ,"org.alfresco.service.cmr.repository.TemplateException: 05100003 Error during processing of the template 'Expression data is undefined on line 4, column 22 in org\/alfresco\/slingshot\/datalists\/data.post.json.ftl.'. Please contact your system administrator."
      ,"org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:201)"
      ,"org.springframework.extensions.webscripts.WebScriptException: 05100006 Wrapped Exception (with status template): 05100003 Error during processing of the template 'Expression data is undefined on line 4, column 22 in org\/alfresco\/slingshot\/datalists\/data.post.json.ftl.'. Please contact your system administrator."
      ,"org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:740)"

  ],
 
  "server" : "Community v3.3.0 (g 2852) schema 4,100",
  "time" : "Jun 10, 2010 6:19:32 AM"
}

Is this what you were also getting? :?:

richard_im
Champ in-the-making
Champ in-the-making
It is what I was getting.  You'll need to debug the javascript to see why the data object is not being populated with anything.  A little more digging will get you there.  It works, obviously, since in Share you can see the items being rendered.  This is the exact URL Share is calling.  I believe it has to do with what is being passed to the URL or something else minor.