<!--
Copyright 2004 The Apache Software Foundation

Licensed 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.
-->
<!--
   - P O R T L E T    A P P L I C A T I O N
-->	

 
  <class-descriptor
   	  class="org.apache.jetspeed.om.portlet.impl.PortletApplicationDefinitionImpl"
   	  table="PORTLET_APPLICATION"
   >
     
      <field-descriptor
         name="id"
         column="APPLICATION_ID"
         jdbc-type="INTEGER"
         primarykey="true"
         autoincrement="true"
         
      />

      <field-descriptor
         name="name"
         column="APP_NAME"
         jdbc-type="VARCHAR"
      />
      <field-descriptor
         name="applicationIdentifier"
         column="APP_IDENTIFIER"
         jdbc-type="VARCHAR"
      />

      <field-descriptor
         name="version"
         column="VERSION"
         jdbc-type="VARCHAR"
      />
      <field-descriptor
         name="description"
         column="DESCRIPTION"
         jdbc-type="VARCHAR"
      /> 
             
      <field-descriptor
         name="webApplicationId"
         column="WEB_APP_ID"
         jdbc-type="INTEGER"       
      />

      <field-descriptor
         name="metadataId"
         column="METADATA_ID"
         jdbc-type="INTEGER"       
      />

      <field-descriptor
         name="applicationType"
         column="APP_TYPE"
         jdbc-type="INTEGER"       
      />
	 <!--
      <reference-descriptor 
      	  name="metadata" 
      	  class-ref="org.apache.jetspeed.om.common.impl.GenericMetadataImpl" 
		  auto-delete="true"
      	  auto-update = "true"
      	  auto-retrieve = "true"
      	  >
         <foreignkey field-ref="metadataId"/>
      </reference-descriptor>
     -->
     
      <reference-descriptor 
      	  name="webApplication" 
      	  class-ref="org.apache.jetspeed.om.servlet.impl.WebApplicationDefinitionImpl" 
      	  otm-dependent="true"  

      	  >
         <foreignkey field-ref="webApplicationId"/>
      </reference-descriptor>

      <collection-descriptor
         name="portlets"
         element-class-ref="org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl"
         class-ref="org.apache.jetspeed.om.servlet.impl.WebApplicationDefinitionImpl" 
     	 otm-dependent="true"  

      >
         <inverse-foreignkey field-ref="appId"/>
      </collection-descriptor>

   </class-descriptor>
   

   
<!--
 	- W E B    A P P L I C A T I O N 
