Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Save data from AEM to Asp.Net Site by API

Avatar

Avatar
Validate 1
Level 1
Manjurhusen
Level 1

Like

1 like

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
Manjurhusen
Level 1

Like

1 like

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
Manjurhusen
Level 1

15-08-2017

Requirements:

  • We want to create two sites. One in AEM and one in asp.net
  • In AEM site we want to create assets and contents(articles or stories with title, detail and assets). Content page uses specific template like Title, Detail, Image, Video etc
  • Asp.net site uses MSSQL which has table with columns like Title, Detail, ImagePath, VideoPath etc
  • Now our requirement is when user create any new Content in AEM site it must be created in ASP.net site. We want to save data from AEM site to ASP.Net site’s database by API
  • Same behavior should happened for delete and update the Contents.
  • If above requirement is possible then how to know content data changed? For example, if I change only title then how can I know title is only changed?
  • If asset is changed in content then how to know which asset changed in content page?

Questions:

  1. Is above requirement possible?
  2. If above requirement is possible then how to know content data changed? For example, if I change only title then how can I know title is only changed?
  3. If asset is changed in content then how to know which asset changed in content page?
View Entire Topic

Avatar

Avatar
Validate 1
Level 2
rajnishkaushik
Level 2

Likes

7 likes

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
rajnishkaushik
Level 2

Likes

7 likes

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile
rajnishkaushik
Level 2

24-10-2017

Sorry for the late response. Unless you have already figured out the answers to the questions, here are quick pointers:


- Total articles/stories in site: To get all the pages that meets your search criteria, I guess you are looking at building search in OSGi using javax.jcr.query. Queries such as:

SELECT * FROM [cq:Page] AS s WHERE ISDESCENDANTNODE(s, '/content/yourapp').

Take a look at 9 JCR-SQL2 Queries Every AEM Developer Should Know | 6D Labs

- Unique id of all stories: Try jcr:uuid property

- All the nodes and properties for specific story (story = content + assets): Once you get the QueryResult, iterate through the Nodes and get their properties and values:

QueryManager manager = session.getWorkspace().getQueryManager();

Query query = manager.createQuery(queryStatement, Query.JCR_SQL2);

QueryResult results = query.execute();

NodeIterator nodeIterator = results.getNodes();

while (nodeIterator.hasNext()) {

    Node node = (Node) nodeIterator.next();

    if (node != null && node.hasProperty(“jcr:content/cq:lastReplicated”)) {

        Property property = node.getProperty(“jcr:content/cq:lastReplicated”);

        if (property != null){

            String value = (property.getString());

        }

    }

}

You can pick and choose the property that you would like to read.

-  By which property we can decide it is published or not? Try jcr:content/cq:lastReplicated

- How to get only published story list in api or querybuilder response? If you are running the query on Author, tweak the WHERE to include something like:

SELECT * FROM [cq:Page] AS s WHERE ISDESCENDANTNODE(s, '/content/yourapp') AND s.[ jcr:content/cq:lastReplicated] IS NULL

If you are running the query on Publish, you can skip the statement after AND, as someone must have published the story or content that it now is in the Publish, provided regular replication process has been used.

Hope that helps