SlideShare une entreprise Scribd logo
1  sur  20
Repository Query Language
Repository Queries
https://software-engineering-101.com/2016/07/12/atg-repository-queries/
RQL
generic language for formulating queries that map to
any repository implementation, such as SQL or LDAP.
Multi-Valued Property Queries
• interests INCLUDES "biking“
• interests INCLUDES ANY { "biking", "swimming" }
• interests INCLUDES ALL { "biking", "swimming" }
• addresses INCLUDES ITEM (zip = "48322" AND state = "MI")
RQL RANGE
• age > 30 RANGE +10
• age > 30 RANGE 10+
• age > 30 RANGE 40+10
atg.repository.QueryBuilder
defines the
available query
operations
build Query
objects
ComparisonQuery
RepositoryView userView = getRepository().getItemDescriptor(USER).getRepositoryView();
QueryBuilder userBuilder = userView.getQueryBuilder();
QueryExpression userType = userBuilder.createPropertyQueryExpression(USER_TYPE);
QueryExpression two = userBuilder.createConstantQueryExpression(USER_TYPE_2);
Query userTypeIsTwo = userBuilder.createComparisonQuery(userType, two,
QueryBuilder.EQUALS);
RepositoryItem[] answer = userView.executeQuery(userTypeIsTwo);
PatternMatchQuery
RepositoryView employeeView = getRepository().getView(USER);
QueryBuilder queryBuilder = employeeView.getQueryBuilder();
QueryExpression propertyExpression = queryBuilder.createPropertyQueryExpression(“login”);
QueryExpression valueExpression = queryBuilder.createConstantQueryExpression(“name”);
Query accountQuery = queryBuilder.createPatternMatchQuery(propertyExpression,
valueExpression, QueryBuilder.CONTAINS);
RepositoryItem[] repositoryItems = employeeView.executeQuery(accountQuery);
IncludesQuery
RepositoryView employeeView = getRepository().getView(USER);
QueryBuilder queryBuilder = employeeView.getQueryBuilder();
QueryExpression propertyExpression =
queryBuilder.createPropertyQueryExpression("user_id");
QueryExpression valueExpression = queryBuilder.createConstantQueryExpression(ids);
Query employeeQuery = queryBuilder.createIncludesQuery(valueExpression,
propertyExpression);
RepositoryItem[] repositoryItems = employeeView.executeQuery(employeeQuery);
Complex Query
RepositoryView userView = getRepository().getItemDescriptor(USER).getRepositoryView();
QueryBuilder userBuilder = userView.getQueryBuilder();
QueryExpression userType = userBuilder.createPropertyQueryExpression("userType");
QueryExpression two = userBuilder.createConstantQueryExpression(2);
Query userTypeLTTwo = userBuilder.createComparisonQuery(userType, two,
QueryBuilder.LESS_THAN);
QueryExpression login = userBuilder.createPropertyQueryExpression("login");
QueryExpression j = userBuilder.createConstantQueryExpression("j");
Query startsWithJ = userBuilder.createPatternMatchQuery(login, j, QueryBuilder.STARTS_WITH);
Query[] pieces = { userTypeLTTwo, startsWithJ };
Query andQuery = userBuilder.createAndQuery(pieces);
RepositoryItem[] answer = userView.executeQuery(andQuery);
atg.repository.QueryOptions
let you limit the size of the result set,
direct how the result set should be sorted,
precache specified properties
QueryOptions
RepositoryView view = getRepository().getView(USER);
Query query = view.getQueryBuilder().createUnconstrainedQuery();
String[] precachedPropertyNames = { "login", "password" };
SortDirectives sortDirectives = new SortDirectives();
sortDirectives.addDirective(new SortDirective( "login",
SortDirective.DIR_ASCENDING));
RepositoryItem[] items = view.executeQuery(query, new QueryOptions(0, 5,
sortDirectives, precachedPropertyNames));
atg.repository.rql.RqlStatement
RepositoryView view = getRepository().getView(USER);
RqlStatement statement = RqlStatement.parseRqlStatement("lastName
STARTS WITH ?0");
Object params[] = { new String("m") };
RepositoryItem items[] = statement.executeQuery(view, params);
Operation tags
<add-item>
<update-item>
<remove-item> to add or update or remove items
<export-items>
<import-items> to export and import items
<print-item> to print item
<transaction> to maintain transactions while adding or removing items.
Generate DDL
<print-ddl/>
• binstartSQLRepository -m <module-name> -
repository /atg/commerce/catalog/ProductCatalog
-outputSQLFile product_catalog.sql
startSQLRepository
To check what items are in cache
<dump-caches item-descriptors="skuSpecialPriceRules" dump-
type="both"/>
Querying using date or timestamp by
using RQL
date <query-items item-descriptor="order">
creationDate>
date("2011-10-10") and state="SUBMITTED"
</query-items>
Timestamp <query-items item-descriptor="order">
creationDate>
date("2011-10-10 10:00:00 EST") and
state="SUBMITTED"
</query-items>
How to get sysdate in RQL named query?
Repository filtering
• Use the <rql-filter> tag in the definition file for an item descriptor.
• Set the filterQuery property of the item descriptor to a Query object.
• Set the rqlFilterString property of the item descriptor to an RQL string, which is
compiled into the Query object that defines the filter.
<rql-filter>
<item-descriptor name="article">
<rql-filter>
<rql>name starts with ?0 or availabilityDate &lt; ?1</rql>
<param value="n"></param>
<param bean="/myApp.IssueDate"></param>
</rql-filter>
<table name="article" id-column-names="article_id">
<property name="name" />
<property name="date" />
</table>
</item-descriptor>
ATG Advanced RQL

Contenu connexe

Tendances

remote-method-guesser - BHUSA2021 Arsenal
remote-method-guesser - BHUSA2021 Arsenal remote-method-guesser - BHUSA2021 Arsenal
remote-method-guesser - BHUSA2021 Arsenal
Tobias Neitzel
 
Easy data-with-spring-data-jpa
Easy data-with-spring-data-jpaEasy data-with-spring-data-jpa
Easy data-with-spring-data-jpa
Staples
 

Tendances (20)

Functional Programming with Groovy
Functional Programming with GroovyFunctional Programming with Groovy
Functional Programming with Groovy
 
Introduction to JCR
Introduction to JCR Introduction to JCR
Introduction to JCR
 
InnoDB Locking Explained with Stick Figures
InnoDB Locking Explained with Stick FiguresInnoDB Locking Explained with Stick Figures
InnoDB Locking Explained with Stick Figures
 
What should a hacker know about WebDav?
What should a hacker know about WebDav?What should a hacker know about WebDav?
What should a hacker know about WebDav?
 
Object Calisthenics Applied to PHP
Object Calisthenics Applied to PHPObject Calisthenics Applied to PHP
Object Calisthenics Applied to PHP
 
Waf bypassing Techniques
Waf bypassing TechniquesWaf bypassing Techniques
Waf bypassing Techniques
 
Mysql Optimization
Mysql OptimizationMysql Optimization
Mysql Optimization
 
You code sucks, let's fix it
You code sucks, let's fix itYou code sucks, let's fix it
You code sucks, let's fix it
 
Web Components and Security
Web Components and SecurityWeb Components and Security
Web Components and Security
 
Hibernate
HibernateHibernate
Hibernate
 
remote-method-guesser - BHUSA2021 Arsenal
remote-method-guesser - BHUSA2021 Arsenal remote-method-guesser - BHUSA2021 Arsenal
remote-method-guesser - BHUSA2021 Arsenal
 
The DID Report 1: The First Official W3C DID Working Group Meeting (Japan)- D...
The DID Report 1: The First Official W3C DID Working Group Meeting (Japan)- D...The DID Report 1: The First Official W3C DID Working Group Meeting (Japan)- D...
The DID Report 1: The First Official W3C DID Working Group Meeting (Japan)- D...
 
Developing RESTful Web APIs with Python, Flask and MongoDB
Developing RESTful Web APIs with Python, Flask and MongoDBDeveloping RESTful Web APIs with Python, Flask and MongoDB
Developing RESTful Web APIs with Python, Flask and MongoDB
 
Pentesting jwt
Pentesting jwtPentesting jwt
Pentesting jwt
 
Comparing Native Java REST API Frameworks - Seattle JUG 2022
Comparing Native Java REST API Frameworks - Seattle JUG 2022Comparing Native Java REST API Frameworks - Seattle JUG 2022
Comparing Native Java REST API Frameworks - Seattle JUG 2022
 
JCR, Sling or AEM? Which API should I use and when?
JCR, Sling or AEM? Which API should I use and when?JCR, Sling or AEM? Which API should I use and when?
JCR, Sling or AEM? Which API should I use and when?
 
Easy data-with-spring-data-jpa
Easy data-with-spring-data-jpaEasy data-with-spring-data-jpa
Easy data-with-spring-data-jpa
 
REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with Spring
 
glTF 2.0 Reference Guide
glTF 2.0 Reference GuideglTF 2.0 Reference Guide
glTF 2.0 Reference Guide
 
Spring data presentation
Spring data presentationSpring data presentation
Spring data presentation
 

En vedette

En vedette (9)

Oracle ATG Commerce Overview for developers
Oracle ATG Commerce Overview for developers Oracle ATG Commerce Overview for developers
Oracle ATG Commerce Overview for developers
 
ATG - Web Commerce @ Your Figertips
ATG - Web Commerce @ Your FigertipsATG - Web Commerce @ Your Figertips
ATG - Web Commerce @ Your Figertips
 
Oracle Commerce Using ATG & Endeca - Do It Yourself Series
Oracle Commerce Using ATG & Endeca - Do It Yourself SeriesOracle Commerce Using ATG & Endeca - Do It Yourself Series
Oracle Commerce Using ATG & Endeca - Do It Yourself Series
 
Oracle endeca information discovery architecture
Oracle endeca information discovery architectureOracle endeca information discovery architecture
Oracle endeca information discovery architecture
 
Endeca
EndecaEndeca
Endeca
 
ATG Advanced Profile Management
ATG Advanced Profile ManagementATG Advanced Profile Management
ATG Advanced Profile Management
 
Common mistakes for ATG applications that affect performance
Common mistakes for ATG applications that affect performanceCommon mistakes for ATG applications that affect performance
Common mistakes for ATG applications that affect performance
 
ATG Commerce: Full Capabilities Overview
ATG Commerce: Full Capabilities OverviewATG Commerce: Full Capabilities Overview
ATG Commerce: Full Capabilities Overview
 
ATG Tutorials - Promotion.
ATG Tutorials - Promotion.ATG Tutorials - Promotion.
ATG Tutorials - Promotion.
 

Similaire à ATG Advanced RQL

OSGi and Spring Data for simple (Web) Application Development - Christian Bar...
OSGi and Spring Data for simple (Web) Application Development - Christian Bar...OSGi and Spring Data for simple (Web) Application Development - Christian Bar...
OSGi and Spring Data for simple (Web) Application Development - Christian Bar...
mfrancis
 
Simple blog wall creation on Java
Simple blog wall creation on JavaSimple blog wall creation on Java
Simple blog wall creation on Java
Max Titov
 
Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010
Rob Windsor
 
20141001 delapsley-oc-openstack-final
20141001 delapsley-oc-openstack-final20141001 delapsley-oc-openstack-final
20141001 delapsley-oc-openstack-final
David Lapsley
 
Modularized Persistence - B Zsoldos
Modularized Persistence - B ZsoldosModularized Persistence - B Zsoldos
Modularized Persistence - B Zsoldos
mfrancis
 
Web осень 2012 лекция 6
Web осень 2012 лекция 6Web осень 2012 лекция 6
Web осень 2012 лекция 6
Technopark
 
Web весна 2013 лекция 6
Web весна 2013 лекция 6Web весна 2013 лекция 6
Web весна 2013 лекция 6
Technopark
 
Testdrevet javautvikling på objektorienterte skinner
Testdrevet javautvikling på objektorienterte skinnerTestdrevet javautvikling på objektorienterte skinner
Testdrevet javautvikling på objektorienterte skinner
Truls Jørgensen
 

Similaire à ATG Advanced RQL (20)

Android dev toolbox
Android dev toolboxAndroid dev toolbox
Android dev toolbox
 
Requery overview
Requery overviewRequery overview
Requery overview
 
Тарас Олексин - Sculpt! Your! Tests!
Тарас Олексин  - Sculpt! Your! Tests!Тарас Олексин  - Sculpt! Your! Tests!
Тарас Олексин - Sculpt! Your! Tests!
 
OSGi and Spring Data for simple (Web) Application Development - Christian Bar...
OSGi and Spring Data for simple (Web) Application Development - Christian Bar...OSGi and Spring Data for simple (Web) Application Development - Christian Bar...
OSGi and Spring Data for simple (Web) Application Development - Christian Bar...
 
OSGi and Spring Data for simple (Web) Application Development
OSGi and Spring Data  for simple (Web) Application DevelopmentOSGi and Spring Data  for simple (Web) Application Development
OSGi and Spring Data for simple (Web) Application Development
 
Understanding backbonejs
Understanding backbonejsUnderstanding backbonejs
Understanding backbonejs
 
Simple blog wall creation on Java
Simple blog wall creation on JavaSimple blog wall creation on Java
Simple blog wall creation on Java
 
Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010
 
Architecture Components
Architecture ComponentsArchitecture Components
Architecture Components
 
20141001 delapsley-oc-openstack-final
20141001 delapsley-oc-openstack-final20141001 delapsley-oc-openstack-final
20141001 delapsley-oc-openstack-final
 
Summer - The HTML5 Library for Java and Scala
Summer - The HTML5 Library for Java and ScalaSummer - The HTML5 Library for Java and Scala
Summer - The HTML5 Library for Java and Scala
 
Desenvolvendo Aplicativos Sociais com Rails 3
Desenvolvendo Aplicativos Sociais com Rails 3Desenvolvendo Aplicativos Sociais com Rails 3
Desenvolvendo Aplicativos Sociais com Rails 3
 
Modularized Persistence - B Zsoldos
Modularized Persistence - B ZsoldosModularized Persistence - B Zsoldos
Modularized Persistence - B Zsoldos
 
Web осень 2012 лекция 6
Web осень 2012 лекция 6Web осень 2012 лекция 6
Web осень 2012 лекция 6
 
Struts2 - 101
Struts2 - 101Struts2 - 101
Struts2 - 101
 
Managing parallelism using coroutines
Managing parallelism using coroutinesManaging parallelism using coroutines
Managing parallelism using coroutines
 
Local storage in Web apps
Local storage in Web appsLocal storage in Web apps
Local storage in Web apps
 
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
 
Web весна 2013 лекция 6
Web весна 2013 лекция 6Web весна 2013 лекция 6
Web весна 2013 лекция 6
 
Testdrevet javautvikling på objektorienterte skinner
Testdrevet javautvikling på objektorienterte skinnerTestdrevet javautvikling på objektorienterte skinner
Testdrevet javautvikling på objektorienterte skinner
 

Plus de Kate Semizhon

Plus de Kate Semizhon (12)

Cracking 1-on-1s
Cracking 1-on-1sCracking 1-on-1s
Cracking 1-on-1s
 
Serverless Pitfalls
Serverless PitfallsServerless Pitfalls
Serverless Pitfalls
 
Seven Facts about Belarus
Seven Facts about BelarusSeven Facts about Belarus
Seven Facts about Belarus
 
Git 101
Git 101Git 101
Git 101
 
How to improve code quality for iOS apps?
How to improve code quality for iOS apps?How to improve code quality for iOS apps?
How to improve code quality for iOS apps?
 
Database Change Management
Database Change ManagementDatabase Change Management
Database Change Management
 
Ecommerce in 2018
Ecommerce in 2018Ecommerce in 2018
Ecommerce in 2018
 
How a project is born. Intro to Discovery Phase
How a project is born. Intro to Discovery Phase How a project is born. Intro to Discovery Phase
How a project is born. Intro to Discovery Phase
 
Code Review Tool Evaluation
Code Review Tool EvaluationCode Review Tool Evaluation
Code Review Tool Evaluation
 
Sonar Review
Sonar ReviewSonar Review
Sonar Review
 
Unit tests benefits
Unit tests benefitsUnit tests benefits
Unit tests benefits
 
SEO Instruments in ATG
SEO Instruments in ATGSEO Instruments in ATG
SEO Instruments in ATG
 

Dernier

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Dernier (20)

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 

ATG Advanced RQL

  • 1. Repository Query Language Repository Queries https://software-engineering-101.com/2016/07/12/atg-repository-queries/
  • 2. RQL generic language for formulating queries that map to any repository implementation, such as SQL or LDAP.
  • 3. Multi-Valued Property Queries • interests INCLUDES "biking“ • interests INCLUDES ANY { "biking", "swimming" } • interests INCLUDES ALL { "biking", "swimming" } • addresses INCLUDES ITEM (zip = "48322" AND state = "MI")
  • 4. RQL RANGE • age > 30 RANGE +10 • age > 30 RANGE 10+ • age > 30 RANGE 40+10
  • 6. ComparisonQuery RepositoryView userView = getRepository().getItemDescriptor(USER).getRepositoryView(); QueryBuilder userBuilder = userView.getQueryBuilder(); QueryExpression userType = userBuilder.createPropertyQueryExpression(USER_TYPE); QueryExpression two = userBuilder.createConstantQueryExpression(USER_TYPE_2); Query userTypeIsTwo = userBuilder.createComparisonQuery(userType, two, QueryBuilder.EQUALS); RepositoryItem[] answer = userView.executeQuery(userTypeIsTwo);
  • 7. PatternMatchQuery RepositoryView employeeView = getRepository().getView(USER); QueryBuilder queryBuilder = employeeView.getQueryBuilder(); QueryExpression propertyExpression = queryBuilder.createPropertyQueryExpression(“login”); QueryExpression valueExpression = queryBuilder.createConstantQueryExpression(“name”); Query accountQuery = queryBuilder.createPatternMatchQuery(propertyExpression, valueExpression, QueryBuilder.CONTAINS); RepositoryItem[] repositoryItems = employeeView.executeQuery(accountQuery);
  • 8. IncludesQuery RepositoryView employeeView = getRepository().getView(USER); QueryBuilder queryBuilder = employeeView.getQueryBuilder(); QueryExpression propertyExpression = queryBuilder.createPropertyQueryExpression("user_id"); QueryExpression valueExpression = queryBuilder.createConstantQueryExpression(ids); Query employeeQuery = queryBuilder.createIncludesQuery(valueExpression, propertyExpression); RepositoryItem[] repositoryItems = employeeView.executeQuery(employeeQuery);
  • 9. Complex Query RepositoryView userView = getRepository().getItemDescriptor(USER).getRepositoryView(); QueryBuilder userBuilder = userView.getQueryBuilder(); QueryExpression userType = userBuilder.createPropertyQueryExpression("userType"); QueryExpression two = userBuilder.createConstantQueryExpression(2); Query userTypeLTTwo = userBuilder.createComparisonQuery(userType, two, QueryBuilder.LESS_THAN); QueryExpression login = userBuilder.createPropertyQueryExpression("login"); QueryExpression j = userBuilder.createConstantQueryExpression("j"); Query startsWithJ = userBuilder.createPatternMatchQuery(login, j, QueryBuilder.STARTS_WITH); Query[] pieces = { userTypeLTTwo, startsWithJ }; Query andQuery = userBuilder.createAndQuery(pieces); RepositoryItem[] answer = userView.executeQuery(andQuery);
  • 10. atg.repository.QueryOptions let you limit the size of the result set, direct how the result set should be sorted, precache specified properties
  • 11. QueryOptions RepositoryView view = getRepository().getView(USER); Query query = view.getQueryBuilder().createUnconstrainedQuery(); String[] precachedPropertyNames = { "login", "password" }; SortDirectives sortDirectives = new SortDirectives(); sortDirectives.addDirective(new SortDirective( "login", SortDirective.DIR_ASCENDING)); RepositoryItem[] items = view.executeQuery(query, new QueryOptions(0, 5, sortDirectives, precachedPropertyNames));
  • 12. atg.repository.rql.RqlStatement RepositoryView view = getRepository().getView(USER); RqlStatement statement = RqlStatement.parseRqlStatement("lastName STARTS WITH ?0"); Object params[] = { new String("m") }; RepositoryItem items[] = statement.executeQuery(view, params);
  • 13. Operation tags <add-item> <update-item> <remove-item> to add or update or remove items <export-items> <import-items> to export and import items <print-item> to print item <transaction> to maintain transactions while adding or removing items.
  • 14. Generate DDL <print-ddl/> • binstartSQLRepository -m <module-name> - repository /atg/commerce/catalog/ProductCatalog -outputSQLFile product_catalog.sql startSQLRepository
  • 15. To check what items are in cache <dump-caches item-descriptors="skuSpecialPriceRules" dump- type="both"/>
  • 16. Querying using date or timestamp by using RQL date <query-items item-descriptor="order"> creationDate> date("2011-10-10") and state="SUBMITTED" </query-items> Timestamp <query-items item-descriptor="order"> creationDate> date("2011-10-10 10:00:00 EST") and state="SUBMITTED" </query-items>
  • 17. How to get sysdate in RQL named query?
  • 18. Repository filtering • Use the <rql-filter> tag in the definition file for an item descriptor. • Set the filterQuery property of the item descriptor to a Query object. • Set the rqlFilterString property of the item descriptor to an RQL string, which is compiled into the Query object that defines the filter.
  • 19. <rql-filter> <item-descriptor name="article"> <rql-filter> <rql>name starts with ?0 or availabilityDate &lt; ?1</rql> <param value="n"></param> <param bean="/myApp.IssueDate"></param> </rql-filter> <table name="article" id-column-names="article_id"> <property name="name" /> <property name="date" /> </table> </item-descriptor>

Notes de l'éditeur

  1. Logical operators and the MATCH and MATCHES operators (described in the later section Full Text Search Queries) should only be applied to scalar properties. Another set of queries can be applied to arrays or collections of scalar values—for example, properties of type int[], or Set of Strings. <query-items item-descriptor="user">secondaryAddresses INCLUDES "se-980040"</query-items> <query-items item-descriptor="user">secondaryAddresses INCLUDES ITEM (postalCode= "02631" AND country= "US")</query-items>
  2. age > 30 RANGE 10+ This causes the first 10 results to be skipped, and the remaining results to be returned.
  3. http://atgkid.blogspot.com/2011/10/using-atg-development-operation-tags.html If you have created a new repository or new item-descriptor in reposiotry in your module. To generate ddl,just start the instance (ignore table missing errors). Once instance is up, go to that particular repository in dynamo component browser (/dyn/admin/) In "Run XML Operation Tags on the Repository"
  4. Set the filterQuery property of the item descriptor to a Query created by the same repository. Do this by creating a Query object and calling GSAItemDescriptor.setFilterQuery() on it. Set the item descriptor’s rqlFilterString to an RQL string that expresses the query. If the filterQuery property of the item descriptor is null, the SQL repository tries to use the rqlFilterString and compile it into the filter query. If both properties are null, filtering is disabled.