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

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 

Recently uploaded (20)

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 

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