Alfresco CMIS: Retrieving relevant context when searching for content - alfresco

I am using Alfresco Community 201707 x64. My application is querying the repository via CMIS, using Apache Chemistry Open CMIS 1.1.
The question, as the title suggests, is: when querying the repository for document content (using the CONTAINS predicate on the search query), how do I retrieve a document's relevant context? Can I do it using CMIS, or do I have to use a different approach?
For example, in Alfresco Share, when a user searches the repository for documents containing some word, the relevant results are displayed with a snippet of the document's content with said word highlighted.

I do not think this is available in CMIS, it is however generally available if using SOLR, depending on Alfresco version.
http://docs.alfresco.com/5.2/concepts/search-api-highlight.html

As said by #Lista,
It is a new feature coming with Alfresco 5.2.1 : http://docs.alfresco.com/5.2/concepts/search-api-highlight.html
You can use it by making a call to the /search endpoint :
The Search API provides access to the search features of Alfresco
Content Services.
The Search API accepts POST requests containing JSON structures as
described in the table below. The JSON is structured to group options
related to different query concepts together.
The Search API is defined under the search namespace. It uses the
/search endpoint, which does not accept any URL parameters and is
therefore, completely controlled via the parameters in a POST body.
But as far as I know, this is not possible to do it by CMIS. Can you switch the way you are interacting with Alfresco (the REST way) ?

Related

How to create custom JSON-API resource drupal 8

I have issues with creating custom JSON API resource which will be visible on mydrupalsite/jsonapi link.
I have found this example:
https://glamanate.com/blog/using-json-api-query-your-search-api-indexes
which shows how to create custom resource but it is outdated. I tried to make a custom module looking in this article, but it doesn't work anymore because json-api module has changed.
For example, I want to show all nodes and make the jsonapi endpoint of type nodes--all which will serve all the nodes of my Drupal site.
I am using drupal 8.7.1 and JSON API core module.
I have tried to google this problem, but there are no examples for creating custom json api endpoints.
For final result i want to make jsonapi endpoint for example: mydrupalsite/jsonapi/nodes/all which will serve all nodes.
You could declare REST endpoints within a custom module.
In /modules/custom/mymodule/src/Plugin/rest/resrouce/MyEndPoints.php, create a class extending ResourceBase, according to https://www.drupal.org/docs/8/api/restful-web-services-api/custom-rest-resources.
Then you could define which set of nodes you want to expose, use query parameters to filter them, paginate, or do whatever you want.
See also : https://medium.com/#emerico/create-custom-rest-resource-for-get-and-post-method-in-drupal-8-e445330be3ff
I successfully used this technique to get events displayed with FullCalendar library, I can elaborate on this if it helps.
Good luck with it
The module does not currently support external connection to its internal-use-only API according to the JSON:API's module maintainers, hence why your referenced module does not work anymore.
There are plans for the mixed bundle you are requesting. See the thread below for the discussion.
https://www.drupal.org/project/jsonapi_extras/issues/2956414
Checkout JSON:API Cross Bundles
We discussed this in Decoupled Days 2019. We came to the following
conclussions:
We will put this under a different contrib as per my request ☺️ jsonapi_cross_bundles
There will only be support for GET
The edge cases in filtering will be solved using whatever stance Entity Query API uses.
In parallel we'll create a JSON:API issue to add a payload to the 404 routes like /jsonapi/node that will contain: (a) a list of links
to the resource types for that entity type, and (b) link to a
documentation page explaining the cross bundle situation (maybe even
mentioning the experimental jsonapi_cross_bundles module).
Source: https://www.drupal.org/project/jsonapi_extras/issues/2956414#comment-13189872
As of 2021, the best way to do this is the JSON:API Resources module.
This module allows you to add your own JSON:API endpoints in a custom module.
There are several examples of how to define your own resources.

Create Connetor CMIS BonitaSoft