-->

   <class-descriptor
   	  class="org.apache.jetspeed.om.servlet.impl.WebApplicationDefinitionImpl"
   	  table="WEB_APPLICATION"
   >
   
      <field-descriptor
         name="id"
         column="ID"
         jdbc-type="INTEGER"
         primarykey="true"
         autoincrement="true"

      />
     
 
      <field-descriptor
         name="contextRoot"
         column="CONTEXT_ROOT"
         jdbc-type="VARCHAR"
      />


      <collection-descriptor
         name="descriptions"
         element-class-ref="org.apache.jetspeed.om.impl.WebAppDescriptionImpl"
         otm-dependent="true"         
      >
         <inverse-foreignkey field-ref="parentId"/>
      </collection-descriptor>

    <collection-descriptor
         name="displayNames"
         element-class-ref="org.apache.jetspeed.om.impl.WebAppDisplayNameImpl"
         otm-dependent="true"
       
      >    
          
          <inverse-foreignkey field-ref="parentId"/>
      </collection-descriptor>

   </class-descriptor>
   
   
   <class-descriptor
   	  class="org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl"
   	  table="PORTLET_DEFINITION"

   >   
   
      <field-descriptor
         name="id"
         column="ID"
         jdbc-type="INTEGER"
         primarykey="true"
         autoincrement="true"
       
      />

      <field-descriptor
         name="portletIdentifier"
         column="PORTLET_IDENTIFIER"
         jdbc-type="VARCHAR"       
      />      
    
      <field-descriptor
         name="name"
         column="NAME"
         jdbc-type="VARCHAR"
      />
      <field-descriptor
         name="className"
         column="CLASS_NAME"
         jdbc-type="VARCHAR"
      />
      
      <field-descriptor
         name="appId"
         column="APPLICATION_ID"
         jdbc-type="INTEGER"
         
      />      
       <field-descriptor
         name="expirationCache"
         column="EXPIRATION_CACHE"
         jdbc-type="VARCHAR"
      />
      
      <field-descriptor
         name="preferenceValidatorClassname"
         column="PREFERENCE_VALIDATOR"
         jdbc-type="VARCHAR"
      />

      <reference-descriptor 
      	name="app" 
      	class-ref="org.apache.jetspeed.om.portlet.impl.PortletApplicationDefinitionImpl" 
   	 >       	        
         <foreignkey field-ref="appId"/>
      </reference-descriptor>
   
   
     <collection-descriptor
         name="displayNames"
         element-class-ref="org.apache.jetspeed.om.impl.PortletDisplayNameImpl"
         otm-dependent="true"   
     >    
          <inverse-foreignkey field-ref="parentId"/>
      </collection-descriptor>
      <collection-descriptor
         name="descriptions"
         element-class-ref="org.apache.jetspeed.om.impl.PortletDescriptionImpl"
         otm-dependent="true"   
      >
         <inverse-foreignkey field-ref="parentId"/>
      </collection-descriptor>
      
      <collection-descriptor
         name="parameterSet"
         element-class-ref="org.apache.jetspeed.om.impl.PortletInitParameterImpl"
         otm-dependent="true"
      >
         <inverse-foreignkey field-ref="parentId"/>
      </collection-descriptor>
      
      <collection-descriptor
         name="prefSet"
         element-class-ref="org.apache.jetspeed.om.preference.impl.DefaultPreferenceImpl"
         otm-dependent="true"
       >         

         <inverse-foreignkey field-ref="parentId"/>
      </collection-descriptor>
      
      <collection-descriptor
         name="languageSet"
         element-class-ref="org.apache.jetspeed.om.impl.LanguageImpl"
         otm-dependent="true"
      >
         <inverse-foreignkey field-ref="portletId"/>
      </collection-descriptor>
      
      <collection-descriptor
         name="contentTypes"
         element-class-ref="org.apache.jetspeed.om.common.portlet.ContentTypeComposite"
       	 otm-dependent="true"
      >
         <inverse-foreignkey field-ref="portletId"/>
      </collection-descriptor>   
      
  
