<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8592878860404675342</id><updated>2026-06-12T06:11:04.314-07:00</updated><category term="solr"/><category term="oracle"/><category term="data import handler"/><category term="data-config.xml"/><category term="Apache Wicket"/><category term="Ubuntu"/><category term="filter"/><category term="mysql"/><category term="tokenizer"/><category term="Achieving the Data Integrity and Incrementally Update the data on ElasticSearch Using Logstash"/><category term="Adding JSON to MongoDB Using Java"/><category term="Calulator"/><category term="DBMS_LOB.SUBSTR"/><category term="DIH"/><category term="DIH with Tika"/><category term="Decrypt"/><category term="Decryption"/><category term="Download solr 3.4"/><category term="Drop Index"/><category term="Dropping Unique Key"/><category term="EdgeNGramFilterFactory"/><category term="ElasticSearch"/><category term="Embedded/sub document example of MongoDB with JAVA."/><category term="Encrypt"/><category term="Encryption"/><category term="Encryption and Decryption"/><category term="Error filterStart"/><category term="ExtJs"/><category term="Extra content at the end of the document"/><category term="Generate XML Output from Jasper Reports"/><category term="Generating plain xml from Jasper Irrespective of the Locale"/><category term="How to index data in solr from database automatically?"/><category term="How to set JAVA_HOME environment variable in Ubuntu"/><category term="How to update multiple value of specific embedded document"/><category term="How to update the email ids for the thousand users through database. Orcale 10g"/><category term="Iframe"/><category term="Install MongoDB 4.0 on Windows 8"/><category term="Installing jdk 1.5 on ubantu"/><category term="JAVA_HOME"/><category term="JSF"/><category term="Jasper"/><category term="Jasper xml export"/><category term="Java To Python"/><category term="JavaScript Calculator"/><category term="MCV"/><category term="MSSQL SERVER DATABASE + LogStash + Elastic Search"/><category term="Migrating the MSSQL Data to ElasticSearch using the Logstash."/><category term="MondoDB using JAVA."/><category term="MongoDB with MongoJack"/><category term="MongoDB with Morphia"/><category term="MultiKeyMap"/><category term="Multiple Indexes"/><category term="MySQL workbench on Ubuntu"/><category term="N-gram"/><category term="Plain xml from Jasper"/><category term="Python"/><category term="SolrRequestFilter"/><category term="Split a large array into smaller arrays..."/><category term="Steps for Solr 6.1 setup with data import handler(DIH)"/><category term="Storing POJOs in MongoDB Using Morphia"/><category term="TikaEntityProcessor"/><category term="Unique constraint and index relationship"/><category term="Updated Embedded array in mongo"/><category term="Use of Java for Inserting data to MongoDB"/><category term="Using Jackson for Mapping Java Objects with Mongo."/><category term="Vaadin"/><category term="Xml Export of jasper report"/><category term="analysis"/><category term="analysis.jsp"/><category term="apache-pig"/><category term="array data in mongoDB"/><category term="autocomplete in solr."/><category term="automization in solr"/><category term="bag"/><category term="bind_ip"/><category term="boilerplate code"/><category term="case insensitive"/><category term="check constraint"/><category term="clob"/><category term="clob to varchar2"/><category term="component"/><category term="connect remote mongoDB through JAVA"/><category term="cookies"/><category term="core"/><category term="count"/><category term="count in pig"/><category term="css"/><category term="custom panel"/><category term="custom xml export for jasper."/><category term="data importer"/><category term="database indexing in solr"/><category term="date query in mongo"/><category term="difference between Java and Python"/><category term="div based"/><category term="drop constraint"/><category term="dump"/><category term="duplicate attribute"/><category term="embedded query in mongo"/><category term="environment variable"/><category term="export-report-in-plain-xml-format-jasper"/><category term="frameworks"/><category term="group"/><category term="iframe example"/><category term="indexing"/><category term="indexing and searching on elastic search by curl."/><category term="inside an array"/><category term="jasper as xml feed."/><category term="javascript"/><category term="jetty default port change"/><category term="like pattern operator in mongo"/><category term="linux"/><category term="lombok"/><category term="lombok annotation"/><category term="lower"/><category term="modify an existing check constraint in oracle?"/><category term="mongoDB"/><category term="mongoDB with Java"/><category term="msg=SolrCore &#39;collection1&#39; is not available due to init failure: Unable to use updateLog: _version_field must exist in schema"/><category term="multiple core in solr"/><category term="multiple core. solr.xml"/><category term="nram"/><category term="of a specific document in MongoDB?"/><category term="pig"/><category term="schedule the logstash"/><category term="schema.xml"/><category term="search"/><category term="selectd field retrivel in mongo"/><category term="set up"/><category term="solr 3.4"/><category term="solr 4.5.1 issue"/><category term="solr core"/><category term="solr integrated with tika."/><category term="solr on linux"/><category term="solr port change"/><category term="solr set up on linux"/><category term="solr set up on tomcat"/><category term="solr with DIH"/><category term="solr with TikaEntityProcessor"/><category term="solr with jetty port change"/><category term="solr with tika"/><category term="specification mandate value for attribute Size"/><category term="split arrays"/><category term="split large xml"/><category term="sqoop"/><category term="sqoop commands"/><category term="sqoop import.."/><category term="sqoop with mysql"/><category term="store"/><category term="tika"/><category term="tomcat"/><category term="tuple"/><category term="update cookies"/><category term="update cookies for specific time"/><category term="update the array data in mongoDB."/><category term="updating cookies expiry date"/><category term="upper"/><category term="use of jquery in wicket"/><category term="varchar2"/><category term="varchar2 to clob"/><category term="variable"/><category term="variable resolver"/><category term="wildcard"/><category term="workbench"/><category term="xml parsing issues"/><category term="xslt"/><title type='text'>Technical Post</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://abhijitbashetti.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://abhijitbashetti.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Abhijit Bashetti</name><uri>http://www.blogger.com/profile/02494128996998150172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUkzTfb2FQaDNMYEccAavR7aylIC_4UBvAhEtPQTesV-IzTwNr0rtF16MQgDIIcQMg4MpzYOQ3gHrFZPLOwyWxqUk1aQA1VxGFjYr5UMOYCRmdgKbeC_v6kJKxY2Fdf_o/s220/IMG_2027.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>49</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8592878860404675342.post-544771137920311066</id><published>2019-01-30T01:00:00.002-08:00</published><updated>2019-01-30T01:00:34.425-08:00</updated><title type='text'>MongoDB Replication set up</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
We will have 3 instance of Mongo In order to achieve the Replication in MongoDB.&lt;br /&gt;
&lt;br /&gt;
C:\Program Files\MongoDB\Server\4.0\bin&amp;gt;mongod --smallfiles --oplogSize 50 --replSet test --port 27017 --dbpath C:\data\db&lt;br /&gt;
&lt;br /&gt;
C:\Program Files\MongoDB\Server\4.0\bin&amp;gt;mongod --smallfiles --oplogSize 50 --replSet test --port 27018 --dbpath D:\data\db&lt;br /&gt;
&lt;br /&gt;
C:\Program Files\MongoDB\Server\4.0\bin&amp;gt;mongod --smallfiles --oplogSize 50 --replSet test --port 27019 --dbpath E:\data\db&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjluaH9tKraj35dC-qa0ClTHsgKd7zx0cqbGhCCMCOKRCaCEQhY-88W9eak6QHFlFwyfyAsojrid_Q4aMb71PWOqQu9uAmZ3Tkn9N5-_y9evdseVoDtBvNqYc8alLhwHP9lBGRqYjnTTV_u/s1600/1.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;681&quot; data-original-width=&quot;1600&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjluaH9tKraj35dC-qa0ClTHsgKd7zx0cqbGhCCMCOKRCaCEQhY-88W9eak6QHFlFwyfyAsojrid_Q4aMb71PWOqQu9uAmZ3Tkn9N5-_y9evdseVoDtBvNqYc8alLhwHP9lBGRqYjnTTV_u/s1600/1.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiL00-ZCXfkujdoIAtNXm_Ec4GYvcGuL-Z6Y36tUp5auda6AT_mYzetW4GF_ruya3Q3s38irBESHXV8t2BNZDnOi5utM2NFZgpisDTtDFuf-GpfzGPzwxU5pAyetmOSklkTWmUC0wWO1X29/s1600/2.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;463&quot; data-original-width=&quot;1600&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiL00-ZCXfkujdoIAtNXm_Ec4GYvcGuL-Z6Y36tUp5auda6AT_mYzetW4GF_ruya3Q3s38irBESHXV8t2BNZDnOi5utM2NFZgpisDTtDFuf-GpfzGPzwxU5pAyetmOSklkTWmUC0wWO1X29/s1600/2.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsQ00Ep-zcrz2FyB-OVZWVZBLtbRmr7HcF4avK_7H5RbxY0SZY0WaeViTDLfVX1-t4psZhyLxjdkWPUpUFjfP5wI1tHVtsa-wUcQ0zmA6oS4IBtrBJ7tknB7FiLgIBYKijDjVriJYM2bF9/s1600/3.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;487&quot; data-original-width=&quot;1600&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsQ00Ep-zcrz2FyB-OVZWVZBLtbRmr7HcF4avK_7H5RbxY0SZY0WaeViTDLfVX1-t4psZhyLxjdkWPUpUFjfP5wI1tHVtsa-wUcQ0zmA6oS4IBtrBJ7tknB7FiLgIBYKijDjVriJYM2bF9/s1600/3.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
C:\&amp;gt;cd &quot;\Program Files\MongoDB\Server\4.0\bin&quot;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiu1M1Jv4dE9GG76B8WrbCItjzsh68LSvaSL-IGG_w-8SBH9ySBjpH7U6pofLGYm98EvRk7lWzndkOqPGzRiOI6kv69KXrB479_cEy7aPzsUllmT7kyCcphcTm9s0cxa7M4y-BKi5lzFoHc/s1600/4.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;232&quot; data-original-width=&quot;1157&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiu1M1Jv4dE9GG76B8WrbCItjzsh68LSvaSL-IGG_w-8SBH9ySBjpH7U6pofLGYm98EvRk7lWzndkOqPGzRiOI6kv69KXrB479_cEy7aPzsUllmT7kyCcphcTm9s0cxa7M4y-BKi5lzFoHc/s1600/4.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
C:\Program Files\MongoDB\Server\4.0\bin&amp;gt;mongo&lt;br /&gt;
MongoDB shell version v4.0.2&lt;br /&gt;
connecting to: mongodb://127.0.0.1:27017&lt;br /&gt;
MongoDB server version: 4.0.2&lt;br /&gt;
Server has startup warnings:&lt;br /&gt;
2019-01-24T10:26:02.197+0530 I CONTROL&amp;nbsp; [initandlisten]&lt;br /&gt;
2019-01-24T10:26:02.197+0530 I CONTROL&amp;nbsp; [initandlisten] ** WARNING: Access control is not enabled for the d&lt;br /&gt;
2019-01-24T10:26:02.198+0530 I CONTROL&amp;nbsp; [initandlisten] **&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Read and write access to data and confi&lt;br /&gt;
2019-01-24T10:26:02.198+0530 I CONTROL&amp;nbsp; [initandlisten]&lt;br /&gt;
2019-01-24T10:26:02.198+0530 I CONTROL&amp;nbsp; [initandlisten] ** WARNING: This server is bound to localhost.&lt;br /&gt;
2019-01-24T10:26:02.198+0530 I CONTROL&amp;nbsp; [initandlisten] **&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Remote systems will be unable to connec&lt;br /&gt;
2019-01-24T10:26:02.198+0530 I CONTROL&amp;nbsp; [initandlisten] **&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Start the server with --bind_ip &amp;lt;addres&lt;br /&gt;
2019-01-24T10:26:02.198+0530 I CONTROL&amp;nbsp; [initandlisten] **&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; addresses it should serve responses fro&lt;br /&gt;
2019-01-24T10:26:02.198+0530 I CONTROL&amp;nbsp; [initandlisten] **&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bind to all interfaces. If this behavio&lt;br /&gt;
2019-01-24T10:26:02.198+0530 I CONTROL&amp;nbsp; [initandlisten] **&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; server with --bind_ip 127.0.0.1 to disa&lt;br /&gt;
2019-01-24T10:26:02.198+0530 I CONTROL&amp;nbsp; [initandlisten]&lt;br /&gt;
&lt;br /&gt;
C:\Program Files\MongoDB\Server\4.0\bin&amp;gt;mongo --host 127.0.0.1:27018&lt;br /&gt;
MongoDB shell version v4.0.2&lt;br /&gt;
connecting to: mongodb://127.0.0.1:27018/&lt;br /&gt;
MongoDB server version: 4.0.2&lt;br /&gt;
Server has startup warnings:&lt;br /&gt;
2019-01-24T10:39:24.775+0530 I CONTROL&amp;nbsp; [initandlisten]&lt;br /&gt;
2019-01-24T10:39:24.775+0530 I CONTROL&amp;nbsp; [initandlisten] ** WARNING: Access control is not enabled for the database.&lt;br /&gt;
2019-01-24T10:39:24.775+0530 I CONTROL&amp;nbsp; [initandlisten] **&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Read and write access to data and configuration is unrestricted.&lt;br /&gt;
2019-01-24T10:39:24.775+0530 I CONTROL&amp;nbsp; [initandlisten]&lt;br /&gt;
2019-01-24T10:39:24.776+0530 I CONTROL&amp;nbsp; [initandlisten] ** WARNING: This server is bound to localhost.&lt;br /&gt;
2019-01-24T10:39:24.776+0530 I CONTROL&amp;nbsp; [initandlisten] **&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Remote systems will be unable to connect to this server.&lt;br /&gt;
2019-01-24T10:39:24.776+0530 I CONTROL&amp;nbsp; [initandlisten] **&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Start the server with --bind_ip &amp;lt;address&amp;gt; to specify which IP&lt;br /&gt;
2019-01-24T10:39:24.777+0530 I CONTROL&amp;nbsp; [initandlisten] **&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; addresses it should serve responses from, or with --bind_ip_all to&lt;br /&gt;
2019-01-24T10:39:24.777+0530 I CONTROL&amp;nbsp; [initandlisten] **&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bind to all interfaces. If this behavior is desired, start the&lt;br /&gt;
2019-01-24T10:39:24.777+0530 I CONTROL&amp;nbsp; [initandlisten] **&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; server with --bind_ip 127.0.0.1 to disable this warning.&lt;br /&gt;
2019-01-24T10:39:24.778+0530 I CONTROL&amp;nbsp; [initandlisten]&lt;br /&gt;
MongoDB Enterprise test:SECONDARY&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJlG_D2phgIA0wvwarueqagwNamU-WeDiICaLr2YWhSsiyHOvfwHBLyRwHTbulkdCz4OLZ_shOyoxqJPkJ-2TFlncMSzIoVp-ZQqDRdwtakjh8_kOy3NZTAEdcQAukvczdvGmDb6S_4fOE/s1600/5.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;269&quot; data-original-width=&quot;1096&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJlG_D2phgIA0wvwarueqagwNamU-WeDiICaLr2YWhSsiyHOvfwHBLyRwHTbulkdCz4OLZ_shOyoxqJPkJ-2TFlncMSzIoVp-ZQqDRdwtakjh8_kOy3NZTAEdcQAukvczdvGmDb6S_4fOE/s1600/5.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
C:\Program Files\MongoDB\Server\4.0\bin&amp;gt;mongo --host 127.0.0.1:27019&lt;br /&gt;
MongoDB shell version v4.0.2&lt;br /&gt;
connecting to: mongodb://127.0.0.1:27019/&lt;br /&gt;
MongoDB server version: 4.0.2&lt;br /&gt;
Server has startup warnings:&lt;br /&gt;
2019-01-30T12:06:55.398+0530 I CONTROL&amp;nbsp; [initandlisten]&lt;br /&gt;
2019-01-30T12:06:55.398+0530 I CONTROL&amp;nbsp; [initandlisten] ** WARNING: Access control is not enabled for the database.&lt;br /&gt;
2019-01-30T12:06:55.398+0530 I CONTROL&amp;nbsp; [initandlisten] **&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Read and write access to data and configuration is unrestricted.&lt;br /&gt;
2019-01-30T12:06:55.399+0530 I CONTROL&amp;nbsp; [initandlisten]&lt;br /&gt;
2019-01-30T12:06:55.399+0530 I CONTROL&amp;nbsp; [initandlisten] ** WARNING: This server is bound to localhost.&lt;br /&gt;
2019-01-30T12:06:55.399+0530 I CONTROL&amp;nbsp; [initandlisten] **&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Remote systems will be unable to connect to this server.&lt;br /&gt;
2019-01-30T12:06:55.400+0530 I CONTROL&amp;nbsp; [initandlisten] **&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Start the server with --bind_ip &amp;lt;address&amp;gt; to specify which IP&lt;br /&gt;
2019-01-30T12:06:55.400+0530 I CONTROL&amp;nbsp; [initandlisten] **&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; addresses it should serve responses from, or with --bind_ip_all to&lt;br /&gt;
2019-01-30T12:06:55.400+0530 I CONTROL&amp;nbsp; [initandlisten] **&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bind to all interfaces. If this behavior is desired, start the&lt;br /&gt;
2019-01-30T12:06:55.400+0530 I CONTROL&amp;nbsp; [initandlisten] **&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; server with --bind_ip 127.0.0.1 to disable this warning.&lt;br /&gt;
2019-01-30T12:06:55.401+0530 I CONTROL&amp;nbsp; [initandlisten]&lt;br /&gt;
MongoDB Enterprise test:SECONDARY&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGz41o9Fz8Kx6hIALbKA9QJnyDs-YlObtRNXSH6LfDDBFv_rWSdFyHHJonrlac_A94WNJVgiz8IHk49S1H6h6-IZJuoaktNErHPPzhJyJFagpOUpED1vnYLNKZ17B0OGiQTqIM-AnMCE3b/s1600/6.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;252&quot; data-original-width=&quot;1111&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGz41o9Fz8Kx6hIALbKA9QJnyDs-YlObtRNXSH6LfDDBFv_rWSdFyHHJonrlac_A94WNJVgiz8IHk49S1H6h6-IZJuoaktNErHPPzhJyJFagpOUpED1vnYLNKZ17B0OGiQTqIM-AnMCE3b/s1600/6.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
MongoDB Enterprise test:PRIMARY&amp;gt; rs.initiate();&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;operationTime&quot; : Timestamp(1548307074, 1),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;ok&quot; : 0,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;errmsg&quot; : &quot;already initialized&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;code&quot; : 23,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;codeName&quot; : &quot;AlreadyInitialized&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;$clusterTime&quot; : {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;clusterTime&quot; : Timestamp(1548307074, 1),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;signature&quot; : {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;hash&quot; : BinData(0,&quot;AAAAAAAAAAAAAAAAAAAAAAAAAAA=&quot;),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;keyId&quot; : NumberLong(0)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
MongoDB Enterprise test:PRIMARY&amp;gt; rs.add(127.0.0.1:27018);&lt;br /&gt;
2019-01-24T10:48:31.528+0530 E QUERY&amp;nbsp; &amp;nbsp; [js] SyntaxError: missing ) after argument list @(shell):1:12&lt;br /&gt;
MongoDB Enterprise test:PRIMARY&amp;gt; rs.add(&quot;127.0.0.1:27018&quot;);&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;ok&quot; : 1,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;operationTime&quot; : Timestamp(1548307139, 1),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;$clusterTime&quot; : {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;clusterTime&quot; : Timestamp(1548307139, 1),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;signature&quot; : {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;hash&quot; : BinData(0,&quot;AAAAAAAAAAAAAAAAAAAAAAAAAAA=&quot;),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;keyId&quot; : NumberLong(0)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
MongoDB Enterprise test:PRIMARY&amp;gt; rs.add(127.0.0.1:27019);&lt;br /&gt;
&lt;br /&gt;
MongoDB Enterprise test:PRIMARY&amp;gt; rs.conf();&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;_id&quot; : &quot;test&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;version&quot; : 2,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;protocolVersion&quot; : NumberLong(1),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;writeConcernMajorityJournalDefault&quot; : true,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;members&quot; : [&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;_id&quot; : 0,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;host&quot; : &quot;localhost:27017&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;arbiterOnly&quot; : false,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;buildIndexes&quot; : true,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;hidden&quot; : false,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;priority&quot; : 1,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;tags&quot; : {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;slaveDelay&quot; : NumberLong(0),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;votes&quot; : 1&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;_id&quot; : 1,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;host&quot; : &quot;127.0.0.1:27018&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;arbiterOnly&quot; : false,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;buildIndexes&quot; : true,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;hidden&quot; : false,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;priority&quot; : 1,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;tags&quot; : {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;slaveDelay&quot; : NumberLong(0),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;votes&quot; : 1&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ],&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;settings&quot; : {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;chainingAllowed&quot; : true,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;heartbeatIntervalMillis&quot; : 2000,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;heartbeatTimeoutSecs&quot; : 10,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;electionTimeoutMillis&quot; : 10000,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;catchUpTimeoutMillis&quot; : -1,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;catchUpTakeoverDelayMillis&quot; : 30000,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;getLastErrorModes&quot; : {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;getLastErrorDefaults&quot; : {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;w&quot; : 1,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;wtimeout&quot; : 0&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;replicaSetId&quot; : ObjectId(&quot;5c416b3d712e9a0ff1ac72b7&quot;)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6lk9thNNChy_aELkv8KFeQz7H9c4Z93XwRG1NyHh4ICEkbsVllf95wXlrOkwoqRDxZmKoRoX32OfE_spNZlrVo7mjrjmWuPm_pLX97Sm9Gr2BPWCEQbFKhfPZNMVm9LLhBaOM9zQrKU54/s1600/7.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;815&quot; data-original-width=&quot;599&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6lk9thNNChy_aELkv8KFeQz7H9c4Z93XwRG1NyHh4ICEkbsVllf95wXlrOkwoqRDxZmKoRoX32OfE_spNZlrVo7mjrjmWuPm_pLX97Sm9Gr2BPWCEQbFKhfPZNMVm9LLhBaOM9zQrKU54/s1600/7.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
MongoDB Enterprise test:PRIMARY&amp;gt; rs.status();&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;set&quot; : &quot;test&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;date&quot; : ISODate(&quot;2019-01-24T05:20:36.793Z&quot;),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;myState&quot; : 1,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;term&quot; : NumberLong(7),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;syncingTo&quot; : &quot;&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;syncSourceHost&quot; : &quot;&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;syncSourceId&quot; : -1,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;heartbeatIntervalMillis&quot; : NumberLong(2000),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;optimes&quot; : {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;lastCommittedOpTime&quot; : {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;ts&quot; : Timestamp(1548307234, 1),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;t&quot; : NumberLong(7)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;readConcernMajorityOpTime&quot; : {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;ts&quot; : Timestamp(1548307234, 1),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;t&quot; : NumberLong(7)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;appliedOpTime&quot; : {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;ts&quot; : Timestamp(1548307234, 1),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;t&quot; : NumberLong(7)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;durableOpTime&quot; : {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;ts&quot; : Timestamp(1548307234, 1),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;t&quot; : NumberLong(7)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;lastStableCheckpointTimestamp&quot; : Timestamp(1548307194, 1),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;members&quot; : [&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;_id&quot; : 0,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;name&quot; : &quot;localhost:27017&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;health&quot; : 1,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;state&quot; : 1,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;stateStr&quot; : &quot;PRIMARY&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;uptime&quot; : 1475,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;optime&quot; : {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;ts&quot; : Timestamp(1548307234, 1),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;t&quot; : NumberLong(7)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;optimeDate&quot; : ISODate(&quot;2019-01-24T05:20:34Z&quot;),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;syncingTo&quot; : &quot;&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;syncSourceHost&quot; : &quot;&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;syncSourceId&quot; : -1,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;infoMessage&quot; : &quot;&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;electionTime&quot; : Timestamp(1548305762, 1),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;electionDate&quot; : ISODate(&quot;2019-01-24T04:56:02Z&quot;),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;configVersion&quot; : 2,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;self&quot; : true,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;lastHeartbeatMessage&quot; : &quot;&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;_id&quot; : 1,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;name&quot; : &quot;127.0.0.1:27018&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;health&quot; : 1,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;state&quot; : 2,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;stateStr&quot; : &quot;SECONDARY&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;uptime&quot; : 97,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;optime&quot; : {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;ts&quot; : Timestamp(1548307234, 1),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;t&quot; : NumberLong(7)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;optimeDurable&quot; : {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;ts&quot; : Timestamp(1548307234, 1),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;t&quot; : NumberLong(7)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;optimeDate&quot; : ISODate(&quot;2019-01-24T05:20:34Z&quot;),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;optimeDurableDate&quot; : ISODate(&quot;2019-01-24T05:20:34Z&quot;),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;lastHeartbeat&quot; : ISODate(&quot;2019-01-24T05:20:35.574Z&quot;),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;lastHeartbeatRecv&quot; : ISODate(&quot;2019-01-24T05:20:36.616Z&quot;),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;pingMs&quot; : NumberLong(0),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;lastHeartbeatMessage&quot; : &quot;&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;syncingTo&quot; : &quot;localhost:27017&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;syncSourceHost&quot; : &quot;localhost:27017&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;syncSourceId&quot; : 0,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;infoMessage&quot; : &quot;&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;configVersion&quot; : 2&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ],&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;ok&quot; : 1,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;operationTime&quot; : Timestamp(1548307234, 1),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;$clusterTime&quot; : {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;clusterTime&quot; : Timestamp(1548307234, 1),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;signature&quot; : {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;hash&quot; : BinData(0,&quot;AAAAAAAAAAAAAAAAAAAAAAAAAAA=&quot;),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;keyId&quot; : NumberLong(0)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0RbjmgcHSZdIKL8TTw5D5WWqMoPicG2pXsQMFWxmhDwRDdExo9FI86JdIXx6VgxiUTEQtsQ9EKQZK6dWB4tLkosAS3mHUG0yGyytbXkRVtZ26dSmXTbnYBQUceneH788yYx9_yEpanKE_/s1600/8.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;990&quot; data-original-width=&quot;894&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0RbjmgcHSZdIKL8TTw5D5WWqMoPicG2pXsQMFWxmhDwRDdExo9FI86JdIXx6VgxiUTEQtsQ9EKQZK6dWB4tLkosAS3mHUG0yGyytbXkRVtZ26dSmXTbnYBQUceneH788yYx9_yEpanKE_/s1600/8.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
MongoDB Enterprise test:PRIMARY&amp;gt;&lt;br /&gt;
&lt;br /&gt;
MongoDB Enterprise test:PRIMARY&amp;gt; use exampleDB&lt;br /&gt;
switched to db exampleDB&lt;br /&gt;
MongoDB Enterprise test:PRIMARY&amp;gt; for (var i = 0; i &amp;lt;= 10; i++) db.exampleCollection.insert( { x : i } )&lt;br /&gt;
WriteResult({ &quot;nInserted&quot; : 1 })&lt;br /&gt;
MongoDB Enterprise test:PRIMARY&amp;gt; db.exampleCollection.find().pretty();&lt;br /&gt;
{ &quot;_id&quot; : ObjectId(&quot;5c494c1fa8a110e1bca27f5f&quot;), &quot;x&quot; : 0 }&lt;br /&gt;
{ &quot;_id&quot; : ObjectId(&quot;5c494c1fa8a110e1bca27f60&quot;), &quot;x&quot; : 1 }&lt;br /&gt;
{ &quot;_id&quot; : ObjectId(&quot;5c494c1fa8a110e1bca27f61&quot;), &quot;x&quot; : 2 }&lt;br /&gt;
{ &quot;_id&quot; : ObjectId(&quot;5c494c1fa8a110e1bca27f62&quot;), &quot;x&quot; : 3 }&lt;br /&gt;
{ &quot;_id&quot; : ObjectId(&quot;5c494c1fa8a110e1bca27f63&quot;), &quot;x&quot; : 4 }&lt;br /&gt;
{ &quot;_id&quot; : ObjectId(&quot;5c494c1fa8a110e1bca27f64&quot;), &quot;x&quot; : 5 }&lt;br /&gt;
{ &quot;_id&quot; : ObjectId(&quot;5c494c1fa8a110e1bca27f65&quot;), &quot;x&quot; : 6 }&lt;br /&gt;
{ &quot;_id&quot; : ObjectId(&quot;5c494c1fa8a110e1bca27f66&quot;), &quot;x&quot; : 7 }&lt;br /&gt;
{ &quot;_id&quot; : ObjectId(&quot;5c494c1fa8a110e1bca27f67&quot;), &quot;x&quot; : 8 }&lt;br /&gt;
{ &quot;_id&quot; : ObjectId(&quot;5c494c1fa8a110e1bca27f68&quot;), &quot;x&quot; : 9 }&lt;br /&gt;
{ &quot;_id&quot; : ObjectId(&quot;5c494c1fa8a110e1bca27f69&quot;), &quot;x&quot; : 10 }&lt;br /&gt;
MongoDB Enterprise test:PRIMARY&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhc-MdgAdajsYHbhyV9XJwkgtz-H6RqgaUHMbAG2QIsMwnpcHFJ_LP4BJUhhs9lxfVaHpqgc0Vliaxaica2xbYZPlia_5pADGJ_Xc_2O-VCF5Dy8wrIs73NbxsutnqmpOnOwHoPkfzx4G4L/s1600/9.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;222&quot; data-original-width=&quot;906&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhc-MdgAdajsYHbhyV9XJwkgtz-H6RqgaUHMbAG2QIsMwnpcHFJ_LP4BJUhhs9lxfVaHpqgc0Vliaxaica2xbYZPlia_5pADGJ_Xc_2O-VCF5Dy8wrIs73NbxsutnqmpOnOwHoPkfzx4G4L/s1600/9.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Now go to the secondary and check if the data is replicated.&lt;br /&gt;
MongoDB Enterprise test:SECONDARY&amp;gt; db.getMongo().setSlaveOk()&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhwSZXPgUMscX-KOVsyLBlmKRWMRbZbWYYqj1FPpCTgbgxN93zGhthLFsOx88PCMgwwq7NcZ_CRuwexFWmK1A_CA2S2uhsNOfoHBaE3M9W6VwXcG9UASPZkDSWcMZNk0hESpekiBevJbvl/s1600/10.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;606&quot; data-original-width=&quot;1311&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhwSZXPgUMscX-KOVsyLBlmKRWMRbZbWYYqj1FPpCTgbgxN93zGhthLFsOx88PCMgwwq7NcZ_CRuwexFWmK1A_CA2S2uhsNOfoHBaE3M9W6VwXcG9UASPZkDSWcMZNk0hESpekiBevJbvl/s1600/10.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
MongoDB Enterprise test:SECONDARY&amp;gt; db.exampleCollection.find().pretty();&lt;br /&gt;
{ &quot;_id&quot; : ObjectId(&quot;5c494c1fa8a110e1bca27f5f&quot;), &quot;x&quot; : 0 }&lt;br /&gt;
{ &quot;_id&quot; : ObjectId(&quot;5c494c1fa8a110e1bca27f61&quot;), &quot;x&quot; : 2 }&lt;br /&gt;
{ &quot;_id&quot; : ObjectId(&quot;5c494c1fa8a110e1bca27f63&quot;), &quot;x&quot; : 4 }&lt;br /&gt;
{ &quot;_id&quot; : ObjectId(&quot;5c494c1fa8a110e1bca27f65&quot;), &quot;x&quot; : 6 }&lt;br /&gt;
{ &quot;_id&quot; : ObjectId(&quot;5c494c1fa8a110e1bca27f62&quot;), &quot;x&quot; : 3 }&lt;br /&gt;
{ &quot;_id&quot; : ObjectId(&quot;5c494c1fa8a110e1bca27f67&quot;), &quot;x&quot; : 8 }&lt;br /&gt;
{ &quot;_id&quot; : ObjectId(&quot;5c494c1fa8a110e1bca27f69&quot;), &quot;x&quot; : 10 }&lt;br /&gt;
{ &quot;_id&quot; : ObjectId(&quot;5c494c1fa8a110e1bca27f64&quot;), &quot;x&quot; : 5 }&lt;br /&gt;
{ &quot;_id&quot; : ObjectId(&quot;5c494c1fa8a110e1bca27f68&quot;), &quot;x&quot; : 9 }&lt;br /&gt;
{ &quot;_id&quot; : ObjectId(&quot;5c494c1fa8a110e1bca27f60&quot;), &quot;x&quot; : 1 }&lt;br /&gt;
{ &quot;_id&quot; : ObjectId(&quot;5c494c1fa8a110e1bca27f66&quot;), &quot;x&quot; : 7 }&lt;br /&gt;
MongoDB Enterprise test:SECONDARY&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check on the another secondary .&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiO5JCF173PdmfRfuLhS6YJvgSs3GV96NZPJHBn3RT_0TsRyy9ybWnFSoHacb4fOr3ct0kZn6RuWIJVMHewCSj60Gvz6IROa0YHordcRH9llI9xnmYQrIutl3n3g40hGyvPaEK87XdP0CE/s1600/11.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;433&quot; data-original-width=&quot;1180&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiO5JCF173PdmfRfuLhS6YJvgSs3GV96NZPJHBn3RT_0TsRyy9ybWnFSoHacb4fOr3ct0kZn6RuWIJVMHewCSj60Gvz6IROa0YHordcRH9llI9xnmYQrIutl3n3g40hGyvPaEK87XdP0CE/s1600/11.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
To test the fail-over lets us kill the primary now. Check the rs.status() on another secondary.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDn-SpfiYZmNZuS0PAnAzK8zGFL_Y75JY-W146PG6Ox6qgCNtNq1wxKd9bZONsdkksEBeDfrtrPg28KHr0G9uIKJlkD_Y7SOK9iehPT-xFI7PdhMRdFh_UUIrvogE9uGqkvqGwzjhP5nY0/s1600/12.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1010&quot; data-original-width=&quot;1591&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDn-SpfiYZmNZuS0PAnAzK8zGFL_Y75JY-W146PG6Ox6qgCNtNq1wxKd9bZONsdkksEBeDfrtrPg28KHr0G9uIKJlkD_Y7SOK9iehPT-xFI7PdhMRdFh_UUIrvogE9uGqkvqGwzjhP5nY0/s1600/12.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Its shows the earlier primary is not available and the one running on the 27018 becomes the primary.&lt;br /&gt;
&lt;br /&gt;
Let start the 27017 again.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7CvKbSZ6B1eYKhvTNrMR8c0EMwxgV4MkUwSzeGQUzOhlcu8f52B9UU2dP8McpyfNdZIhCKh5ljZsGyrVlrM3zhaBtDy9uK2Raens6B_JAK3g79xqrj-8WauILLEl62608RZxfAGSp4Kn6/s1600/13.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;954&quot; data-original-width=&quot;827&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7CvKbSZ6B1eYKhvTNrMR8c0EMwxgV4MkUwSzeGQUzOhlcu8f52B9UU2dP8McpyfNdZIhCKh5ljZsGyrVlrM3zhaBtDy9uK2Raens6B_JAK3g79xqrj-8WauILLEl62608RZxfAGSp4Kn6/s1600/13.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5Q0DUNK5oUJ6ViMD1zR-u-0L-SB5VMX7R9UnR8WAzl_1EFksdMzCc6tQ9bfq1J5SLvRQjp32rnUlIDZCV7Wgj3bQR_Pcxuypvu-Qbb1Q2qC0AX-j704uEFI6_hKtOqQNCe8P7qgnf27nf/s1600/14.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;467&quot; data-original-width=&quot;779&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5Q0DUNK5oUJ6ViMD1zR-u-0L-SB5VMX7R9UnR8WAzl_1EFksdMzCc6tQ9bfq1J5SLvRQjp32rnUlIDZCV7Wgj3bQR_Pcxuypvu-Qbb1Q2qC0AX-j704uEFI6_hKtOqQNCe8P7qgnf27nf/s1600/14.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://abhijitbashetti.blogspot.com/feeds/544771137920311066/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://abhijitbashetti.blogspot.com/2019/01/mongodb-replication-set-up.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/544771137920311066'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/544771137920311066'/><link rel='alternate' type='text/html' href='http://abhijitbashetti.blogspot.com/2019/01/mongodb-replication-set-up.html' title='MongoDB Replication set up'/><author><name>Abhijit Bashetti</name><uri>http://www.blogger.com/profile/02494128996998150172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUkzTfb2FQaDNMYEccAavR7aylIC_4UBvAhEtPQTesV-IzTwNr0rtF16MQgDIIcQMg4MpzYOQ3gHrFZPLOwyWxqUk1aQA1VxGFjYr5UMOYCRmdgKbeC_v6kJKxY2Fdf_o/s220/IMG_2027.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjluaH9tKraj35dC-qa0ClTHsgKd7zx0cqbGhCCMCOKRCaCEQhY-88W9eak6QHFlFwyfyAsojrid_Q4aMb71PWOqQu9uAmZ3Tkn9N5-_y9evdseVoDtBvNqYc8alLhwHP9lBGRqYjnTTV_u/s72-c/1.PNG" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8592878860404675342.post-7970213106059372129</id><published>2019-01-21T03:44:00.002-08:00</published><updated>2019-01-21T03:47:17.527-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Install MongoDB 4.0 on Windows 8"/><title type='text'>Install MongoDB 4.0 on Windows 8</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: georgia, &amp;quot;times new roman&amp;quot;, serif; line-height: 107%; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;1.&lt;span style=&quot;font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background: white; font-family: georgia, &amp;quot;times new roman&amp;quot;, serif; line-height: 107%; text-indent: -0.25in;&quot;&gt;Now go to &lt;/span&gt;&lt;span style=&quot;background: white; font-family: georgia, &amp;quot;times new roman&amp;quot;, serif; line-height: 107%; text-indent: -0.25in;&quot;&gt;&lt;a href=&quot;https://www.mongodb.com/download-center&quot; style=&quot;font-family: georgia, &amp;quot;times new roman&amp;quot;, serif; text-indent: -0.25in;&quot;&gt;https://www.mongodb.com/download-center&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: georgia, &amp;quot;times new roman&amp;quot;, serif; line-height: 107%; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;2.&lt;span style=&quot;font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background: white; font-family: georgia, &amp;quot;times new roman&amp;quot;, serif; line-height: 107%; text-indent: -0.25in;&quot;&gt;Click Download (msi) and run it.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: georgia, &amp;quot;times new roman&amp;quot;, serif; line-height: 107%; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;3.&lt;span style=&quot;font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background: white; font-family: georgia, &amp;quot;times new roman&amp;quot;, serif; line-height: 107%; text-indent: -0.25in;&quot;&gt;Click Next.&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;line-height: 107%;&quot;&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shapetype id=&quot;_x0000_t75&quot;
 coordsize=&quot;21600,21600&quot; o:spt=&quot;75&quot; o:preferrelative=&quot;t&quot; path=&quot;m@4@5l@4@11@9@11@9@5xe&quot;
 filled=&quot;f&quot; stroked=&quot;f&quot;&gt;
 &lt;v:stroke joinstyle=&quot;miter&quot;/&gt;
 &lt;v:formulas&gt;
  &lt;v:f eqn=&quot;if lineDrawn pixelLineWidth 0&quot;/&gt;
  &lt;v:f eqn=&quot;sum @0 1 0&quot;/&gt;
  &lt;v:f eqn=&quot;sum 0 0 @1&quot;/&gt;
  &lt;v:f eqn=&quot;prod @2 1 2&quot;/&gt;
  &lt;v:f eqn=&quot;prod @3 21600 pixelWidth&quot;/&gt;
  &lt;v:f eqn=&quot;prod @3 21600 pixelHeight&quot;/&gt;
  &lt;v:f eqn=&quot;sum @0 0 1&quot;/&gt;
  &lt;v:f eqn=&quot;prod @6 1 2&quot;/&gt;
  &lt;v:f eqn=&quot;prod @7 21600 pixelWidth&quot;/&gt;
  &lt;v:f eqn=&quot;sum @8 21600 0&quot;/&gt;
  &lt;v:f eqn=&quot;prod @7 21600 pixelHeight&quot;/&gt;
  &lt;v:f eqn=&quot;sum @10 21600 0&quot;/&gt;
 &lt;/v:formulas&gt;
 &lt;v:path o:extrusionok=&quot;f&quot; gradientshapeok=&quot;t&quot; o:connecttype=&quot;rect&quot;/&gt;
 &lt;o:lock v:ext=&quot;edit&quot; aspectratio=&quot;t&quot;/&gt;
&lt;/v:shapetype&gt;&lt;v:shape id=&quot;Picture_x0020_1&quot; o:spid=&quot;_x0000_i1034&quot; type=&quot;#_x0000_t75&quot;
 style=&#39;width:381pt;height:301.5pt;visibility:visible;mso-wrap-style:square&#39;&gt;
 &lt;v:imagedata src=&quot;file:///C:\Users\abhijitb\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png&quot;
  o:title=&quot;&quot;/&gt;
&lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;!--[endif]--&gt;&lt;/span&gt;&lt;span style=&quot;background: white; line-height: 107%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwjaWtua6QiOM1tSW1DZKpRDq8dpInfpLUqK9SRr_RaEr3nXgrgBUgkEdONdbhoMapigJwrOJmAXbNtwvZNAh1UFu2ak90boq5Gv3-i_QCP5H3zIj8ZYjRT74xy58Llq3cLz-bXqrgHoaO/s1600/mongo1.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;402&quot; data-original-width=&quot;508&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwjaWtua6QiOM1tSW1DZKpRDq8dpInfpLUqK9SRr_RaEr3nXgrgBUgkEdONdbhoMapigJwrOJmAXbNtwvZNAh1UFu2ak90boq5Gv3-i_QCP5H3zIj8ZYjRT74xy58Llq3cLz-bXqrgHoaO/s1600/mongo1.PNG&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;line-height: 107%;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;span style=&quot;line-height: 107%; text-indent: -0.25in;&quot;&gt;4.&lt;span style=&quot;font-stretch: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;line-height: 107%; text-indent: -0.25in;&quot;&gt;Accept the terms.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; line-height: 107%; text-indent: -0.25in;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; line-height: 107%; text-indent: -0.25in;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2goOzaGo2EymsU_dnbzX4ujl4dz-x75eaMSyCyu5BtV1rzK2JgSykacnmEPjSmqydYUqCBHTqn_-n7YvQRYR1vnMSiD_kbSFKNtH3CmcO9fBpUKD_oKeASDSoy269idMy02gQLvzK-Sq9/s1600/mongo2.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;402&quot; data-original-width=&quot;509&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2goOzaGo2EymsU_dnbzX4ujl4dz-x75eaMSyCyu5BtV1rzK2JgSykacnmEPjSmqydYUqCBHTqn_-n7YvQRYR1vnMSiD_kbSFKNtH3CmcO9fBpUKD_oKeASDSoy269idMy02gQLvzK-Sq9/s1600/mongo2.PNG&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; line-height: 107%; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;line-height: 17.12px;&quot;&gt;&lt;span style=&quot;font-stretch: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background: white; line-height: 17.12px;&quot;&gt;5. You choose the&amp;nbsp;&lt;span class=&quot;guilabel&quot;&gt;&lt;b&gt;Complete&lt;/b&gt;&lt;/span&gt;&amp;nbsp;(recommended for most users)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo1; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBH8WfDGU78LIdfR-EConWX86WMeRbEVrE-P5RakyKERNL080_3-dFHMWcD9qSKlIaKZo1ay9gju_l6YBDEknt1UatJGzXoqZQdRxfrBsrq4UIq4BwNe7N-NljZ4Cc4kjB6yCTp0DU-6oa/s1600/mongo3.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;403&quot; data-original-width=&quot;510&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBH8WfDGU78LIdfR-EConWX86WMeRbEVrE-P5RakyKERNL080_3-dFHMWcD9qSKlIaKZo1ay9gju_l6YBDEknt1UatJGzXoqZQdRxfrBsrq4UIq4BwNe7N-NljZ4Cc4kjB6yCTp0DU-6oa/s1600/mongo3.PNG&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;6.&amp;nbsp;&lt;span style=&quot;background-color: white; text-indent: -24px;&quot;&gt;Select&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;guilabel&quot; style=&quot;text-indent: -24px;&quot;&gt;&lt;b&gt;Install MongoD as a Service&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; text-indent: -24px;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggTPcNmziYshh9W-KI6OAR5WW3-HmLrrPrrQxFkZbp6sveimEASx1Zlh1row1ctTY6uqZKimqd1qcwShSOzHISCu7r7Tl-Fu9Y77QNYCqh8cT_4_fdEoqkdvCIyaGp4CF45oSkHrhvNyT9/s1600/mongo5.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;402&quot; data-original-width=&quot;510&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggTPcNmziYshh9W-KI6OAR5WW3-HmLrrPrrQxFkZbp6sveimEASx1Zlh1row1ctTY6uqZKimqd1qcwShSOzHISCu7r7Tl-Fu9Y77QNYCqh8cT_4_fdEoqkdvCIyaGp4CF45oSkHrhvNyT9/s1600/mongo5.PNG&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;7.&amp;nbsp;&lt;span style=&quot;line-height: 17.12px; text-indent: -24px;&quot;&gt;&lt;span style=&quot;font-stretch: normal; line-height: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background: white; line-height: 17.12px; text-indent: -24px;&quot;&gt;To install Compass, select&amp;nbsp;&lt;span class=&quot;guilabel&quot;&gt;&lt;b&gt;Install MongoDB Compass&lt;/b&gt;&lt;/span&gt;&amp;nbsp;(Default).&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgs9N9paQRSz7zE050s9Pm7lMBFLB_eXtKbKX7mxHA5Wqsz6zsgMGVjxt80ImfSQkCJbzTzlvTKEP1EiT4oHVUtC0CP2gSi64x_wrQEF3JzxlzrqNmUKjS6pcFq9rEdh2Nzw6TNgq49i7jW/s1600/mongo6.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;399&quot; data-original-width=&quot;510&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgs9N9paQRSz7zE050s9Pm7lMBFLB_eXtKbKX7mxHA5Wqsz6zsgMGVjxt80ImfSQkCJbzTzlvTKEP1EiT4oHVUtC0CP2gSi64x_wrQEF3JzxlzrqNmUKjS6pcFq9rEdh2Nzw6TNgq49i7jW/s1600/mongo6.PNG&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;8.&amp;nbsp;Click&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;guilabel&quot;&gt;&lt;b&gt;Install&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhM5S8XTFYcb_qN9FsoHAyTKdp6O9zEFpwt3vX8njZ-HdNRAqaI-Wyw95e_1JJ3hV7tLwKsLYbVq-oUTzFifhvWkkHqEwtpeZIzR61wQ4IdZ-gctY4cMuo-_eMkgfZwoTPEUY07YiE8MaVn/s1600/mongo7.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;397&quot; data-original-width=&quot;503&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhM5S8XTFYcb_qN9FsoHAyTKdp6O9zEFpwt3vX8njZ-HdNRAqaI-Wyw95e_1JJ3hV7tLwKsLYbVq-oUTzFifhvWkkHqEwtpeZIzR61wQ4IdZ-gctY4cMuo-_eMkgfZwoTPEUY07YiE8MaVn/s1600/mongo7.PNG&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzeV7yXKDzomGFEqptcu3Nn0d2nsl4UZIuu3dOdGorRnO1VMjaYXQlHCQ-LZejaSsXSRhqdDFndK7o2LzqHJd5AYJfXHJrQOzvUXnlfi1Rwl4jlewB0x_CWk0SacctexbDvY0y2MutdThM/s1600/mongo8.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;398&quot; data-original-width=&quot;506&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzeV7yXKDzomGFEqptcu3Nn0d2nsl4UZIuu3dOdGorRnO1VMjaYXQlHCQ-LZejaSsXSRhqdDFndK7o2LzqHJd5AYJfXHJrQOzvUXnlfi1Rwl4jlewB0x_CWk0SacctexbDvY0y2MutdThM/s1600/mongo8.PNG&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;line-height: 107%;&quot;&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shape id=&quot;Picture_x0020_2&quot;
 o:spid=&quot;_x0000_i1033&quot; type=&quot;#_x0000_t75&quot; style=&#39;width:381.75pt;height:301.5pt;
 visibility:visible;mso-wrap-style:square&#39;&gt;
 &lt;v:imagedata src=&quot;file:///C:\Users\abhijitb\AppData\Local\Temp\msohtmlclip1\01\clip_image002.png&quot;
  o:title=&quot;&quot;/&gt;
&lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;!--[endif]--&gt;&lt;/span&gt;&lt;span style=&quot;background: white; line-height: 107%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;line-height: 107%;&quot;&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shape id=&quot;Picture_x0020_7&quot;
 o:spid=&quot;_x0000_i1030&quot; type=&quot;#_x0000_t75&quot; style=&#39;width:382.5pt;height:299.25pt;
 visibility:visible;mso-wrap-style:square&#39;&gt;
 &lt;v:imagedata src=&quot;file:///C:\Users\abhijitb\AppData\Local\Temp\msohtmlclip1\01\clip_image005.png&quot;
  o:title=&quot;&quot;/&gt;
&lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;!--[endif]--&gt;&lt;/span&gt;&lt;span style=&quot;line-height: 107%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Run
MongoDB Community Edition from the Command Interpreter&lt;/span&gt;&lt;/div&gt;
&lt;h3 style=&quot;background: white; line-height: 18.0pt; margin-bottom: .25in; margin-left: 0in; margin-right: 0in; margin-top: .25in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: small; font-weight: normal;&quot;&gt;Create
database directory.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; line-height: 107%;&quot;&gt;From the command line &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; line-height: 107%;&quot;&gt;cd D:\&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; line-height: 107%;&quot;&gt;md “\MongoData \db”&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Start your MongoDB database&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;background: white; line-height: 107%;&quot;&gt;To start MongoDB, run&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://docs.mongodb.com/manual/reference/program/mongod.exe/#bin.mongod.exe&quot; title=&quot;bin.mongod.exe&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&lt;span style=&quot;background: white; line-height: 107%; text-decoration: none;&quot;&gt;mongod.exe&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background: white; line-height: 107%;&quot;&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;background: white; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; line-height: 107%;&quot;&gt;Let’s point server to your database
directory.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background: white; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; line-height: 107%;&quot;&gt;&quot;C:\Program
Files\MongoDB\Server\4.0\bin\mongod.exe&quot; --dbpath=&quot;c:\data\db&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjle-KMeqU5W229dQf5C-cVABipIwg8vuI0ZIfX6Rrks94DC_s8OGQKzxvxbz2XhsWJASWgnSerKoh0RrxfMaemncu-pLupZMwLFCDIgFbv5Ms8gb_hfBmtoGB5bXWyRfWD4qYVwqIu2qfA/s1600/mongo9.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;278&quot; data-original-width=&quot;814&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjle-KMeqU5W229dQf5C-cVABipIwg8vuI0ZIfX6Rrks94DC_s8OGQKzxvxbz2XhsWJASWgnSerKoh0RrxfMaemncu-pLupZMwLFCDIgFbv5Ms8gb_hfBmtoGB5bXWyRfWD4qYVwqIu2qfA/s1600/mongo9.png&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;background: white; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; line-height: 107%;&quot;&gt;If the MongoDB database server is
running correctly, the&amp;nbsp;&lt;span class=&quot;guilabel&quot;&gt;&lt;b&gt;Command Interpreter&lt;/b&gt;&lt;/span&gt;&amp;nbsp;displays:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Connect to MongoDB.&lt;/span&gt;&lt;/div&gt;
&lt;h3 style=&quot;background: white; line-height: 18.0pt; margin-bottom: .25in; margin-left: 0in; margin-right: 0in; margin-top: .25in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: small; font-weight: normal;&quot;&gt;&quot;C:\Program
Files\MongoDB\Server\4.0\bin\mongo.exe&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCRvkyaOhAUJ3vC8W5ugZazsMUCCZCvhXihCkhcbJ2Ml-bZdGhBHSxg0eXxUA0_Lp3ARMlp55Yh60xVuGrcSjNOEGdosgV6F4yiQHgH7OKabIpTnnFJImCvY6R_vvm2RHGEX4gg5f22OHb/s1600/mongo10.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;93&quot; data-original-width=&quot;628&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCRvkyaOhAUJ3vC8W5ugZazsMUCCZCvhXihCkhcbJ2Ml-bZdGhBHSxg0eXxUA0_Lp3ARMlp55Yh60xVuGrcSjNOEGdosgV6F4yiQHgH7OKabIpTnnFJImCvY6R_vvm2RHGEX4gg5f22OHb/s1600/mongo10.png&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;line-height: 107%;&quot;&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shape id=&quot;Picture_x0020_12&quot;
 o:spid=&quot;_x0000_i1025&quot; type=&quot;#_x0000_t75&quot; style=&#39;width:468pt;height:63.75pt;
 visibility:visible;mso-wrap-style:square&#39;&gt;
 &lt;v:imagedata src=&quot;file:///C:\Users\abhijitb\AppData\Local\Temp\msohtmlclip1\01\clip_image011.png&quot;
  o:title=&quot;&quot;/&gt;
&lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;!--[endif]--&gt;&lt;/span&gt;&lt;span style=&quot;line-height: 107%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://abhijitbashetti.blogspot.com/feeds/7970213106059372129/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://abhijitbashetti.blogspot.com/2019/01/install-mongodb-40.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/7970213106059372129'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/7970213106059372129'/><link rel='alternate' type='text/html' href='http://abhijitbashetti.blogspot.com/2019/01/install-mongodb-40.html' title='Install MongoDB 4.0 on Windows 8'/><author><name>Abhijit Bashetti</name><uri>http://www.blogger.com/profile/02494128996998150172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUkzTfb2FQaDNMYEccAavR7aylIC_4UBvAhEtPQTesV-IzTwNr0rtF16MQgDIIcQMg4MpzYOQ3gHrFZPLOwyWxqUk1aQA1VxGFjYr5UMOYCRmdgKbeC_v6kJKxY2Fdf_o/s220/IMG_2027.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwjaWtua6QiOM1tSW1DZKpRDq8dpInfpLUqK9SRr_RaEr3nXgrgBUgkEdONdbhoMapigJwrOJmAXbNtwvZNAh1UFu2ak90boq5Gv3-i_QCP5H3zIj8ZYjRT74xy58Llq3cLz-bXqrgHoaO/s72-c/mongo1.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8592878860404675342.post-3425480339963936072</id><published>2018-12-31T02:48:00.001-08:00</published><updated>2018-12-31T02:50:19.892-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Achieving the Data Integrity and Incrementally Update the data on ElasticSearch Using Logstash"/><category scheme="http://www.blogger.com/atom/ns#" term="schedule the logstash"/><title type='text'>Achieving the Data Integrity and Incrementally Update the data on ElasticSearch Using Logstash</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
In order to avoid the duplication issues at elasticsearch you may need to add the unique id for the documents at elasticsearch.&lt;br /&gt;
&lt;br /&gt;
Modify the logstashMSSQL_Test.conf by adding the &quot;document_id&quot; =&amp;gt; &quot;%{studentid}&quot; in the output like below.&lt;br /&gt;
&lt;br /&gt;
output {&lt;br /&gt;
&amp;nbsp; stdout { codec =&amp;gt; json_lines }&lt;br /&gt;
&amp;nbsp; elasticsearch {&lt;br /&gt;
&amp;nbsp; &quot;hosts&quot; =&amp;gt; &quot;localhost:9200&quot;&lt;br /&gt;
&amp;nbsp; &quot;index&quot; =&amp;gt; &quot;test-migrate&quot;&lt;br /&gt;
&amp;nbsp; &quot;document_type&quot; =&amp;gt; &quot;data&quot;&lt;br /&gt;
&amp;nbsp; &quot;document_id&quot; =&amp;gt; &quot;%{studentid}&quot;&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Schedule the same migration if the data is continuosly been updateded on the MSSQL Sever side&lt;br /&gt;
This will be running after every one minute&lt;br /&gt;
Add the below part in order to incrementing update&lt;br /&gt;
&lt;br /&gt;
schedule =&amp;gt; &quot;* * * * *&quot;&lt;br /&gt;
statement =&amp;gt; &quot;SELECT * FROM Student where studentid &amp;gt; :sql_last_value&quot;&lt;br /&gt;
use_column_value =&amp;gt; true&lt;br /&gt;
tracking_column =&amp;gt; studentid&lt;br /&gt;
&lt;br /&gt;
input {&lt;br /&gt;
&amp;nbsp; jdbc {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; jdbc_connection_string =&amp;gt; &quot;jdbc:sqlserver://localhost:1433;databaseName=test&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; # The user we wish to execute our statement as&lt;br /&gt;
&amp;nbsp; &amp;nbsp; jdbc_user =&amp;gt; &quot;sa&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; jdbc_password =&amp;gt; &quot;sasa&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; # The path to our downloaded jdbc driver&lt;br /&gt;
&amp;nbsp; &amp;nbsp; jdbc_driver_library =&amp;gt; &quot;C:\Users\abhijitb\.m2\repository\com\microsoft\sqlserver\mssql-jdbc\6.2.2.jre8\mssql-jdbc-6.2.2.jre8.jar&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; jdbc_driver_class =&amp;gt; &quot;com.microsoft.sqlserver.jdbc.SQLServerDriver&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; # our query&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;#clean_run =&amp;gt; true&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;schedule =&amp;gt; &quot;* * * * *&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; statement =&amp;gt; &quot;SELECT * FROM Student where studentid &amp;gt; :sql_last_value&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; use_column_value =&amp;gt; true&lt;br /&gt;
&amp;nbsp; &amp;nbsp; tracking_column =&amp;gt; &quot;studentid&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
output {&lt;br /&gt;
&amp;nbsp; #stdout { codec =&amp;gt; json_lines }&lt;br /&gt;
&amp;nbsp; elasticsearch {&lt;br /&gt;
&amp;nbsp; &quot;hosts&quot; =&amp;gt; &quot;localhost:9200&quot;&lt;br /&gt;
&amp;nbsp; &quot;index&quot; =&amp;gt; &quot;student&quot;&lt;br /&gt;
&amp;nbsp; &quot;document_type&quot; =&amp;gt; &quot;data&quot;&lt;br /&gt;
&amp;nbsp; &quot;document_id&quot; =&amp;gt; &quot;%{studentid}&quot;&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
Add the data to Table Student one by one.&lt;br /&gt;
&lt;br /&gt;
INSERT INTO Student (StudentId, FirstName, LastName, Age, Sex, City, Country, EnrolledDate) VALUES&lt;br /&gt;
(8,&#39;David&#39;,&#39;Bruce&#39;, 32, &#39;M&#39;, &#39;Paris&#39;, &#39;FRANCE&#39;, GETDATE());&lt;br /&gt;
&lt;br /&gt;
INSERT INTO Student (StudentId, FirstName, LastName, Age, Sex, City, Country, EnrolledDate) VALUES&lt;br /&gt;
(9,&#39;Steve&#39;,&#39;Warne&#39;, 30, &#39;M&#39;, &#39;Paris&#39;, &#39;FRANCE&#39;, GETDATE()-200);&lt;br /&gt;
&lt;br /&gt;
INSERT INTO Student (StudentId, FirstName, LastName, Age, Sex, City, Country, EnrolledDate) VALUES&lt;br /&gt;
(10,&#39;Ajit&#39;,&#39;Patil&#39;, 32, &#39;M&#39;, &#39;Pune&#39;, &#39;India&#39;, GETDATE()-100);&lt;br /&gt;
&lt;br /&gt;
INSERT INTO Student (StudentId, FirstName, LastName, Age, Sex, City, Country, EnrolledDate) VALUES&lt;br /&gt;
(11,&#39;Steve&#39;,&#39;Scot&#39;, 32, &#39;M&#39;, &#39;Paris&#39;, &#39;FRANCE&#39;, GETDATE()-50);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you update the file, go the&lt;br /&gt;
Go the path C:\logstash-6.5.4\logstash-6.5.4\bin&amp;gt; on the command prompt.&lt;br /&gt;
run the below command &quot;logstash -f logstashMSSQL_Test.conf&quot;&lt;br /&gt;
&lt;br /&gt;
C:\logstash-6.5.4\logstash-6.5.4\bin&amp;gt;logstash -f logstashMSSQL_Test.conf&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgufmRxg-XYDDGADFMsGM1ZOQvpON1MAqzZG1YMtGtp0Vq1lPpSvVUxVp26NivFBhrGYqm4LZD6P4xpRermdtv2NQ56OqRgZjpp409kX6q41QjCQJxakXH8h9r7-xywfqpeLfVMBIrNiWfu/s1600/IncrementalLogstash.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;401&quot; data-original-width=&quot;1256&quot; height=&quot;204&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgufmRxg-XYDDGADFMsGM1ZOQvpON1MAqzZG1YMtGtp0Vq1lPpSvVUxVp26NivFBhrGYqm4LZD6P4xpRermdtv2NQ56OqRgZjpp409kX6q41QjCQJxakXH8h9r7-xywfqpeLfVMBIrNiWfu/s640/IncrementalLogstash.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
To verify the Data on the ElasticSeach side click the link on the browser.&lt;br /&gt;
http://localhost:9200/student/_search?pretty=true&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLsEf5EtIzbo5GCDMGZ1ADPGYsd8jkcHzny7zsTOT1f5MFIuqyEJ410qwdN51H30Cn96t4zBVVnAIH43D5oCEp4iJF-69yCyai_vqfR-wcVVwNMA5F4vuuyUiVRWI64iEa5DRkmW7KH6fA/s1600/IncrementalElasticSearch.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1027&quot; data-original-width=&quot;744&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLsEf5EtIzbo5GCDMGZ1ADPGYsd8jkcHzny7zsTOT1f5MFIuqyEJ410qwdN51H30Cn96t4zBVVnAIH43D5oCEp4iJF-69yCyai_vqfR-wcVVwNMA5F4vuuyUiVRWI64iEa5DRkmW7KH6fA/s1600/IncrementalElasticSearch.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Check the data in descending order. You can verify the when the data is added to elastic search by checking the timestamp of it.&lt;br /&gt;
http://localhost:9200/student/_search?q=*&amp;amp;sort=studentid:desc&amp;amp;pretty=true&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgx52w1_cY6JS16K9v1oxzZvPEbc6c_dwXFhFQv1vjOs2ssdgayB9bCfTioWfWlxRe78c9C68ZZ9CrQLuBbbz1P8YVc3VuDibrrD4ectCz4B1d29FbAawPbLMBiyFIaKc_RqC3Cu9YFFbZC/s1600/IncrementalElasticSearchSorted.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1036&quot; data-original-width=&quot;845&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgx52w1_cY6JS16K9v1oxzZvPEbc6c_dwXFhFQv1vjOs2ssdgayB9bCfTioWfWlxRe78c9C68ZZ9CrQLuBbbz1P8YVc3VuDibrrD4ectCz4B1d29FbAawPbLMBiyFIaKc_RqC3Cu9YFFbZC/s1600/IncrementalElasticSearchSorted.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
To check more properties visit https://www.elastic.co/guide/en/logstash/current/plugins-inputs-jdbc.html&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://abhijitbashetti.blogspot.com/feeds/3425480339963936072/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://abhijitbashetti.blogspot.com/2018/12/achieving-data-integratity-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/3425480339963936072'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/3425480339963936072'/><link rel='alternate' type='text/html' href='http://abhijitbashetti.blogspot.com/2018/12/achieving-data-integratity-and.html' title='Achieving the Data Integrity and Incrementally Update the data on ElasticSearch Using Logstash'/><author><name>Abhijit Bashetti</name><uri>http://www.blogger.com/profile/02494128996998150172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUkzTfb2FQaDNMYEccAavR7aylIC_4UBvAhEtPQTesV-IzTwNr0rtF16MQgDIIcQMg4MpzYOQ3gHrFZPLOwyWxqUk1aQA1VxGFjYr5UMOYCRmdgKbeC_v6kJKxY2Fdf_o/s220/IMG_2027.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgufmRxg-XYDDGADFMsGM1ZOQvpON1MAqzZG1YMtGtp0Vq1lPpSvVUxVp26NivFBhrGYqm4LZD6P4xpRermdtv2NQ56OqRgZjpp409kX6q41QjCQJxakXH8h9r7-xywfqpeLfVMBIrNiWfu/s72-c/IncrementalLogstash.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8592878860404675342.post-3138116590733438042</id><published>2018-12-31T00:05:00.000-08:00</published><updated>2018-12-31T00:18:00.192-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Migrating the MSSQL Data to ElasticSearch using the Logstash."/><category scheme="http://www.blogger.com/atom/ns#" term="MSSQL SERVER DATABASE + LogStash + Elastic Search"/><title type='text'>Example of Migrating the MSSQL Data to ElasticSearch using the Logstash.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Example of MSSQL SERVER DATABASE + LogStash + Elastic Search&lt;br /&gt;
&lt;br /&gt;
Step 1 :&lt;br /&gt;
&lt;br /&gt;
I assume the MSSQL server database is installed.&lt;br /&gt;
&lt;br /&gt;
Let create a table and insert some data to it.&lt;br /&gt;
&lt;br /&gt;
Use Test;&lt;br /&gt;
&lt;br /&gt;
create table Student (StudentId int, FirstName varchar(255), LastName varchar(255), Age int, Sex char(2), City varchar(255), Country varchar(255), EnrolledDate datetime);&lt;br /&gt;
&lt;br /&gt;
INSERT INTO Student (StudentId, FirstName, LastName, Age, Sex, City, Country, EnrolledDate) VALUES&lt;br /&gt;
(1,&#39;Abhijit&#39;,&#39;Bashetti&#39;,33, &#39;M&#39;, &#39;Pune&#39;, &#39;India&#39;, &#39;2016-05-23 16:12:03&#39;);&lt;br /&gt;
&lt;br /&gt;
INSERT INTO Student (StudentId, FirstName, LastName, Age, Sex, City, Country, EnrolledDate) VALUES&lt;br /&gt;
(2,&#39;Mark&#39;,&#39;Brown&#39;,31, &#39;M&#39;, &#39;Mumbai&#39;, &#39;India&#39;, &#39;2017-05-23 16:12:03&#39;);&lt;br /&gt;
&lt;br /&gt;
INSERT INTO Student (StudentId, FirstName, LastName, Age, Sex, City, Country, EnrolledDate) VALUES&lt;br /&gt;
(3,&#39;Michell&#39;,&#39;Oak&#39;,31, &#39;F&#39;, &#39;NewYork&#39;, &#39;US&#39;, &#39;2017-08-25 16:12:03&#39;);&lt;br /&gt;
&lt;br /&gt;
INSERT INTO Student (StudentId, FirstName, LastName, Age, Sex, City, Country, EnrolledDate) VALUES&lt;br /&gt;
(4,&#39;Peter&#39;,&#39;Samprass&#39;, 30, &#39;M&#39;, &#39;Sydeny&#39;, &#39;Australlia&#39;, &#39;2017-09-30 16:12:03&#39;);&lt;br /&gt;
&lt;br /&gt;
INSERT INTO Student (StudentId, FirstName, LastName, Age, Sex, City, Country, EnrolledDate) VALUES&lt;br /&gt;
(5,&#39;Andre&#39;,&#39;Russel&#39;, 30, &#39;M&#39;, &#39;London&#39;, &#39;UK&#39;, &#39;2017-12-01 16:12:03&#39;);&lt;br /&gt;
&lt;br /&gt;
INSERT INTO Student (StudentId, FirstName, LastName, Age, Sex, City, Country, EnrolledDate) VALUES&lt;br /&gt;
(6,&#39;Kevin&#39;,&#39;Peterson&#39;, 32, &#39;M&#39;, &#39;London&#39;, &#39;UK&#39;, &#39;2017-12-21 16:12:03&#39;);&lt;br /&gt;
&lt;br /&gt;
INSERT INTO Student (StudentId, FirstName, LastName, Age, Sex, City, Country, EnrolledDate) VALUES&lt;br /&gt;
(7,&#39;Kevin&#39;,&#39;Burake&#39;, 32, &#39;M&#39;, &#39;London&#39;, &#39;UK&#39;, &#39;2017-12-21 16:12:03&#39;);&lt;br /&gt;
&lt;br /&gt;
select * from Student;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_K58KFVZpNtke35FxdnSOoCm5ilqnG-e4_oEP11LUI-xEwKX40feQqzUL65GZzuWBa8xHC6doerYiEEtwUmvc1obFXZ8OQEq5FQOxD9LFn_rJLx1MRuEPjPJK4SQkpE4vy-zJ2sdjcwg0/s1600/MSSQL.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;645&quot; data-original-width=&quot;1291&quot; height=&quot;318&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_K58KFVZpNtke35FxdnSOoCm5ilqnG-e4_oEP11LUI-xEwKX40feQqzUL65GZzuWBa8xHC6doerYiEEtwUmvc1obFXZ8OQEq5FQOxD9LFn_rJLx1MRuEPjPJK4SQkpE4vy-zJ2sdjcwg0/s640/MSSQL.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Step 2 :&lt;br /&gt;
&lt;br /&gt;
Now Install the elastic search by downloading the same from https://www.elastic.co/downloads/elasticsearch&lt;br /&gt;
&lt;br /&gt;
Go to the installed path like &quot;C:\Program Files\Elastic\Elasticsearch\6.5.3\bin&quot;. and start the elastic search.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_x5cuxCP2Hgfvbke9M-zMW57-b5KS8VFy1DJZrnEO04Jen90iRzoxUt7F8bCBG8QMmU1oYLVPvEN4iRfqlzQshVu5P3wf_NHsjfJqNUf1Ro7EwReAb8njjPpeuV-LfCmz7YcToFTEB3O3/s1600/ElasticSearchRunning.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;515&quot; data-original-width=&quot;1600&quot; height=&quot;205&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_x5cuxCP2Hgfvbke9M-zMW57-b5KS8VFy1DJZrnEO04Jen90iRzoxUt7F8bCBG8QMmU1oYLVPvEN4iRfqlzQshVu5P3wf_NHsjfJqNUf1Ro7EwReAb8njjPpeuV-LfCmz7YcToFTEB3O3/s640/ElasticSearchRunning.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Step 3 :&lt;br /&gt;
&lt;br /&gt;
Now Download the Logstash. https://www.elastic.co/downloads/logstash&lt;br /&gt;
&lt;br /&gt;
Go to the path C:\logstash-6.5.4\logstash-6.5.4\config&lt;br /&gt;
&lt;br /&gt;
Copy the logstash-sample.conf for the MSSQL DATABASE.&lt;br /&gt;
Rename it to logstashMSSQL_Test.conf.&lt;br /&gt;
&lt;br /&gt;
Add below properties.&lt;br /&gt;
&lt;br /&gt;
input {&lt;br /&gt;
&amp;nbsp; jdbc {&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;# the full url string for the mssql server&lt;br /&gt;
&amp;nbsp; &amp;nbsp; jdbc_connection_string =&amp;gt; &quot;jdbc:sqlserver://localhost:1433;databaseName=test&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; # The username and password to execute our statement as&lt;br /&gt;
&amp;nbsp; &amp;nbsp; jdbc_user =&amp;gt; &quot;sa&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; jdbc_password =&amp;gt; &quot;sasa&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; # The path to our downloaded mssql jdbc driver&lt;br /&gt;
&amp;nbsp; &amp;nbsp; jdbc_driver_library =&amp;gt; &quot;C:\Users\abhijitb\.m2\repository\com\microsoft\sqlserver\mssql-jdbc\6.2.2.jre8\mssql-jdbc-6.2.2.jre8.jar&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; jdbc_driver_class =&amp;gt; &quot;com.microsoft.sqlserver.jdbc.SQLServerDriver&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; # The required query&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;statement =&amp;gt; &quot;select * from Student&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
output {&lt;br /&gt;
&amp;nbsp; #stdout { codec =&amp;gt; json_lines }&lt;br /&gt;
&amp;nbsp; elasticsearch {&lt;br /&gt;
&amp;nbsp; &quot;hosts&quot; =&amp;gt; &quot;localhost:9200&quot;&lt;br /&gt;
&amp;nbsp; &quot;index&quot; =&amp;gt; &quot;student&quot;&lt;br /&gt;
&amp;nbsp; &quot;document_type&quot; =&amp;gt; &quot;data&quot;&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_JwgXkTa69Z6jcwkDwa-sRuk0XbCBH9hoK_vnSPmG0iJwjqGk55GgkfV9BXQXzoHyDTzi7tMUIAJ8kWPfJjLUPGvaJFD6_RXJovuAlpVH300raD_P28iBGH5Tp6xaTPM9NCARCe83OiXn/s1600/LogstashConfigFile.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;409&quot; data-original-width=&quot;1120&quot; height=&quot;233&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_JwgXkTa69Z6jcwkDwa-sRuk0XbCBH9hoK_vnSPmG0iJwjqGk55GgkfV9BXQXzoHyDTzi7tMUIAJ8kWPfJjLUPGvaJFD6_RXJovuAlpVH300raD_P28iBGH5Tp6xaTPM9NCARCe83OiXn/s640/LogstashConfigFile.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Go the path C:\logstash-6.5.4\logstash-6.5.4\bin&amp;gt; on the command prompt.&lt;br /&gt;
run the below command &quot;logstash -f logstashMSSQL_Test.conf&quot;&lt;br /&gt;
&lt;br /&gt;
C:\logstash-6.5.4\logstash-6.5.4\bin&amp;gt;logstash -f logstashMSSQL_Test.conf&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiT-ZVNDlx3Gj4AUrCNPM-yc6qR2diqzQFCymDH0unF758Pk9aKmU2b7eLURHeXqqHqcmpSCbu6qkaCMTW3i4gHSss1U7HEQJUxhQlGxUlOCq0aYkYEZn5mDmAhFBNwZ2rvOw0VsMaaxfGD/s1600/Logstash.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;252&quot; data-original-width=&quot;1600&quot; height=&quot;99&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiT-ZVNDlx3Gj4AUrCNPM-yc6qR2diqzQFCymDH0unF758Pk9aKmU2b7eLURHeXqqHqcmpSCbu6qkaCMTW3i4gHSss1U7HEQJUxhQlGxUlOCq0aYkYEZn5mDmAhFBNwZ2rvOw0VsMaaxfGD/s640/Logstash.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Step 4 :&lt;br /&gt;
&lt;br /&gt;
Its time to verify if the data is migrated to elasticsearch.&lt;br /&gt;
&lt;br /&gt;
If you have windows git go to the path &quot;C:\Program Files\Git\mingw64\bin&amp;gt;&quot;&lt;br /&gt;
and execute the command curl -XPOST &quot;localhost:9200/student/_search?pretty=true&quot;&lt;br /&gt;
C:\Program Files\Git\mingw64\bin&amp;gt;curl -XPOST &quot;localhost:9200/student/_search?pretty=true&quot;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbtuUsVJb5Nzw8i14R3hLayVNpPU_oWKSaPabT6DCFzWGgI1gw1TMK_xAoRXhoFKsOfu7855SGPr8-sYzGKyWDomlT3plLnc3N962ywVCInz5SWvPsrh66yzbQP9w-aXrVAgjwvrcMKR1i/s1600/VerifyOnElasticSearch.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1012&quot; data-original-width=&quot;753&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbtuUsVJb5Nzw8i14R3hLayVNpPU_oWKSaPabT6DCFzWGgI1gw1TMK_xAoRXhoFKsOfu7855SGPr8-sYzGKyWDomlT3plLnc3N962ywVCInz5SWvPsrh66yzbQP9w-aXrVAgjwvrcMKR1i/s1600/VerifyOnElasticSearch.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
or go to the browser and type http://localhost:9200/student/_search?pretty=true&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNQLg_5BYrOMxlK4u4G70NE43tiVaqSK_agcNjCglQY5EbntN4lKH2fqz5DqdvQJgztkMlzP_OYzuSHlFB-kCgpg41lbYubRJHiBlZ_YTYTT9MYOwKXDm8Usv6B1i_G_jyLVm0iyAhngFT/s1600/searchOnElasticSearch.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1035&quot; data-original-width=&quot;614&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNQLg_5BYrOMxlK4u4G70NE43tiVaqSK_agcNjCglQY5EbntN4lKH2fqz5DqdvQJgztkMlzP_OYzuSHlFB-kCgpg41lbYubRJHiBlZ_YTYTT9MYOwKXDm8Usv6B1i_G_jyLVm0iyAhngFT/s1600/searchOnElasticSearch.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://abhijitbashetti.blogspot.com/feeds/3138116590733438042/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://abhijitbashetti.blogspot.com/2018/12/example-of-migrating-mssql-data-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/3138116590733438042'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/3138116590733438042'/><link rel='alternate' type='text/html' href='http://abhijitbashetti.blogspot.com/2018/12/example-of-migrating-mssql-data-to.html' title='Example of Migrating the MSSQL Data to ElasticSearch using the Logstash.'/><author><name>Abhijit Bashetti</name><uri>http://www.blogger.com/profile/02494128996998150172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUkzTfb2FQaDNMYEccAavR7aylIC_4UBvAhEtPQTesV-IzTwNr0rtF16MQgDIIcQMg4MpzYOQ3gHrFZPLOwyWxqUk1aQA1VxGFjYr5UMOYCRmdgKbeC_v6kJKxY2Fdf_o/s220/IMG_2027.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_K58KFVZpNtke35FxdnSOoCm5ilqnG-e4_oEP11LUI-xEwKX40feQqzUL65GZzuWBa8xHC6doerYiEEtwUmvc1obFXZ8OQEq5FQOxD9LFn_rJLx1MRuEPjPJK4SQkpE4vy-zJ2sdjcwg0/s72-c/MSSQL.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8592878860404675342.post-1884247106212112374</id><published>2018-12-30T21:25:00.000-08:00</published><updated>2018-12-30T21:25:20.913-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ElasticSearch"/><category scheme="http://www.blogger.com/atom/ns#" term="indexing and searching on elastic search by curl."/><title type='text'>Indexing and searching to ElasticSearch by Curl</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
I have listed down the curl request for indexing the data on ElasticSearch and curl request for searching the data on ElasticSearch.&lt;br /&gt;
&lt;br /&gt;
I am using the Curl provided by the Git. You may need to install Window Git in order to use the same. Once you install Windows GIT. Go to the path cd C:\Program Files\Git\mingw64\bin&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. To create an index named &quot;customer&quot;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;curl -X PUT &quot;localhost:9200/customer?pretty&quot;&lt;br /&gt;
&lt;br /&gt;
Response is :&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &quot;acknowledged&quot; : true,&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &quot;shards_acknowledged&quot; : true,&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &quot;index&quot; : &quot;customer&quot;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
2. To list all the indices availabale&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;curl -X GET &quot;localhost:9200/_cat/indices?v&quot;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
3.&amp;nbsp; To add a document&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;curl -X PUT &quot;localhost:9200/customer/_doc/1?pretty&quot; -H &quot;Content-Type: application/json&quot; -d &quot;{\&quot;name\&quot;: \&quot;John Doe\&quot;}&quot;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
4. To view a specific document&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;curl -X GET &quot;localhost:9200/customer/_doc/1?pretty&quot;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
5. To delete a index&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;curl -X DELETE &quot;localhost:9200/customer?pretty&quot;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;curl -X GET &quot;localhost:9200/_cat/indices?v&quot;&lt;br /&gt;
&lt;br /&gt;
6. To Update a document&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;curl -X POST &quot;localhost:9200/customer/_doc/1/_update?pretty&quot; -H &quot;Content-Type: application/json&quot; -d &quot;{\&quot;doc\&quot;: { \&quot;name\&quot;: \&quot;Jane Doe\&quot; }}&quot;&lt;br /&gt;
&lt;br /&gt;
7. To Delete a document&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;curl -X DELETE &quot;localhost:9200/customer/_doc/1?pretty&quot;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;To verift run the below command&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;curl -X GET &quot;localhost:9200/customer/_doc/1?pretty&quot;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;C:\Program Files\Git\mingw64\bin&amp;gt;curl -X GET &quot;localhost:9200/customer/_doc/1?pretty&quot;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &quot;_index&quot; : &quot;customer&quot;,&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &quot;_type&quot; : &quot;_doc&quot;,&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &quot;_id&quot; : &quot;1&quot;,&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &quot;found&quot; : false&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
8. Buld adding documents&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;curl -H &quot;Content-Type: application/json&quot; -XPOST &quot;localhost:9200/bank/_doc/_bulk?pretty&amp;amp;refresh&quot; --data-binary &quot;@accounts.json&quot;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Check if the index named bank is created&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;curl &quot;localhost:9200/_cat/indices?v&quot;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
9. Search all the document in ascending order&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;curl -X GET &quot;localhost:9200/bank/_search?q=*&amp;amp;sort=account_number:asc&amp;amp;pretty&quot;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;OR&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;curl -X GET &quot;localhost:9200/bank/_search?pretty&quot; -H &quot;Content-Type: application/json&quot; -d &quot;{\&quot;query\&quot;: { \&quot;match_all\&quot;: {} }, \&quot;sort\&quot;: [{ \&quot;account_number\&quot;: \&quot;asc\&quot; }]}&quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
10. Search document by mentioning the limit&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;curl -X GET &quot;localhost:9200/bank/_search?pretty&quot; -H &quot;Content-Type: application/json&quot; -d &quot;{\&quot;query\&quot;: { \&quot;match_all\&quot;: {} }, \&quot;size\&quot;: 1 }&quot;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
11. Search Document in sorting order&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;curl -X GET &quot;localhost:9200/bank/_search?pretty&quot; -H &quot;Content-Type: application/json&quot; -d &quot;{\&quot;query\&quot;: {\&quot;match_all\&quot;: {} }, \&quot;sort\&quot;: {\&quot;balance\&quot;: { \&quot;order\&quot;: \&quot;desc\&quot; } }}&quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
12. Search all and return data of specific fields&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;curl -X GET &quot;localhost:9200/bank/_search?pretty&quot; -H &quot;Content-Type: application/json&quot; -d &quot;{\&quot;query\&quot;: { \&quot;match_all\&quot;: {} }, \&quot;_source\&quot;: [\&quot;account_number\&quot;, \&quot;balance\&quot;]}&quot;&lt;br /&gt;
&lt;br /&gt;
13. Search for specific document by applying criteria&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;curl -X GET &quot;localhost:9200/bank/_search?pretty&quot; -H &quot;Content-Type: application/json&quot; -d &quot;{\&quot;query\&quot;: { \&quot;match\&quot;: { \&quot;account_number\&quot;: 20 } }}&quot;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;curl -X GET &quot;localhost:9200/bank/_search?pretty&quot; -H &quot;Content-Type: application/json&quot; -d &quot;{\&quot;query\&quot;: { \&quot;match\&quot;: { \&quot;address\&quot;: \&quot;mill\&quot; } }}&quot;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
14. Search for specific document by applying AND criteria with Bool with must&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;curl -X GET &quot;localhost:9200/bank/_search?pretty&quot; -H &quot;Content-Type: application/json&quot; -d &quot;{\&quot;query\&quot;: { \&quot;bool\&quot;: { \&quot;must\&quot;: [{ \&quot;match\&quot;: { \&quot;address\&quot;: \&quot;mill\&quot; } },{ \&quot;match\&quot;: { \&quot;address\&quot;: \&quot;lane\&quot; } }]}}}&quot;&lt;br /&gt;
&lt;br /&gt;
15. Search for specific document by applying OR criteria with Bool with should&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;curl -X GET &quot;localhost:9200/bank/_search?pretty&quot; -H &quot;Content-Type: application/json&quot; -d &quot;{\&quot;query\&quot;: { \&quot;bool\&quot;: { \&quot;should\&quot;: [ { \&quot;match\&quot;: { \&quot;address\&quot;: \&quot;mill\&quot; } }, { \&quot;match\&quot;: { \&quot;address\&quot;: \&quot;lane\&quot; } }]}}}&quot;&lt;br /&gt;
&lt;br /&gt;
16. Search for specific document by applying AND &amp;amp; NOT criteria with Bool with should&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;curl -X GET &quot;localhost:9200/bank/_search?pretty&quot; -H &quot;Content-Type: application/json&quot; -d &quot;{ \&quot;query\&quot;: { \&quot;bool\&quot;: { \&quot;must\&quot;: [{ \&quot;match\&quot;: { \&quot;age\&quot;: \&quot;40\&quot; } }], \&quot;must_not\&quot;: [{ \&quot;match\&quot;: { \&quot;state\&quot;: \&quot;ID\&quot; } }]}}}&quot;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
17. Search Documents by applying some filter like greater than , lesser than to it.&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;curl -X GET &quot;localhost:9200/bank/_search?pretty&quot; -H &quot;Content-Type:application/json&quot; -d &quot;{ \&quot;query\&quot;: { \&quot;bool\&quot;: { \&quot;must\&quot;: { \&quot;match_all\&quot;: {} }, \&quot;filter\&quot;: { \&quot;range\&quot;: { \&quot;balance\&quot;: {\&quot;gte\&quot;: 20000, \&quot;lte\&quot;: 30000}}}}}}&quot;&lt;br /&gt;
&lt;br /&gt;
18. Search Document by some aggregations&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;curl -X GET &quot;localhost:9200/bank/_search?pretty&quot; -H &quot;Content-Type:application/json&quot; -d &quot;{ \&quot;size\&quot;: 0, \&quot;aggs\&quot;: { \&quot;group_by_state\&quot;: { \&quot;terms\&quot;: { \&quot;field\&quot;: \&quot;state.keyword\&quot;}}}}&quot;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://abhijitbashetti.blogspot.com/feeds/1884247106212112374/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://abhijitbashetti.blogspot.com/2018/12/indexing-and-searching-to-elasticsearch.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/1884247106212112374'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/1884247106212112374'/><link rel='alternate' type='text/html' href='http://abhijitbashetti.blogspot.com/2018/12/indexing-and-searching-to-elasticsearch.html' title='Indexing and searching to ElasticSearch by Curl'/><author><name>Abhijit Bashetti</name><uri>http://www.blogger.com/profile/02494128996998150172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUkzTfb2FQaDNMYEccAavR7aylIC_4UBvAhEtPQTesV-IzTwNr0rtF16MQgDIIcQMg4MpzYOQ3gHrFZPLOwyWxqUk1aQA1VxGFjYr5UMOYCRmdgKbeC_v6kJKxY2Fdf_o/s220/IMG_2027.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8592878860404675342.post-5206183942914845500</id><published>2018-12-09T00:14:00.000-08:00</published><updated>2018-12-09T00:36:12.664-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="boilerplate code"/><category scheme="http://www.blogger.com/atom/ns#" term="lombok"/><category scheme="http://www.blogger.com/atom/ns#" term="lombok annotation"/><title type='text'>Generate the Boilerplate code using Lombok</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
All the time while doing the programming we do the same thing again and again.The same code is been added by us or we use eclispe to generate the same code. This code is called as boilerplate code. Its the time to get rid of such things. There is a magic available for the same which is called as lombok. Yes, its lombok library which helps you to remove the boilerplate code and also provides some others features. If Lombok is added to your project classpath, you can can easily get rid of all the getters &amp;amp; setters methods, class constructors(argument constructor, no argument constructor), hashcode and equals methods and many more by just adding couple of annotations the class. For more details and other feature please refer https://projectlombok.org/features/all. The guys have created a very nice thing.&lt;br /&gt;
&lt;br /&gt;
I will list down all the annotation provided by the lombok and will see some them with the examples.&lt;br /&gt;
&lt;br /&gt;
@Getter/@Setter : It will generate the getter and setter methods of the class fields. All the methods genearated are by default public. You can set the access level for any field.&lt;br /&gt;
&lt;br /&gt;
@NonNull : Can be used for the parameters of a methos or a constructors for null check. It can be applied to a field as well.&lt;br /&gt;
&lt;br /&gt;
@NoArgsConstructor : It generates constructor with no parameters.&lt;br /&gt;
&lt;br /&gt;
@RequiredArgsConstructor : It generates a constructor with one parameter of each field where it requires special handling.&lt;br /&gt;
&lt;br /&gt;
@AllArgsConstructor : It generates a constructor with 1 parameter for each field in your class.&lt;br /&gt;
&lt;br /&gt;
@ToString : It provides the implementation of toString method to your class where it will print the classs name and the fields of the class.&lt;br /&gt;
&lt;br /&gt;
@EqualsAndHashCode : Same as toString , Lombok provides the implemenation of the equals and hashCode method. It will consider the non-static and non-transient fields. You can also incluse or exclude the fields explicitely @EqualsAndHashCode.Include or @EqualsAndHashCode.Exclude.&lt;br /&gt;
&lt;br /&gt;
@Data : Its combo provided by lombok for some the commonly used annotation. Its combo of&lt;br /&gt;
@ToString, @EqualsAndHashCode, @Getter / @Setter and @RequiredArgsConstructor. It covers all of the above in one shot.&lt;br /&gt;
&lt;br /&gt;
Here is an example where I have created a java class named Employee.java&lt;br /&gt;
I have added the member as empId,firstName,lastName,address&lt;br /&gt;
On the right side, in the outline window you can find all the code generated by lombok.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitlS5x1h8w9_0l_Ud4_FBHO8FY30_a1B5PDup8n3PbxWv8ueKdFVt8OJGC3Jel9wbUuDBiOjIWv88TRgjs498cJqMDcluA1wZiqBn0m-O15MIa8gxF_PEOdb37oqZC3Di8L5oyRx_q0hy3/s1600/LombokExmpale.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;768&quot; data-original-width=&quot;1366&quot; height=&quot;356&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitlS5x1h8w9_0l_Ud4_FBHO8FY30_a1B5PDup8n3PbxWv8ueKdFVt8OJGC3Jel9wbUuDBiOjIWv88TRgjs498cJqMDcluA1wZiqBn0m-O15MIa8gxF_PEOdb37oqZC3Di8L5oyRx_q0hy3/s640/LombokExmpale.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;br /&gt;
I have created the object of Employee class and shown how to use the implementation provided by lombok. In this case I have used the toString and equals method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdwXvLBRXoBzdzOdTEEse6dHTgHfKxwc_4JYqaWmL8ttNQ59vr3D8f6JFIlJIiESBjE53Bg2W0cPoZk5CExz_Np4U8XbP8_xO96-8LKX_N8UmDjUZ73T84AlGYuaqfhBn1jvaP5BP49P0I/s1600/LombokExmpale1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;768&quot; data-original-width=&quot;1366&quot; height=&quot;358&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdwXvLBRXoBzdzOdTEEse6dHTgHfKxwc_4JYqaWmL8ttNQ59vr3D8f6JFIlJIiESBjE53Bg2W0cPoZk5CExz_Np4U8XbP8_xO96-8LKX_N8UmDjUZ73T84AlGYuaqfhBn1jvaP5BP49P0I/s640/LombokExmpale1.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1wh6Z9ts8glyRz5DBBfoT2yNg1d8dLvNCFfl6L0vd6N4cP_xv3v9s8zjBnOJA9ZmehkNZ5B55ZqPw8CgBQUnLwY13r5pcgahstDWVlP-SHDbiQQT-06CylKRsT8Iw2o-vNz4KdIA49pgd/s1600/LombokExmpale2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;460&quot; data-original-width=&quot;1313&quot; height=&quot;224&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1wh6Z9ts8glyRz5DBBfoT2yNg1d8dLvNCFfl6L0vd6N4cP_xv3v9s8zjBnOJA9ZmehkNZ5B55ZqPw8CgBQUnLwY13r5pcgahstDWVlP-SHDbiQQT-06CylKRsT8Iw2o-vNz4KdIA49pgd/s640/LombokExmpale2.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://abhijitbashetti.blogspot.com/feeds/5206183942914845500/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://abhijitbashetti.blogspot.com/2018/12/generate-boilerplate-code-using-lombok.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/5206183942914845500'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/5206183942914845500'/><link rel='alternate' type='text/html' href='http://abhijitbashetti.blogspot.com/2018/12/generate-boilerplate-code-using-lombok.html' title='Generate the Boilerplate code using Lombok'/><author><name>Abhijit Bashetti</name><uri>http://www.blogger.com/profile/02494128996998150172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUkzTfb2FQaDNMYEccAavR7aylIC_4UBvAhEtPQTesV-IzTwNr0rtF16MQgDIIcQMg4MpzYOQ3gHrFZPLOwyWxqUk1aQA1VxGFjYr5UMOYCRmdgKbeC_v6kJKxY2Fdf_o/s220/IMG_2027.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitlS5x1h8w9_0l_Ud4_FBHO8FY30_a1B5PDup8n3PbxWv8ueKdFVt8OJGC3Jel9wbUuDBiOjIWv88TRgjs498cJqMDcluA1wZiqBn0m-O15MIa8gxF_PEOdb37oqZC3Di8L5oyRx_q0hy3/s72-c/LombokExmpale.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8592878860404675342.post-1667593012578147647</id><published>2018-12-01T22:00:00.001-08:00</published><updated>2018-12-01T22:00:43.566-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="split large xml"/><category scheme="http://www.blogger.com/atom/ns#" term="xslt"/><title type='text'>Split the large xml into smaller xml using xslt.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Split the large xml to smaller xml using XSLT.&lt;br /&gt;
&lt;br /&gt;
Here is sample of source xml.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;br /&gt;
&amp;lt;ABC&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;END /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;Tables&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;START&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;row&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;id&amp;gt;111&amp;lt;/id&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;name&amp;gt;abc&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;deptId&amp;gt;1&amp;lt;/deptId&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/row&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;row&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;id&amp;gt;112&amp;lt;/id&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;name&amp;gt;abc1&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;deptId&amp;gt;1&amp;lt;/deptId&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/row&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;row&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;id&amp;gt;113&amp;lt;/id&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;name&amp;gt;abc3&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;deptId&amp;gt;1&amp;lt;/deptId&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/row&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;row&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;id&amp;gt;222&amp;lt;/id&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;name&amp;gt;def&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;deptId&amp;gt;2&amp;lt;/deptId&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/row&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;row&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;id&amp;gt;333&amp;lt;/id&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;name&amp;gt;pqr&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;deptId&amp;gt;2&amp;lt;/deptId&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/row&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;row&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;id&amp;gt;444&amp;lt;/id&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;name&amp;gt;xyz&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;deptId&amp;gt;2&amp;lt;/deptId&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/row&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;row&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;id&amp;gt;555&amp;lt;/id&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;name&amp;gt;lmn&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;deptId&amp;gt;3&amp;lt;/deptId&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/row&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;row&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;id&amp;gt;555&amp;lt;/id&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;name&amp;gt;lmn&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;deptId&amp;gt;3&amp;lt;/deptId&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/row&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/START&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/Tables&amp;gt;&lt;br /&gt;
&amp;lt;/ABC&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I have a xml with the above structure.&lt;br /&gt;
I have to spilt the xml into 3 xml&#39;s based on the different deptId.&lt;br /&gt;
I have to Split the xml into smaller one based on change in tag values.&lt;br /&gt;
My elemement is deptId whose values is been changed after some rows.&lt;br /&gt;
The all elements with same deptId are in a sequence.&lt;br /&gt;
&lt;br /&gt;
The required output is : Its good to have the xml name as the department id.&lt;br /&gt;
The first xml be with name 1.xml :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-16&quot;?&amp;gt;&lt;br /&gt;
&amp;lt;ABC&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;END /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;Tables&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;START&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;row&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;id&amp;gt;111&amp;lt;/id&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;name&amp;gt;abc&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;deptId&amp;gt;1&amp;lt;/deptId&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/row&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;row&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;id&amp;gt;112&amp;lt;/id&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;name&amp;gt;abc1&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;deptId&amp;gt;1&amp;lt;/deptId&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/row&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;row&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;id&amp;gt;113&amp;lt;/id&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;name&amp;gt;abc3&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;deptId&amp;gt;1&amp;lt;/deptId&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/row&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/START&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/Tables&amp;gt;&lt;br /&gt;
&amp;lt;/ABC&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The solution to the above the problem is to use the XSLT.&lt;br /&gt;
Create a xsl file like below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;xsl:transform xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot; version=&quot;2.0&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;lt;xsl:template match=&quot;/&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;xsl:for-each-group select=&quot;//ABC//Tables//START//row&quot; group-adjacent=&quot;deptId&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;xsl:variable name=&quot;file&quot; select=&quot;concat(deptId,&#39;.xml&#39;)&quot;/&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;xsl:result-document href=&quot;{$file}&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ABC&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;END /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Tables&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;START&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;xsl:copy-of select=&quot;current-group()&quot;/&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/START&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/Tables&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/ABC&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/xsl:result-document&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/xsl:for-each-group&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;lt;/xsl:template&amp;gt;&lt;br /&gt;
&amp;lt;/xsl:transform&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the sample piece of java code that need to run.&lt;br /&gt;
&lt;br /&gt;
package com.java.xml;&lt;br /&gt;
&lt;br /&gt;
import java.io.File;&lt;br /&gt;
&lt;br /&gt;
import javax.xml.transform.stream.StreamSource;&lt;br /&gt;
&lt;br /&gt;
import net.sf.saxon.s9api.Processor;&lt;br /&gt;
import net.sf.saxon.s9api.SaxonApiException;&lt;br /&gt;
import net.sf.saxon.s9api.Serializer;&lt;br /&gt;
import net.sf.saxon.s9api.Xslt30Transformer;&lt;br /&gt;
import net.sf.saxon.s9api.XsltCompiler;&lt;br /&gt;
import net.sf.saxon.s9api.XsltExecutable;&lt;br /&gt;
&lt;br /&gt;
public class SplitXml {&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void main(String[] args) {&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Processor proc = new Processor(false);&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;XsltCompiler comp = proc.newXsltCompiler();&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;XsltExecutable exp;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;exp = comp.compile(new StreamSource(new File(&quot;E://test.xsl&quot;)));&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Serializer out = proc.newSerializer(new File(&quot;E://output.xml&quot;));&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Xslt30Transformer trans = exp.load30();&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;trans.applyTemplates(new StreamSource(new File(&quot;E://source.xml&quot;)),&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;out);&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} catch (SaxonApiException e) {&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;e.printStackTrace();&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://abhijitbashetti.blogspot.com/feeds/1667593012578147647/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://abhijitbashetti.blogspot.com/2018/12/split-large-xml-into-smaller-xml-using.html#comment-form' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/1667593012578147647'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/1667593012578147647'/><link rel='alternate' type='text/html' href='http://abhijitbashetti.blogspot.com/2018/12/split-large-xml-into-smaller-xml-using.html' title='Split the large xml into smaller xml using xslt.'/><author><name>Abhijit Bashetti</name><uri>http://www.blogger.com/profile/02494128996998150172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUkzTfb2FQaDNMYEccAavR7aylIC_4UBvAhEtPQTesV-IzTwNr0rtF16MQgDIIcQMg4MpzYOQ3gHrFZPLOwyWxqUk1aQA1VxGFjYr5UMOYCRmdgKbeC_v6kJKxY2Fdf_o/s220/IMG_2027.jpg'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8592878860404675342.post-3429509523847781375</id><published>2017-02-27T05:45:00.003-08:00</published><updated>2017-02-27T05:45:50.223-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Steps for Solr 6.1 setup with data import handler(DIH)"/><title type='text'>Steps for Solr 6.1 setup with data import handler(DIH)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
1. Install Java Runtime Environment (JRE) version 1.8 for Solr 6.1&lt;br /&gt;
&lt;br /&gt;
2. Set Java home &quot;export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_101/&quot;&lt;br /&gt;
&lt;br /&gt;
2. Download solr 6.1 &quot;solr-6.1.0.tgz&quot; from http://www-eu.apache.org/dist/lucene/solr/6.1.0/&lt;br /&gt;
&lt;br /&gt;
3. Extract tgz file using &quot;tar zxf solr-6.1.0.tgz&quot;.&lt;br /&gt;
&lt;br /&gt;
4. Open the port 8983 as to communicate with solr.&lt;br /&gt;
&lt;br /&gt;
5. Go to the path ../solr-6.1.0/ and start the server with &quot;bin/solr start&quot;&lt;br /&gt;
&lt;br /&gt;
============================================================================================================================================================&lt;br /&gt;
&lt;br /&gt;
1. Create a config folder named myConfig under configsets directory , move the conf folder into it. Add the data-config.xml into &quot;/myConfig/conf&quot;.&lt;br /&gt;
&lt;br /&gt;
2. Fire the url to create the core.&lt;br /&gt;
&lt;br /&gt;
http://localhost:8983/solr/admin/cores?action=CREATE&amp;amp;name=25406&amp;amp;instanceDir=/home/abhijit/Downloads/solr-6.1.0/server/solr/25406/&amp;amp;configSet=myConfig&lt;br /&gt;
&lt;br /&gt;
3. Add the jars &quot;solr-dataimporthandler-6.1.0.jar&quot;, &quot;solr-dataimporthandler-extras-6.1.0.jar&quot; to path &quot;/home/abhijit/Downloads/solr-6.1.0/server/lib&quot;.&lt;br /&gt;
&lt;br /&gt;
4. Add the &quot;solr-core-6.1.0.jar&quot; jar to the path &quot;/home/abhijit/Downloads/solr-6.1.0/server/lib&quot;.&lt;br /&gt;
&lt;br /&gt;
5. Add the &quot;solr-solrj-6.1.0.jar&quot; jar to the path &quot;/home/abhijit/Downloads/solr-6.1.0/server/lib&quot;.&lt;br /&gt;
&lt;br /&gt;
6. If you do the above steps you will get the error like :&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&quot;Error Instantiating requestHandler, org.apache.solr.handler.dataimport.DataImportHandler failed to instantiate org.apache.solr.request.SolrRequestHandler&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; This problem occurred because dataimporthandler and requesthandler are loaded by two different class loaders. To solve it, ensure that solr loads its jars only from the same class loader. &amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Option to steps 3,4,5 create a folder lib inside the solr folder at path &quot;/home/abhijit/Downloads/solr-6.1.0/server/solr&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;and add the entry of the same to solrConfig.xml as &quot;&amp;lt;lib dir=&quot;./solr/lib&quot; /&amp;gt;&quot;.&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Comment the other lib entries from solrConfig.xml&lt;br /&gt;
&amp;nbsp; &amp;nbsp;the jars &quot;solr-dataimporthandler-6.1.0.jar&quot;, &quot;solr-dataimporthandler-extras-6.1.0.jar&quot; to path &quot;/home/abhijit/Downloads/solr-6.1.0/server/solr/lib&quot;.&lt;br /&gt;
&lt;br /&gt;
9. Commented the updateRequestProcessorChain in solrConfig.xml.&lt;br /&gt;
&lt;br /&gt;
10. HttpSolrCall null:org.apache.solr.handler.dataimport.DataImportHandlerException: Data Config problem: Entity must have a name.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Every entity defined in data-config file must have a name defined to it e.g. &quot;&amp;lt;entity name=&quot;tika&quot; , &quot;&amp;lt;entity name=&quot;customProperty&quot;&lt;br /&gt;
&lt;br /&gt;
11. Error : &quot;java.lang.NoClassDefFoundError: org/apache/tika/parser/Parser&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Add the jar &quot;tika-core-1.7.jar&quot; to path &quot;/home/abhijit/Downloads/solr-6.1.0/server/solr/lib&quot;.&lt;br /&gt;
&lt;br /&gt;
12. Copy all the jars from &quot;/Downloads/solr-6.1.0/contrib/extraction/lib&quot; to path &quot;/home/abhijit/Downloads/solr-6.1.0/server/solr/lib&quot;.&lt;br /&gt;
&lt;br /&gt;
13. Error : &quot; java.sql.SQLSyntaxErrorException: ORA-00907: missing right parenthesis&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &quot; &#39; &quot; is missing for the date parameter passed while the full import e.g &#39;24/05/2015&#39;&lt;br /&gt;
&lt;br /&gt;
14. Command for full import&lt;br /&gt;
&lt;br /&gt;
http://localhost:8983/solr/mycore/dataimport?command=full-import&amp;amp;clean=true&amp;amp;commit=true&lt;br /&gt;
&lt;br /&gt;
15. Check core status&lt;br /&gt;
&lt;br /&gt;
http://localhost:8983/solr/admin/cores?action=STATUS&amp;amp;core=25406&lt;br /&gt;
&lt;br /&gt;
16. Delete URL was not working so added the solrConfig.xml file.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; http://10.55.36.19:8983/solr/25406/update?stream.body=&amp;lt;delete&amp;gt;&amp;lt;id&amp;gt;25473&amp;lt;/id&amp;gt;&amp;lt;/delete&amp;gt;&amp;amp;commit=true&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;lt;requestHandler name=&quot;/update&quot; class=&quot;solr.UpdateRequestHandler&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;lt;lst name=&quot;defaults&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;str name=&quot;update.chain&quot;&amp;gt;id&amp;lt;/str&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;lt;/lst&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;lt;/requestHandler&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&quot;o.a.s.h.RequestHandlerBase org.apache.solr.common.SolrException: unknown UpdateRequestProcessorChain: add-unknown-fields-to-the-schema&quot;&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp;Uncommentted the &quot;updateRequestProcessorChain&quot; in solrConfig.xml and named it as name=&quot;id&quot;.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://abhijitbashetti.blogspot.com/feeds/3429509523847781375/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://abhijitbashetti.blogspot.com/2017/02/steps-for-solr-61-setup-with-data.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/3429509523847781375'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/3429509523847781375'/><link rel='alternate' type='text/html' href='http://abhijitbashetti.blogspot.com/2017/02/steps-for-solr-61-setup-with-data.html' title='Steps for Solr 6.1 setup with data import handler(DIH)'/><author><name>Abhijit Bashetti</name><uri>http://www.blogger.com/profile/02494128996998150172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUkzTfb2FQaDNMYEccAavR7aylIC_4UBvAhEtPQTesV-IzTwNr0rtF16MQgDIIcQMg4MpzYOQ3gHrFZPLOwyWxqUk1aQA1VxGFjYr5UMOYCRmdgKbeC_v6kJKxY2Fdf_o/s220/IMG_2027.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8592878860404675342.post-5888895644001689259</id><published>2017-02-26T23:54:00.001-08:00</published><updated>2017-02-26T23:54:09.301-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="jetty default port change"/><category scheme="http://www.blogger.com/atom/ns#" term="solr port change"/><category scheme="http://www.blogger.com/atom/ns#" term="solr with jetty port change"/><title type='text'>Change in the default port of Jetty for Solr.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Change in the default port of Jetty for Solr.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;Currently Jetty uses 8983 as default port.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;I wanted to change it to 8080 port.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; To achieve the same I have done the changes at the following places.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;1. Change in the file solr.xml located at ../solr-6.1.0/server/solr/.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Change from &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;i&gt;&lt;b&gt;&amp;lt;int name=&quot;hostPort&quot;&amp;gt;${jetty.port:8983}&amp;lt;/int&amp;gt;&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; to&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;i&gt;&lt;b&gt;&amp;lt;int name=&quot;hostPort&quot;&amp;gt;${jetty.port:8080}&amp;lt;/int&amp;gt;&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;2. Change in the file solr.in.sh located at ../solr-6.1.0/bin/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Change from&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;i&gt;&lt;b&gt;# Sets the port Solr binds to, default is 8983&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;i&gt;&lt;b&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SOLR_PORT=8983&lt;/span&gt;&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; to&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;i&gt;&lt;b&gt; # Sets the port Solr binds to, default is 8983&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;i&gt;&lt;b&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SOLR_PORT=8080&lt;/span&gt;&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://abhijitbashetti.blogspot.com/feeds/5888895644001689259/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://abhijitbashetti.blogspot.com/2017/02/change-in-default-port-of-jetty-for-solr.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/5888895644001689259'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/5888895644001689259'/><link rel='alternate' type='text/html' href='http://abhijitbashetti.blogspot.com/2017/02/change-in-default-port-of-jetty-for-solr.html' title='Change in the default port of Jetty for Solr.'/><author><name>Abhijit Bashetti</name><uri>http://www.blogger.com/profile/02494128996998150172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUkzTfb2FQaDNMYEccAavR7aylIC_4UBvAhEtPQTesV-IzTwNr0rtF16MQgDIIcQMg4MpzYOQ3gHrFZPLOwyWxqUk1aQA1VxGFjYr5UMOYCRmdgKbeC_v6kJKxY2Fdf_o/s220/IMG_2027.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8592878860404675342.post-7751956349838768581</id><published>2016-04-12T02:51:00.001-07:00</published><updated>2016-04-12T02:51:53.972-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="sqoop"/><category scheme="http://www.blogger.com/atom/ns#" term="sqoop commands"/><category scheme="http://www.blogger.com/atom/ns#" term="sqoop import.."/><category scheme="http://www.blogger.com/atom/ns#" term="sqoop with mysql"/><title type='text'>Sqoop Learning...</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Sqoop is a tool designed to transfer data between Hadoop and relational databases. You can use Sqoop to import data from a relational database management system (RDBMS) such as MySQL or Oracle into the Hadoop Distributed File System (HDFS), transform the data in Hadoop MapReduce, and then export the data back into an RDBMS.&lt;br /&gt;
&lt;br /&gt;
With Sqoop, you can import data from a relational database system into HDFS. The input to the import process is a database table. Sqoop will read the table row-by-row into HDFS. The output of this import process is a set of files containing a copy of the imported table. The import process is performed in parallel. For this reason, the output will be in multiple files. These files may be delimited text files (for example, with commas or tabs separating each field), or binary Avro or SequenceFiles containing serialized record data.&lt;br /&gt;
&lt;br /&gt;
A by-product of the import process is a generated Java class which can encapsulate one row of the imported table. This class is used during the import process by Sqoop itself. The Java source code for this class is also provided to you, for use in subsequent MapReduce processing of the data. This class can serialize and deserialize data to and from the SequenceFile format.&lt;br /&gt;
&lt;br /&gt;
Sqoop includes some other commands which allow you to inspect the database you are working with.&lt;br /&gt;
For example,&lt;br /&gt;
1.list the available database schemas (with the sqoop-list-databases tool).&lt;br /&gt;
&lt;br /&gt;
sqoop-list-databases --connect jdbc:mysql://localhost:3306/ --username root --password hr;&lt;br /&gt;
&lt;br /&gt;
2.List the available tables within a schema (with the sqoop-list-tables tool).&lt;br /&gt;
&lt;br /&gt;
sqoop-list-tables --connect jdbc:mysql://localhost:3306/vaibhav --username root --password hr;&lt;br /&gt;
&lt;br /&gt;
3.Sqoop also includes a primitive SQL execution shell (the sqoop-eval tool).&lt;br /&gt;
&lt;br /&gt;
sqoop eval --connect jdbc:mysql://localhost:3306/vaibhav --username root --password hr --query &quot;select * from employees&quot;;&lt;br /&gt;
&lt;br /&gt;
Most aspects of the import, code generation, and export processes can be customized. You can control the specific row range or columns imported. You can specify particular delimiters and escape characters for the file-based representation of the data, as well as the file format used. You can also control the class or package names used in generated code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sqoop ships with a help tool. To display a list of all available tools, type the following command:&lt;br /&gt;
&lt;br /&gt;
$ sqoop help&lt;br /&gt;
&lt;br /&gt;
usage: sqoop COMMAND [ARGS]&lt;br /&gt;
&lt;br /&gt;
Available commands:&lt;br /&gt;
&amp;nbsp; codegen &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Generate code to interact with database records&lt;br /&gt;
&amp;nbsp; create-hive-table &amp;nbsp;Import a table definition into Hive&lt;br /&gt;
&amp;nbsp; eval &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Evaluate a SQL statement and display the results&lt;br /&gt;
&amp;nbsp; export &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Export an HDFS directory to a database table&lt;br /&gt;
&amp;nbsp; help &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; List available commands&lt;br /&gt;
&amp;nbsp; import &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Import a table from a database to HDFS&lt;br /&gt;
&amp;nbsp; import-all-tables &amp;nbsp;Import tables from a database to HDFS&lt;br /&gt;
&amp;nbsp; job &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Work with saved jobs&lt;br /&gt;
&amp;nbsp; list-databases &amp;nbsp; &amp;nbsp; List available databases on a server&lt;br /&gt;
&amp;nbsp; list-tables &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;List available tables in a database&lt;br /&gt;
&amp;nbsp; merge &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Merge results of incremental imports&lt;br /&gt;
&amp;nbsp; metastore &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Run a standalone Sqoop metastore&lt;br /&gt;
&amp;nbsp; version &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Display version information&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To display help for a specific tool by entering: sqoop help (tool-name);&lt;br /&gt;
for example,&lt;br /&gt;
&lt;br /&gt;
$ sqoop help import.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
usage: sqoop import [GENERIC-ARGS] [TOOL-ARGS]&lt;br /&gt;
&lt;br /&gt;
Common arguments:&lt;br /&gt;
&amp;nbsp; &amp;nbsp;--connect &amp;lt;jdbc-uri&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Specify JDBC connect String&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;--connection-manager &amp;lt;class-name&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Specify connection manager class name&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;--connection-param-file &amp;lt;properties-file&amp;gt; &amp;nbsp; &amp;nbsp;Specify connection parameters file&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;--driver &amp;lt;class-name&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Manually specify JDBC driver class to use&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;--hadoop-home &amp;lt;hdir&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Override $HADOOP_MAPRED_HOME_ARG&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;--hadoop-mapred-home &amp;lt;dir&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Override $HADOOP_MAPRED_HOME_ARG&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;--password &amp;lt;password&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Set authentication password&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;--password-file &amp;lt;password-file&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Set authentication password file path&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;--username &amp;lt;username&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Set authentication username&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Options Files to Pass Arguments&lt;br /&gt;
&lt;br /&gt;
sqoop import --connect jdbc:mysql://localhost/db --username root --table TEST&lt;br /&gt;
&lt;br /&gt;
$ sqoop --options-file /users/homer/work/import.txt --table TEST&lt;br /&gt;
&lt;br /&gt;
where the options file /users/homer/work/import.txt contains the following:&lt;br /&gt;
&lt;br /&gt;
import&lt;br /&gt;
--connect&lt;br /&gt;
jdbc:mysql://localhost/db&lt;br /&gt;
--username&lt;br /&gt;
root&lt;br /&gt;
&lt;br /&gt;
The options file can have empty lines and comments for readability purposes. Comments within option files that begin with the hash character.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
sqoop-import : The import tool imports an individual table from an RDBMS to HDFS.&lt;br /&gt;
&lt;br /&gt;
Table 1. Common arguments&lt;br /&gt;
Argument &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;Description&lt;br /&gt;
--connect &amp;lt;jdbc-uri&amp;gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Specify JDBC connect string&lt;br /&gt;
--connection-manager &amp;lt;class-name&amp;gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Specify connection manager class to use&lt;br /&gt;
--driver &amp;lt;class-name&amp;gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Manually specify JDBC driver class to use&lt;br /&gt;
--hadoop-mapred-home &amp;lt;dir&amp;gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Override $HADOOP_MAPRED_HOME&lt;br /&gt;
--help &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;Print usage instructions&lt;br /&gt;
--password-file &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Set path for a file containing the authentication password&lt;br /&gt;
-P &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;Read password from console&lt;br /&gt;
--password &amp;lt;password&amp;gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Set authentication password&lt;br /&gt;
--username &amp;lt;username&amp;gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Set authentication username&lt;br /&gt;
--verbose &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;Print more information while working&lt;br /&gt;
--connection-param-file &amp;lt;filename&amp;gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Optional properties file that provides connection parameters&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Table 2. Import control arguments:&lt;br /&gt;
&lt;br /&gt;
Argument &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;Description&lt;br /&gt;
--append &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;Append data to an existing dataset in HDFS&lt;br /&gt;
--as-avrodatafile &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Imports data to Avro Data Files&lt;br /&gt;
--as-sequencefile &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Imports data to SequenceFiles&lt;br /&gt;
--as-textfile &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;Imports data as plain text (default)&lt;br /&gt;
--boundary-query &amp;lt;statement&amp;gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Boundary query to use for creating splits&lt;br /&gt;
--columns &amp;lt;col,col,col…&amp;gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Columns to import from table&lt;br /&gt;
--delete-target-dir &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Delete the import target directory if it exists&lt;br /&gt;
--direct &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;Use direct import fast path&lt;br /&gt;
--direct-split-size &amp;lt;n&amp;gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Split the input stream every n bytes when importing in direct mode&lt;br /&gt;
--fetch-size &amp;lt;n&amp;gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Number of entries to read from database at once.&lt;br /&gt;
--inline-lob-limit &amp;lt;n&amp;gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Set the maximum size for an inline LOB&lt;br /&gt;
-m,--num-mappers &amp;lt;n&amp;gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Use n map tasks to import in parallel&lt;br /&gt;
-e,--query &amp;lt;statement&amp;gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Import the results of statement.&lt;br /&gt;
--split-by &amp;lt;column-name&amp;gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Column of the table used to split work units&lt;br /&gt;
--table &amp;lt;table-name&amp;gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Table to read&lt;br /&gt;
--target-dir &amp;lt;dir&amp;gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;HDFS destination dir&lt;br /&gt;
--warehouse-dir &amp;lt;dir&amp;gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;HDFS parent for table destination&lt;br /&gt;
--where &amp;lt;where clause&amp;gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;WHERE clause to use during import&lt;br /&gt;
-z,--compress &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;Enable compression&lt;br /&gt;
--compression-codec &amp;lt;c&amp;gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Use Hadoop codec (default gzip)&lt;br /&gt;
--null-string &amp;lt;null-string&amp;gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;The string to be written for a null value for string columns&lt;br /&gt;
--null-non-string &amp;lt;null-string&amp;gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;The string to be written for a null value for non-string columns&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Selecting the Data to Import&lt;br /&gt;
--table : argument to select the table to import&lt;br /&gt;
--columns : argument to select a subset of columns and control their ordering&lt;br /&gt;
--where : control which rows are imported by adding a SQL WHERE clause to the import statement&lt;br /&gt;
--query : Instead of using the --table, --columns and --where arguments, you can specify a SQL statement with the --query argument.&lt;br /&gt;
&lt;br /&gt;
$CONDITIONS :&lt;br /&gt;
If you want to import the results of a query in parallel, then each map task will need to execute a copy of the query, with results partitioned by bounding conditions inferred by Sqoop. Your query must include the token $CONDITIONS which each Sqoop process will replace with a unique condition expression. You must also select a splitting column with --split-by.&lt;br /&gt;
&lt;br /&gt;
the query can be executed once and imported serially, by specifying a single map task with -m 1:&lt;br /&gt;
&lt;br /&gt;
-m : Sqoop imports data in parallel from most database sources. You can specify the number of map tasks (parallel processes) to use to perform the import by using the -m or --num-mappers argument.&lt;br /&gt;
When performing parallel imports, Sqoop needs a criterion by which it can split the workload. Sqoop uses a splitting column to split the workload. By default, Sqoop will identify the primary key column (if present) in a table and use it as the splitting column.&lt;br /&gt;
&lt;br /&gt;
--warehouse-dir : By default, Sqoop will import a table named foo to a directory named foo inside your home directory in HDFS. For example, if your username is someuser, then the import tool will write to /user/someuser/foo/(files). You can adjust the parent directory of the import with the --warehouse-dir argument.&lt;br /&gt;
&lt;br /&gt;
Incremental Imports : Incremental import mode which can be used to retrieve only rows newer than some previously-imported set of rows.&lt;br /&gt;
--check-column (col) &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Specifies the column to be examined when determining which rows to import. (the column should not be of type &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;CHAR/NCHAR/VARCHAR/VARNCHAR/ LONGVARCHAR/LONGNVARCHAR)&lt;br /&gt;
--incremental (mode) &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Specifies how Sqoop determines which rows are new. Legal values for mode include append and lastmodified.&lt;br /&gt;
--last-value (value) &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Specifies the maximum value of the check column from the previous import.&lt;br /&gt;
&lt;br /&gt;
File Formats : two file formats: delimited text or SequenceFiles.&lt;br /&gt;
1.Delimited text is the default import format. You can also specify it explicitly by using the --as-textfile argument.&lt;br /&gt;
2.SequenceFiles are a binary format that store individual records in custom record-specific data types.&lt;br /&gt;
3.Avro data files are a compact, efficient binary format that provides interoperability with applications written in other programming languages. Avro also supports versioning, so that when, e.g., columns are added or removed from a table, previously imported data files can be processed along with new ones.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-z or --compress : compress your data by using the deflate (gzip) algorithm with the -z or --compress argument,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Examples :&lt;br /&gt;
&lt;br /&gt;
1. basic import of a table named employees&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;sqoop import --connect jdbc:mysql://localhost:3306/vaibhav --username root --password hr --table employees;&lt;br /&gt;
&lt;br /&gt;
2. basic import requiring a login:&lt;br /&gt;
&lt;br /&gt;
sqoop import --connect jdbc:mysql://localhost:3306/vaibhav --username root -P --table employees;&lt;br /&gt;
&lt;br /&gt;
3. Selecting specific columns from the EMPLOYEES table&lt;br /&gt;
&lt;br /&gt;
sqoop import --connect jdbc:mysql://localhost:3306/vaibhav --username root --password hr --table employees --columns &quot;employee_id, first_name, last_name&quot;;&lt;br /&gt;
&lt;br /&gt;
4. Controlling the import parallelism (using 8 parallel tasks):&lt;br /&gt;
&lt;br /&gt;
sqoop import --connect jdbc:mysql://localhost:3306/vaibhav --username root --password hr --table employees --columns &quot;employee_id, first_name, last_name&quot; -m 8;&lt;br /&gt;
&lt;br /&gt;
5. Specifying the delimiters to use in a text-mode import:&lt;br /&gt;
&lt;br /&gt;
sqoop import --connect jdbc:mysql://localhost:3306/vaibhav --username root --password hr --table employees --columns &quot;employee_id, first_name, last_name&quot; --fields-terminated-by &#39;\t&#39; --lines-terminated-by &#39;\n&#39; --optionally-enclosed-by &#39;\&quot;&#39;;&lt;br /&gt;
&lt;br /&gt;
6. importing data to a target directory &quot;/abhijit&quot;&lt;br /&gt;
&lt;br /&gt;
sqoop import --connect jdbc:mysql://localhost:3306/vaibhav --username root --password hr --table employees --columns &quot;employee_id, first_name, last_name&quot; --target-dir /abhijit;&lt;br /&gt;
&lt;br /&gt;
7. Import subset of data.&lt;br /&gt;
sqoop import --connect jdbc:mysql://localhost:3306/vaibhav --username root --password hr --table employees --where &#39;salary&amp;gt;10000&#39; --target-dir /abhijit/subset;&lt;br /&gt;
&lt;br /&gt;
8. Import Subset with specific columns&lt;br /&gt;
&lt;br /&gt;
sqoop import --connect jdbc:mysql://localhost:3306/vaibhav --username root --password hr --table employees --where &#39;salary&amp;gt;10000&#39; --columns &quot;employee_id, first_name, last_name&quot; --target-dir /abhijit/subset;&lt;br /&gt;
&lt;br /&gt;
9. IMport Subset with Specifying the delimiters&lt;br /&gt;
&lt;br /&gt;
sqoop import --connect jdbc:mysql://localhost:3306/vaibhav --username root --password hr --table employees --where &#39;salary&amp;gt;10000&#39; --target-dir /abhijit/subset/terminated --fields-terminated-by &#39;\t&#39; --lines-terminated-by &#39;\n&#39;;&lt;br /&gt;
&lt;br /&gt;
10. An incremental import of new data&lt;br /&gt;
&lt;br /&gt;
sqoop import --connect jdbc:mysql://localhost:3306/vaibhav --username root --password hr --table employees --check-column employee_id --incremental append --last-value 208;&lt;br /&gt;
&lt;br /&gt;
11. Import to sequenceFile format&lt;br /&gt;
&lt;br /&gt;
sqoop import --connect jdbc:mysql://localhost:3306/vaibhav --username root --password hr --table employees --where &#39;salary&amp;gt;10000&#39; --target-dir /abhijit/subset/sequenceFile --as-sequencefile;&lt;br /&gt;
&lt;br /&gt;
12. Import to avrodatafile format&lt;br /&gt;
&lt;br /&gt;
sqoop import --connect jdbc:mysql://localhost:3306/vaibhav --username root --password hr --table employees --where &#39;salary&amp;gt;10000&#39; --target-dir /abhijit/subset/avroFile --as-avrodatafile;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
12. sqoop-import-all-tables&lt;br /&gt;
The import-all-tables tool imports a set of tables from an RDBMS to HDFS. Data from each table is stored in a separate directory in HDFS.&lt;br /&gt;
For the import-all-tables tool to be useful, the following conditions must be met:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Each table must have a single-column primary key.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; You must intend to import all columns of each table.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; You must not intend to use non-default splitting column, nor impose any conditions via a WHERE clause.&lt;br /&gt;
&lt;br /&gt;
===============================================================================================================================&lt;br /&gt;
&lt;br /&gt;
Importing Data Into Hive&lt;br /&gt;
&lt;br /&gt;
Argument &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;Description&lt;br /&gt;
--hive-home &amp;lt;dir&amp;gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Override $HIVE_HOME&lt;br /&gt;
--hive-import &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;Import tables into Hive (Uses Hive’s default delimiters if none are set.)&lt;br /&gt;
--hive-overwrite &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Overwrite existing data in the Hive table.&lt;br /&gt;
--create-hive-table &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;If set, then the job will fail if the target hive&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;table exits. By default this property is false.&lt;br /&gt;
&lt;br /&gt;
--hive-table &amp;lt;table-name&amp;gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Sets the table name to use when importing to Hive.&lt;br /&gt;
--hive-drop-import-delims &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Drops \n, \r, and \01 from string fields when importing to Hive.&lt;br /&gt;
--hive-delims-replacement &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Replace \n, \r, and \01 from string fields with user defined string when importing to Hive.&lt;br /&gt;
--hive-partition-key &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Name of a hive field to partition are sharded on&lt;br /&gt;
--hive-partition-value &amp;lt;v&amp;gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;String-value that serves as partition key for this imported into hive in this job.&lt;br /&gt;
--map-column-hive &amp;lt;map&amp;gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Override default mapping from SQL type to Hive type for configured columns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sqoop will by default import NULL values as string null. Hive is however using string \N to denote NULL values and therefore predicates dealing with NULL (like IS NULL) will not work correctly. You should append parameters --null-string and --null-non-string in case of import job or --input-null-string and --input-null-non-string in case of an export job if you wish to properly preserve NULL values.&lt;br /&gt;
&lt;br /&gt;
Hive can put data into partitions for more efficient query performance. You can tell a Sqoop job to import data for Hive into a particular partition by specifying the --hive-partition-key and --hive-partition-value arguments. The partition value must be a string.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://abhijitbashetti.blogspot.com/feeds/7751956349838768581/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://abhijitbashetti.blogspot.com/2016/04/sqoop-learning.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/7751956349838768581'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/7751956349838768581'/><link rel='alternate' type='text/html' href='http://abhijitbashetti.blogspot.com/2016/04/sqoop-learning.html' title='Sqoop Learning...'/><author><name>Abhijit Bashetti</name><uri>http://www.blogger.com/profile/02494128996998150172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUkzTfb2FQaDNMYEccAavR7aylIC_4UBvAhEtPQTesV-IzTwNr0rtF16MQgDIIcQMg4MpzYOQ3gHrFZPLOwyWxqUk1aQA1VxGFjYr5UMOYCRmdgKbeC_v6kJKxY2Fdf_o/s220/IMG_2027.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8592878860404675342.post-6370831111732200457</id><published>2016-04-06T05:42:00.001-07:00</published><updated>2016-04-06T05:42:52.588-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="apache-pig"/><category scheme="http://www.blogger.com/atom/ns#" term="bag"/><category scheme="http://www.blogger.com/atom/ns#" term="count"/><category scheme="http://www.blogger.com/atom/ns#" term="count in pig"/><category scheme="http://www.blogger.com/atom/ns#" term="dump"/><category scheme="http://www.blogger.com/atom/ns#" term="group"/><category scheme="http://www.blogger.com/atom/ns#" term="pig"/><category scheme="http://www.blogger.com/atom/ns#" term="store"/><category scheme="http://www.blogger.com/atom/ns#" term="tuple"/><title type='text'>How does count work using apache-pig?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
I am learning pig and came across some question like how grouping works and how to get the count.&lt;br /&gt;
I thought to put some example which could be useful for others when they go for doing some grouping and count out of it.&lt;br /&gt;
&lt;br /&gt;
I am not going to cover what is pig and the advantages of it. Will directly jump on with an example and try to elaborate more on to it.&lt;br /&gt;
&lt;br /&gt;
Let&#39;s start with it.&lt;br /&gt;
&lt;br /&gt;
Here is sample data for the example.&lt;br /&gt;
&lt;br /&gt;
1,The Nightmare Before Christmas,1993,3.9,4568&lt;br /&gt;
2,The Mummy,1932,3.5,4388&lt;br /&gt;
3,Orphans of the Storm,1921,3.2,9062&lt;br /&gt;
4,The Object of Beauty,1991,2.8,6150&lt;br /&gt;
5,Night Tide,1963,2.8,5126&lt;br /&gt;
6,One Magic Christmas,1985,3.8,5333&lt;br /&gt;
7,Muriel&#39;s Wedding,1994,3.5,6323&lt;br /&gt;
8,Mother&#39;s Boys,1994,3.4,5733&lt;br /&gt;
9,Nosferatu: Original Version,1929,3.5,5651&lt;br /&gt;
10,Nick of Time,1995,3.4,5333&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The data is related with movies as movie name, release year, rating for the movie and number of likes.&lt;br /&gt;
&lt;br /&gt;
Our assignment is to get the count of movies for a year.&lt;br /&gt;
Below are steps to be taken to analyse the data.&lt;br /&gt;
&lt;br /&gt;
1. Loading Data : Will use the Load function to read the data into Pig. Here Load is just a pointer and does not load the data. When Store or Dump is requested then only pig starts with an execution.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;movies = load &#39;/home/abhijit/Downloads/movies.txt&#39; Using PigStorage(&#39;,&#39;);&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
2. To verify the output or for testing/debugging of your changes you can use DUMP.&lt;br /&gt;
DUMP displays the results on to the terminal.(Never use the same on production. Use the STORE instead)&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;DUMP movies;&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
The result on the terminal is :&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(1,The Nightmare Before Christmas,1993,3.9,4568)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(2,The Mummy,1932,3.5,4388)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(3,Orphans of the Storm,1921,3.2,9062)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(4,The Object of Beauty,1991,2.8,6150)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(5,Night Tide,1963,2.8,5126)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(6,One Magic Christmas,1985,3.8,5333)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(7,Muriel&#39;s Wedding,1994,3.5,6323)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(8,Mother&#39;s Boys,1994,3.4,5733)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(9,Nosferatu: Original Version,1929,3.5,5651)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(10,Nick of Time,1995,3.4,5333)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Group the data by key year. We will use group operator for the same. It group together the tuples that have same key, which will be called group key. In our case release year is the group key.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;groupByYear = group movies by $2;&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
$2 here is the position that represents the value of release year(We are using the position here as we have not created any schema. We will talk about schema later).&lt;br /&gt;
&lt;br /&gt;
Again call DUMP to verify the result.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;DUMP groupByYear ;&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
The result on the terminal is :&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(1921,{(3,Orphans of the Storm,1921,3.2,9062)})&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(1929,{(9,Nosferatu: Original Version,1929,3.5,5651)})&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(1932,{(2,The Mummy,1932,3.5,4388)})&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(1963,{(5,Night Tide,1963,2.8,5126)})&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(1985,{(6,One Magic Christmas,1985,3.8,5333)})&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(1991,{(4,The Object of Beauty,1991,2.8,6150)})&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(1993,{(1,The Nightmare Before Christmas,1993,3.9,4568)})&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(1994,{(7,Muriel&#39;s Wedding,1994,3.5,6323),(8,Mother&#39;s Boys,1994,3.4,5733)})&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(1995,{(10,Nick of Time,1995,3.4,5333)})&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Now from the output it is clear why we do grouping before we go for the count.&lt;br /&gt;
&lt;br /&gt;
(1921,{(3,Orphans of the Storm,1921,3.2,9062)})&lt;br /&gt;
&lt;br /&gt;
1921 signifies the key and (3,Orphans of the Storm,1921,3.2,9062) is the Tuple or the value of it. Here we have single tuple in the form of (3,Orphans of the Storm,1921,3.2,9062).&lt;br /&gt;
&lt;br /&gt;
Tuple is an ordered set of fields.&lt;br /&gt;
&amp;nbsp;(3,Orphans of the Storm,1921,3.2,9062).&lt;br /&gt;
&lt;br /&gt;
A bag is a collection of Tuples&lt;br /&gt;
Representation of bag is&lt;br /&gt;
{(3,Orphans of the Storm,1921,3.2,9062)}&lt;br /&gt;
&lt;br /&gt;
Now we want to get the count of the tuples or the values of key.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;movieCountOfYear = foreach groupByYear generate $0, COUNT($1);&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
$0 represents the key and $1 represents the value.&lt;br /&gt;
&lt;br /&gt;
To verify the result call DUMP.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;DUMP movieCountOfYear;&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(1921,1)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(1929,1)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(1932,1)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(1963,1)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(1985,1)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(1991,1)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(1993,1)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(1994,2)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;(1995,1)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
In the result set you can see by the year and the respective movie count of it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://abhijitbashetti.blogspot.com/feeds/6370831111732200457/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://abhijitbashetti.blogspot.com/2016/04/how-does-count-work-using-apache-pig.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/6370831111732200457'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/6370831111732200457'/><link rel='alternate' type='text/html' href='http://abhijitbashetti.blogspot.com/2016/04/how-does-count-work-using-apache-pig.html' title='How does count work using apache-pig?'/><author><name>Abhijit Bashetti</name><uri>http://www.blogger.com/profile/02494128996998150172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUkzTfb2FQaDNMYEccAavR7aylIC_4UBvAhEtPQTesV-IzTwNr0rtF16MQgDIIcQMg4MpzYOQ3gHrFZPLOwyWxqUk1aQA1VxGFjYr5UMOYCRmdgKbeC_v6kJKxY2Fdf_o/s220/IMG_2027.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8592878860404675342.post-172037067156550928</id><published>2015-12-06T22:49:00.002-08:00</published><updated>2015-12-06T22:51:33.936-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="How to update the email ids for the thousand users through database. Orcale 10g"/><title type='text'>How to update the email ids for the thousand users through database.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;How to update the email ids for the thousand users through database.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Updating email ids means updating only the domain part of the email.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;example a user has email as bc.xyz@bajajauto.com and now has to update as abc.xyz@atulauto.com&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Here you need to update the part of the email id.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;I have written the function for the same.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;BEGIN&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp; FOR user_ids in (SELECT user_id FROM user usr where usr.email like &#39;%@bajajauto.com%&#39;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp; &amp;nbsp; LOOP&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FOR user_email_id in (&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SELECT SUBSTR(t.email, 0, INSTR(t.email, &#39;@&#39;)-1) AS part_of_email, t.user_id FROM &amp;nbsp;user t where t.user_id = user_ids.user_id)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; LOOP&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;update user user2 set user2.email = user_email_id.part_of_email || &#39;@atulauto.com&#39; WHERE user2.user_id = &amp;nbsp;user_email_id.user_id;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; END LOOP;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp; &amp;nbsp; END LOOP;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;END;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Hope this would be useful. Let me know if it could be improved. Also if anyone knows any other quicker solution.&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://abhijitbashetti.blogspot.com/feeds/172037067156550928/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://abhijitbashetti.blogspot.com/2015/12/how-to-update-email-ids-for-thousand.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/172037067156550928'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/172037067156550928'/><link rel='alternate' type='text/html' href='http://abhijitbashetti.blogspot.com/2015/12/how-to-update-email-ids-for-thousand.html' title='How to update the email ids for the thousand users through database.'/><author><name>Abhijit Bashetti</name><uri>http://www.blogger.com/profile/02494128996998150172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUkzTfb2FQaDNMYEccAavR7aylIC_4UBvAhEtPQTesV-IzTwNr0rtF16MQgDIIcQMg4MpzYOQ3gHrFZPLOwyWxqUk1aQA1VxGFjYr5UMOYCRmdgKbeC_v6kJKxY2Fdf_o/s220/IMG_2027.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8592878860404675342.post-7454237791210354936</id><published>2015-02-26T06:19:00.002-08:00</published><updated>2015-02-26T06:19:52.296-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL workbench on Ubuntu"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><category scheme="http://www.blogger.com/atom/ns#" term="workbench"/><title type='text'>Installing the MySQL workbench on Ubuntu...</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
You can get the necessary mysql workbench deb&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&quot;http://dev.mysql.com/downloads/workbench/#downloads&quot;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
First run the following:&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
sudo dpkg -i mysql-workbench-gpl-5.2.40-1ubu1104-i386.deb&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
As you know this will fail about the dependencies. Then wget and install the following:&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
wget https://launchpad.net/ubuntu/+archive/primary/+files/libzip1_0.9.3-1_i386.deb&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
wget http://launchpadlibrarian.net/94563300/libmysqlclient16_5.1.58-1ubuntu5_i386.deb&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Next install:&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
sudo dpkg -i libzip1_0.9.3-1_i386.deb&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
sudo dpkg -i libmysqlclient16_5.1.58-1ubuntu5_i386.deb&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
If you&#39;re using 64bit, you&#39;ll want this instead:&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
wget https://launchpad.net/ubuntu/+archive/primary/+files/libzip1_0.9.3-1_amd64.deb&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
sudo dpkg -i libzip1_0.9.3-1_amd64.deb&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
wget http://launchpadlibrarian.net/94808408/libmysqlclient16_5.1.58-1ubuntu5_amd64.deb&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
sudo dpkg -i libmysqlclient16_5.1.58-1ubuntu5_amd64.deb&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Then run the following:&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
sudo apt-get -f install python-paramiko libzip2 libmysqlclient18 mysql-client mysql-common python-pysqlite2 libdbi-perl libdbd-mysql-perl libplrpc-perl libnet-daemon-perl mysql-client&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
This too will fail, and ask you to re-run, just re-run it again:&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
sudo apt-get -f install&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Launch it once from either your terminal mysql-workbench or Unity Dash, once it&#39;s in the launcher, right click on it and select &quot;Lock to Launcher&quot;.&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://abhijitbashetti.blogspot.com/feeds/7454237791210354936/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://abhijitbashetti.blogspot.com/2015/02/installing-mysql-workbench-on-ubuntu.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/7454237791210354936'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/7454237791210354936'/><link rel='alternate' type='text/html' href='http://abhijitbashetti.blogspot.com/2015/02/installing-mysql-workbench-on-ubuntu.html' title='Installing the MySQL workbench on Ubuntu...'/><author><name>Abhijit Bashetti</name><uri>http://www.blogger.com/profile/02494128996998150172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUkzTfb2FQaDNMYEccAavR7aylIC_4UBvAhEtPQTesV-IzTwNr0rtF16MQgDIIcQMg4MpzYOQ3gHrFZPLOwyWxqUk1aQA1VxGFjYr5UMOYCRmdgKbeC_v6kJKxY2Fdf_o/s220/IMG_2027.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8592878860404675342.post-7693258774559233670</id><published>2015-01-30T03:01:00.003-08:00</published><updated>2015-02-01T23:56:58.302-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="filter"/><category scheme="http://www.blogger.com/atom/ns#" term="solr"/><category scheme="http://www.blogger.com/atom/ns#" term="tokenizer"/><title type='text'>Solr Revisited...</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Long back I had written blogs on solr setup and how I used it in my application.&lt;br /&gt;
Meanwhile I am getting questions/quries from the readers on the same.&lt;br /&gt;
And these readers make you to work on it...revisit the technologies or stuffs your had worked...&lt;br /&gt;
&lt;br /&gt;
The queries are like I am searching &quot;Solr Blog&quot; as text but getting the results of &quot;Solr&quot; as well&lt;br /&gt;
&quot;Solr indexing&quot; or my blah blah search text is not getting the correct result.&lt;br /&gt;
After going through all these quries I realised that where it is going wrong.&lt;br /&gt;
Or rather how my blogs are not helping them to resolve their issues...&lt;br /&gt;
So I decided to write another one which may ease their job or guide them working on solr and&lt;br /&gt;
will brush up my knowledge on the same subject :)&lt;br /&gt;
&lt;br /&gt;
Lets go with the real example, which made me to pen down this blog ...&lt;br /&gt;
A reader asked me a question :&lt;br /&gt;
&quot;If he search for &quot;Abhijit &amp;amp; his blogs&quot;, It should show the exact match as &quot;Abhijit &amp;amp; his blogs&quot; and not matches like &quot;Abhijit&quot; or&lt;br /&gt;
or &quot;Abhijit Songs&quot;... &quot;.&lt;br /&gt;
&lt;br /&gt;
On this what all questions comes to your mind...? &amp;nbsp;What would be wrong here ...?&lt;br /&gt;
any idea...?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is simple theory ...what you index, will be available for search... :)&lt;br /&gt;
In short you are using a wrong analyzer for indexing and quering...&lt;br /&gt;
&lt;br /&gt;
Find out which is the fieldType been used for indexing and querying....&lt;br /&gt;
Is it the default provided by Solr or you have written your own custom field type(created by using the&lt;br /&gt;
available tokenizers and filtes)..&lt;br /&gt;
&lt;br /&gt;
For the above example turn off the stemming ...&lt;br /&gt;
The solutions for the problem would be...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;types&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;lt;fieldType name=&quot;text_no_stem&quot; class=&quot;solr.TextField&quot; omitNorms=&quot;false&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;analyzer&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;tokenizer class=&quot;solr.StandardTokenizerFactory&quot;/&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;filter class=&quot;solr.StandardFilterFactory&quot;/&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;filter class=&quot;solr.LowerCaseFilterFactory&quot;/&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/analyzer&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;lt;/fieldType&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/types&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;fields&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;lt;dynamicField name=&quot;*_nostem&quot; type=&quot;text_no_stem&quot; indexed=&quot;true&quot; stored=&quot;true&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/fields&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or Use solr string field whcih will do an exact value search e.g&lt;br /&gt;
&lt;br /&gt;
&amp;lt;fieldType class=&quot;solr.StrField&quot; name=&quot;string&quot; omitNorms=&quot;true&quot; sortMissingLast=&quot;true&quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now coming to the point what I realised ..?&lt;br /&gt;
&lt;br /&gt;
That is we need to know more on the role tokenizers and filtes in the analyzers.&lt;br /&gt;
Which all types of tokenizers and filtes are available...how to make use of it and when to use it..&lt;br /&gt;
How to test the same...?&lt;br /&gt;
&lt;br /&gt;
Here is the brief about the three important things&lt;br /&gt;
&lt;br /&gt;
1. Analyzer : They pre-process the test at the time of indexing and quering(or search). Ans yes make sure you are using same analyzers that for both index and query.&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;For example, if an indexing analyzer lowercases words, then the query analyzer should do the same to enable finding the indexed words.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
2. Tokenizers : It splits/seperates stream of characters into a series of tokens or small chunks/words. There can be only one Tokenizer in each Analyzer.&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;There are different tokenizer available to use. For example..&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; KeywordTokenizerFactory&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;LetterTokenizerFactory&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;WhitespaceTokenizerFactory&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;StandardTokenizerFactory&lt;br /&gt;
&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;LowerCaseTokenizerFactory&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Filters : This takes a granular level of tokes. doing many changes to it before indexing it.&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;There are different filters available to use..&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;LowerCaseFilterFactory&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;ClassicFilterFactory&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;StopFilterFactory&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;EdgeNGramFilterFactory&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;and many more are available.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You should be very precise about how and what is the way you want your search should work.&lt;br /&gt;
Then its very easy to decide the fieldType ...rather very easy to create your own type and use it.&lt;br /&gt;
&lt;br /&gt;
While doing any sort of analysis do use the tool given by solr i.e analysis.jsp.&lt;br /&gt;
It will help you a lot for resolving your problems...&lt;br /&gt;
&lt;br /&gt;
If you want to read more about the solr&#39;s tokenizer&#39;s and filter&#39;s refere the solr Wiki which has a lot info&lt;br /&gt;
https://wiki.apache.org/solr/&lt;br /&gt;
&lt;br /&gt;
Please feel free to put on your view on it...&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://abhijitbashetti.blogspot.com/feeds/7693258774559233670/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://abhijitbashetti.blogspot.com/2015/01/solr-revisited.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/7693258774559233670'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/7693258774559233670'/><link rel='alternate' type='text/html' href='http://abhijitbashetti.blogspot.com/2015/01/solr-revisited.html' title='Solr Revisited...'/><author><name>Abhijit Bashetti</name><uri>http://www.blogger.com/profile/02494128996998150172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUkzTfb2FQaDNMYEccAavR7aylIC_4UBvAhEtPQTesV-IzTwNr0rtF16MQgDIIcQMg4MpzYOQ3gHrFZPLOwyWxqUk1aQA1VxGFjYr5UMOYCRmdgKbeC_v6kJKxY2Fdf_o/s220/IMG_2027.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8592878860404675342.post-4938908827894185316</id><published>2014-12-07T23:43:00.006-08:00</published><updated>2014-12-07T23:43:58.405-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Installing jdk 1.5 on ubantu"/><title type='text'>Installing jdk 1.5 on ubantu</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Installing jdk 1.5 on ubantu&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here uou can keep multiple versions of Java (JRE and JDK) at a time and choose between them which one to use.&lt;br /&gt;
on the below link download your version of Java.&lt;br /&gt;
&lt;br /&gt;
http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase5-419410.html&lt;br /&gt;
&lt;br /&gt;
I have download the following file;&lt;br /&gt;
&lt;br /&gt;
Java Development Kit 5.0 Update 22 &amp;nbsp;42.14 MB &amp;nbsp; &amp;nbsp;jdk-1_5_0_22-linux-amd64.bin&lt;br /&gt;
&lt;br /&gt;
Go to the termial and go the the path where you downloaded the file.&lt;br /&gt;
&lt;br /&gt;
type the following command;&lt;br /&gt;
&lt;br /&gt;
sudo mv jdk-1_5_0_22-linux-amd64.bin /usr/lib/jvm&lt;br /&gt;
cd /usr/lib/jvm&lt;br /&gt;
chmod +x jdk-1_5_0_22-linux-amd64.bin&lt;br /&gt;
sudo ./jdk-1_5_0_22-linux-amd64.bin&lt;br /&gt;
&lt;br /&gt;
sudo update-alternatives --install &quot;/usr/bin/java&quot; &quot;java&quot; &quot;/usr/lib/jvm/jdk1.5.0_22/bin/java&quot; 2&lt;br /&gt;
&lt;br /&gt;
sudo update-alternatives --install &quot;/usr/bin/javac&quot; &quot;javac&quot; &quot;/usr/lib/jvm/jdk1.5.0_22/bin/javac&quot; 2&lt;br /&gt;
&lt;br /&gt;
You have installed the jdk 1.5 Successfully&lt;br /&gt;
&lt;br /&gt;
If you two verions of jdk you can use following commands to switch them&lt;br /&gt;
&lt;br /&gt;
sudo update-alternatives --config java&lt;br /&gt;
sudo update-alternatives --config javac&lt;br /&gt;
&lt;br /&gt;
Confirm the version of Java currently in use with these commands:&lt;br /&gt;
&lt;br /&gt;
java -version&lt;br /&gt;
javac -version&lt;br /&gt;
&lt;br /&gt;
Cheers!!!&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://abhijitbashetti.blogspot.com/feeds/4938908827894185316/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://abhijitbashetti.blogspot.com/2014/12/installing-jdk-15-on-ubantu.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/4938908827894185316'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/4938908827894185316'/><link rel='alternate' type='text/html' href='http://abhijitbashetti.blogspot.com/2014/12/installing-jdk-15-on-ubantu.html' title='Installing jdk 1.5 on ubantu'/><author><name>Abhijit Bashetti</name><uri>http://www.blogger.com/profile/02494128996998150172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUkzTfb2FQaDNMYEccAavR7aylIC_4UBvAhEtPQTesV-IzTwNr0rtF16MQgDIIcQMg4MpzYOQ3gHrFZPLOwyWxqUk1aQA1VxGFjYr5UMOYCRmdgKbeC_v6kJKxY2Fdf_o/s220/IMG_2027.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8592878860404675342.post-6624333508636115050</id><published>2014-11-14T04:01:00.000-08:00</published><updated>2014-11-17T22:49:17.615-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MongoDB with Morphia"/><category scheme="http://www.blogger.com/atom/ns#" term="Storing POJOs in MongoDB Using Morphia"/><title type='text'>Storing POJOs in MongoDB Using Morphia</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Storing POJOs in MongoDB Using Morphia:&lt;br /&gt;
&lt;br /&gt;
Storing data in any Database is always a challenge irrespective of the Datadabase.&lt;br /&gt;
&lt;br /&gt;
MongoDB is a leading NoSQL Database.&lt;br /&gt;
We create pojo/entity and store the data in the Database using framework like Hibernate.&lt;br /&gt;
&lt;br /&gt;
Similarly we have Morphia which helps to store the data in the MongoDB.&lt;br /&gt;
In this we will try to store the Person data in the MongoDB.&lt;br /&gt;
Person will have name, address and the hobbies.&lt;br /&gt;
&lt;br /&gt;
To store the above mentioned person data, we will create the entities.&lt;br /&gt;
Will create the entities for Person Entity, Hobbies Entity and the Address Entity.&lt;br /&gt;
&lt;br /&gt;
We will embed the Hobbies and Address entity into Person.&lt;br /&gt;
&lt;br /&gt;
Entity Annotation : To Store the class in MongoDB thro&#39; Morphia, add annotate to class as @Entity&lt;br /&gt;
&lt;br /&gt;
To Suppress the class name from the Mongo Document use &quot;noClassnameStored=true&quot;.&lt;br /&gt;
&lt;br /&gt;
@Id : Entity require unique @Id values; these values are stored in the MongoDB &quot;_id&quot; field.&lt;br /&gt;
&lt;br /&gt;
@Indexed : This annotation applies an index to a field.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;The indexes are applied when the datastore.ensureIndexes() method is called&lt;br /&gt;
&lt;br /&gt;
Example : @Indexed(value=IndexDirection.ASC, name=&quot;userName&quot;, unique=true, dropDups=true)&lt;br /&gt;
&lt;br /&gt;
@Embedded : &amp;nbsp;to create a class that will be embedded in the Entity.&lt;br /&gt;
&lt;br /&gt;
Below is the code sample of the mentioned Entities.&lt;br /&gt;
&lt;br /&gt;
package com.mongo.morphia.entity;&lt;br /&gt;
&lt;br /&gt;
import java.util.List;&lt;br /&gt;
&lt;br /&gt;
import org.bson.types.ObjectId;&lt;br /&gt;
&lt;br /&gt;
import com.google.code.morphia.annotations.Embedded;&lt;br /&gt;
import com.google.code.morphia.annotations.Entity;&lt;br /&gt;
import com.google.code.morphia.annotations.Id;&lt;br /&gt;
import com.google.code.morphia.annotations.Property;&lt;br /&gt;
&lt;br /&gt;
@Entity(noClassnameStored=true)&lt;br /&gt;
public class Person {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@Id&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@Property(&quot;id&quot;)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private ObjectId id;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private String name;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private List&amp;lt;Hobbies&amp;gt; hobbies;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@Embedded&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private Address address;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public ObjectId getId() {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return id;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void setId(ObjectId id) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.id = id;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String getName() {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return name;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void setName(String name) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.name = name;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public List&amp;lt;Hobbies&amp;gt; getHobbiess() {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return hobbies;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void setHobbies(List&amp;lt;Hobbies&amp;gt; hobbies) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.hobbies = hobbies;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public Address getAddress() {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return address;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void setAddress(Address address) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.address = address;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
package com.mongo.morphia.entity;&lt;br /&gt;
&lt;br /&gt;
import com.google.code.morphia.annotations.Embedded;&lt;br /&gt;
&lt;br /&gt;
@Embedded&lt;br /&gt;
public class Address {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private String number;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private String street;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private String town;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private String postcode;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String getNumber() {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return number;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void setNumber(String number) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.number = number;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String getStreet() {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return street;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void setStreet(String street) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.street = street;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String getTown() {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return town;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void setTown(String town) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.town = town;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String getPostcode() {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return postcode;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void setPostcode(String postcode) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.postcode = postcode;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
package com.mongo.morphia.entity;&lt;br /&gt;
&lt;br /&gt;
import org.bson.types.ObjectId;&lt;br /&gt;
&lt;br /&gt;
import com.google.code.morphia.annotations.Entity;&lt;br /&gt;
import com.google.code.morphia.annotations.Id;&lt;br /&gt;
import com.google.code.morphia.annotations.Property;&lt;br /&gt;
&lt;br /&gt;
@Entity&lt;br /&gt;
public class Hobbies {&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@Id&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@Property(&quot;id&quot;)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private ObjectId id;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private String name;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String getName() {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return name;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void setName(String name) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.name = name;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public ObjectId getId() {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return id;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void setId(ObjectId id) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.id = id;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
}&lt;br /&gt;
&lt;div&gt;
DAO class..&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
package com.mongo.morphia.dao;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
import com.google.code.morphia.Morphia;&lt;/div&gt;
&lt;div&gt;
import com.google.code.morphia.dao.BasicDAO;&lt;/div&gt;
&lt;div&gt;
import com.mongo.morphia.entity.Person;&lt;/div&gt;
&lt;div&gt;
import com.mongodb.Mongo;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
public class PersonDAO extends BasicDAO&amp;lt;Person, String&amp;gt; { &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public PersonDAO(Morphia morphia, Mongo mongo, String dbName) { &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;super(mongo, morphia, dbName); &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
}&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the below class we have called the save , update , find and Delete operation. here we are using the entities to do all the operations.&lt;br /&gt;
&lt;br /&gt;
package com.mongo.morphia;&lt;br /&gt;
&lt;br /&gt;
import java.net.UnknownHostException;&lt;br /&gt;
import java.util.ArrayList;&lt;br /&gt;
import java.util.List;&lt;br /&gt;
&lt;br /&gt;
import com.google.code.morphia.Datastore;&lt;br /&gt;
import com.google.code.morphia.Morphia;&lt;br /&gt;
import com.google.code.morphia.mapping.Mapper;&lt;br /&gt;
import com.google.code.morphia.query.Query;&lt;br /&gt;
import com.google.code.morphia.query.QueryResults;&lt;br /&gt;
import com.google.code.morphia.query.UpdateOperations;&lt;br /&gt;
import com.mongo.morphia.dao.PersonDAO;&lt;br /&gt;
import com.mongo.morphia.entity.Hobbies;&lt;br /&gt;
import com.mongo.morphia.entity.Address;&lt;br /&gt;
import com.mongo.morphia.entity.Person;&lt;br /&gt;
import com.mongodb.Mongo;&lt;br /&gt;
import com.mongodb.MongoException;&lt;br /&gt;
&lt;br /&gt;
public class Example {&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void main(String[] args) throws UnknownHostException,MongoException {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;String dbName = new String(&quot;User&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Mongo mongo = new Mongo();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Morphia morphia = new Morphia();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Datastore datastore = morphia.createDatastore(mongo, dbName);&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;morphia.mapPackage(&quot;com.mongo.morphia.entity&quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Address address = new Address();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;address.setNumber(&quot;Q-101&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;address.setStreet(&quot;M.G. Road&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;address.setTown(&quot;Pune&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;address.setPostcode(&quot;411001&quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Hobbies hobbies = new Hobbies();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;hobbies.setName(&quot;Trekking&quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;List&amp;lt;Hobbies&amp;gt; listHobbies = new ArrayList&amp;lt;Hobbies&amp;gt;();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;listHobbies.add(hobbies);&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Person person = new Person();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;person.setAddress(address);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;person.setName(&quot;Mr Martin d&#39;souza&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;person.setHobbies(listHobbies);&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;//Save Methods&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;PersonDAO personDAO = new PersonDAO(morphia, mongo, dbName);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;personDAO.save(person);&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;//Find Methods&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;//use in a loop&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;for(Person personObj : datastore.find(Person.class, &quot;hobbies.name&quot;, &quot;Trekking&quot;)) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(personObj.getName());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;//get back as a list&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;//List&amp;lt;Person&amp;gt; personObj1 = datastore.find(Person.class, &quot;name&quot;, &quot;Martin&quot;).asList();&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;// Get the Data Using Query Criteria&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Query&amp;lt;Person&amp;gt; query = datastore.createQuery(Person.class);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;query.and(query.criteria(&quot;hobbies.name&quot;).equal(&quot;Trekking&quot;),&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;query.criteria(&quot;address.number&quot;).equal(&quot;Q-101&quot;),&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;query.criteria(&quot;name&quot;).contains(&quot;Martin&quot;));&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;QueryResults&amp;lt;Person&amp;gt; retrievedPersons = personDAO.find(query);&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;for (Person retrievedPerson : retrievedPersons) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(retrievedPerson.getName());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(retrievedPerson.getAddress().getPostcode());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(retrievedPerson.getHobbiess().get(0).getName());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;//Update Methods&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;for (Person retrievedPerson : retrievedPersons) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;UpdateOperations&amp;lt;Person&amp;gt; updatePerson = datastore.createUpdateOperations(Person.class).set(&quot;name&quot;, &quot;Kevin Gibbs&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;datastore.update(datastore.createQuery(Person.class).field(Mapper.ID_KEY).equal(retrievedPerson.getId()), updatePerson);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;//Delete Methods&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;//personDAO.delete(retrievedCustomer);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
If You check the Mongo console you will find the below output ...&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
db.Person.find().pretty();&lt;/div&gt;
&lt;div&gt;
{&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;_id&quot; : ObjectId(&quot;5465ddf2e4b02b54a64d9fdd&quot;),&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;address&quot; : {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&quot;number&quot; : &quot;Q-101&quot;,&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&quot;street&quot; : &quot;M.G. Road&quot;,&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&quot;town&quot; : &quot;Pune&quot;,&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&quot;postcode&quot; : &quot;411001&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;},&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;hobbies&quot; : [&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&quot;name&quot; : &quot;Trekking&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;],&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;name&quot; : &quot;Kevin Gibbs&quot;&lt;/div&gt;
&lt;div&gt;
}&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://abhijitbashetti.blogspot.com/feeds/6624333508636115050/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://abhijitbashetti.blogspot.com/2014/11/storing-pojos-in-mongodb-using-morphia.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/6624333508636115050'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/6624333508636115050'/><link rel='alternate' type='text/html' href='http://abhijitbashetti.blogspot.com/2014/11/storing-pojos-in-mongodb-using-morphia.html' title='Storing POJOs in MongoDB Using Morphia'/><author><name>Abhijit Bashetti</name><uri>http://www.blogger.com/profile/02494128996998150172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUkzTfb2FQaDNMYEccAavR7aylIC_4UBvAhEtPQTesV-IzTwNr0rtF16MQgDIIcQMg4MpzYOQ3gHrFZPLOwyWxqUk1aQA1VxGFjYr5UMOYCRmdgKbeC_v6kJKxY2Fdf_o/s220/IMG_2027.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8592878860404675342.post-7191383282005812428</id><published>2014-11-13T06:22:00.001-08:00</published><updated>2014-11-19T04:19:06.762-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="difference between Java and Python"/><category scheme="http://www.blogger.com/atom/ns#" term="Java To Python"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>Java To Python.......</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;Learning a new thing is always a fun... then whatever it is ... you enjoy it...&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;I am learning Python now...I knew java and use it for building the application as of now....&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;While learning the Python, it doesn&#39;t seems to hard with respect to the syntax..its very easy..&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;its like plain text sort of thing being learnt...&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;background-color: white; line-height: 20.799999237060547px;&quot;&gt;Python&#39;s simple and straight-forward syntax also encourages good programming habbits,&lt;/span&gt;&lt;span style=&quot;background-color: white; line-height: 20.799999237060547px;&quot;&gt;&amp;nbsp;especially through its focus on white space indentation, which contributes to the development of neat looking code.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;We try to put out some difference between Python and Java...&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;Before that I am not criticizing any language here, just wanted you to enjoy this as I had...&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;1. If you want to print the &quot;Hello World&quot; in java, it looks something like this&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;public class TestJava {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;color: blue; font-family: Georgia, Times New Roman, serif; white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void main(String[] args) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(&quot;Hello World&quot;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;color: blue; font-family: Georgia, Times New Roman, serif; white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;and the same thing in Python is&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;print &quot;Hello, Python!&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;2. When it comes to some reserved words ..then yes both the languages has some keys reserved. I dint find any difference here. And the view is same that the reserved words not be used as constant or variable or any other identifier names.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;3. Next is line and indentation where In Python the fact is that there are no braces to indicate blocks of code for class and function definitions or flow control. Blocks of code are denoted by line indentation, which is rigidly enforced.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;The number of spaces in the indentation is variable, but all statements within the block must be indented the same amount.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;Both blocks in this example are fine:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;if True:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp; print &quot;True&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;else:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; print &quot;False&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;and the below block in this example will generate an error:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;if True:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp; print &quot;Answer&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp; print &quot;True&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;else:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp; print &quot;Answer&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; print &quot;False&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;Thus, in Python all the continuous lines indented with similar number of spaces would form a block.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;4. Quotation in Python: Python accepts single (&#39;), double (&quot;) and triple (&#39;&#39;&#39; or &quot;&quot;&quot;) quotes to denote string literals, as long as the same type of quote starts and ends the string.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;Same is not the case with Java while defining the String literals.. :)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;5. Commenting the code in Python : A hash sign (#) that is not inside a string literal begins a comment.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;All characters after the # and up to the physical line end are part of the comment and the Python interpreter ignores them.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;In java Single line commenting is done by &quot;//&quot; and multiple lines commenting is by /* */. Anything that comes between /* */ will be ignored.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;6. Values Assigning to Variable : In Python&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;count = 100 &amp;nbsp;# integer assignment&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;distance = 10.5 # floating&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;name = &quot;Steve&quot; &amp;nbsp;# String&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;In Java&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;String name = &quot;xyx&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;Integer count = 100;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;Difference is you need to mention the data type along with the variable name.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;7. Multiple Assignment:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;Python allows you to assign a single value to several variables simultaneously.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;For example:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;a = b = c = 1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;Same thing is not possible in Java.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;You can also assign multiple objects to multiple variables.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;For example:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; a, b, c = 1, 2, &quot;john&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;and if you print it the output is&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;color: blue; font-family: Georgia, Times New Roman, serif; white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;print a,b,c&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;1 2 john&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;8. Lists : Lists are the most versatile of Python&#39;s compound data types.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;A list contains items separated by commas and enclosed within square brackets ([]).&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;In java you have different collections like ArrayList and Hashset etc.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;One difference between them is that all the items belonging to a list in Python can be of different data &amp;nbsp; &amp;nbsp;type.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;In Java it does too but seems hard when you introduce Generics.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;9. Value access from List :&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;In Python the values stored in a list can be accessed using the slice operator ( [ ] and [ : ] ) with&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;indexes starting at 0 in the beginning of the list and working their way to end -1.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;list = [ &#39;abcd&#39;, 786 , 2.23, &#39;john&#39;, 70.2 ]&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;print list &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;# Prints complete list&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;print list[0] &amp;nbsp; &amp;nbsp; &amp;nbsp; # Prints first element of the list&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;print list[1:3] &amp;nbsp; &amp;nbsp; # Prints elements starting from 2nd till 3rd&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;In Java use of Iterator or new for each would be used to get the data.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;10. Defining a Function&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp; Here are simple rules to define a function in Python.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp; Function blocks begin with the keyword def followed by the function name and parentheses ( ( ) ).&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp; Any input parameters or arguments should be placed within these parentheses. You can also define &amp;nbsp; &amp;nbsp; &amp;nbsp; parameters inside these parentheses.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp; The first statement of a function can be an optional statement - the documentation string of the &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; function or docstring.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp; The code block within every function starts with a colon (:) and is indented.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp; The statement return [expression] exits a function, optionally passing back an expression to the caller.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp; A return statement with no arguments is the same as return None.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp; For Example :&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp; def printme( str ):&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &quot;This prints a passed string into this function&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp; print str&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp; return&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp; In Java :&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp; public void test(Integer i){&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;System.out.println(&quot;funtion&quot; + i);&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;I would appreciate if anyone add more if they knew and correct me if I am wrong at any point...&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Georgia, Times New Roman, serif;&quot;&gt;Till then cheers...&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://abhijitbashetti.blogspot.com/feeds/7191383282005812428/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://abhijitbashetti.blogspot.com/2014/11/java-to-python.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/7191383282005812428'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/7191383282005812428'/><link rel='alternate' type='text/html' href='http://abhijitbashetti.blogspot.com/2014/11/java-to-python.html' title='Java To Python.......'/><author><name>Abhijit Bashetti</name><uri>http://www.blogger.com/profile/02494128996998150172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUkzTfb2FQaDNMYEccAavR7aylIC_4UBvAhEtPQTesV-IzTwNr0rtF16MQgDIIcQMg4MpzYOQ3gHrFZPLOwyWxqUk1aQA1VxGFjYr5UMOYCRmdgKbeC_v6kJKxY2Fdf_o/s220/IMG_2027.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8592878860404675342.post-1196857093266172385</id><published>2014-06-03T02:11:00.002-07:00</published><updated>2014-06-03T02:11:55.674-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Generating plain xml from Jasper Irrespective of the Locale"/><category scheme="http://www.blogger.com/atom/ns#" term="Plain xml from Jasper"/><title type='text'>Generating plain xml from Jasper Irrespective of the Locale</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Generating plain xml from the jasper report has another problem for me.&lt;br /&gt;
&lt;br /&gt;
If the locale is changed then the column names will get changed.&lt;br /&gt;
&lt;br /&gt;
As I want the xml for the Data Feed, it would not work as the xml parsing&lt;br /&gt;
mechanism will change as the locale will change.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So to achieve the same i.e. to get the xml attribute in English all the time&lt;br /&gt;
irrespective of the locale, need to do some changes in the code.&lt;br /&gt;
&lt;br /&gt;
Here is the modified exportText method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public void exportText(JRPrintText text) throws IOException&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;JRStyle style = text.getStyle();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if (style != null){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;String styleName = style.getName();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if(!isColumn &amp;amp;&amp;amp; &quot;TableColumnHeaderTextStyle&quot;.equals(styleName)){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;columnMap.put(columnCount, text.getOriginalText());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;columnCount++;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}else if(!isRow &amp;amp;&amp;amp; &quot;TableDetailTextStyle&quot;.equals(styleName)){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;isColumn = true;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;isRow = true;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if(isRow){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if (!isNewColumn &amp;amp;&amp;amp; text.hasProperties())&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;JRPropertiesMap propertiesMap = text.getPropertiesMap();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;String[] propertyNames = propertiesMap.getPropertyNames();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;if (propertyNames != null &amp;amp;&amp;amp; propertyNames.length &amp;gt; 0)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;for(int i = 0; i &amp;lt; propertyNames.length; i++)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;String value = propertiesMap.getProperty(propertyNames[i]);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;if (value != null)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;int p = value.indexOf(&#39;.&#39;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;String regex = &quot;[_][0-9][0-9][0-9]&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;if (p &amp;gt;= 0) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt; &amp;nbsp; &amp;nbsp;String right = value.substring(p + 1);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt; &amp;nbsp; &amp;nbsp;String []val = right.split(regex);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt; &amp;nbsp; &amp;nbsp;String modValue = val[0];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt; &amp;nbsp; &amp;nbsp;if(newColumnMap.containsValue(modValue)){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;isNewColumn = true;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}else{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;newColumnMap.put(newCoulmnCount, modValue);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;newCoulmnCount++ ;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if(style != null &amp;amp;&amp;amp; &quot;TableDetailTextStyle&quot;.equals(style.getName())){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;isRowClosed = false;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;if(rowCount == 0){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;xmlWriter.startElement(ELEMENT_row);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;if(null == text.getOriginalText()){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;System.out.println(&quot;text value is null&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;String attributName = newColumnMap.get(rowCount);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;xmlWriter.addEncodedAttribute(attributName, text.getOriginalText());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;rowCount++;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if(rowCount == columnCount){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;isRowClosed = true;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;xmlWriter.closeElement();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;rowCount = 0;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://abhijitbashetti.blogspot.com/feeds/1196857093266172385/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://abhijitbashetti.blogspot.com/2014/06/generating-plain-xml-from-jasper.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/1196857093266172385'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/1196857093266172385'/><link rel='alternate' type='text/html' href='http://abhijitbashetti.blogspot.com/2014/06/generating-plain-xml-from-jasper.html' title='Generating plain xml from Jasper Irrespective of the Locale'/><author><name>Abhijit Bashetti</name><uri>http://www.blogger.com/profile/02494128996998150172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUkzTfb2FQaDNMYEccAavR7aylIC_4UBvAhEtPQTesV-IzTwNr0rtF16MQgDIIcQMg4MpzYOQ3gHrFZPLOwyWxqUk1aQA1VxGFjYr5UMOYCRmdgKbeC_v6kJKxY2Fdf_o/s220/IMG_2027.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8592878860404675342.post-3345416929945941977</id><published>2014-06-01T22:11:00.001-07:00</published><updated>2014-07-03T03:36:17.206-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="duplicate attribute"/><category scheme="http://www.blogger.com/atom/ns#" term="Extra content at the end of the document"/><category scheme="http://www.blogger.com/atom/ns#" term="specification mandate value for attribute Size"/><category scheme="http://www.blogger.com/atom/ns#" term="xml parsing issues"/><title type='text'>XML parsing Issues</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
While working on Generating XML output/export in jasper, I came across some xml issues.&lt;br /&gt;
&lt;br /&gt;
Xml generation was successful, but parsing the same in browsers had some issues.&lt;br /&gt;
&lt;br /&gt;
Listing out those issues here and the solution for the same.&lt;br /&gt;
&lt;br /&gt;
Every Browser show the error or explain it differently.&lt;br /&gt;
&lt;br /&gt;
Here I am showing the errors by crome and Firefox.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Issue 1:&lt;br /&gt;
&lt;br /&gt;
On Crome :&lt;br /&gt;
This page contains the following errors:&lt;br /&gt;
error on line 4 at column 60: Specification mandate value for attribute Size&lt;br /&gt;
Below is a rendering of the page up to the first error.&lt;br /&gt;
&lt;br /&gt;
Here Size is the attribute name, being used by me in the xml.&lt;br /&gt;
The original column name in jasper was Size(Kb)&lt;br /&gt;
&lt;br /&gt;
On FireFox :&lt;br /&gt;
XML Parsing Error: not well-formed&lt;br /&gt;
Location: http://10.55.36.34:8080/xyz?id=dT01ODg5NyZwPTEzODI4JnI9VGVzdCBSZXBvcnQmaj0vOTYzNDctdXNyLWZvbC11cmkvMTM4MjgtdXNyLXdzLXJlcG9ydHMtZm9sLXVyaS9UZXN0X1JlcG9ydCZkPTE0MDA3MzkxODYwODgmYz0xNjgyMjA4NTg2&lt;br /&gt;
Line Number 4, Column 171:&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&amp;lt;row Reference=&quot;abc-16316AD-2411101F000&quot; Action_Date=&quot;18/03/2014 11:45&quot; Title=&quot;audit.png&quot; User_Name=&quot;SEND NO MESSAGES KEINE NACHRICHT SENDEN&quot; Content_Id=&quot;21565941&quot; Size(Kb)=&quot;72&quot;&lt;br /&gt;
&lt;br /&gt;
FireFox highlights the error by pointing to the attribute &quot;Size(Kb)&quot;. The attribute contains the special character.&lt;br /&gt;
&lt;br /&gt;
By removing/replacing the special character &quot;(&quot;, the above issue gets resolved.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Issue 2:&lt;br /&gt;
&lt;br /&gt;
On crome :&lt;br /&gt;
This page contains the following errors:&lt;br /&gt;
error on line 6843 at column 19: Extra content at the end of the document&lt;br /&gt;
Below is a rendering of the page up to the first error.&lt;br /&gt;
&lt;br /&gt;
On FireFox :&lt;br /&gt;
XML Parsing Error: no element found&lt;br /&gt;
Location: http://10.55.36.34:8080/xyz?id=dT01ODg5NyZwPTEzODI4JnI9RG9jdW1lbnQgRGlzdHJpYnV0aW9uIFYxIFJlcG9ydCZqPS85NjM0Ny11c3ItZm9sLXVyaS8xMzgyOC11c3Itd3MtcmVwb3J0cy1mb2wtdXJpL0RvY3VtZW50X0Rpc3RyaWJ1dGlvbl9WMV9SZXBvcnQmZD0xNDAwNzUxODUzNDUzJmM9MzI3NjMxMDE0Mg&lt;br /&gt;
Line Number 6844, Column 1:&lt;br /&gt;
&lt;br /&gt;
The error was because of xml root node is missing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Issue 3:&lt;br /&gt;
&lt;br /&gt;
Mozilla....&lt;br /&gt;
&lt;br /&gt;
XML Parsing Error: duplicate attribute&lt;br /&gt;
Location: http://10.55.36.34:8080/BIReportDataFeed?id=dT01ODg5NyZwPTEzODI4Jmo9Lzk2MzQ3LXVzci1mb2wtdXJpLzEzODI4LXVzci13cy1yZXBvcnRzLWZvbC11cmkvRG9jdW1lbnRfTWV0YWRhdGEmZD0xNDAwODUyNzU5Mjg2JmM9MjUzMTIwMTg0NQ&lt;br /&gt;
Line Number 4, Column 42:&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;row Reference=&quot;GER-BRU-7&quot; Property=&quot;&quot; Property=&quot;&quot; Property=&quot;&quot; Property=&quot;&quot; Property=&quot;&quot; Property=&quot;&quot; Property=&quot;&quot; Property=&quot;&quot; Property=&quot;&quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is very straight forward. Xml does not allow duplicate attributes.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://abhijitbashetti.blogspot.com/feeds/3345416929945941977/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://abhijitbashetti.blogspot.com/2014/06/xml-parsing-issues.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/3345416929945941977'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/3345416929945941977'/><link rel='alternate' type='text/html' href='http://abhijitbashetti.blogspot.com/2014/06/xml-parsing-issues.html' title='XML parsing Issues'/><author><name>Abhijit Bashetti</name><uri>http://www.blogger.com/profile/02494128996998150172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUkzTfb2FQaDNMYEccAavR7aylIC_4UBvAhEtPQTesV-IzTwNr0rtF16MQgDIIcQMg4MpzYOQ3gHrFZPLOwyWxqUk1aQA1VxGFjYr5UMOYCRmdgKbeC_v6kJKxY2Fdf_o/s220/IMG_2027.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8592878860404675342.post-7809404241129501880</id><published>2014-05-21T00:13:00.003-07:00</published><updated>2014-05-21T00:14:11.722-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="jasper as xml feed."/><category scheme="http://www.blogger.com/atom/ns#" term="Jasper xml export"/><title type='text'>Generate Xml export from Jasper for the data feed in Excel.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Generate Xml export from Jasper for the data feed in Excel.&lt;br /&gt;
&lt;br /&gt;
Generating xml export from jasper for the data feed.&lt;br /&gt;
This data feed or the xml file when imported in excel should generate a report in correct format.&lt;br /&gt;
&lt;br /&gt;
The xml format is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;jasperPrint name=&quot;rt demo&quot;&amp;gt;&lt;br /&gt;
&amp;lt;report-results&amp;gt;&lt;br /&gt;
&amp;lt;row Reference=&quot;Dummy Reference 12&quot; Date=&quot;25/03/2014 16:38&quot; User_Name=&quot;Vaibhav joshi&quot; Type_ID=&quot;85&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;row Reference=&quot;Dummy Reference 11&quot; Date=&quot;25/03/2014 16:38&quot; User_Name=&quot;Vaibhav joshi&quot; Type_ID=&quot;85&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;row Reference=&quot;Dummy Reference 5&quot; Date=&quot;25/03/2014 16:34&quot; User_Name=&quot;Vaibhav joshi&quot; Type_ID=&quot;17&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;row Reference=&quot;Dummy Reference 5&quot; Date=&quot;25/03/2014 16:34&quot; User_Name=&quot;Vaibhav joshi&quot; Type_ID=&quot;3&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;row Reference=&quot;Dummy Reference 4&quot; Date=&quot;25/03/2014 16:34&quot; User_Name=&quot;Vaibhav joshi&quot; Type_ID=&quot;3&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;row Reference=&quot;Dummy Reference 2&quot; Date=&quot;21/03/2014 12:15&quot; User_Name=&quot;Vaibhav joshi&quot; Type_ID=&quot;165&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;row Reference=&quot;register2.JPG&quot; Date=&quot;20/03/2014 14:03&quot; User_Name=&quot;Vaibhav joshi&quot; Type_ID=&quot;1&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;row Reference=&quot;Dummy Reference 1&quot; Date=&quot;20/03/2014 12:43&quot; User_Name=&quot;Vaibhav joshi&quot; Type_ID=&quot;17&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;row Reference=&quot;Dummy Reference 2&quot; Date=&quot;20/03/2014 12:43&quot; User_Name=&quot;Vaibhav joshi&quot; Type_ID=&quot;17&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;row Reference=&quot;Dummy Reference 6&quot; Date=&quot;18/03/2014 12:48&quot; User_Name=&quot;Vaibhav joshi&quot; Type_ID=&quot;7&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;row Reference=&quot;Dummy Reference 7&quot; Date=&quot;18/03/2014 12:48&quot; User_Name=&quot;Vaibhav joshi&quot; Type_ID=&quot;7&quot;/&amp;gt;&lt;br /&gt;
........&lt;br /&gt;
.......&lt;br /&gt;
......&lt;br /&gt;
&amp;lt;/jasperPrint&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Modified XML Export code to achieve the above xml is :&lt;br /&gt;
&lt;br /&gt;
public class FinalCustomExporter extends JRXmlExporter&lt;br /&gt;
{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private static final Log log = LogFactory.getLog(JRXmlExporter.class);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private static final String XML_EXPORTER_PROPERTIES_PREFIX = JRPropertiesUtil.PROPERTY_PREFIX + &quot;export.xml.&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static final String XML_EXPORTER_KEY = JRPropertiesUtil.PROPERTY_PREFIX + &quot;xml&quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static final String PROPERTY_REPLACE_INVALID_CHARS = JRPropertiesUtil.PROPERTY_PREFIX + &quot;export.xml.replace.invalid.chars&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected static final String DEFAULT_XML_ENCODING = &quot;UTF-8&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected static final String DEFAULT_OBJECT_TYPE = &quot;java.lang.String&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected static final String XML_FILES_SUFFIX = &quot;_files&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected static final String IMAGE_PREFIX = &quot;img_&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static final String &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;ELEMENT_row &amp;nbsp;=&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;row&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static final String &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;ELEMENT_report_results &amp;nbsp;=&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;report-results&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static final XmlNamespace JASPERPRINT_NAMESPACE =&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;new XmlNamespace(JRXmlConstants.JASPERPRINT_NAMESPACE, null, JRXmlConstants.JASPERPRINT_XSD_SYSTEM_ID);&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected JRXmlWriteHelper xmlWriter;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected String encoding;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected String version;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected VersionComparator versionComparator = new VersionComparator();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected JRExportProgressMonitor progressMonitor;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected Map&amp;lt;Renderable,String&amp;gt; rendererToImagePathMap;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected Map&amp;lt;String,byte[]&amp;gt; imageNameToImageDataMap;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected Map&amp;lt;String,JRStyle&amp;gt; stylesMap = new HashMap&amp;lt;String,JRStyle&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected boolean isEmbeddingImages = true;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected boolean isColumn = false;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected boolean isRow = false;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected Integer columnCount = 0;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected Integer rowCount = 0;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected Map&amp;lt;Integer,String&amp;gt; columnMap = new HashMap&amp;lt;Integer, String&amp;gt;();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected File destFile;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected File imagesDir;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected class ExporterContext extends BaseExporterContext implements JRXmlExporterContext&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;public String getExportPropertiesPrefix()&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;return FinalCustomExporter.this.getExporterPropertiesPrefix();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected JRXmlExporterContext exporterContext = new ExporterContext();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public FinalCustomExporter()&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this(DefaultJasperReportsContext.getInstance());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public FinalCustomExporter(JasperReportsContext jasperReportsContext)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;super(jasperReportsContext);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void exportReport() throws JRException&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;progressMonitor = (JRExportProgressMonitor)parameters.get(JRExporterParameter.PROGRESS_MONITOR);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;setOffset();&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;setExportContext();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;setInput();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if (!parameters.containsKey(JRExporterParameter.FILTER))&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;filter = createFilter(getExporterPropertiesPrefix());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;setPageRange();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;@SuppressWarnings(&quot;deprecation&quot;)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;String dtdLocation = (String)parameters.get(JRXmlExporterParameter.DTD_LOCATION);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if (dtdLocation != null)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;log.warn(&quot;The JRXmlExporterParameter.DTD_LOCATION export parameter has no effect and should no longer be used.&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;encoding = (String)parameters.get(JRExporterParameter.CHARACTER_ENCODING);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if (encoding == null)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;encoding = DEFAULT_XML_ENCODING;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;setHyperlinkProducerFactory();&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;StringBuffer sb = (StringBuffer)parameters.get(JRExporterParameter.OUTPUT_STRING_BUFFER);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if (sb != null)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;StringBuffer buffer = exportReportToBuffer();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;sb.append(buffer.toString());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;else&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;Writer outWriter = (Writer)parameters.get(JRExporterParameter.OUTPUT_WRITER);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;if (outWriter != null)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;try&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;exportReportToStream(outWriter);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;catch (IOException e)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;throw new JRException(&quot;Error writing to writer : &quot; + jasperPrint.getName(), e);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;else&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;OutputStream os = (OutputStream)parameters.get(JRExporterParameter.OUTPUT_STREAM);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;if (os != null)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;try&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;exportReportToStream(new OutputStreamWriter(os, encoding));&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;catch (Exception e)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;throw new JRException(&quot;Error writing to OutputStream : &quot; + jasperPrint.getName(), e);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;else&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;destFile = (File)parameters.get(JRExporterParameter.OUTPUT_FILE);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;if (destFile == null)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;String fileName = (String)parameters.get(JRExporterParameter.OUTPUT_FILE_NAME);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;if (fileName != null)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;destFile = new File(fileName);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;else&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;throw new JRException(&quot;No output specified for the exporter.&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;imagesDir = new File(destFile.getParent(), destFile.getName() + XML_FILES_SUFFIX);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;Boolean isEmbeddingImagesParameter = (Boolean)parameters.get(JRXmlExporterParameter.IS_EMBEDDING_IMAGES);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;if (isEmbeddingImagesParameter == null)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;isEmbeddingImagesParameter = Boolean.TRUE;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;isEmbeddingImages = isEmbeddingImagesParameter.booleanValue();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;exportReportToFile();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;finally&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;resetExportContext();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected void setHyperlinkProducerFactory()&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;hyperlinkProducerFactory = (JRHyperlinkProducerFactory) parameters.get(JRExporterParameter.HYPERLINK_PRODUCER_FACTORY);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected void exportReportToFile() throws JRException&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;rendererToImagePathMap = new HashMap&amp;lt;Renderable,String&amp;gt;();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;imageNameToImageDataMap = new HashMap&amp;lt;String,byte[]&amp;gt;();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Writer writer = null;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;OutputStream fileOutputStream = new FileOutputStream(destFile);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;writer = new BufferedWriter(new OutputStreamWriter(fileOutputStream, encoding));&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;exportReportToStream(writer);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;catch (IOException e)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;throw new JRException(&quot;Error writing to file : &quot; + destFile, e);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;finally&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if (writer != null)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;try&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;writer.close();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;catch(IOException e)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if (!isEmbeddingImages)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Collection&amp;lt;String&amp;gt; imageNames = imageNameToImageDataMap.keySet();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if (imageNames != null &amp;amp;&amp;amp; imageNames.size() &amp;gt; 0)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;if (!imagesDir.exists())&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;imagesDir.mkdir();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;for(Iterator&amp;lt;String&amp;gt; it = imageNames.iterator(); it.hasNext();)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;String imageName = it.next();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;byte[] imageData = imageNameToImageDataMap.get(imageName);&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;File imageFile = new File(imagesDir, imageName);&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;OutputStream fos = null;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;try&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;fos = new FileOutputStream(imageFile);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;fos.write(imageData, 0, imageData.length);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;catch (IOException e)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;throw new JRException(&quot;Error writing to image file : &quot; + imageFile, e);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;finally&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;if (fos != null)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;try&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;fos.close();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;catch(IOException e)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected StringBuffer exportReportToBuffer() throws JRException&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;StringWriter buffer = new StringWriter();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;exportReportToStream(buffer);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;catch (IOException e)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;throw new JRException(&quot;Error while exporting report to buffer&quot;, e);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return buffer.getBuffer();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected XmlNamespace getNamespace()&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return JASPERPRINT_NAMESPACE;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected void exportReportToStream(Writer writer) throws JRException, IOException&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;version = JRPropertiesUtil.getInstance(jasperReportsContext).getProperty(jasperPrint, JRXmlBaseWriter.PROPERTY_REPORT_VERSION);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;xmlWriter = new JRXmlWriteHelper(writer);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;xmlWriter.writeProlog(encoding);&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;xmlWriter.startElement(JRXmlConstants.ELEMENT_jasperPrint);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_name, jasperPrint.getName());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;List&amp;lt;JRPrintPage&amp;gt; pages = jasperPrint.getPages();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if (pages != null &amp;amp;&amp;amp; pages.size() &amp;gt; 0)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;JRPrintPage page = null;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;for(int i = startPageIndex; i &amp;lt;= endPageIndex; i++)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;if (Thread.interrupted())&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;throw new JRException(&quot;Current thread interrupted.&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;page = pages.get(i);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;exportPage(page);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if(isRow){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;xmlWriter.closeElement();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;isRow = false;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;xmlWriter.closeElement();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;writer.flush();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected void exportPage(JRPrintPage page) throws JRException, IOException&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;exportElements(page.getElements());&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if (progressMonitor != null)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;progressMonitor.afterPageExport();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected void exportElements(Collection&amp;lt;JRPrintElement&amp;gt; elements) throws IOException, JRException&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if (elements != null &amp;amp;&amp;amp; elements.size() &amp;gt; 0)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;for(Iterator&amp;lt;JRPrintElement&amp;gt; it = elements.iterator(); it.hasNext();)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;exportElement(it.next());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void exportElement(JRPrintElement element) throws IOException, JRException&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if (filter == null || filter.isToExport(element))&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if (element instanceof JRPrintText)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;exportText((JRPrintText)element);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;else if (element instanceof JRPrintFrame)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;exportFrame((JRPrintFrame) element);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void exportText(JRPrintText text) throws IOException&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;JRStyle style = text.getStyle();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if (style != null){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;String styleName = style.getName();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if(!isColumn &amp;amp;&amp;amp; &quot;TableColumnHeaderTextStyle&quot;.equals(styleName)){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;columnMap.put(columnCount, text.getOriginalText());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;columnCount++;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}else if(!isRow &amp;amp;&amp;amp; &quot;TableDetailTextStyle&quot;.equals(styleName)){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;isColumn = true;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;isRow = true;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;xmlWriter.startElement(ELEMENT_report_results);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if(isRow &amp;amp;&amp;amp; style != null &amp;amp;&amp;amp; &quot;TableDetailTextStyle&quot;.equals(style.getName())){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if(rowCount == 0){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;xmlWriter.startElement(ELEMENT_row);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if(null == text.getOriginalText()){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;System.out.println(&quot;text value is null&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;String attributName = columnMap.get(rowCount);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;String replaceAttribName = attributName.replace(&quot; &quot;, &quot;_&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;xmlWriter.addEncodedAttribute(replaceAttribName, text.getOriginalText());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;rowCount++;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if(rowCount == columnCount){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;xmlWriter.closeElement();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;rowCount = 0;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected void exportFrame(JRPrintFrame frame) throws IOException, JRException&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;setFrameElementsOffset(frame, true);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;exportElements(frame.getElements());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;finally&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;restoreElementOffsets();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected String getExporterPropertiesPrefix()&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return XML_EXPORTER_PROPERTIES_PREFIX;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String getExporterKey()&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return XML_EXPORTER_KEY;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public JRXmlWriteHelper getXmlWriteHelper()&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return xmlWriter;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected boolean isNewerVersionOrEqual(String oldVersion)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return versionComparator.compare(version, oldVersion) &amp;gt;= 0;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output in Excel looks alike...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgz5-cZFPHJCk24iqXAokfXpLu4miwDlAayx-xvsM1goZE6aGSaXoIOk7s1LExEERlLYeIbnHhOePX3_qvoQhn2a1BIS7hgcmlZmHZut-RFSd-ErfIwKHjfV2LmwzP7nYm8AGWOj_6cqgh4/s1600/BI-data-feed-screen.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgz5-cZFPHJCk24iqXAokfXpLu4miwDlAayx-xvsM1goZE6aGSaXoIOk7s1LExEERlLYeIbnHhOePX3_qvoQhn2a1BIS7hgcmlZmHZut-RFSd-ErfIwKHjfV2LmwzP7nYm8AGWOj_6cqgh4/s1600/BI-data-feed-screen.jpg&quot; height=&quot;281&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://abhijitbashetti.blogspot.com/feeds/7809404241129501880/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://abhijitbashetti.blogspot.com/2014/05/generate-xml-export-from-jasper-for.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/7809404241129501880'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/7809404241129501880'/><link rel='alternate' type='text/html' href='http://abhijitbashetti.blogspot.com/2014/05/generate-xml-export-from-jasper-for.html' title='Generate Xml export from Jasper for the data feed in Excel.'/><author><name>Abhijit Bashetti</name><uri>http://www.blogger.com/profile/02494128996998150172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUkzTfb2FQaDNMYEccAavR7aylIC_4UBvAhEtPQTesV-IzTwNr0rtF16MQgDIIcQMg4MpzYOQ3gHrFZPLOwyWxqUk1aQA1VxGFjYr5UMOYCRmdgKbeC_v6kJKxY2Fdf_o/s220/IMG_2027.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgz5-cZFPHJCk24iqXAokfXpLu4miwDlAayx-xvsM1goZE6aGSaXoIOk7s1LExEERlLYeIbnHhOePX3_qvoQhn2a1BIS7hgcmlZmHZut-RFSd-ErfIwKHjfV2LmwzP7nYm8AGWOj_6cqgh4/s72-c/BI-data-feed-screen.jpg" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8592878860404675342.post-6490644457053720789</id><published>2014-05-20T02:26:00.001-07:00</published><updated>2014-06-02T04:18:45.311-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="custom xml export for jasper."/><category scheme="http://www.blogger.com/atom/ns#" term="export-report-in-plain-xml-format-jasper"/><category scheme="http://www.blogger.com/atom/ns#" term="Generate XML Output from Jasper Reports"/><category scheme="http://www.blogger.com/atom/ns#" term="Jasper"/><category scheme="http://www.blogger.com/atom/ns#" term="Xml Export of jasper report"/><title type='text'>Generate XML Output from Jasper Reports</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Generate XML Output from Jasper Reports :&lt;br /&gt;
&lt;br /&gt;
I was trying for generating/exporting the data in xml from Jasper.&lt;br /&gt;
It generates the data in xml but along with the text content it generates the other tag/layout data&lt;br /&gt;
in xml as which is the layout of the report...like style tag and all... which is not required.&lt;br /&gt;
&lt;br /&gt;
So we modified the code to achieve xml export.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The xml ouput we were getting from the jasper was something like this&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;jasperPrint xmlns=&quot;http://jasperreports.sourceforge.net/jasperreports/print&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation=&quot;http://jasperreports.sourceforge.net/jasperreports/print http://jasperreports.sourceforge.net/xsd/jasperprint.xsd&quot; name=&quot;rt demo&quot; pageWidth=&quot;665&quot; pageHeight=&quot;792&quot; topMargin=&quot;20&quot; leftMargin=&quot;20&quot; bottomMargin=&quot;20&quot; rightMargin=&quot;20&quot; locale=&quot;en_US&quot; timezone=&quot;Asia/Calcutta&quot;&amp;gt;&lt;br /&gt;
&amp;lt;property name=&quot;net.sf.jasperreports.export.xml.start.page.index&quot; value=&quot;0&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;property name=&quot;net.sf.jasperreports.export.xml.end.page.index&quot; value=&quot;2&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;property name=&quot;net.sf.jasperreports.export.xml.page.count&quot; value=&quot;3&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;property name=&quot;net.sf.jasperreports.export.xls.collapse.row.span&quot; value=&quot;false&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;property name=&quot;net.sf.jasperreports.export.html.border.collapse&quot; value=&quot;separate&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;property name=&quot;net.sf.jasperreports.export.docx.frames.as.nested.tables&quot; value=&quot;false&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;property name=&quot;net.sf.jasperreports.export.pdf.tagged&quot; value=&quot;false&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;property name=&quot;net.sf.jasperreports.export.pdf.tag.language&quot; value=&quot;EN-US&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;origin group=&quot;newSet2.CATEGORY_NAME&quot; band=&quot;groupHeader&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;origin group=&quot;newSet2.CATEGORY_NAME&quot; band=&quot;groupFooter&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;origin band=&quot;title&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;origin band=&quot;detail&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;origin band=&quot;summary&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;origin report=&quot;rt32demo_tableDataset_1400134558392_604720&quot; group=&quot;newSet2.CATEGORY_NAME&quot; band=&quot;groupHeader&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;origin report=&quot;rt32demo_tableDataset_1400134558392_604720&quot; group=&quot;newSet2.CATEGORY_NAME&quot; band=&quot;groupFooter&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;origin report=&quot;rt32demo_tableDataset_1400134558392_604720&quot; band=&quot;columnHeader&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;origin report=&quot;rt32demo_tableDataset_1400134558392_604720&quot; band=&quot;detail&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;style name=&quot;ReportDefault&quot; isDefault=&quot;true&quot; mode=&quot;Transparent&quot; forecolor=&quot;#666666&quot; backcolor=&quot;#FFFFFF&quot; hAlign=&quot;Left&quot; vAlign=&quot;Middle&quot; fontName=&quot;DejaVu Sans&quot; fontSize=&quot;11&quot;&amp;gt;...&amp;lt;/style&amp;gt;&lt;br /&gt;
&amp;lt;style name=&quot;TableBaseFrameStyle&quot; mode=&quot;Transparent&quot;&amp;gt;...&amp;lt;/style&amp;gt;&lt;br /&gt;
&amp;lt;style name=&quot;TableFrameStyle&quot; style=&quot;TableBaseFrameStyle&quot;&amp;gt;...&amp;lt;/style&amp;gt;&lt;br /&gt;
&amp;lt;style name=&quot;TableColumnHeaderFrameStyle&quot; style=&quot;TableBaseFrameStyle&quot;&amp;gt;...&amp;lt;/style&amp;gt;&lt;br /&gt;
&amp;lt;style name=&quot;TableColumnFooterFrameStyle&quot; style=&quot;TableBaseFrameStyle&quot;&amp;gt;...&amp;lt;/style&amp;gt;&lt;br /&gt;
&amp;lt;style name=&quot;TableColumnHeaderTextStyle&quot; style=&quot;ReportDefault&quot; mode=&quot;Opaque&quot; forecolor=&quot;#666666&quot; backcolor=&quot;#D5DEE8&quot; hAlign=&quot;Left&quot; vAlign=&quot;Middle&quot; fontName=&quot;DejaVu Sans&quot; fontSize=&quot;11&quot; isBold=&quot;true&quot;&amp;gt;...&amp;lt;/style&amp;gt;&lt;br /&gt;
.....&lt;br /&gt;
......&lt;br /&gt;
&amp;lt;style name=&quot;ChartSeriesColor0&quot; backcolor=&quot;#87C4FE&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;style name=&quot;ChartSeriesColor1&quot; backcolor=&quot;#E96270&quot;/&amp;gt;&lt;br /&gt;
......&lt;br /&gt;
......&lt;br /&gt;
&amp;lt;page&amp;gt;&lt;br /&gt;
&amp;lt;frame&amp;gt;&lt;br /&gt;
&amp;lt;reportElement uuid=&quot;21047d3c-c9f7-46e2-810e-3689a470fce9&quot; style=&quot;TableFrameStyle&quot; x=&quot;20&quot; y=&quot;20&quot; width=&quot;627&quot; height=&quot;727&quot; origin=&quot;4&quot; srcId=&quot;3&quot;&amp;gt;...&amp;lt;/reportElement&amp;gt;&lt;br /&gt;
&amp;lt;frame&amp;gt;&lt;br /&gt;
&amp;lt;reportElement uuid=&quot;1b51c819-e28b-43a1-87a3-3add5e51ac0d&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;125&quot; height=&quot;25&quot; origin=&quot;7&quot; srcId=&quot;8&quot;&amp;gt;&lt;br /&gt;
&amp;lt;property name=&quot;net.sf.jasperreports.export.headertoolbar.cellID&quot; value=&quot;newSet2.DOCUMENT_REFERENCE_1882018985_0&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;property name=&quot;net.sf.jasperreports.export.html.class&quot; value=&quot;jrcolHeader interactiveElement&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;property name=&quot;net.sf.jasperreports.export.headertoolbar.columnUUID&quot; value=&quot;93469203-1702-437d-856c-5326b63e6082&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;property name=&quot;net.sf.jasperreports.export.headertoolbar.tableUUID&quot; value=&quot;21047d3c-c9f7-46e2-810e-3689a470fce9&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;property name=&quot;net.sf.jasperreports.export.headertoolbar.columnIndex&quot; value=&quot;0&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/reportElement&amp;gt;&lt;br /&gt;
&amp;lt;genericElement&amp;gt;...&amp;lt;/genericElement&amp;gt;&lt;br /&gt;
&amp;lt;text textAlignment=&quot;Left&quot; textHeight=&quot;12.8046875&quot; lineSpacingFactor=&quot;1.1640625&quot; leadingOffset=&quot;-2.5942383&quot;&amp;gt;&lt;br /&gt;
&amp;lt;reportElement uuid=&quot;940ff028-90cf-4ca2-ae5c-864da3e50ebc&quot; style=&quot;TableColumnHeaderTextStyle&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;125&quot; height=&quot;25&quot; origin=&quot;7&quot; srcId=&quot;10&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;textContent&amp;gt;&lt;br /&gt;
&amp;lt;![CDATA[ Reference ]]&amp;gt;&lt;br /&gt;
&amp;lt;/textContent&amp;gt;&lt;br /&gt;
&amp;lt;lineBreakOffsets&amp;gt;&lt;br /&gt;
&amp;lt;![CDATA[ ]]&amp;gt;&lt;br /&gt;
&amp;lt;/lineBreakOffsets&amp;gt;&lt;br /&gt;
&amp;lt;/text&amp;gt;&lt;br /&gt;
&amp;lt;/frame&amp;gt;&lt;br /&gt;
&amp;lt;frame&amp;gt;&lt;br /&gt;
&amp;lt;reportElement uuid=&quot;6720edab-8950-4141-8120-c705e23c0082&quot; x=&quot;125&quot; y=&quot;0&quot; width=&quot;125&quot; height=&quot;25&quot; origin=&quot;7&quot; srcId=&quot;11&quot;&amp;gt;&lt;br /&gt;
&amp;lt;property name=&quot;net.sf.jasperreports.export.headertoolbar.cellID&quot; value=&quot;newSet1.AUDIT_EVENT_DATE_TIME_806444232_0&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;property name=&quot;net.sf.jasperreports.export.html.class&quot; value=&quot;jrcolHeader interactiveElement&quot;/&amp;gt;&lt;br /&gt;
......&lt;br /&gt;
&amp;lt;frame&amp;gt;&lt;br /&gt;
&amp;lt;reportElement uuid=&quot;a363100e-edd8-4a0e-93dd-e05d00b25368&quot; x=&quot;500&quot; y=&quot;0&quot; width=&quot;125&quot; height=&quot;25&quot; origin=&quot;7&quot; srcId=&quot;20&quot;&amp;gt;&lt;br /&gt;
&amp;lt;property name=&quot;net.sf.jasperreports.export.headertoolbar.cellID&quot; value=&quot;newSet1.AUDIT_EVENT_TYPE_ID_1616381145_0&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;property name=&quot;net.sf.jasperreports.export.html.class&quot; value=&quot;jrcolHeader interactiveElement&quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;reportElement uuid=&quot;7d0e99df-b27b-4d17-9642-153799495f2b&quot; key=&quot;textField&quot; style=&quot;TableDetailTextStyle&quot; x=&quot;500&quot; y=&quot;250&quot; width=&quot;125&quot; height=&quot;25&quot; origin=&quot;8&quot; srcId=&quot;27&quot;&amp;gt;&lt;br /&gt;
&amp;lt;property name=&quot;net.sf.jasperreports.export.html.class&quot; value=&quot;jrcel cel_newSet1.AUDIT_EVENT_TYPE_ID_1616381145_0&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/reportElement&amp;gt;&lt;br /&gt;
&amp;lt;textContent&amp;gt;&lt;br /&gt;
&amp;lt;![CDATA[ 17 ]]&amp;gt;&lt;br /&gt;
&amp;lt;/textContent&amp;gt;&lt;br /&gt;
&amp;lt;lineBreakOffsets&amp;gt;&lt;br /&gt;
&amp;lt;![CDATA[ ]]&amp;gt;&lt;br /&gt;
&amp;lt;/lineBreakOffsets&amp;gt;&lt;br /&gt;
&amp;lt;/text&amp;gt;&lt;br /&gt;
...........&lt;br /&gt;
..........&lt;br /&gt;
...........&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
this was not in readable format for us.&lt;br /&gt;
&lt;br /&gt;
So we modified the code by Writing CustomXmlExporter and got the xml in proper format.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;jasperPrint name=&quot;rt demo&quot;&amp;gt;&lt;br /&gt;
&amp;lt;columns&amp;gt;&lt;br /&gt;
&amp;lt;column&amp;gt;&lt;br /&gt;
&amp;lt;![CDATA[ Reference ]]&amp;gt;&lt;br /&gt;
&amp;lt;/column&amp;gt;&lt;br /&gt;
&amp;lt;column&amp;gt;&lt;br /&gt;
&amp;lt;![CDATA[ Action Date ]]&amp;gt;&lt;br /&gt;
&amp;lt;/column&amp;gt;&lt;br /&gt;
&amp;lt;column&amp;gt;&lt;br /&gt;
&amp;lt;![CDATA[ Uploaded By Username ]]&amp;gt;&lt;br /&gt;
&amp;lt;/column&amp;gt;&lt;br /&gt;
&amp;lt;column&amp;gt;&lt;br /&gt;
&amp;lt;![CDATA[ User Name ]]&amp;gt;&lt;br /&gt;
&amp;lt;/column&amp;gt;&lt;br /&gt;
&amp;lt;column&amp;gt;&lt;br /&gt;
&amp;lt;![CDATA[ Action Type ID ]]&amp;gt;&lt;br /&gt;
&amp;lt;/column&amp;gt;&lt;br /&gt;
&amp;lt;/columns&amp;gt;&lt;br /&gt;
&amp;lt;rows&amp;gt;&lt;br /&gt;
&amp;lt;row&amp;gt;&lt;br /&gt;
&amp;lt;text&amp;gt;&lt;br /&gt;
&amp;lt;![CDATA[ Dummy Reference 12 ]]&amp;gt;&lt;br /&gt;
&amp;lt;/text&amp;gt;&lt;br /&gt;
&amp;lt;text&amp;gt;&lt;br /&gt;
&amp;lt;![CDATA[ 25/03/2014 16:38 ]]&amp;gt;&lt;br /&gt;
&amp;lt;/text&amp;gt;&lt;br /&gt;
&amp;lt;text&amp;gt;&lt;br /&gt;
&amp;lt;![CDATA[&amp;nbsp;xyz xyz&amp;nbsp;]]&amp;gt;&lt;br /&gt;
&amp;lt;/text&amp;gt;&lt;br /&gt;
&amp;lt;text&amp;gt;&lt;br /&gt;
&amp;lt;![CDATA[&amp;nbsp;xyz xyz&amp;nbsp;]]&amp;gt;&lt;br /&gt;
&amp;lt;/text&amp;gt;&lt;br /&gt;
&amp;lt;text&amp;gt;&lt;br /&gt;
&amp;lt;![CDATA[ 85 ]]&amp;gt;&lt;br /&gt;
&amp;lt;/text&amp;gt;&lt;br /&gt;
&amp;lt;/row&amp;gt;&lt;br /&gt;
&amp;lt;row&amp;gt;&lt;br /&gt;
&amp;lt;text&amp;gt;&lt;br /&gt;
&amp;lt;![CDATA[ Dummy Reference 11 ]]&amp;gt;&lt;br /&gt;
&amp;lt;/text&amp;gt;&lt;br /&gt;
&amp;lt;text&amp;gt;&lt;br /&gt;
&amp;lt;![CDATA[ 25/03/2014 16:38 ]]&amp;gt;&lt;br /&gt;
&amp;lt;/text&amp;gt;&lt;br /&gt;
&amp;lt;text&amp;gt;&lt;br /&gt;
&amp;lt;![CDATA[ xyz xyz ]]&amp;gt;&lt;br /&gt;
&amp;lt;/text&amp;gt;&lt;br /&gt;
&amp;lt;text&amp;gt;&lt;br /&gt;
&amp;lt;![CDATA[&amp;nbsp;xyz xyz&amp;nbsp;]]&amp;gt;&lt;br /&gt;
&amp;lt;/text&amp;gt;&lt;br /&gt;
&amp;lt;text&amp;gt;&lt;br /&gt;
&amp;lt;![CDATA[ 85 ]]&amp;gt;&lt;br /&gt;
&amp;lt;/text&amp;gt;&lt;br /&gt;
&amp;lt;/row&amp;gt;&lt;br /&gt;
..........&lt;br /&gt;
&amp;lt;row&amp;gt;&lt;br /&gt;
&amp;lt;text&amp;gt;&lt;br /&gt;
...........&lt;br /&gt;
...........&lt;br /&gt;
...........&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/rows&amp;gt;&lt;br /&gt;
&amp;lt;/jasperPrint&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is been achieved by modifying the below code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class FinalCustomExporter extends JRXmlExporter&lt;br /&gt;
{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private static final Log log = LogFactory.getLog(JRXmlExporter.class);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private static final String XML_EXPORTER_PROPERTIES_PREFIX = JRPropertiesUtil.PROPERTY_PREFIX + &quot;export.xml.&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static final String XML_EXPORTER_KEY = JRPropertiesUtil.PROPERTY_PREFIX + &quot;xml&quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static final String PROPERTY_REPLACE_INVALID_CHARS = JRPropertiesUtil.PROPERTY_PREFIX + &quot;export.xml.replace.invalid.chars&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected static final String DEFAULT_XML_ENCODING = &quot;UTF-8&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected static final String DEFAULT_OBJECT_TYPE = &quot;java.lang.String&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected static final String XML_FILES_SUFFIX = &quot;_files&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected static final String IMAGE_PREFIX = &quot;img_&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static final java.lang.String &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;ELEMENT_columns &amp;nbsp;=&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;columns&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static final java.lang.String &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;ELEMENT_column &amp;nbsp;=&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;column&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static final java.lang.String &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;ELEMENT_rows &amp;nbsp;=&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;rows&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static final java.lang.String &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;ELEMENT_row &amp;nbsp;=&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;row&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static final XmlNamespace JASPERPRINT_NAMESPACE =&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;new XmlNamespace(JRXmlConstants.JASPERPRINT_NAMESPACE, null, JRXmlConstants.JASPERPRINT_XSD_SYSTEM_ID);&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected JRXmlWriteHelper xmlWriter;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected String encoding;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected String version;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected VersionComparator versionComparator = new VersionComparator();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected JRExportProgressMonitor progressMonitor;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected Map&amp;lt;Renderable,String&amp;gt; rendererToImagePathMap;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected Map&amp;lt;String,byte[]&amp;gt; imageNameToImageDataMap;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected Map&amp;lt;String,JRStyle&amp;gt; stylesMap = new HashMap&amp;lt;String,JRStyle&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected boolean isEmbeddingImages = true;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected boolean isColumn = false;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected boolean isRow = false;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected Integer columnCount = 0;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected Integer rowCount = 0;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected File destFile;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected File imagesDir;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected class ExporterContext extends BaseExporterContext implements JRXmlExporterContext&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;public String getExportPropertiesPrefix()&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;return FinalCustomExporter.this.getExporterPropertiesPrefix();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected JRXmlExporterContext exporterContext = new ExporterContext();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public FinalCustomExporter()&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this(DefaultJasperReportsContext.getInstance());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public FinalCustomExporter(JasperReportsContext jasperReportsContext)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;super(jasperReportsContext);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void exportReport() throws JRException&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;progressMonitor = (JRExportProgressMonitor)parameters.get(JRExporterParameter.PROGRESS_MONITOR);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;setOffset();&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;setExportContext();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;setInput();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if (!parameters.containsKey(JRExporterParameter.FILTER))&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;filter = createFilter(getExporterPropertiesPrefix());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;setPageRange();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;@SuppressWarnings(&quot;deprecation&quot;)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;String dtdLocation = (String)parameters.get(JRXmlExporterParameter.DTD_LOCATION);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if (dtdLocation != null)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;log.warn(&quot;The JRXmlExporterParameter.DTD_LOCATION export parameter has no effect and should no longer be used.&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;encoding = (String)parameters.get(JRExporterParameter.CHARACTER_ENCODING);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if (encoding == null)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;encoding = DEFAULT_XML_ENCODING;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;setHyperlinkProducerFactory();&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;StringBuffer sb = (StringBuffer)parameters.get(JRExporterParameter.OUTPUT_STRING_BUFFER);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if (sb != null)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;StringBuffer buffer = exportReportToBuffer();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;sb.append(buffer.toString());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;else&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;Writer outWriter = (Writer)parameters.get(JRExporterParameter.OUTPUT_WRITER);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;if (outWriter != null)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;try&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;exportReportToStream(outWriter);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;catch (IOException e)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;throw new JRException(&quot;Error writing to writer : &quot; + jasperPrint.getName(), e);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;else&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;OutputStream os = (OutputStream)parameters.get(JRExporterParameter.OUTPUT_STREAM);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;if (os != null)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;try&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;exportReportToStream(new OutputStreamWriter(os, encoding));&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;catch (Exception e)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;throw new JRException(&quot;Error writing to OutputStream : &quot; + jasperPrint.getName(), e);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;else&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;destFile = (File)parameters.get(JRExporterParameter.OUTPUT_FILE);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;if (destFile == null)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;String fileName = (String)parameters.get(JRExporterParameter.OUTPUT_FILE_NAME);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;if (fileName != null)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;destFile = new File(fileName);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;else&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;throw new JRException(&quot;No output specified for the exporter.&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;imagesDir = new File(destFile.getParent(), destFile.getName() + XML_FILES_SUFFIX);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;Boolean isEmbeddingImagesParameter = (Boolean)parameters.get(JRXmlExporterParameter.IS_EMBEDDING_IMAGES);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;if (isEmbeddingImagesParameter == null)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;isEmbeddingImagesParameter = Boolean.TRUE;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;isEmbeddingImages = isEmbeddingImagesParameter.booleanValue();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;exportReportToFile();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;finally&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;resetExportContext();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected void setHyperlinkProducerFactory()&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;hyperlinkProducerFactory = (JRHyperlinkProducerFactory) parameters.get(JRExporterParameter.HYPERLINK_PRODUCER_FACTORY);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected void exportReportToFile() throws JRException&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;rendererToImagePathMap = new HashMap&amp;lt;Renderable,String&amp;gt;();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;imageNameToImageDataMap = new HashMap&amp;lt;String,byte[]&amp;gt;();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Writer writer = null;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;OutputStream fileOutputStream = new FileOutputStream(destFile);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;writer = new BufferedWriter(new OutputStreamWriter(fileOutputStream, encoding));&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;exportReportToStream(writer);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;catch (IOException e)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;throw new JRException(&quot;Error writing to file : &quot; + destFile, e);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;finally&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if (writer != null)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;try&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;writer.close();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;catch(IOException e)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if (!isEmbeddingImages)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Collection&amp;lt;String&amp;gt; imageNames = imageNameToImageDataMap.keySet();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if (imageNames != null &amp;amp;&amp;amp; imageNames.size() &amp;gt; 0)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;if (!imagesDir.exists())&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;imagesDir.mkdir();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;for(Iterator&amp;lt;String&amp;gt; it = imageNames.iterator(); it.hasNext();)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;String imageName = it.next();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;byte[] imageData = imageNameToImageDataMap.get(imageName);&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;File imageFile = new File(imagesDir, imageName);&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;OutputStream fos = null;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;try&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;fos = new FileOutputStream(imageFile);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;fos.write(imageData, 0, imageData.length);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;catch (IOException e)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;throw new JRException(&quot;Error writing to image file : &quot; + imageFile, e);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;finally&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;if (fos != null)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;try&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;fos.close();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;catch(IOException e)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected StringBuffer exportReportToBuffer() throws JRException&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;StringWriter buffer = new StringWriter();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;exportReportToStream(buffer);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;catch (IOException e)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;throw new JRException(&quot;Error while exporting report to buffer&quot;, e);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return buffer.getBuffer();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected XmlNamespace getNamespace()&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return JASPERPRINT_NAMESPACE;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected void exportReportToStream(Writer writer) throws JRException, IOException&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;version = JRPropertiesUtil.getInstance(jasperReportsContext).getProperty(jasperPrint, JRXmlBaseWriter.PROPERTY_REPORT_VERSION);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;xmlWriter = new JRXmlWriteHelper(writer);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;xmlWriter.writeProlog(encoding);&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;xmlWriter.startElement(JRXmlConstants.ELEMENT_jasperPrint);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_name, jasperPrint.getName());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;List&amp;lt;JRPrintPage&amp;gt; pages = jasperPrint.getPages();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if (pages != null &amp;amp;&amp;amp; pages.size() &amp;gt; 0)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;JRPrintPage page = null;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;for(int i = startPageIndex; i &amp;lt;= endPageIndex; i++)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;if (Thread.interrupted())&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;throw new JRException(&quot;Current thread interrupted.&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;page = pages.get(i);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;exportPage(page);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if(isRow){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;xmlWriter.closeElement();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;isRow = false;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;xmlWriter.closeElement();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;writer.flush();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected void exportPage(JRPrintPage page) throws JRException, IOException&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;exportElements(page.getElements());&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if (progressMonitor != null)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;progressMonitor.afterPageExport();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected void exportElements(Collection&amp;lt;JRPrintElement&amp;gt; elements) throws IOException, JRException&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if (elements != null &amp;amp;&amp;amp; elements.size() &amp;gt; 0)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;for(Iterator&amp;lt;JRPrintElement&amp;gt; it = elements.iterator(); it.hasNext();)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;exportElement(it.next());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void exportElement(JRPrintElement element) throws IOException, JRException&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if (filter == null || filter.isToExport(element))&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if (element instanceof JRPrintText)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;exportText((JRPrintText)element);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;else if (element instanceof JRPrintFrame)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;exportFrame((JRPrintFrame) element);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void exportText(JRPrintText text) throws IOException&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;JRStyle style = text.getStyle();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if (style != null)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;String styleName = style.getName();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if(!isRow &amp;amp;&amp;amp; !isColumn &amp;amp;&amp;amp; &quot;TableColumnHeaderTextStyle&quot;.equals(styleName)){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;xmlWriter.startElement(ELEMENT_columns);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;isColumn = true;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;columnCount = 0;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}else if(isColumn &amp;amp;&amp;amp; (&quot;TableGroupHeaderTextStyle&quot;.equals(styleName) || &quot;TableDetailTextStyle&quot;.equals(styleName))){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;xmlWriter.closeElement();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;isColumn = false;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;isRow = true;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;xmlWriter.startElement(ELEMENT_rows);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if (isColumn &amp;amp;&amp;amp; text.getOriginalText() != null)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;columnCount++;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;xmlWriter.writeCDATAElement(ELEMENT_column, text.getOriginalText(),&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;JRXmlConstants.ATTRIBUTE_truncateIndex, text.getTextTruncateIndex());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}else if(style != null &amp;amp;&amp;amp; !(&quot;TableGroupHeaderTextStyle&quot;.equals(style.getName())) &amp;amp;&amp;amp; isRow){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if(rowCount == 0){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;xmlWriter.startElement(ELEMENT_row);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;rowCount++;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;xmlWriter.writeCDATAElement(JRXmlConstants.ELEMENT_text, text.getOriginalText(),&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;JRXmlConstants.ATTRIBUTE_truncateIndex, text.getTextTruncateIndex());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;xmlWriter.writeCDATAElement(JRXmlConstants.ELEMENT_textTruncateSuffix, text.getTextTruncateSuffix());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if(rowCount == columnCount){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;xmlWriter.closeElement();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;rowCount = 0;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected void exportFrame(JRPrintFrame frame) throws IOException, JRException&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;setFrameElementsOffset(frame, true);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;exportElements(frame.getElements());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;finally&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;restoreElementOffsets();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected String getExporterPropertiesPrefix()&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return XML_EXPORTER_PROPERTIES_PREFIX;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String getExporterKey()&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return XML_EXPORTER_KEY;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public JRXmlWriteHelper getXmlWriteHelper()&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return xmlWriter;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected boolean isNewerVersionOrEqual(String oldVersion)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return versionComparator.compare(version, oldVersion) &amp;gt;= 0;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://abhijitbashetti.blogspot.com/feeds/6490644457053720789/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://abhijitbashetti.blogspot.com/2014/05/generate-xml-output-from-jasper-reports.html#comment-form' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/6490644457053720789'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/6490644457053720789'/><link rel='alternate' type='text/html' href='http://abhijitbashetti.blogspot.com/2014/05/generate-xml-output-from-jasper-reports.html' title='Generate XML Output from Jasper Reports'/><author><name>Abhijit Bashetti</name><uri>http://www.blogger.com/profile/02494128996998150172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUkzTfb2FQaDNMYEccAavR7aylIC_4UBvAhEtPQTesV-IzTwNr0rtF16MQgDIIcQMg4MpzYOQ3gHrFZPLOwyWxqUk1aQA1VxGFjYr5UMOYCRmdgKbeC_v6kJKxY2Fdf_o/s220/IMG_2027.jpg'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8592878860404675342.post-9124767026941014985</id><published>2014-01-09T04:25:00.000-08:00</published><updated>2014-01-09T19:31:20.931-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="How to update multiple value of specific embedded document"/><category scheme="http://www.blogger.com/atom/ns#" term="inside an array"/><category scheme="http://www.blogger.com/atom/ns#" term="of a specific document in MongoDB?"/><category scheme="http://www.blogger.com/atom/ns#" term="Updated Embedded array in mongo"/><title type='text'>How to update multiple value of specific embedded document, inside an array, of a specific document in MongoDB?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
How to update multiple value of specific embedded document, inside an array, of a specific document in MongoDB?&lt;br /&gt;
&lt;br /&gt;
MongoDB has a limitation of the same.&lt;br /&gt;
&lt;br /&gt;
for more details please find the below link for your information.&lt;br /&gt;
&lt;br /&gt;
https://jira.mongodb.org/browse/SERVER-1243&lt;br /&gt;
&lt;br /&gt;
for example you have a JSON structure like this ...&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;_id&quot; : ObjectId(&quot;52ce2e4c9109b0e2274a388b&quot;),&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;address&quot; : {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&quot;street&quot; : &quot;Aurthor Street 1&quot;,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&quot;area&quot; : &quot;Area 1&quot;,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&quot;city&quot; : &quot;New York 1&quot;,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&quot;country&quot; : &quot;UK&quot;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;},&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;age&quot; : 29,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;commList&quot; : [&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&quot;userId&quot; : 1,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&quot;firstName&quot; : &quot;Commenter First Name&quot;,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&quot;lastName&quot; : &quot;Commenter Last Name&quot;,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&quot;commentText&quot; : &quot;Comment Text&quot;,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&quot;date&quot; : ISODate(&quot;2014-01-09T05:06:20.283Z&quot;)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;},&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&quot;userId&quot; : 1,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&quot;firstName&quot; : &quot;Commenter First Name&quot;,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&quot;lastName&quot; : &quot;Commenter Last Name&quot;,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&quot;commentText&quot; : &quot;Comment Text 2&quot;,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&quot;date&quot; : ISODate(&quot;2014-01-09T11:59:57.050Z&quot;)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;],&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;commentCount&quot; : 2,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;name&quot; : &quot;Jamse Cook&quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now the user name is changed and we need to update the it.&lt;br /&gt;
&lt;br /&gt;
If we try using java code like :&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;DBCollection dbCollection = getCollection();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;JacksonDBCollection&amp;lt;Person, String&amp;gt; coll = JacksonDBCollection.wrap(dbCollection, Person.class, String.class);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;DBUpdate.Builder builder = new DBUpdate.Builder();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;builder.set(&quot;commList.$.firstName&quot;, &quot;Puneet&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;WriteResult&amp;lt;Person, String&amp;gt; result = coll.update(DBQuery.is(&quot;commList.userId&quot;, 1), builder);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(&quot;rows updated :: &quot; + result.getN());&lt;br /&gt;
&lt;br /&gt;
It updates the first occurence only.&lt;br /&gt;
&lt;br /&gt;
you can use the below code and run it on mongoshell which will update the all occurances&lt;br /&gt;
var runUpdate = function(){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; db.test.find({&quot;commList.userId&quot; : 1}).forEach( function(test) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; for(var i in test.commList){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;test.commList[i].firstName = &#39;abhijit&#39;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;db.test.save(test);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;});&lt;br /&gt;
};&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
db.eval(runUpdate);&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://abhijitbashetti.blogspot.com/feeds/9124767026941014985/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://abhijitbashetti.blogspot.com/2014/01/how-to-update-multiple-value-of.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/9124767026941014985'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/9124767026941014985'/><link rel='alternate' type='text/html' href='http://abhijitbashetti.blogspot.com/2014/01/how-to-update-multiple-value-of.html' title='How to update multiple value of specific embedded document, inside an array, of a specific document in MongoDB?'/><author><name>Abhijit Bashetti</name><uri>http://www.blogger.com/profile/02494128996998150172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUkzTfb2FQaDNMYEccAavR7aylIC_4UBvAhEtPQTesV-IzTwNr0rtF16MQgDIIcQMg4MpzYOQ3gHrFZPLOwyWxqUk1aQA1VxGFjYr5UMOYCRmdgKbeC_v6kJKxY2Fdf_o/s220/IMG_2027.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8592878860404675342.post-1634010970032001162</id><published>2014-01-07T21:44:00.000-08:00</published><updated>2014-02-01T01:50:40.490-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MongoDB with MongoJack"/><category scheme="http://www.blogger.com/atom/ns#" term="Using Jackson for Mapping Java Objects with Mongo."/><title type='text'>Example of MongoDB with MongoJack</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
There is need of java mapper to the mongo object and MongoJack is very helpful in the same&lt;br /&gt;
to achieve the objective. It uses Jackson as the Java JSON mapper.&lt;br /&gt;
&lt;br /&gt;
You need to add the following jars.&lt;br /&gt;
&lt;br /&gt;
1. &amp;nbsp;bson4jackson-2.1.0.jar&lt;br /&gt;
2. &amp;nbsp;commons-io-2.4.jar&lt;br /&gt;
3. &amp;nbsp;hamcrest-core-1.3.jar&lt;br /&gt;
4. &amp;nbsp;hamcrest-library-1.3.jar&lt;br /&gt;
5. &amp;nbsp;jackson-annotations-2.1.2.jar&lt;br /&gt;
6. &amp;nbsp;jackson-core-2.1.3.jar&lt;br /&gt;
7. &amp;nbsp;jackson-databind-2.1.3.jar&lt;br /&gt;
8. &amp;nbsp;mongo-java-driver-2.11.3.jar&lt;br /&gt;
9. &amp;nbsp;mongojack-2.0.0-RC5.jar&lt;br /&gt;
10.&amp;nbsp;persistence-api-1.0.2.jar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the example you will find how add, update, updating Embedded field, find and find with some criteria using the MongoJack.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public static void main(String[] args) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;create();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;findOne();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;updateEmbeddedField();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;update();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;findOne();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;findWithCriteria();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void create(){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;DBCollection dbCollection = getCollection();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;JacksonDBCollection&amp;lt;Person, String&amp;gt; coll = JacksonDBCollection.wrap(dbCollection, Person.class,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;String.class);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Person person = getPerson();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;WriteResult&amp;lt;Person, String&amp;gt; result = coll.insert(person);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Person p = coll.findOne();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Address ad = p.getAddress();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(&quot;Create o/p -&amp;gt;&amp;gt; &amp;nbsp;name :: &quot; + p.getName() + &quot; age :: &quot; + p.getAge() + &quot; area :: &quot;+ ad.getArea());&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void updateEmbeddedField(){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;DBCollection dbCollection = getCollection();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;JacksonDBCollection&amp;lt;Person, String&amp;gt; coll = JacksonDBCollection.wrap(dbCollection, Person.class,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;String.class);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;DBUpdate.Builder builder = new DBUpdate.Builder();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;builder.set(&quot;address.area&quot;, &quot;Pune&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Person result = coll.findAndModify(DBQuery.is(&quot;name&quot;, &quot;Jamse Cook&quot;), null, null, false, builder, false, false);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Address ad = result.getAddress();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(&quot;updateEmbeddedField o/p -&amp;gt;&amp;gt; name :: &quot; + result.getName() + &quot; age :: &quot; + result.getAge() + &quot; area :: &quot;+ ad.getArea());&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void update(){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;DBCollection dbCollection = getCollection();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;JacksonDBCollection&amp;lt;Person, String&amp;gt; coll = JacksonDBCollection.wrap(dbCollection, Person.class,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;String.class);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;DBUpdate.Builder builder = new DBUpdate.Builder();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;builder.set(&quot;name&quot;, &quot;Abhijit&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Person result = coll.findAndModify(DBQuery.is(&quot;name&quot;, &quot;Jamse Cook&quot;), null, null, false, builder, false, false);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Address ad = result.getAddress();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(&quot;update o/p &amp;nbsp;-&amp;gt;&amp;gt; &amp;nbsp;name :: &quot; + result.getName() + &quot; age :: &quot; + result.getAge() + &quot; area :: &quot;+ ad.getArea());&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void findOne(){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;DBCollection dbCollection = getCollection();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;JacksonDBCollection&amp;lt;Person, String&amp;gt; coll = JacksonDBCollection.wrap(dbCollection, Person.class,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;String.class);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Person result = coll.findOne();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Address ad = result.getAddress();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(&quot;find o/p -&amp;gt;&amp;gt; name :: &quot; + result.getName() + &quot; age :: &quot; + result.getAge() + &quot; area :: &quot;+ ad.getArea());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void findWithCriteria(){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;DBCollection dbCollection = getCollection();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;JacksonDBCollection&amp;lt;Person, String&amp;gt; coll = JacksonDBCollection.wrap(dbCollection, Person.class,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;String.class);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Person result = coll.findOne(DBQuery.is(&quot;name&quot;, &quot;Abhijit&quot;));&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Address ad = result.getAddress();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(&quot;findWithCriteria o/p -&amp;gt;&amp;gt; &amp;nbsp;name :: &quot; + result.getName() + &quot; age :: &quot; + result.getAge() + &quot; area :: &quot;+ ad.getArea());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private static DBCollection getCollection() {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;MongoClient mongoClient = null;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;mongoClient = new MongoClient( &quot;localhost&quot; , 27017 );&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} catch (UnknownHostException e) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;e.printStackTrace();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;DB db = mongoClient.getDB( &quot;jack&quot; );&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;DBCollection dbCollection = db.getCollection(&quot;test&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return dbCollection;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private static Person getPerson(){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; Person person = new Person();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; person.setName(&quot;Jamse Cook&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; person.setAge(29);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; Address address = new Address();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; address.setArea(&quot;Area 1&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; address.setCity(&quot;New York 1&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; address.setStreet(&quot;Aurthor Street 1&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; address.setCountry(&quot;UK&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; person.setAddress(address);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; return person;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
The output on the java console is :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Create o/p -&amp;gt;&amp;gt; &amp;nbsp;name :: Jamse Cook age :: 29 area :: Area 1&lt;br /&gt;
find o/p -&amp;gt;&amp;gt; name :: Jamse Cook age :: 29 area :: Area 1&lt;br /&gt;
updateEmbeddedField o/p -&amp;gt;&amp;gt; name :: Jamse Cook age :: 29 area :: Area 1&lt;br /&gt;
update o/p &amp;nbsp;-&amp;gt;&amp;gt; &amp;nbsp;name :: Jamse Cook age :: 29 area :: Pune&lt;br /&gt;
find o/p -&amp;gt;&amp;gt; name :: Abhijit age :: 29 area :: Pune&lt;br /&gt;
findWithCriteria o/p -&amp;gt;&amp;gt; &amp;nbsp;name :: Abhijit age :: 29 area :: Pune&lt;br /&gt;
&lt;br /&gt;
And the output on the mongo shell is :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
db.test.find().pretty();&lt;br /&gt;
{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;_id&quot; : ObjectId(&quot;52cce4e19109c56d473c46eb&quot;),&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;address&quot; : {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&quot;area&quot; : &quot;Pune&quot;,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&quot;city&quot; : &quot;New York 1&quot;,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&quot;country&quot; : &quot;UK&quot;,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&quot;street&quot; : &quot;Aurthor Street 1&quot;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;},&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;age&quot; : 29,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;name&quot; : &quot;Abhijit&quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://abhijitbashetti.blogspot.com/feeds/1634010970032001162/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://abhijitbashetti.blogspot.com/2014/01/example-of-mongodb-with-mongojack.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/1634010970032001162'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/1634010970032001162'/><link rel='alternate' type='text/html' href='http://abhijitbashetti.blogspot.com/2014/01/example-of-mongodb-with-mongojack.html' title='Example of MongoDB with MongoJack'/><author><name>Abhijit Bashetti</name><uri>http://www.blogger.com/profile/02494128996998150172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUkzTfb2FQaDNMYEccAavR7aylIC_4UBvAhEtPQTesV-IzTwNr0rtF16MQgDIIcQMg4MpzYOQ3gHrFZPLOwyWxqUk1aQA1VxGFjYr5UMOYCRmdgKbeC_v6kJKxY2Fdf_o/s220/IMG_2027.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8592878860404675342.post-3356010285781813824</id><published>2014-01-04T04:37:00.003-08:00</published><updated>2014-01-04T04:38:12.123-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Adding JSON to MongoDB Using Java"/><title type='text'>Adding JSON to MongoDB Using Java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
we can add JSON directly to mongo using Java.&lt;br /&gt;
&lt;br /&gt;
1. In the first example will add josn String directly as shown in the code below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public static void jsonExmple(){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;String jsonString = &quot;{&#39;Name&#39; : &#39;James Smith&#39;, &#39;Age&#39; : 29,&quot; +&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; &amp;nbsp;&quot;&#39;Address&#39; : {&#39;area&#39; : &#39;Area&#39;, &#39;city&#39; : &#39;New York&#39;, &#39;country&#39; : &#39;USA&#39;} }&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;MongoClient mongoClient = null;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;mongoClient = new MongoClient( &quot;localhost&quot; , 27017 );&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} catch (UnknownHostException e) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;e.printStackTrace();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;DB db = mongoClient.getDB( &quot;testJson&quot; );&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;DBCollection json = db.getCollection(&quot;json&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;DBObject dbObject = (DBObject)JSON.parse(jsonString);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;json.insert(dbObject);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;DBCursor jsonDoc = json.find();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;while (jsonDoc.hasNext()) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(jsonDoc.next());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
the output on the mongo console would be like :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
db.json.find().pretty();&lt;br /&gt;
{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;_id&quot; : ObjectId(&quot;52c7fead91090c7db49d1604&quot;),&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;Name&quot; : &quot;James Smith&quot;,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;Age&quot; : 29,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;Address&quot; : {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&quot;area&quot; : &quot;Area&quot;,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&quot;city&quot; : &quot;New York&quot;,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&quot;country&quot; : &quot;USA&quot;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
2. Another case would be, convert the Java object to json and add the json to mongoDB as shown below.&lt;br /&gt;
I have used the google json api to convert Java object to Json.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public static void jsonExample(){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;MongoClient mongoClient = null;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt; mongoClient = new MongoClient( &quot;localhost&quot; , 27017 );&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt; DB db = mongoClient.getDB( &quot;testJson&quot; );&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt; DBCollection json = db.getCollection(&quot;json&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt; Person person = new Person();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt; person.setName(&quot;Jamse Cook&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt; person.setAge(29);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt; Address address = new Address();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt; address.setArea(&quot;Area&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt; address.setCity(&quot;New York&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt; address.setStreet(&quot;Aurthor Street&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt; address.setCountry(&quot;USA&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt; person.setAddress(address);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt; Gson gson = new Gson();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;String jsonString = gson.toJson(person);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;System.out.println(&quot; print the json &quot; + jsonString);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DBObject dbObject = (DBObject)JSON.parse(jsonString);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;json.insert(dbObject);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}catch (Exception e) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
the output on the mongo console would be like :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;_id&quot; : ObjectId(&quot;52c7fc479109fd33fdc45793&quot;),&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;name&quot; : &quot;Jamse Cook&quot;,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;age&quot; : 29,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;address&quot; : {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&quot;street&quot; : &quot;Aurthor Street&quot;,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&quot;area&quot; : &quot;Area&quot;,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&quot;city&quot; : &quot;New York&quot;,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&quot;country&quot; : &quot;USA&quot;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://abhijitbashetti.blogspot.com/feeds/3356010285781813824/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://abhijitbashetti.blogspot.com/2014/01/adding-json-to-mongodb-using-java.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/3356010285781813824'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/3356010285781813824'/><link rel='alternate' type='text/html' href='http://abhijitbashetti.blogspot.com/2014/01/adding-json-to-mongodb-using-java.html' title='Adding JSON to MongoDB Using Java'/><author><name>Abhijit Bashetti</name><uri>http://www.blogger.com/profile/02494128996998150172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUkzTfb2FQaDNMYEccAavR7aylIC_4UBvAhEtPQTesV-IzTwNr0rtF16MQgDIIcQMg4MpzYOQ3gHrFZPLOwyWxqUk1aQA1VxGFjYr5UMOYCRmdgKbeC_v6kJKxY2Fdf_o/s220/IMG_2027.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8592878860404675342.post-3384886575451826285</id><published>2013-12-16T03:24:00.001-08:00</published><updated>2013-12-16T03:24:20.441-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="array data in mongoDB"/><category scheme="http://www.blogger.com/atom/ns#" term="update the array data in mongoDB."/><title type='text'>How to read the array data in mongoDB, modify the array data and update the same in mongoDB.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
How to read the arrat data in mongoDB, modify the array data and update the same in mongoDB.&lt;br /&gt;
&lt;br /&gt;
public static void mongoArrayExample(){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;DBCursor cursor = null;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;MongoClient mongoClient = null;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;mongoClient = new MongoClient(&quot;localhost&quot;, 27017);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;DB db = mongoClient.getDB(&quot;school&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;DBCollection students = db.getCollection(&quot;students&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;BasicDBObject whereQuery = new BasicDBObject();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;whereQuery.put(&quot;_id&quot; , 0);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;cursor = students.find(whereQuery);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Map&amp;lt;String,&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Double&amp;gt; map = new HashMap&amp;lt;String, Double&amp;gt;();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;while (cursor.hasNext()){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt; BasicDBObject result = (BasicDBObject) cursor.next();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt; BasicDBList &amp;nbsp;scores = (BasicDBList) result.get(&quot;scores&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt; // Reading the data from Array.&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for(int j = 0; j&amp;lt; scores.size(); j++)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; // Reading the individual records&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String type = (String) ((BSONObject) scores.get(j)).get(&quot;type&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Double score = (Double) ((BSONObject) scores.get(j)).get(&quot;score&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(map.containsKey(&quot;homework&quot;)){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; map.put(type, score);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt; List&amp;lt;BasicDBObject&amp;gt; scores = new ArrayList&amp;lt;BasicDBObject&amp;gt;();&lt;br /&gt;
&amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt; Set&amp;lt;String&amp;gt; str = map.keySet();&lt;br /&gt;
&amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt; for (String string : str) {&lt;br /&gt;
&amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;BasicDBObject obje = new BasicDBObject();&lt;br /&gt;
&amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;obje.put(&quot;type&quot;, string);&lt;br /&gt;
&amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;obje.put(&quot;score&quot;, map.get(string));&lt;br /&gt;
&amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;scores.add(obje);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;// Modifying the array&lt;br /&gt;
&amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;BasicDBObject updateQuery = new BasicDBObject();&lt;br /&gt;
&amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;updateQuery.append(&quot;$set&quot;, new BasicDBObject().append(&quot;scores&quot;, scores));&lt;br /&gt;
&amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;students.update(whereQuery, updateQuery);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}catch (Exception e) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://abhijitbashetti.blogspot.com/feeds/3384886575451826285/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://abhijitbashetti.blogspot.com/2013/12/how-to-read-array-data-in-mongodb.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/3384886575451826285'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8592878860404675342/posts/default/3384886575451826285'/><link rel='alternate' type='text/html' href='http://abhijitbashetti.blogspot.com/2013/12/how-to-read-array-data-in-mongodb.html' title='How to read the array data in mongoDB, modify the array data and update the same in mongoDB.'/><author><name>Abhijit Bashetti</name><uri>http://www.blogger.com/profile/02494128996998150172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUkzTfb2FQaDNMYEccAavR7aylIC_4UBvAhEtPQTesV-IzTwNr0rtF16MQgDIIcQMg4MpzYOQ3gHrFZPLOwyWxqUk1aQA1VxGFjYr5UMOYCRmdgKbeC_v6kJKxY2Fdf_o/s220/IMG_2027.jpg'/></author><thr:total>0</thr:total></entry></feed>