com.stratelia.silverpeas.portlet
Class SpaceModelFactory

java.lang.Object
  extended by com.stratelia.silverpeas.portlet.SpaceModelFactory

public class SpaceModelFactory
extends Object

The SpaceModelFactory is a class used for its statics methods. its construct and maintain the SpaceModel hierarchie in memory. It implement the persistance for the SpaceModel class, ie : it provide read and save methods from/to a database. It can read/save the user specific state for the portlets (min, max or normal) either.


Field Summary
protected static Map<String,WAComponent> compoDescriptors
           
protected static OrganisationController oc
           
 
Method Summary
static Portlet getPortlet(int aInstanceId)
          getPortlet Read an instance from database and contruct a Portlet in memory
static PortletComponent[] getPortletList(SpaceModel space)
          getPortletList Construct the list of portlet that can be added to a space : All instances that are not allready added the this space minus instance that are not "portlettizable" yet.
static SpaceModel getSpaceModel(MainSessionController msc, String aSpaceId, boolean isAdmin)
          get a spaceModel and remove the component that are not allowed for this user
static SpaceModel getSpaceModel(PortletSchema os, String aSpaceId)
          Read a spaceModel from database and construct a SpaceModel in memory
static boolean portletAvailable(MainSessionController mainSessionCtrl, String spaceId)
          Compute if there is any portlets avaible for this user in this space
static void portletSaveState(SpaceModel space, Portlet aPortlet)
          portletSaveState Save the portlet state : minimized, normal or maximized
static void saveSpaceModel(SpaceModel space)
          saveSpaceModel Save all the spaceModel structure in database. the save in done by deleting and recreating the structure.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

oc

protected static final OrganisationController oc

compoDescriptors

protected static final Map<String,WAComponent> compoDescriptors
Method Detail

getSpaceModel

public static SpaceModel getSpaceModel(PortletSchema os,
                                       String aSpaceId)
                                throws PortletException
Read a spaceModel from database and construct a SpaceModel in memory

Parameters:
os -
aSpaceId - the space database Id
Returns:
a spaceModel
Throws:
PortletException

getSpaceModel

public static SpaceModel getSpaceModel(MainSessionController msc,
                                       String aSpaceId,
                                       boolean isAdmin)
                                throws PortletException
get a spaceModel and remove the component that are not allowed for this user

Parameters:
msc - parameter for getSpaceModel
aSpaceId - the required space Id
isAdmin - true if the user is editing the spaceModel. in this case, the unallowed portlets are not remove from the spaceModel.
Returns:
the returned SpaceModel
Throws:
PortletException - -

portletSaveState

public static void portletSaveState(SpaceModel space,
                                    Portlet aPortlet)
                             throws PortletException
portletSaveState Save the portlet state : minimized, normal or maximized

Parameters:
aSpaceId - parameter for portletSaveState
aPortlet - the portlet to save the state
Throws:
PortletException - -

getPortlet

public static Portlet getPortlet(int aInstanceId)
                          throws PortletException
getPortlet Read an instance from database and contruct a Portlet in memory

Parameters:
aInstanceId - parameter for getPortlet
Returns:
the returned Portlet
Throws:
PortletException - -

getPortletList

public static PortletComponent[] getPortletList(SpaceModel space)
getPortletList Construct the list of portlet that can be added to a space : All instances that are not allready added the this space minus instance that are not "portlettizable" yet.

Parameters:
space - parameter for getPortletList
Returns:
the returned ComponentInstanceRow[]

saveSpaceModel

public static void saveSpaceModel(SpaceModel space)
                           throws PortletException
saveSpaceModel Save all the spaceModel structure in database. the save in done by deleting and recreating the structure.

Parameters:
space - parameter for saveSpaceModel
Throws:
PortletException - -

portletAvailable

public static boolean portletAvailable(MainSessionController mainSessionCtrl,
                                       String spaceId)
Compute if there is any portlets avaible for this user in this space

Parameters:
mainSessionCtrl -
spaceId -
Returns:
true if there is at leat one portlet avalaible for this user


Copyright © 2016 Silverpeas. All Rights Reserved.