Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.  See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Entity
(
    entityid


--------------------------------------
  Portlet Preference Lookup Algorithm
--------------------------------------

(a) Look for authenticated principal's PortletPreference for the given entity
if Found 
    Return PortletPreference
End if

(b) Look for PortletPreference for this entity window, not associated to a principal
if Found
    Return PortletPreference
End

(c) Look for default PortletPreference for the portlet
if Found
    Return default PortletPreference
End

Return Not Found


-----------------------------
  Model
-----------------------------

Page 1 has 

Portlet-1, entity id = 51
Portlet-2, entity id = 52
Portlet-3, entity id = 53
Portlet-1, entity id = 54

Username = David

RELATIONSHIPS

(a) Stored in PREF_NODE table with NODE_NAME = 
   for entity 51:  /user/David/portletprefs/51
              52:  /user/David/portletprefs/52
              53:  /user/David/portletprefs/53
              54:  /user/David/portletprefs/54

(b) Considering window 51, the pref doesn't exist for user David,
    Stored in PREF_NODE table with NODE_NAME = 
   for entity 51:  /System/Jetspeed/entities/51

(c) fallback to Portlet Registry


-----------------------------
  Associations
-----------------------------

TABLE ENTITY_WINDOW_ASSOC
(
    ENTITY_ID INTEGER REFERENCES ENTITY,
    WINDOW_ID INTEGER REFERENCES FRAGMENT
)

TABLE ENTITY_PREF_ASSOC
(
    ENTITY_ID INTEGER REFERENCES ENTITY,
    PREFS_NODE INTEGER REFERENCES PREFS_NODE
)

