public void updatePortletApplication(PortletApplication app) throws RegistryException { getPersistenceBrokerTemplate().store(app); }
public void removeApplication(PortletApplication app) throws RegistryException { getPersistenceBrokerTemplate().delete(app); this.preferenceService.removeDefaults(app); }
public void savePortletDefinition( PortletDefinition portlet ) throws FailedToStorePortletDefinitionException { try { getPersistenceBrokerTemplate().store(portlet); portlet.storeChildren(); } catch (DataAccessException e) { throw new FailedToStorePortletDefinitionException(portlet, e); } }
public void registerPortletApplication(PortletApplication newApp) throws RegistryException { getPersistenceBrokerTemplate().store(newApp); this.preferenceService.storeDefaults(newApp); this.restoreClones(newApp); }
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); }
@SuppressWarnings("unchecked") public Collection<PortletApplication> getPortletApplications() { Criteria c = new Criteria(); Collection<PortletApplication> list = getPersistenceBrokerTemplate().getCollectionByQuery( QueryFactory.newQuery(PortletApplicationDefinitionImpl.class, c)); postLoadColl(list); return list; }
@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 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); }
@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; }
@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; }
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 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; }
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; }