/* $Id$ */
/*============================================================================*
 |                 Copyright (c) 2014 Applaud Solutions UK Ltd                |
 |                             All rights reserved                            |
 *===========================================================================*/

SET VERIFY OFF
SET FEEDBACK OFF
SET SCAN OFF
WHENEVER OSERROR  EXIT FAILURE ROLLBACK
WHENEVER SQLERROR EXIT FAILURE ROLLBACK



DECLARE 

  e_dir_exists EXCEPTION;
  PRAGMA EXCEPTION_INIT(e_dir_exists, -31003);

  e_does_not_exists EXCEPTION;
  PRAGMA EXCEPTION_INIT(e_does_not_exists , -31001);

  result boolean;
  
BEGIN

  BEGIN

    result := DBMS_XDB.createfolder('/public/xxas/');
    result := DBMS_XDB.createfolder('/public/xxas/emp/');
    result := DBMS_XDB.createfolder('/public/xxas/emp/view/');

  EXCEPTION
    WHEN e_dir_exists THEN
      NULL;
  END;

  
  BEGIN

    DBMS_XDB.DeleteResource('/public/xxas/emp/view/vacancyrecruitmentactivities.xml');

  EXCEPTION
    WHEN e_does_not_exists THEN
      NULL;
  END;

  
  result := DBMS_XDB.createresource('/public/xxas/emp/view/vacancyrecruitmentactivities.xml',
'<View title="Vacancy recruitment activities" defaultFormHandler="xxas_vacancy_pkg.commit_form_data" objectType="XXAS_PER_REC_ACTIVITY" deleteAllowed="true" deleteLabel="Delete">

  <CreateFields>
  
    <Hidden id="RECRUITMENT_ACTIVITY_ID"/>
    <Hidden id="RECRUITMENT_ACTIVITY_FOR_ID"/>
    <Hidden id="VACANCY_ID"/>
    <Date id="DATE_START"/>
    <Date id="DATE_END"/>
    <Hidden id="NAME"/>
    <Hidden id="POSTING_CONTENT_ID"/>
    <Hidden id="RECRUITING_SITE_ID"/>
    <TextInput id="RECRUITING_SITE_NAME"/>
    <Hidden id="OBJECT_VERSION_NUMBER"/>
    <Hidden id="FOR_OBJECT_VERSION_NUMBER"/>
    <Hidden id="LAST_UPDATE_DATE"/>
    <Hidden id="LAST_UPDATED_BY"/>
    <Hidden id="LAST_UPDATE_LOGIN"/>
    <Hidden id="CREATED_BY"/>
    <Hidden id="CREATION_DATE"/>
    
  </CreateFields>

</View>' ); 
xxas_forms_pkg.update_forms_resource('/public/xxas/emp/view/vacancyrecruitmentactivities.xml');
END;
/
COMMIT;
EXIT;
