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

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 

Recently uploaded (20)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 

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/> <% }%>