Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (C) 2009 eXo Platform SAS. This 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 software 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. You should have received a copy of the GNU Lesser General Public License along with this software; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 
 package org.gatein.mop.core.api.workspace;
 
 

Author(s):
Julien Viet
Version:
$Revision$
 
 @NodeMapping(name = "mop:workspace")
 public abstract class WorkspaceImpl extends WorkspaceObjectImpl implements WorkspaceWorkspaceCustomizationContext {
 
   public ObjectType<? extends WorkspacegetObjectType() {
     return .;
   }
 
   // Abstract **********************************************************************************************************
 
   @OneToOne
   @MappedBy("portalsites")
   public abstract PortalSiteContainer getPortalSites();
 
   @OneToOne
   @MappedBy("groupsites")
   public abstract GroupSiteContainer getGroupSites();
 
   @OneToOne
   @MappedBy("usersites")
   public abstract UserSiteContainer getUserSites();
 
   @OneToOne
   @MappedBy("sharedsites")
   public abstract UserSiteContainer getSharedSites();
 
   @OneToOne
   @MappedBy("customizations")
   public abstract CustomizationContainer getCustomizations();
 
   // CustomizationContextResolver implementation ***********************************************************************
 
   @FindById
   public abstract WorkspaceObject getObject(String objectId);
 
   @FindById
   public abstract CustomizationContext resolveContext(String contextId);
 
   // WorkspaceCustomizationContext implementation **********************************************************************
 
   public String getContextType() {
   }
 
   public String getContextId() {
     return getObjectId();
   }
 
   public boolean contains(CustomizationContext that) {
     return contains(thisthat);
   }
 
   public Customization<?> getCustomization(String name) {
     return getCustomizations().getCustomization(name);
   }
 
   public <S> Customization<S> customize(String nameContentType<S> contentTypeString contentId, S state) {
     return getCustomizations().customize(namecontentTypecontentIdstate);
   }
 
  public <S> Customization<S> customize(String nameCustomization<S> customization) {
    return getCustomizations().customize(namecustomization);
  }
  // Workspace implementation ******************************************************************************************
  @SuppressWarnings("unchecked")
  private <S extends SiteSiteContainer<S> getSiteContainer(ObjectType<S> siteType) {
    if (siteType == .) {
      return (SiteContainer<S>)getPortalSites();
    } else if (siteType == .) {
      return (SiteContainer<S>)getGroupSites();
    } else if (siteType == .) {
      return (SiteContainer<S>)getUserSites();
    } else if (siteType == .) {
      return (SiteContainer<S>)getSharedSites();
    } else {
      throw new UnsupportedOperationException();
    }
  }
  public <S extends Site> S getSite(ObjectType<S> siteTypeString siteName) {
    SiteContainer<S> sites = getSiteContainer(siteType);
    return sites.getSite(siteName);
  }
  public Collection<SitegetSites() {
    throw new UnsupportedOperationException();
  }
  public <S extends SiteCollection<S> getSites(ObjectType<S> siteType) {
    SiteContainer<S> sites = getSiteContainer(siteType);
    return sites.getAllSites();
  }
  public <S extends Site> S addSite(ObjectType<S> siteTypeString name) {
    SiteContainer<S> sites = getSiteContainer(siteType);
    return sites.addSite(name);
  }
  public <O extends WorkspaceObject> O getObject(ObjectType<O> typeString id) {
    WorkspaceObject object = getObject(id);
    if (object != null) {
      return type.cast(object);
    } else {
      return null;
    }
  }
  public Site getSharedSite() {
    return getSite(."default");
  }
New to GrepCode? Check out our FAQ X