SlideShare a Scribd company logo
1 of 3
Data Store
(Google App Engine)

          José Luis Santos
 joseluis.santos@cs.kuleuven.be
Servlet
DatastoreServicedatastore = DatastoreServiceFactory.getDatastoreService();

Entity person = new Entity("Person", "test");
person.setUnindexedProperty("name", "TestUser"); //Unindexed properties for these properties that you will
not filter on

Entity weddingPhoto = new Entity("Photo", person.getKey()); // We link this Entity to another (Foreign key)
weddingPhoto.setProperty("imageUrl", "http://scm-l3.technorati.com/11/02/05/25749/marriage.jpg");
weddingPhoto.setProperty("date", new Date());

Entity weddingVideo = new Entity("Video", person.getKey()); // We link this Entity to another (Foreign key)
weddingVideo.setProperty("videoUrl", "http://www.criticallayouts.com/images/rsgallery/original/just-
married-cans-ag1.gif");
weddingVideo.setUnindexedProperty("date", new Date());

datastore.put(person);
datastore.put(weddingPhoto);
datastore.put(weddingVideo);

req.setAttribute("Key", person.getKey()); //Sending an object to a jsp file
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/store.jsp");
dispatcher.forward(req,resp);
JSP
DatastoreServicedatastore = DatastoreServiceFactory.getDatastoreService();
Key key = (Key)request.getAttribute("Key"); //We get an object not only an String
if (key != null){
Query userMediaQuery = new Query();
userMediaQuery.setAncestor(key);

// Ancestor queries return ancestors by default. This filter excludes the ancestor from query results.
userMediaQuery.addFilter(Entity.KEY_RESERVED_PROPERTY, Query.FilterOperator.GREATER_THAN, key);

// Returns both weddingPhoto and weddingVideo even though they are different entity kinds.
List<Entity> results = datastore.prepare(userMediaQuery).asList( FetchOptions.Builder.withDefaults());

for (inti=0;i<results.size();i++){
if (results.get(i).getKind().compareTo("Video")==0){%>
This is a photo:<br/><imgsrc="<%=results.get(i).getProperty("videoUrl")%>"></img><br/>
<% }else if (results.get(i).getKind().compareTo("Photo")==0){%>
This is a video:<br/><imgsrc="<%=results.get(i).getProperty("imageUrl")%>"></img><br/>
<% }%>

More Related Content

Viewers also liked

Qualitative data analysis: many approaches to understand user insights
Qualitative data analysis: many approaches to understand user insightsQualitative data analysis: many approaches to understand user insights
Qualitative data analysis: many approaches to understand user insightsAgnieszka Szóstek
 
Presentation on Database management system
Presentation on Database management systemPresentation on Database management system
Presentation on Database management systemPrerana Bhattarai
 
Data Collection-Primary & Secondary
Data Collection-Primary & SecondaryData Collection-Primary & Secondary
Data Collection-Primary & SecondaryPrathamesh Parab
 

Viewers also liked (9)

Bottom up & top down tutorial 2
Bottom up & top down tutorial 2Bottom up & top down tutorial 2
Bottom up & top down tutorial 2
 
Qualitative data analysis: many approaches to understand user insights
Qualitative data analysis: many approaches to understand user insightsQualitative data analysis: many approaches to understand user insights
Qualitative data analysis: many approaches to understand user insights
 
Presentation on Database management system
Presentation on Database management systemPresentation on Database management system
Presentation on Database management system
 
Databases: Normalisation
Databases: NormalisationDatabases: Normalisation
Databases: Normalisation
 
Teaching approaches
Teaching approachesTeaching approaches
Teaching approaches
 
Qualitative Research
Qualitative ResearchQualitative Research
Qualitative Research
 
Chapter 9-METHODS OF DATA COLLECTION
Chapter 9-METHODS OF DATA COLLECTIONChapter 9-METHODS OF DATA COLLECTION
Chapter 9-METHODS OF DATA COLLECTION
 
Data Collection-Primary & Secondary
Data Collection-Primary & SecondaryData Collection-Primary & Secondary
Data Collection-Primary & Secondary
 
Qualitative data analysis
Qualitative data analysisQualitative data analysis
Qualitative data analysis
 

Similar to Datastore

Try!Swift India 2017: All you need is Swift
Try!Swift India 2017: All you need is SwiftTry!Swift India 2017: All you need is Swift
Try!Swift India 2017: All you need is SwiftChris Bailey
 
Creating a Facebook Clone - Part XXXVII.pdf
Creating a Facebook Clone - Part XXXVII.pdfCreating a Facebook Clone - Part XXXVII.pdf
Creating a Facebook Clone - Part XXXVII.pdfShaiAlmog1
 
Parse - a mobile backend platform
Parse - a mobile backend platformParse - a mobile backend platform
Parse - a mobile backend platformCarlotta Tatti
 
Desenvolvendo Aplicativos Sociais com Rails 3
Desenvolvendo Aplicativos Sociais com Rails 3Desenvolvendo Aplicativos Sociais com Rails 3
Desenvolvendo Aplicativos Sociais com Rails 3Carlos Brando
 
Lviv MDDay 2014. Ігор Коробка “забезпечення базової безпеки в андроїд аплікац...
Lviv MDDay 2014. Ігор Коробка “забезпечення базової безпеки в андроїд аплікац...Lviv MDDay 2014. Ігор Коробка “забезпечення базової безпеки в андроїд аплікац...
Lviv MDDay 2014. Ігор Коробка “забезпечення базової безпеки в андроїд аплікац...Lviv Startup Club
 
Creating a Facebook Clone - Part X - Transcript.pdf
Creating a Facebook Clone - Part X - Transcript.pdfCreating a Facebook Clone - Part X - Transcript.pdf
Creating a Facebook Clone - Part X - Transcript.pdfShaiAlmog1
 

Similar to Datastore (8)

Vaadin7
Vaadin7Vaadin7
Vaadin7
 
Try!Swift India 2017: All you need is Swift
Try!Swift India 2017: All you need is SwiftTry!Swift India 2017: All you need is Swift
Try!Swift India 2017: All you need is Swift
 
Creating a Facebook Clone - Part XXXVII.pdf
Creating a Facebook Clone - Part XXXVII.pdfCreating a Facebook Clone - Part XXXVII.pdf
Creating a Facebook Clone - Part XXXVII.pdf
 
Parse - a mobile backend platform
Parse - a mobile backend platformParse - a mobile backend platform
Parse - a mobile backend platform
 
Desenvolvendo Aplicativos Sociais com Rails 3
Desenvolvendo Aplicativos Sociais com Rails 3Desenvolvendo Aplicativos Sociais com Rails 3
Desenvolvendo Aplicativos Sociais com Rails 3
 
Lviv MDDay 2014. Ігор Коробка “забезпечення базової безпеки в андроїд аплікац...
Lviv MDDay 2014. Ігор Коробка “забезпечення базової безпеки в андроїд аплікац...Lviv MDDay 2014. Ігор Коробка “забезпечення базової безпеки в андроїд аплікац...
Lviv MDDay 2014. Ігор Коробка “забезпечення базової безпеки в андроїд аплікац...
 
Creating a Facebook Clone - Part X - Transcript.pdf
Creating a Facebook Clone - Part X - Transcript.pdfCreating a Facebook Clone - Part X - Transcript.pdf
Creating a Facebook Clone - Part X - Transcript.pdf
 
jQuery secrets
jQuery secretsjQuery secrets
jQuery secrets
 

More from Jose Luis Santos Odriozola

Workshop - Functional Testing - Lessons Learned
Workshop - Functional Testing - Lessons LearnedWorkshop - Functional Testing - Lessons Learned
Workshop - Functional Testing - Lessons LearnedJose Luis Santos Odriozola
 
LAK 14 presentation - Success, activity and drop-outs in MOOCs
LAK 14 presentation - Success, activity and drop-outs in MOOCsLAK 14 presentation - Success, activity and drop-outs in MOOCs
LAK 14 presentation - Success, activity and drop-outs in MOOCsJose Luis Santos Odriozola
 
Empowering students to reflect on their activity with StepUp!
Empowering students to reflect on their activity with StepUp!Empowering students to reflect on their activity with StepUp!
Empowering students to reflect on their activity with StepUp!Jose Luis Santos Odriozola
 

More from Jose Luis Santos Odriozola (18)

Workshop - Functional Testing - Lessons Learned
Workshop - Functional Testing - Lessons LearnedWorkshop - Functional Testing - Lessons Learned
Workshop - Functional Testing - Lessons Learned
 
DiD at the XPDays Benelux
DiD at the XPDays BeneluxDiD at the XPDays Benelux
DiD at the XPDays Benelux
 
Public PhD defense
Public PhD defensePublic PhD defense
Public PhD defense
 
LAK 14 presentation - Success, activity and drop-outs in MOOCs
LAK 14 presentation - Success, activity and drop-outs in MOOCsLAK 14 presentation - Success, activity and drop-outs in MOOCs
LAK 14 presentation - Success, activity and drop-outs in MOOCs
 
Seminar at UC3M Madrid
Seminar at UC3M MadridSeminar at UC3M Madrid
Seminar at UC3M Madrid
 
20131007 peno3 sessie3_sven_jose
20131007 peno3 sessie3_sven_jose20131007 peno3 sessie3_sven_jose
20131007 peno3 sessie3_sven_jose
 
20130918 ectel cyprus_jose
20130918 ectel cyprus_jose20130918 ectel cyprus_jose
20130918 ectel cyprus_jose
 
Presentation @LAK13
Presentation @LAK13 Presentation @LAK13
Presentation @LAK13
 
WeSPOT presentation with Alacatel-lucent
WeSPOT presentation with Alacatel-lucent WeSPOT presentation with Alacatel-lucent
WeSPOT presentation with Alacatel-lucent
 
Final presentación
Final presentaciónFinal presentación
Final presentación
 
Peno 3 Google App Engine introduction
Peno 3 Google App Engine introductionPeno 3 Google App Engine introduction
Peno 3 Google App Engine introduction
 
Peno3 instructions
Peno3 instructionsPeno3 instructions
Peno3 instructions
 
Learning Analytics MUME 2012
Learning Analytics MUME 2012Learning Analytics MUME 2012
Learning Analytics MUME 2012
 
Empowering students to reflect on their activity with StepUp!
Empowering students to reflect on their activity with StepUp!Empowering students to reflect on their activity with StepUp!
Empowering students to reflect on their activity with StepUp!
 
Lak12 jlsantos-v2
Lak12 jlsantos-v2Lak12 jlsantos-v2
Lak12 jlsantos-v2
 
Project management
Project managementProject management
Project management
 
Quantified learning
Quantified learningQuantified learning
Quantified learning
 
Registry slides for Se@m Workshop
Registry slides for Se@m Workshop Registry slides for Se@m Workshop
Registry slides for Se@m Workshop
 

Recently uploaded

Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
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 Takeoffsammart93
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
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​Bhuvaneswari Subramani
 
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 DiscoveryTrustArc
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
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 WorkerThousandEyes
 
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 ...apidays
 
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...DianaGray10
 
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 2024Victor Rentea
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
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 REVIEWERMadyBayot
 
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, ...Angeliki Cooney
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 

Recently uploaded (20)

Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
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
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
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​
 
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
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
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
 
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 ...
 
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...
 
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
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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
 
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, ...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 

Datastore

  • 1. Data Store (Google App Engine) José Luis Santos joseluis.santos@cs.kuleuven.be
  • 2. Servlet DatastoreServicedatastore = DatastoreServiceFactory.getDatastoreService(); Entity person = new Entity("Person", "test"); person.setUnindexedProperty("name", "TestUser"); //Unindexed properties for these properties that you will not filter on Entity weddingPhoto = new Entity("Photo", person.getKey()); // We link this Entity to another (Foreign key) weddingPhoto.setProperty("imageUrl", "http://scm-l3.technorati.com/11/02/05/25749/marriage.jpg"); weddingPhoto.setProperty("date", new Date()); Entity weddingVideo = new Entity("Video", person.getKey()); // We link this Entity to another (Foreign key) weddingVideo.setProperty("videoUrl", "http://www.criticallayouts.com/images/rsgallery/original/just- married-cans-ag1.gif"); weddingVideo.setUnindexedProperty("date", new Date()); datastore.put(person); datastore.put(weddingPhoto); datastore.put(weddingVideo); req.setAttribute("Key", person.getKey()); //Sending an object to a jsp file RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/store.jsp"); dispatcher.forward(req,resp);
  • 3. JSP DatastoreServicedatastore = DatastoreServiceFactory.getDatastoreService(); Key key = (Key)request.getAttribute("Key"); //We get an object not only an String if (key != null){ Query userMediaQuery = new Query(); userMediaQuery.setAncestor(key); // Ancestor queries return ancestors by default. This filter excludes the ancestor from query results. userMediaQuery.addFilter(Entity.KEY_RESERVED_PROPERTY, Query.FilterOperator.GREATER_THAN, key); // Returns both weddingPhoto and weddingVideo even though they are different entity kinds. List<Entity> results = datastore.prepare(userMediaQuery).asList( FetchOptions.Builder.withDefaults()); for (inti=0;i<results.size();i++){ if (results.get(i).getKind().compareTo("Video")==0){%> This is a photo:<br/><imgsrc="<%=results.get(i).getProperty("videoUrl")%>"></img><br/> <% }else if (results.get(i).getKind().compareTo("Photo")==0){%> This is a video:<br/><imgsrc="<%=results.get(i).getProperty("imageUrl")%>"></img><br/> <% }%>