{"id":324,"date":"2013-11-04T10:00:00","date_gmt":"2013-11-04T07:00:00","guid":{"rendered":"http:\/\/www.coding-dude.com\/wp\/?p=324"},"modified":"2018-11-12T12:15:26","modified_gmt":"2018-11-12T09:15:26","slug":"liferay-beanshell-scripts-sharded-environments","status":"publish","type":"post","link":"https:\/\/www.coding-dude.com\/wp\/liferay\/liferay-beanshell-scripts-sharded-environments\/","title":{"rendered":"Liferay Beanshell Scripts for Sharded Environments"},"content":{"rendered":"<div class=\"9db0862b9cf2e44f8d962262c5a80491\" data-index=\"1\" style=\"float: none; margin:10px 0 10px 0; text-align:center;\">\n<script type=\"text\/javascript\"><!--\r\ngoogle_ad_client = \"ca-pub-3421619882899259\";\r\n\/* Coding Dude Medium Banner *\/\r\ngoogle_ad_slot = \"2969896483\";\r\ngoogle_ad_width = 468;\r\ngoogle_ad_height = 60;\r\n\/\/-->\r\n<\/script>\r\n<script type=\"text\/javascript\"\r\nsrc=\"\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\r\n<\/script>\n<\/div>\n<p>Liferay Beanshell scripts are a quick way of handling Liferay portal administration tasks that otherwise would take a very long time to do manually.<br \/>\n<!--more--><\/p>\n<h1>Liferay Beanshell Scripts<\/h1>\n<p>Every Liferay administrator, having worked enough with the Liferay Portal, came across the situation in which various batch operations are required. For example, if you need to add one user, then you can use the Control Panel &gt; Users &gt; Add new. But what if you need to add 100 users? Doing the same operation manually 100 times is not that fun. Therefore you need liferay scripts.<\/p>\n<p>The solution: <strong>Liferay server scripts<\/strong>. Liferay supports several scripting languages:<\/p>\n<ol>\n<li>Beanshell<\/li>\n<li>Javascript<\/li>\n<li>Groovy<\/li>\n<li>Python<\/li>\n<li>Ruby<\/li>\n<\/ol>\n<p>In this article (and in the following articles of this series if I&#8217;ll receive positive feedback on this) I will be using Beanshell.<\/p>\n<p>Beanshell is very similar to Java in syntax, only that it is more loosely typed. For more information on Beanshell visit\u00a0<a title=\"beanshell.org\" href=\"\/\/www.beanshell.org\/intro.html\" target=\"_blank\" rel=\"noopener\">beanshell.org\/intro.html<\/a><\/p>\n<h1>How Liferay server scripts work?<\/h1>\n<p>Liferay server scripts get passed to the server, the server compiles them on the spot and then runs them in the context of the server. In these scripts you will have runtime access to the Liferay API, so operations like adding or removing users are quite easy to do.<\/p>\n<h1>Liferay instances and sharded configuration<\/h1>\n<p>Liferay usually manages multiple instances. If you have multiple clients hosted on your installation then you probably set up a new instance for each client. Also, Liferay can be configured for using multiple shards. That means that it can separate the data for each instance (client) on a different database. If you would like to find out more about how you can configure a multi sharded environment see my post\u00a0<a title=\"Liferay Saas solution \u2013 handling multi-tenancy\" href=\"\/\/www.coding-dude.com\/wp\/java\/liferay\/liferay-saas-multi-tenancy\/\">Liferay Saas solution \u2013 handling multi-tenancy<\/a>.<\/p>\n<p>Server side scripts can be run in the Liferay portal <strong>only in the default instance<\/strong> under\u00a0<strong style=\"font-size: 14px;\">Control Panel &gt; Server Administration &gt; Script<\/strong><span style=\"font-size: 14px;\"> section. Having instances configured to run in different database shards has a big impact on how you have to write your server side scripts. All scripts you run have to start with properly selecting the shard in which you want to do the operations.<\/span><\/p>\n<p>Also, when writing server side scripts you have to have some knowledge regarding how Liferay stores its data in order to properly access it.<\/p>\n<p>To give you an example: in a sharded environment information about all the instances (like the name of the virtual hosts) is stored in the\u00a0<em>company_<\/em> table <strong>ONLY<\/strong> in the default database shard. User information however is stored in the\u00a0<em>user_<\/em>\u00a0table on each database shard.<\/p>\n<p>So, when using the Liferay portal API in scripts you will have to be careful to access the right data in the right place.<\/p>\n<h1>Beanshell script basics<\/h1>\n<p>To keep things organize my approach to writing Liferay Beanshell scripts is to create 4 sections in the script:<\/p>\n<ol>\n<li>imports section &#8211; where I list all libraries required in the script<\/li>\n<li>initialization area &#8211; where I initialize constants and variables<\/li>\n<li>function area &#8211; where I define Beanshell functions that I will use<\/li>\n<li>the main are &#8211; where I write the actual operations that need to be performed<\/li>\n<\/ol>\n<p>In the end the script will look something like:<\/p>\n<pre class=\"prettyprint lang-java\"><code>\/*import section*\/\r\nimport com.liferay.portal.*;                                             \r\nimport com.liferay.portal.model.*;\r\nimport com.liferay.portal.service.*; \r\nimport com.liferay.portal.kernel.dao.orm.*;\r\nimport com.liferay.portlet.documentlibrary.model.*;\r\nimport com.liferay.portlet.documentlibrary.service.*;\r\nimport com.liferay.portal.model.PortletConstants;\r\nimport com.liferay.portal.security.auth.*;\r\nimport com.liferay.portal.security.permission.*;\r\nimport com.liferay.portal.service.*;\r\nimport com.liferay.portal.kernel.dao.shard.*;\r\n\r\n\/*initialization section*\/\r\nString portletResource=\"20\";\r\nString selResource = DLFolder.class.getName();\r\n\r\n\/*function section*\/\r\nlong getCompanyIdByShardName(String shardName){\r\n...\r\n}\r\n\r\n\/*main section*\/\r\n\/\/actual code here\r\n....\r\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n<h1>Beanshell script for working with a certain shard<\/h1>\n<p>As I mentioned earlier, when running a Liferay script in a sharded environment you need to first select the right shard where you want to do the operations. Usually you will only know the internal name of the shard (because this is usually configured by the administrator). Starting with this shard name, you find the id of the instance (companyId) and use that to select the right shard with the use of the\u00a0<strong>ShardUtil<\/strong> class.<\/p>\n<p>It is important to know that the\u00a0<strong>ShardUtil<\/strong> class and all shard related operations are very sensitive and extensive care needs to be taken when working with them because selecting a shard works with an internal stack, and after use, if this stack is not restored at the initial state the portal will not function properly anymore.<\/p>\n<p>This is why you should\u00a0<strong>ALWAYS USE TRY \/ FINALLY BLOCKS\u00a0<\/strong>when working in a sharded configuration. As an example, here&#8217;s the code for getting the name of a user for which you know the password:<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"prettyprint lang-java\"><code>\/*import section*\/\r\nimport com.liferay.portal.*;                                             \r\nimport com.liferay.portal.model.*;\r\nimport com.liferay.portal.service.*; \r\nimport com.liferay.portal.kernel.dao.orm.*;\r\nimport com.liferay.portlet.documentlibrary.model.*;\r\nimport com.liferay.portlet.documentlibrary.service.*;\r\nimport com.liferay.portal.model.PortletConstants;\r\nimport com.liferay.portal.security.auth.*;\r\nimport com.liferay.portal.security.permission.*;\r\nimport com.liferay.portal.service.*;\r\nimport com.liferay.portal.kernel.dao.shard.*;\r\n\r\n\/*initialization section*\/\r\nString shardName=\"c1\";\r\nString userEmail=\"admin@coding-dude.com\";\r\n\r\n\/*function section*\/\r\nlong getCompanyIdByShardName(String shardName){\r\n\t\/\/get list of all shards\r\n\t\/\/shard information is stored only in the default shard \r\n\t\/\/so no shard selection is necessary\r\n\tList allShards = ShardLocalServiceUtil.getShards(QueryUtil.ALL_POS, QueryUtil.ALL_POS);\r\n\tlong result = 0;\r\n\tif (allShards!=null){\r\n\t\tfor (i=0;i&lt;allShards.size();i++){\r\n\t\t\tif (allShards.get(i).getName().equals(shardName)){\r\n\t\t\t\treturn allShards.get(i).getClassPK();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn result;\r\n}\r\n\r\nUser getUser(long companyId,String email){\r\n\tUser user = null;\r\n\ttry{\r\n\t\t\/\/select the shard\r\n\t\tShardUtil.pushCompanyService(companyId);\r\n\t\tuser = UserLocalServiceUtil.getUserByEmailAddress(companyId,email);\r\n\t}\r\n\tfinally {\r\n\t\t\/\/unselect the shard\r\n\t\tShardUtil.popCompanyService();\r\n\t}\r\n\treturn user;\r\n}\r\n\r\n\/*main section*\/\r\nlong companyId = getCompanyIdByShardName(shardName);\r\nUser user = getUser(companyId,email);\r\nif (user == null){\r\n\tSystem.out.println(\"User \"+email+\" not found\");\r\n}else{\r\n\tSystem.out.println(\"User found: \"+user.getFullName());\r\n}\r\n<\/code><\/pre>\n<p>I hope you enjoyed this post and please send me any remarks or questions you have related to it. I plan on creating more posts in which to describe all sorts of Liferay scripts that I often use to manage the Liferay servers I work with. I will post these scripts under the tag\u00a0<a title=\"liferay scripts\" href=\"\/\/www.coding-dude.com\/wp\/tag\/liferay-script\/\">liferay script<\/a> to allow you easier access.<\/p>\n<!--CusAds0-->\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>Liferay Beanshell scripts are a quick way of handling Liferay portal administration tasks that otherwise would take a very long time to do manually.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[253],"tags":[293,11,24],"class_list":["post-324","post","type-post","status-publish","format-standard","hentry","category-liferay","tag-6-0-x","tag-liferay-2","tag-liferay-script"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Liferay Beanshell Scripts for Sharded Environments - Coding Dude<\/title>\n<meta name=\"description\" content=\"Liferay Beanshell scripts are a quick way of handling Liferay portal administration tasks that otherwise would take a very long time to do manually.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.coding-dude.com\/wp\/liferay\/liferay-beanshell-scripts-sharded-environments\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Liferay Beanshell Scripts for Sharded Environments - Coding Dude\" \/>\n<meta property=\"og:description\" content=\"Liferay Beanshell scripts are a quick way of handling Liferay portal administration tasks that otherwise would take a very long time to do manually.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.coding-dude.com\/wp\/liferay\/liferay-beanshell-scripts-sharded-environments\/\" \/>\n<meta property=\"og:site_name\" content=\"Coding Dude\" \/>\n<meta property=\"article:published_time\" content=\"2013-11-04T07:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-11-12T09:15:26+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.coding-dude.com\/wp\/wp-content\/uploads\/2023\/05\/coding-dude.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1792\" \/>\n\t<meta property=\"og:image:height\" content=\"1024\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"John Negoita\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@codingdudecom\" \/>\n<meta name=\"twitter:site\" content=\"@codingdudecom\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"John Negoita\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.coding-dude.com\\\/wp\\\/liferay\\\/liferay-beanshell-scripts-sharded-environments\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.coding-dude.com\\\/wp\\\/liferay\\\/liferay-beanshell-scripts-sharded-environments\\\/\"},\"author\":{\"name\":\"John Negoita\",\"@id\":\"https:\\\/\\\/www.coding-dude.com\\\/wp\\\/#\\\/schema\\\/person\\\/29b7100b9ec7bb332359bd9fcba98370\"},\"headline\":\"Liferay Beanshell Scripts for Sharded Environments\",\"datePublished\":\"2013-11-04T07:00:00+00:00\",\"dateModified\":\"2018-11-12T09:15:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.coding-dude.com\\\/wp\\\/liferay\\\/liferay-beanshell-scripts-sharded-environments\\\/\"},\"wordCount\":772,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/www.coding-dude.com\\\/wp\\\/#organization\"},\"keywords\":[\"6.0.x\",\"liferay\",\"liferay script\"],\"articleSection\":[\"Liferay\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.coding-dude.com\\\/wp\\\/liferay\\\/liferay-beanshell-scripts-sharded-environments\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.coding-dude.com\\\/wp\\\/liferay\\\/liferay-beanshell-scripts-sharded-environments\\\/\",\"url\":\"https:\\\/\\\/www.coding-dude.com\\\/wp\\\/liferay\\\/liferay-beanshell-scripts-sharded-environments\\\/\",\"name\":\"Liferay Beanshell Scripts for Sharded Environments - Coding Dude\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.coding-dude.com\\\/wp\\\/#website\"},\"datePublished\":\"2013-11-04T07:00:00+00:00\",\"dateModified\":\"2018-11-12T09:15:26+00:00\",\"description\":\"Liferay Beanshell scripts are a quick way of handling Liferay portal administration tasks that otherwise would take a very long time to do manually.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.coding-dude.com\\\/wp\\\/liferay\\\/liferay-beanshell-scripts-sharded-environments\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.coding-dude.com\\\/wp\\\/liferay\\\/liferay-beanshell-scripts-sharded-environments\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.coding-dude.com\\\/wp\\\/liferay\\\/liferay-beanshell-scripts-sharded-environments\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.coding-dude.com\\\/wp\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Liferay Beanshell Scripts for Sharded Environments\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.coding-dude.com\\\/wp\\\/#website\",\"url\":\"https:\\\/\\\/www.coding-dude.com\\\/wp\\\/\",\"name\":\"Coding Dude\",\"description\":\"Coding tutorials, tips and tricks\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.coding-dude.com\\\/wp\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.coding-dude.com\\\/wp\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.coding-dude.com\\\/wp\\\/#organization\",\"name\":\"Coding Dude\",\"url\":\"https:\\\/\\\/www.coding-dude.com\\\/wp\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.coding-dude.com\\\/wp\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.coding-dude.com\\\/wp\\\/wp-content\\\/uploads\\\/2018\\\/05\\\/codingdude-logo-wide.jpg\",\"contentUrl\":\"https:\\\/\\\/www.coding-dude.com\\\/wp\\\/wp-content\\\/uploads\\\/2018\\\/05\\\/codingdude-logo-wide.jpg\",\"width\":226,\"height\":60,\"caption\":\"Coding Dude\"},\"image\":{\"@id\":\"https:\\\/\\\/www.coding-dude.com\\\/wp\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/codingdudecom\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.coding-dude.com\\\/wp\\\/#\\\/schema\\\/person\\\/29b7100b9ec7bb332359bd9fcba98370\",\"name\":\"John Negoita\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d51d5d54d4c51f0a7bfe39333bd98cfc5245ab49433be692fce26b741c08181e?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d51d5d54d4c51f0a7bfe39333bd98cfc5245ab49433be692fce26b741c08181e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d51d5d54d4c51f0a7bfe39333bd98cfc5245ab49433be692fce26b741c08181e?s=96&d=mm&r=g\",\"caption\":\"John Negoita\"},\"description\":\"I'm a Java programmer, been into programming since 1999 and having tons of fun with it.\",\"sameAs\":[\"http:\\\/\\\/www.coding-dude.com\",\"https:\\\/\\\/x.com\\\/codingdudecom\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Liferay Beanshell Scripts for Sharded Environments - Coding Dude","description":"Liferay Beanshell scripts are a quick way of handling Liferay portal administration tasks that otherwise would take a very long time to do manually.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.coding-dude.com\/wp\/liferay\/liferay-beanshell-scripts-sharded-environments\/","og_locale":"en_US","og_type":"article","og_title":"Liferay Beanshell Scripts for Sharded Environments - Coding Dude","og_description":"Liferay Beanshell scripts are a quick way of handling Liferay portal administration tasks that otherwise would take a very long time to do manually.","og_url":"https:\/\/www.coding-dude.com\/wp\/liferay\/liferay-beanshell-scripts-sharded-environments\/","og_site_name":"Coding Dude","article_published_time":"2013-11-04T07:00:00+00:00","article_modified_time":"2018-11-12T09:15:26+00:00","og_image":[{"width":1792,"height":1024,"url":"https:\/\/www.coding-dude.com\/wp\/wp-content\/uploads\/2023\/05\/coding-dude.jpg","type":"image\/jpeg"}],"author":"John Negoita","twitter_card":"summary_large_image","twitter_creator":"@codingdudecom","twitter_site":"@codingdudecom","twitter_misc":{"Written by":"John Negoita","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.coding-dude.com\/wp\/liferay\/liferay-beanshell-scripts-sharded-environments\/#article","isPartOf":{"@id":"https:\/\/www.coding-dude.com\/wp\/liferay\/liferay-beanshell-scripts-sharded-environments\/"},"author":{"name":"John Negoita","@id":"https:\/\/www.coding-dude.com\/wp\/#\/schema\/person\/29b7100b9ec7bb332359bd9fcba98370"},"headline":"Liferay Beanshell Scripts for Sharded Environments","datePublished":"2013-11-04T07:00:00+00:00","dateModified":"2018-11-12T09:15:26+00:00","mainEntityOfPage":{"@id":"https:\/\/www.coding-dude.com\/wp\/liferay\/liferay-beanshell-scripts-sharded-environments\/"},"wordCount":772,"commentCount":2,"publisher":{"@id":"https:\/\/www.coding-dude.com\/wp\/#organization"},"keywords":["6.0.x","liferay","liferay script"],"articleSection":["Liferay"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.coding-dude.com\/wp\/liferay\/liferay-beanshell-scripts-sharded-environments\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.coding-dude.com\/wp\/liferay\/liferay-beanshell-scripts-sharded-environments\/","url":"https:\/\/www.coding-dude.com\/wp\/liferay\/liferay-beanshell-scripts-sharded-environments\/","name":"Liferay Beanshell Scripts for Sharded Environments - Coding Dude","isPartOf":{"@id":"https:\/\/www.coding-dude.com\/wp\/#website"},"datePublished":"2013-11-04T07:00:00+00:00","dateModified":"2018-11-12T09:15:26+00:00","description":"Liferay Beanshell scripts are a quick way of handling Liferay portal administration tasks that otherwise would take a very long time to do manually.","breadcrumb":{"@id":"https:\/\/www.coding-dude.com\/wp\/liferay\/liferay-beanshell-scripts-sharded-environments\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.coding-dude.com\/wp\/liferay\/liferay-beanshell-scripts-sharded-environments\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.coding-dude.com\/wp\/liferay\/liferay-beanshell-scripts-sharded-environments\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.coding-dude.com\/wp\/"},{"@type":"ListItem","position":2,"name":"Liferay Beanshell Scripts for Sharded Environments"}]},{"@type":"WebSite","@id":"https:\/\/www.coding-dude.com\/wp\/#website","url":"https:\/\/www.coding-dude.com\/wp\/","name":"Coding Dude","description":"Coding tutorials, tips and tricks","publisher":{"@id":"https:\/\/www.coding-dude.com\/wp\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.coding-dude.com\/wp\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.coding-dude.com\/wp\/#organization","name":"Coding Dude","url":"https:\/\/www.coding-dude.com\/wp\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.coding-dude.com\/wp\/#\/schema\/logo\/image\/","url":"https:\/\/www.coding-dude.com\/wp\/wp-content\/uploads\/2018\/05\/codingdude-logo-wide.jpg","contentUrl":"https:\/\/www.coding-dude.com\/wp\/wp-content\/uploads\/2018\/05\/codingdude-logo-wide.jpg","width":226,"height":60,"caption":"Coding Dude"},"image":{"@id":"https:\/\/www.coding-dude.com\/wp\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/codingdudecom"]},{"@type":"Person","@id":"https:\/\/www.coding-dude.com\/wp\/#\/schema\/person\/29b7100b9ec7bb332359bd9fcba98370","name":"John Negoita","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/d51d5d54d4c51f0a7bfe39333bd98cfc5245ab49433be692fce26b741c08181e?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/d51d5d54d4c51f0a7bfe39333bd98cfc5245ab49433be692fce26b741c08181e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d51d5d54d4c51f0a7bfe39333bd98cfc5245ab49433be692fce26b741c08181e?s=96&d=mm&r=g","caption":"John Negoita"},"description":"I'm a Java programmer, been into programming since 1999 and having tons of fun with it.","sameAs":["http:\/\/www.coding-dude.com","https:\/\/x.com\/codingdudecom"]}]}},"jetpack_featured_media_url":"","amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.coding-dude.com\/wp\/wp-json\/wp\/v2\/posts\/324","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.coding-dude.com\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.coding-dude.com\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.coding-dude.com\/wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.coding-dude.com\/wp\/wp-json\/wp\/v2\/comments?post=324"}],"version-history":[{"count":13,"href":"https:\/\/www.coding-dude.com\/wp\/wp-json\/wp\/v2\/posts\/324\/revisions"}],"predecessor-version":[{"id":3048,"href":"https:\/\/www.coding-dude.com\/wp\/wp-json\/wp\/v2\/posts\/324\/revisions\/3048"}],"wp:attachment":[{"href":"https:\/\/www.coding-dude.com\/wp\/wp-json\/wp\/v2\/media?parent=324"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.coding-dude.com\/wp\/wp-json\/wp\/v2\/categories?post=324"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.coding-dude.com\/wp\/wp-json\/wp\/v2\/tags?post=324"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}