public void registerPortletApplication(PortletApplication newApp) throws RegistryException { getPersistenceBrokerTemplate().store(newApp); this.preferenceService.storeDefaults(newApp); this.restoreClones(newApp); }
public boolean portletApplicationExists( String name ) { return getPortletApplication(name, true) != null; }
public PortletDefinition getPortletDefinitionByUniqueName( String name ) { return getPortletDefinitionByUniqueName(name, false); }
@SuppressWarnings("unchecked") public Collection<PortletDefinition> getAllDefinitions() { Criteria c = new Criteria(); Collection<PortletDefinition> list = getPersistenceBrokerTemplate().getCollectionByQuery( QueryFactory.newQuery(PortletDefinitionImpl.class, c)); postLoadColl(list); return list; }
public void removeClone(PortletDefinition clone) throws RegistryException { if (!clone.isClone()) { throw new IllegalArgumentException("The portlet is not a cloned one: " + clone.getUniqueName()); } PortletApplication pa = clone.getApplication(); getPersistenceBrokerTemplate().delete(clone); pa.getClones().remove(clone); this.updatePortletApplication(pa); }
public PortletDefinition clonePortletDefinition(PortletDefinition source, String newPortletName) throws FailedToStorePortletDefinitionException if (this.portletDefinitionExists(newPortletName, source.getApplication())) updatePortletApplication(destApp); throw new FailedToStorePortletDefinitionException(e); PortletDefinition pd = getPortletDefinitionByUniqueName(PortletRegistryHelper.makeUniqueName(source.getApplication().getName(), newPortletName)); PortletApplication pa = pd.getApplication();
public PortletApplication getPortletApplication(String name, boolean fromCache) { if (fromCache) { CacheElement cacheElement = applicationNameCache.get(name); if (cacheElement != null) { cacheElement = applicationOidCache.get(((RegistryCacheObjectWrapper)cacheElement.getContent()).getId()); if (cacheElement != null) { return (PortletApplication)cacheElement.getContent(); } } } Criteria c = new Criteria(); c.addEqualTo("name", name); PortletApplication app = (PortletApplication) getPersistenceBrokerTemplate().getObjectByQuery( QueryFactory.newQuery(PortletApplicationDefinitionImpl.class, c)); postLoad(app); return app; }
if (listeners != null && !listeners.isEmpty()) PortletDefinition pd = this.getPortletDefinitionByUniqueName((String)key); if (pd != null) if (listeners != null && !listeners.isEmpty()) PortletApplication pa = this.getPortletApplication((String)key); if (pa != null)
public void updatePortletApplication(PortletApplication app) throws RegistryException { getPersistenceBrokerTemplate().store(app); }
@SuppressWarnings("unchecked") public Collection<PortletApplication> getPortletApplications() { Criteria c = new Criteria(); Collection<PortletApplication> list = getPersistenceBrokerTemplate().getCollectionByQuery( QueryFactory.newQuery(PortletApplicationDefinitionImpl.class, c)); postLoadColl(list); return list; }
public void removeAllClones(PortletApplication pa) throws RegistryException { Criteria c = new Criteria(); c.addEqualTo("cloneParent", pa.getName()); getPersistenceBrokerTemplate().deleteByQuery(QueryFactory.newQuery(PortletDefinitionImpl.class, c)); pa.getClones().clear(); this.updatePortletApplication(pa); }
public PortletDefinition getPortletDefinitionByUniqueName( String name, boolean fromCache ) { if (fromCache) { CacheElement cacheElement = portletNameCache.get(name); if (cacheElement != null) { cacheElement = portletOidCache.get(((RegistryCacheObjectWrapper)cacheElement.getContent()).getId()); if (cacheElement != null) { return (PortletDefinition)cacheElement.getContent(); } } } String appName = PortletRegistryHelper.parseAppName(name); String portletName = PortletRegistryHelper.parsePortletName(name); Criteria c = new Criteria(); c.addEqualTo("app.name", appName); c.addEqualTo("portletName", portletName); PortletDefinition def = (PortletDefinition) getPersistenceBrokerTemplate().getObjectByQuery( QueryFactory.newQuery(PortletDefinitionImpl.class, c)); if (def != null && def.getApplication() == null) { final String msg = "getPortletDefinitionByIdentifier() returned a PortletDefinition that has no parent PortletApplication."; throw new IllegalStateException(msg); } postLoad(def); return def; }
public void removeApplication(PortletApplication app) throws RegistryException { getPersistenceBrokerTemplate().delete(app); this.preferenceService.removeDefaults(app); }
@SuppressWarnings("unchecked") public Collection<PortletDefinition> getAllPortletDefinitions() { Criteria c = new Criteria(); c.addIsNull("cloneParent"); Collection<PortletDefinition> list = getPersistenceBrokerTemplate().getCollectionByQuery( QueryFactory.newQuery(PortletDefinitionImpl.class, c)); postLoadColl(list); return list; }
public int restoreClones(PortletApplication pa) throws RegistryException { int count = 0; Criteria criteria = new Criteria(); criteria.addEqualTo("cloneParent", pa.getName()); Collection<PortletDefinitionImpl> clones = getPersistenceBrokerTemplate().getCollectionByQuery( QueryFactory.newQuery(PortletDefinitionImpl.class, criteria)); for (PortletDefinitionImpl pd : clones) { if (pd.isClone()) { if (pa.getName().equals(pd.getCloneParent())) { // Restore Clone pd.setApplication(pa); pa.getClones().add(pd); count++; } } } if (count > 0) { updatePortletApplication(pa); } return count; }
public void savePortletDefinition( PortletDefinition portlet ) throws FailedToStorePortletDefinitionException { try { getPersistenceBrokerTemplate().store(portlet); portlet.storeChildren(); } catch (DataAccessException e) { throw new FailedToStorePortletDefinitionException(portlet, e); } }
public boolean portletDefinitionExists( String portletName, PortletApplication app ) { return getPortletDefinitionByUniqueName(app.getName() + "::" + portletName) != null; }
public PortletApplication getPortletApplication(String name) { return getPortletApplication(name, false); }
@SuppressWarnings("unchecked") public Collection<PortletDefinition> getAllCloneDefinitions() { Criteria c = new Criteria(); c.addNotNull("cloneParent"); Collection<PortletDefinition> list = getPersistenceBrokerTemplate().getCollectionByQuery( QueryFactory.newQuery(PortletDefinitionImpl.class, c)); postLoadColl(list); return list; }