Posts

Showing posts from April, 2019

Comparator

As for sorting Collection, it is more efficient to implement either comparator or comparable and put all the compare method in one place. Collections . sort ( criticalAndImportantUpdates , new CriticalAndImportantUpdatesComparator ( themeDisplay , contentStatusLocalService ). acknowledgedComparator ); Collections . sort ( criticalAndImportantUpdates , new CriticalAndImportantUpdatesComparator ( themeDisplay , contentStatusLocalService ). dateComparator ); ---------------------------------------------------------------------------------------------------------------------- public class CriticalAndImportantUpdatesComparator {      private ThemeDisplay themeDisplay ;      public CriticalAndImportantUpdatesComparator ( ThemeDisplay themeDisplay , ContentStatusLocalService contentStatusLocalService ) {          this . themeDisplay = themeDisplay ;          this . contentStatusLocalService = contentStatusLocalService ;     }           public Com

Getting viewURL of assetEntry (JournalArticle)

Image
* Prerequisite There should be a page where a asset publisher for assetentry is embedded like a placeholder. And then in DISPLAY PAGE setting of web content, choose ' Use a specific display page for the web content.' and select the page where the asset publisher is.

Simplest way to compare date using Liferay DateUtil

Image

Looping Tree Hierarchy - Can be applied to Categories and Folders

Image

Making class comparable to simplfy sorting

https://beginnersbook.com/2017/08/comparable-interface-in-java-with-example/
EVERY DAY IS A FRESH START. JUST MOVE FORWARD
Image
* Approach Devise a plan to efficiently manage organizational, ambiguity, and technical complexities. Last week of sprint : preparation for stakeholders meeting - 90% of defects should be refined prior to the demo Sprint planning : - speed up the estimation part along with POC - separate all compatibility issues from current stories. AND Babying your ego is not part of my work.

Getting URL of AssetPublisher

compileOnly group: "com.liferay", name: "com.liferay.asset.publisher.api", version: "1.0.1" assetPublisherHelper.getAssetViewURL(request, response, entry);
Image

Updating "Automation Module"

1. Create new package with the latest version name 2. Create new class extending UpgradeProcess under the package. 3. Update register method to add the new piece of upgrade. 4. Upgrade the version in bnd.bnd During development, it is good to throw exception at the end of the created class to avoid troublesome work (like dropping DB... to fix).

How to read field values from JournalArticle Model

Image
Field title and values are defined as content in JournalAritcleEntry, and field value can be extracted by xml and json parser.
Image
JournalArticle journalArticle = (JournalArticle) assetEntry.getAssetRenderer().getAssetObject(); Try to make exception specific and descriptive When using liferay tag for journal article, classPK is resourcePrimKey, but articleId as resourcePrimKey is the one stored in assetentry