<!-- 
  
       <collection-descriptor
         name="securityRoleRefSet"
         element-class-ref="org.apache.jetspeed.om.impl.SecurityRoleRefImpl"
          auto-delete="true"
      	  auto-update = "true"
      	  auto-retrieve = "true"

       >         

         <inverse-foreignkey field-ref="portletId"/>
      </collection-descriptor>
      


  -->

   <!--      
      <collection-descriptor
         name="portletEntities"
         element-class-ref="org.apache.jetspeed.components.portletentity.PortletEntityImpl"
          auto-delete="true"
      	  auto-update = "true"
      	  auto-retrieve = "true"
      >
    
           <inverse-foreignkey field-ref="portletId"/>
     </collection-descriptor>
       -->
   </class-descriptor>
   
  <class-descriptor
   	  class="org.apache.jetspeed.om.impl.PortletInitParameterImpl"
   	  table="PARAMETER"
   >
      <field-descriptor
         name="parentId"
         column="PARENT_ID"
         jdbc-type="INTEGER"

      />
      
        <field-descriptor
         name="parameterId"
         column="PARAMETER_ID"
         jdbc-type="INTEGER"
         primarykey="true"
         autoincrement="true"         
      />
      
      <field-descriptor
         name="parentId"
         column="PARENT_ID"
         jdbc-type="INTEGER"

      />
      
      <field-descriptor
         name="name"
         column="NAME"
         jdbc-type="VARCHAR"
      />

      <field-descriptor
         name="value"
         column="PARAMETER_VALUE"
         jdbc-type="VARCHAR"         
      />       
         
   
   <field-descriptor
         name="ojbConcreteClass"
         column="CLASS_NAME"
         jdbc-type="VARCHAR"
      />
      
      <collection-descriptor
         name="descriptions"
         element-class-ref="org.apache.jetspeed.om.impl.ParameterDescriptionImpl"
       	 otm-dependent="true"  
      >         
         <inverse-foreignkey field-ref="parentId"/>

      </collection-descriptor>      
   
  </class-descriptor>
  
      <class-descriptor
   	  class="org.apache.jetspeed.om.preference.impl.DefaultPreferenceImpl"
   	  table="PORTLET_PREFERENCE"
   >
      
        <field-descriptor
         name="id"
         column="ID"
         jdbc-type="INTEGER"
         primarykey="true"
         autoincrement="true"         
      />
      <field-descriptor
         name="ojbConcreteClass"
         column="CLASS_NAME"
         jdbc-type="VARCHAR"
      />
            
      <field-descriptor
         name="parentId"
         column="PARENT_ID"
         jdbc-type="INTEGER"


      />
      
      <field-descriptor
         name="name"
         column="NAME"
         jdbc-type="VARCHAR"
      />
      
       <field-descriptor
         name="readOnly"
         column="READ_ONLY"
         jdbc-type="BIT"
      />    
      
      <collection-descriptor
         name="values"
         element-class-ref="org.apache.jetspeed.om.preference.impl.PreferenceValueImpl"
         otm-dependent="true"  

      >         
         <inverse-foreignkey field-ref="preferenceId"/>
        
      </collection-descriptor>
      
      <collection-descriptor
         name="descriptions"
         element-class-ref="org.apache.jetspeed.om.impl.PreferenceDescriptionImpl"
       	 otm-dependent="true"  

      >         

         <inverse-foreignkey field-ref="parentId"/>
   
      </collection-descriptor>  
    </class-descriptor>
   
   <!-- These preference map directly to a Portlet Entity --> 
   <class-descriptor
   	  class="org.apache.jetspeed.om.preference.impl.PreferenceImpl"
   	  table="PORTLET_PREFERENCE"
   >
      
        <field-descriptor
         name="id"
         column="ID"
         jdbc-type="INTEGER"
         primarykey="true"
         autoincrement="true"
         
      />
      <field-descriptor
         name="ojbConcreteClass"
         column="CLASS_NAME"
         jdbc-type="VARCHAR"
      />
            
      <field-descriptor
         name="parentId"
         column="PARENT_ID"
         jdbc-type="INTEGER"

      />
      
      <field-descriptor
         name="name"
         column="NAME"
         jdbc-type="VARCHAR"
      />

       <field-descriptor
         name="readOnly"
         column="READ_ONLY"
         jdbc-type="BIT"
      />    
      
      <collection-descriptor
         name="values"
         element-class-ref="org.apache.jetspeed.om.preference.impl.PreferenceValueImpl"
         otm-dependent="true"  

      >         
         <inverse-foreignkey field-ref="preferenceId"/>
        
      </collection-descriptor>
      
      <collection-descriptor
         name="descriptions"
         element-class-ref="org.apache.jetspeed.om.impl.PreferenceDescriptionImpl"
         otm-dependent="true"  

      >         
         <inverse-foreignkey field-ref="parentId"/>

      </collection-descriptor>  
    </class-descriptor>
    
 
        
   <class-descriptor
   	  class="org.apache.jetspeed.om.preference.impl.PreferenceValueImpl"
   	  table="PREFERENCE_VALUE"
   >
      
        <field-descriptor
         name="id"
         column="ID"
         jdbc-type="INTEGER"
         primarykey="true"
         autoincrement="true"  

      />
      
      <field-descriptor
         name="preferenceId"
         column="PREFERENCE_ID"
         jdbc-type="INTEGER"

      />
      
    
      
      <field-descriptor
         name="value"
         column="VALUE"
         jdbc-type="VARCHAR"
      />  
  
  </class-descriptor>
  
   <class-descriptor
   	  class="org.apache.jetspeed.om.impl.LanguageImpl"
   	  table="LANGUAGE"
   >
   
      <field-descriptor
         name="id"
         column="ID"
         jdbc-type="INTEGER"
         primarykey="true"
         autoincrement="true"         
      />
      
      <field-descriptor
         name="portletId"
         column="PORTLET_ID"
         jdbc-type="INTEGER"
          
      />
      
      
      <field-descriptor
         name="title"
         column="TITLE"
         jdbc-type="VARCHAR"
      />
      <field-descriptor
         name="shortTitle"
         column="SHORT_TITLE"
         jdbc-type="VARCHAR"
      />
      
      <field-descriptor
         name="keywords"
         column="KEYWORDS"
         jdbc-type="VARCHAR"
         conversion="org.apache.jetspeed.util.ojb.CSVtoCollectionFieldConversion"
      />
      
      <field-descriptor
         name="locale"
         column="LOCALE_STRING"
         jdbc-type="VARCHAR"
         conversion="org.apache.jetspeed.util.ojb.LocaleFieldConversion"
      />      

   </class-descriptor>
   
 
  <class-descriptor
    class="org.apache.jetspeed.om.common.portlet.ContentTypeComposite"
   >
      <extent-class class-ref="org.apache.jetspeed.om.portlet.impl.ContentTypeImpl" />              
   </class-descriptor>
 
  <class-descriptor
   	  class="org.apache.jetspeed.om.portlet.impl.ContentTypeImpl"
   	  table="PORTLET_CONTENT_TYPE"
   >   
     <field-descriptor
         name="contentTypeId"
         column="CONTENT_TYPE_ID"
         jdbc-type="INTEGER"
         primarykey="true"
         autoincrement="true"         
      />
      <field-descriptor
         name="portletId"
         column="PORTLET_ID"
         jdbc-type="INTEGER"

      />
      <field-descriptor
         name="contentType"
         column="CONTENT_TYPE"
         jdbc-type="VARCHAR"
      />
      <field-descriptor
         name="portletModes"
         column="MODES"
         jdbc-type="VARCHAR"
         conversion="org.apache.jetspeed.util.ojb.CSVtoPortletModeFieldConversion"
      />  
   </class-descriptor>
  
   
   
   
   
  <class-descriptor
   	  class="org.apache.jetspeed.om.impl.WebAppDescriptionImpl"
   	  table="LOCALIZED_DESCRIPTION"
   >
      
      <field-descriptor
         name="id"
         column="ID"
         jdbc-type="INTEGER"
         primarykey="true"
         autoincrement="true"
  
   
      />
      
      <field-descriptor
         name="parentId"
         column="OBJECT_ID"
         jdbc-type="INTEGER"

      />
        
      
      <field-descriptor
         name="ojbConcreteClass"
         column="CLASS_NAME"
         jdbc-type="VARCHAR"
      />
      
      <field-descriptor
         name="description"
         column="DESCRIPTION"
         jdbc-type="VARCHAR"
      />   
      
      <field-descriptor
         name="locale"
         column="LOCALE_STRING"
         jdbc-type="VARCHAR"
         conversion="org.apache.jetspeed.util.ojb.LocaleFieldConversion"
      />          
      
  
    </class-descriptor>
    
   <class-descriptor
   	  class="org.apache.jetspeed.om.impl.ParameterDescriptionImpl"
   	  table="LOCALIZED_DESCRIPTION"
   >
      
      <field-descriptor
         name="id"
         column="ID"
         jdbc-type="INTEGER"
         primarykey="true"
         autoincrement="true"

   
      />
      
      <field-descriptor
         name="parentId"
         column="OBJECT_ID"
         jdbc-type="INTEGER"

      />
        
      
      <field-descriptor
         name="ojbConcreteClass"
         column="CLASS_NAME"
         jdbc-type="VARCHAR"
      />
      
      <field-descriptor
         name="description"
         column="DESCRIPTION"
         jdbc-type="VARCHAR"
      />   
      
      <field-descriptor
         name="locale"
         column="LOCALE_STRING"
         jdbc-type="VARCHAR"
         conversion="org.apache.jetspeed.util.ojb.LocaleFieldConversion"
      />          
      
  
    </class-descriptor>
    
    
    
    
     <class-descriptor
   	  class="org.apache.jetspeed.om.impl.WebAppDisplayNameImpl"
   	  table="LOCALIZED_DISPLAY_NAME"
   >
        
      <field-descriptor
         name="id"
         column="ID"
         jdbc-type="INTEGER"
         primarykey="true"
         autoincrement="true"
         
      />
      
      <field-descriptor
         name="parentId"
         column="OBJECT_ID"
         jdbc-type="INTEGER"

      />

      
       <field-descriptor
         name="ojbConcreteClass"
         column="CLASS_NAME"
         jdbc-type="VARCHAR"
      />
      
      <field-descriptor
         name="displayName"
         column="DISPLAY_NAME"
         jdbc-type="VARCHAR"
      />   
      
      <field-descriptor
         name="locale"
         column="LOCALE_STRING"
         jdbc-type="VARCHAR"
         conversion="org.apache.jetspeed.util.ojb.LocaleFieldConversion"
      />          
    

   </class-descriptor>
   
    <class-descriptor
   	  class="org.apache.jetspeed.om.impl.PortletDescriptionImpl"
   	  table="LOCALIZED_DESCRIPTION"
   >
      
      <field-descriptor
         name="id"
         column="ID"
         jdbc-type="INTEGER"
         primarykey="true"
         autoincrement="true"
   
   
      />
      
      <field-descriptor
         name="parentId"
         column="OBJECT_ID"
         jdbc-type="INTEGER"
   
      />
        
      
      <field-descriptor
         name="ojbConcreteClass"
         column="CLASS_NAME"
         jdbc-type="VARCHAR"
      />
      
      <field-descriptor
         name="description"
         column="DESCRIPTION"
         jdbc-type="VARCHAR"
      />   
       
      <field-descriptor
         name="locale"
         column="LOCALE_STRING"
         jdbc-type="VARCHAR"
         conversion="org.apache.jetspeed.util.ojb.LocaleFieldConversion"
      />          
      
  
    </class-descriptor>
    
   <class-descriptor
   	  class="org.apache.jetspeed.om.impl.PortletDisplayNameImpl"
   	  table="LOCALIZED_DISPLAY_NAME"
   >    
        
      <field-descriptor
         name="id"
         column="ID"
         jdbc-type="INTEGER"
         primarykey="true"
         autoincrement="true"   
      />
      
      <field-descriptor
         name="parentId"
         column="OBJECT_ID"
         jdbc-type="INTEGER"

      />
      
       <field-descriptor
         name="ojbConcreteClass"
         column="CLASS_NAME"
         jdbc-type="VARCHAR"
      />

      <field-descriptor
         name="displayName"
         column="DISPLAY_NAME"
         jdbc-type="VARCHAR"
      />   
      
      <field-descriptor
         name="locale"
         column="LOCALE_STRING"
         jdbc-type="VARCHAR"
         conversion="org.apache.jetspeed.util.ojb.LocaleFieldConversion"
      />       
    
   </class-descriptor>
   
   <class-descriptor
   	  class="org.apache.jetspeed.om.impl.PreferenceDescriptionImpl"
   	  table="LOCALIZED_DESCRIPTION"
   >
      
      <field-descriptor
         name="id"
         column="ID"
         jdbc-type="INTEGER"
         primarykey="true"
         autoincrement="true"

   
      />
      
      <field-descriptor
         name="parentId"
         column="OBJECT_ID"
         jdbc-type="INTEGER"

      />
        
      
      <field-descriptor
         name="ojbConcreteClass"
         column="CLASS_NAME"
         jdbc-type="VARCHAR"
      />
      
      <field-descriptor
         name="description"
         column="DESCRIPTION"
         jdbc-type="VARCHAR"
      />   
      
      <field-descriptor
         name="locale"
         column="LOCALE_STRING"
         jdbc-type="VARCHAR"
         conversion="org.apache.jetspeed.util.ojb.LocaleFieldConversion"
      />          
      
  
    </class-descriptor>
    
    
   <class-descriptor
   	  class="org.apache.jetspeed.components.portletentity.PortletEntityImpl"
   	  table="PORTLET_ENTITY"
   >
      
        <field-descriptor
         name="id"
         column="ID"
         jdbc-type="INTEGER"
         primarykey="true"
         autoincrement="true"
         
      />
      
      <field-descriptor
         name="portletId"
         column="PORTLET_DEFINITION_ID"
         jdbc-type="INTEGER"

      />
      
      <field-descriptor
         name="oid"
         column="GUID"
         jdbc-type="VARCHAR"
         conversion="org.apache.jetspeed.util.ojb.ObjectIDtoStringFieldConversion"
      />
      
     <reference-descriptor 
      	name="portletDefinition" 
      	class-ref="org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl" 
   	 >       	        
         <foreignkey field-ref="portletId"/>
      </reference-descriptor>

      <collection-descriptor
         name="originalPreferences"
         element-class-ref="org.apache.jetspeed.om.preference.impl.PreferenceImpl"
         otm-dependent="true"  

       >         
         <inverse-foreignkey field-ref="parentId"/>
      </collection-descriptor>  
  </class-descriptor>
  