Java tutorial
/** * Copyright (c) 2000-present Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ package com.liferay.blogs.web.internal.asset.display.contributor; import com.liferay.asset.display.contributor.AssetDisplayContributor; import com.liferay.asset.display.contributor.BaseAssetDisplayContributor; import com.liferay.blogs.model.BlogsEntry; import com.liferay.portal.kernel.language.LanguageUtil; import com.liferay.portal.kernel.util.AggregateResourceBundleLoader; import com.liferay.portal.kernel.util.ResourceBundleLoader; import com.liferay.portal.kernel.util.ResourceBundleLoaderUtil; import java.util.Locale; import java.util.ResourceBundle; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; /** * @author Jrgen Kappler */ @Component(immediate = true, service = AssetDisplayContributor.class) public class BlogsEntryAssetDisplayContributor extends BaseAssetDisplayContributor implements AssetDisplayContributor { @Override public String getClassName() { return BlogsEntry.class.getName(); } @Override public String getLabel(Locale locale) { ResourceBundle resourceBundle = resourceBundleLoader.loadResourceBundle(locale); return LanguageUtil.get(resourceBundle, "model.resource.com.liferay.blogs.model.BlogsEntry"); } @Override protected String[] getAssetEntryModelFields() { return new String[] { "title", "subtitle", "content" }; } @Reference(target = "(bundle.symbolic.name=com.liferay.blogs.web)", unbind = "-") protected void setResourceBundleLoader(ResourceBundleLoader resourceBundleLoader) { this.resourceBundleLoader = new AggregateResourceBundleLoader(resourceBundleLoader, ResourceBundleLoaderUtil.getPortalResourceBundleLoader()); } }