I'm working with BonitaSoft Community version 7.6.3 and I want to create a CMIS connector to list the folders and documents for version 5.2 of Alfresco. I noticed that for this version of Bonita many connectors that existed in version 5.9.1 disappeared. When I asked the question how could I list Alfresco's folders and documents indicated that I would have to create a connector, however when reading the documentation for UI Designer forms it is not possible and that the solution would be REST API extension. When I analyze information about how to create REST API extensions it only gives Performance, Efficiency and Teamwork. How can I get around this?
The REST API extension documentation page has been updated and now cover the community edition as well.
Note that connector are used when you need to interact between Bonita process execution and an external system. Execution of connectors happen on the Bonita server. When executed, a connector has access to a context that includes information about the current process definition, instance and task instance.
REST API extension are usually call from the user web browser. More precisely it is the forms or pages served by Bonita that will execute the REST API call. REST API is executed on the Bonita server but has no context information about the currently running process or task. If you need such information you need to provide them as part of the REST API extension.

Embed Alfresco WebPreviewer in my own website

I have a Spring MVC application that connect with Alfresco using CMIS libraries, actually I can upload documents and download it but I need integrate Alfresco's WebPreviewer to preview documents in my app.
I found some code here but I don't know how to do it
It's hard to say for certain because of the limited amount of information that you've provided, but I think that the problem that you're going to be faced with when trying to use any of the existing previewer code is one of authentication. If you're using only using CMIS then you won't be able to use any of the WebScript based REST APIs that the Alfresco widgets will be using.
There are two possible previewer widgets that you can use - the older YUI2 based previewer (that you'd currently find in the document details page and the Document Library film strip view, and the newer Aikau component that you'd find in the faceted search previewer (from version 5.0 onwards).
I suspect that you won't be able to re-use either of these components without either authenticating against Alfresco in a way that allows you to access the WebScript based REST APIs or extending and customizing those widgets.
You've said that you have your own Spring MVC application, but you haven't said whether or not that is using the Surf extension - if it is, and you're using the authentication capabilities provided by Surf then you will be authenticated to use those REST APIs - as the Surf authentication provides access across all APIs (including CMIS) via a single authentication.
If you are able to access those APIs then you should be able to follow the steps outlined in both the form post and the blog posts in your own question and the previous answer, however - based on your question I suspect that you can't do that.
If you've not come across it, you might be interested in the Aikau archetype that builds a ready-made Alfresco client using Surf (see this link) and that tutorial also shows how to use the Aikau previewer (see here).
Because this is providing you with a Spring MVC client that is preconfigured to authenticate against Alfresco, you might be able to port your application to use it.
Otherwise, as I said earlier - chances are you'll need to extend the existing widgets to use the CMIS APIs to render the previewers. Again, Aikau is easier to extend that the old YUI2 widgets - but is reliant on Surf.

Alfresco: Get list of nodes with updated ACL/permission

I am exploring Alfresco Web scripts and CMIS API's, and looking for an API or some way to figure out the nodes whose ACL/permission is modified after some specified time/timestamp in Alfresco.
I am able to get nodes with modified metadata using CMIS QUERY API, but regarding only ACL/permission modification its not working.
For now, I am crawling all nodes and checking its modification date with respect to earlier/last crawl datetime. This doesn't seem to be a proper approach.
For more details, here is the link of query posted earlier on alfresco forum:Fetch the list of nodes whose permission is updated/modified
Could anyone please assist.
I have figured out the solution, using CMISChangeLog application, which need to be enabled on Alfresco server. Also, with the help of CMIS 1.1 Atom Api's, the CMIS change log query works fine on both the Alfresco version, 4.x and 5.x.

How to get and set custom metadata values in Alfresco via REST API?

Please help me to get/set metadata by REST API Calls.I am Using Alfresco 5.0 version.
Unfortunately the Alfresco REST API is limited to a small subset wich doesn't support (custom) metadata. Alfresco expects you use CMIS instead. Since CMIS may be too complicated / an overkill to integrate in your use case you could still create your own WebScripts to enable RESTful methods as you expect. This is straight forward. Take a look into the Web_Scripts_Examples and the official Web Scripts Documentation
You can find details of all existing rest api on below link
http://host:port/alfresco/service/index/all
If the api does not exist on above than you need to create your custom one.I am not sure about metadata.But you can find it on above link.

Resources