* @param name
* @return
*/
public PortletDefinitionComposite getPortletDefinitionByUniqueName( String name )
{
PersistenceStore store = getPersistenceStore();
prepareTransaction(store);
String appName = PortletRegistryHelper.parseAppName(name);
String portletName = PortletRegistryHelper.parsePortletName(name);
// build filter
Filter filter = store.newFilter();
filter.addEqualTo("app.name", appName);
filter.addEqualTo("name", portletName);
Object query = store.newQuery(portletDefClass, filter);
PortletDefinitionComposite portlet = (PortletDefinitionComposite) store.getObjectByQuery(query);
if (portlet != null)
{
if (portlet.getPortletApplicationDefinition() == null)
{
filter = store.newFilter();
filter.addEqualTo("name", appName);
query = store.newQuery(portletAppClass, filter);
MutablePortletApplication app = (MutablePortletApplication) store.getObjectByQuery(query);
if (null == app)
{
final String msg = "getPortletDefinitionByUniqueName() returned a PortletDefinition that has no parent PortletApplication.";
log.error(msg);
throw new IllegalStateException(msg);