<?xml version="1.0" encoding="UTF-8" ?>
<!--
  ~ Copyright (c) DbVis Software AB. All Rights Reserved.
  -->

<!DOCTYPE DatabaseProfile SYSTEM "dbvis-defs.dtd">

<DatabaseProfile
        desc="Profile for Derby"
        minver="9.5"
        extends="generic">

   <!-- =================================================================== -->
   <!-- Definition of the commands -->
   <!-- =================================================================== -->

   <Commands extends="true">

      <!--
        The "getTableNamesFor" command is used by Database getTableNamesFor().
        It must return table names for the catalog and schema named by
        the ${table_catalog} and ${table_catalog} variables in the first
        column.
      -->
      <Command id="derby.getTableNamesFor">
         <SQL>
            <![CDATA[
SELECT T.TABLENAME
FROM SYS.SYSTABLES T, SYS.SYSSCHEMAS S
WHERE T.SCHEMAID = S.SCHEMAID
  AND CAST(S.SCHEMANAME AS VARCHAR(1024)) = '${table_schema}'
ORDER BY T.TABLENAME
            ]]>
         </SQL>
      </Command>

      <!--
        The "getColumnNamesFor" command is used by Database getColumnNamesFor().
        It must return column names for the catalog, schema and table named by
        the ${table_catalog}, ${table_catalog} and ${table_name} variables in
        the first column.
      -->
      <Command id="derby.getColumnNamesFor">
         <SQL>
            <![CDATA[
SELECT C.COLUMNNAME
FROM SYS.SYSTABLES T, SYS.SYSSCHEMAS S, SYS.SYSCOLUMNS C
WHERE T.SCHEMAID = S.SCHEMAID AND T.TABLEID = C.REFERENCEID
  AND CAST(S.SCHEMANAME AS VARCHAR(1024)) = '${table_schema}' AND CAST(T.TABLENAME AS VARCHAR(1024)) = '${table_name}'
ORDER BY C.COLUMNNAME
            ]]>
         </SQL>
      </Command>

      <!-- =================================================================== -->
      <!-- Definition of the generic error handler (for all Commands). Its -->
      <!-- conditions will be evaluated with possible errors produced by each -->
      <!-- commands. If a match is found then the text in the <Message> -->
      <!-- element will be displayed in DbVisualizer. -->
      <!-- =================================================================== -->

      <Command id="derby.getSchemas">
         <SQL>
            <![CDATA[
SELECT
    SCHEMANAME as "Schema",
    SCHEMAID   as "Schema Id"
FROM
    SYS.SYSSCHEMAS
ORDER BY
    SCHEMANAME
            ]]>
         </SQL>
      </Command>

      <Command id="derby.getSchemaNames">
         <SQL>
            <![CDATA[
SELECT
    SCHEMANAME as "Schema",
    SCHEMAID   as "Schema Id"
FROM
    SYS.SYSSCHEMAS
ORDER BY
    SCHEMANAME
            ]]>
         </SQL>
         <!--Must have Filter element here since this command is fetched from code-->
         <Filter index="Schema" label="Name"/>
      </Command>

      <Command id="derby.getTables">
         <SQL>
            <![CDATA[
SELECT
    '${schema}'     as "Schema",
    TABLENAME       as "Table Name",
    TABLETYPE       as "Table Type",
    LOCKGRANULARITY as "Lock Granularity",
    SCHEMAID        as "Schema Id",
    TABLEID         as "Table Id"
FROM
    SYS.SYSTABLES
WHERE
    CAST(SCHEMAID AS VARCHAR(1024)) LIKE '${schemaId}'
    AND CAST(TABLETYPE AS CHAR) IN (${tableType})
ORDER BY
    TABLENAME
            ]]>
         </SQL>
      </Command>

      <Command id="derby.getSynonyms">
         <SQL>
            <![CDATA[
SELECT
    '${schema}'       as "Schema",
    T.TABLENAME       as "Synonym Name",
    A.ALIASINFO       as "Target Table",
    T.TABLETYPE       as "Type",
    T.LOCKGRANULARITY as "Lock Granularity",
    T.SCHEMAID        as "Schema Id",
    T.TABLEID         as "Synonym Id"
FROM
    SYS.SYSTABLES T,
    SYS.SYSALIASES A
WHERE
    CAST(T.SCHEMAID AS VARCHAR(1024)) LIKE '${schemaId}'
    AND CAST(T.TABLETYPE AS CHAR) IN ('A')
    AND T.SCHEMAID = A.SCHEMAID
    AND T.TABLENAME = A.ALIAS
ORDER BY
    1,
    T.TABLENAME
            ]]>
         </SQL>
      </Command>

      <Command id="derby.getTriggers">
         <SQL>
            <![CDATA[
SELECT
    s.SCHEMANAME          as "Schema",
    tr.TRIGGERNAME        as "Trigger Name",
    t.TABLENAME           as "Table Name",
    tr.CREATIONTIMESTAMP  as "Created",
    tr.EVENT              as "Event",
    tr.FIRINGTIME         as "Firing Time",
    tr.TYPE               as "Type",
    tr.STATE              as "State",
    tr.WHENSTMTID         as "When Statement Id",
    tr.ACTIONSTMTID       as "Action Statement Id",
    tr.REFERENCEDCOLUMNS  as "Referenced Columns",
    tr.TRIGGERDEFINITION  as "Trigger Definition",
    tr.REFERENCINGOLD     as "Referencing Old",
    tr.REFERENCINGNEW     as "Referencing New",
    tr.OLDREFERENCINGNAME as "Old Referencing Name",
    tr.NEWREFERENCINGNAME as "New Referencing Name"
FROM
    SYS.SYSTRIGGERS tr,
    SYS.SYSSCHEMAS s,
    SYS.SYSTABLES t
WHERE
    CAST(s.schemaid AS VARCHAR(1024)) = '${schemaId}'
    AND tr.SCHEMAID = s.SCHEMAID
    AND tr.TABLEID = t.TABLEID
    ${condition}
ORDER BY
    tr.TRIGGERNAME
            ]]>
         </SQL>
      </Command>

      <Command id="derby.getFunctions">
         <SQL>
            <![CDATA[
SELECT
    s.schemaname    as "Schema",
    a.alias         as "Name",
    a.javaclassname as "Java Class Name",
    a.aliasinfo     as "Interface",
    a.systemalias   as "System Alias"
FROM
    SYS.SYSALIASES a,
    SYS.SYSSCHEMAS s
WHERE
    CAST(a.ALIASTYPE AS CHAR)    in (${functionType})
    and CAST(a.schemaid AS VARCHAR(1024)) = '${schemaId}'
    AND a.SCHEMAID   = s.SCHEMAID
ORDER BY
    a.alias
            ]]>
         </SQL>
      </Command>

      <Command id="derby.getSequences">
         <SQL>
            <![CDATA[
select
    sequenceid as "Sequence ID",
    sequencename as "Sequence Name",
    currentvalue as "Current Value",
    startvalue as "Start Value",
    minimumvalue as "Minimum Value",
    maximumvalue as "Maximum Value",
    increment as "Increment",
    cycleoption as "Cycle Option"
  from
    sys.SYSSEQUENCES
  where
    cast(schemaid as varchar(1024)) = '${schemaId}'
    and sequencename like '${sequenceName}'
  order by sequencename asc
            ]]>
         </SQL>
      </Command>

      <Command id="derby.getIndexes">
         <SQL>
            <![CDATA[
SELECT
    c.CONGLOMERATENAME AS INDEX_NAME,
    sc.SCHEMANAME      AS INDEX_SCHEMA,
    c.DESCRIPTOR       AS INDEX_DESC,
    t.TABLENAME        AS TABLE_NAME,
    st.SCHEMANAME      AS TABLE_SCHEMA
FROM
    SYS.SYSCONGLOMERATES c,
    SYS.SYSTABLES t,
    SYS.SYSSCHEMAS st,
    SYS.SYSSCHEMAS sc
WHERE
    (
        c.SCHEMAID = sc.SCHEMAID
    AND c.TABLEID = t.TABLEID
    AND t.SCHEMAID = st.SCHEMAID)
AND CAST(t.TABLENAME AS VARCHAR(1024)) LIKE '${tableNamePattern}'
AND CAST(st.SCHEMANAME AS VARCHAR(1024)) = '${owner}'
AND c.ISINDEX
AND NOT c.ISCONSTRAINT;
            ]]>
         </SQL>
      </Command>

   </Commands>

   <!-- =================================================================== -->
   <!-- Definition of the object actions that are used by the tree          -->
   <!-- =================================================================== -->

   <ObjectsActionDef extends="false">

      <ActionGroup type="Schemas">
         <Action id="derby-schemas-create" label="Create Schema" reload="true"
                 resetschemas="true" icon="add">
            <Input label="Schema Name" name="schemaName" style="text"/>
            <Command>
              <SQL><![CDATA[create schema ${QB}${schemaName}${QE}]]></SQL>
            </Command>
            <Result>
               Schema ${schemaName} created!
            </Result>
         </Action>
      </ActionGroup>

      <ActionGroup type="Schema">
         <Action id="derby-schema-drop" label="Drop Schema" reload="true"
                 resetschemas="true" icon="remove">
            <Input label="Schema" style="text" editable="false">
               <Default>${schema}</Default>
            </Input>
            <Command><SQL><![CDATA[drop schema "${schema}" restrict]]></SQL></Command>
            <Confirm>
               Really drop schema ${schema}?
            </Confirm>
            <Result>
               Schema ${schema} has been dropped!
            </Result>
         </Action>
         <Action id="derby-schema-export" label="Export Schema"
                 icon="export" reload="false"
                 class="schemaExport"
                 doclink="http://www.dbvis.com/doclink/export-schema"/>
      </ActionGroup>

      <ActionGroup type="Tables">
         <Action id="derby-tables-create-table" label="Create Table"
                 icon="add" reload="true"
                 class="tableCreateOrAlter"
                 classargs="create"
                 doclink="http://www.dbvis.com/doclink/create-table"/>

         <Action id="derby-tables-import-table-data" label="Import Table Data" icon="import"
                 reload="true"
                 class="tableDataImport"
                 doclink="http://www.dbvis.com/doclink/import-table"/>

      </ActionGroup>

      <ActionGroup type="Table">
         <Action id="derby-tables-alter-table" label="Alter Table"
                 icon="edit" reload="true"
                 class="tableCreateOrAlter"
                 classargs="alter"
                 doclink="http://www.dbvis.com/doclink/alter-table"/>

         <Action id="derby-table-rename" label="Rename Table" reload="true" icon="rename">
            <Input label="Schema" style="text" editable="false">
               <Default>${schema}</Default>
            </Input>
            <Input label="Table" style="text" editable="false">
               <Default>${objectname}</Default>
            </Input>
            <Input label="New Table Name" name="newTable" style="text"/>
            <Command>
               <SQL><![CDATA[rename table "${schema}"."${objectname}" to ${QB}${newTable}${QE}]]></SQL>
            </Command>
            <Confirm>
               Confirm rename of ${schema}.${objectname} to ${newTable}?
            </Confirm>
            <Result>
               Table ${schema}.${objectname} renamed to ${newTable}!
            </Result>
         </Action>

         <Action id="derby-table-clear" label="Empty Table" reload="true">
            <Input label="Schema" style="text" editable="false">
               <Default>${schema}</Default>
            </Input>
            <Input label="Table" style="text" editable="false">
               <Default>${objectname}</Default>
            </Input>

            <Command>
               <SQL><![CDATA[delete from "${schema}"."${objectname}"]]></SQL>
            </Command>
            <Confirm>
               Really remove all rows in table ${schema}.${objectname}?
            </Confirm>
            <Result>
               All rows in table ${schema}.${objectname} has been removed!
            </Result>
         </Action>

         <Action id="derby-table-drop" label="Drop Table" reload="true" icon="remove">
            <Input label="Schema" style="text" editable="false">
               <Default>${schema}</Default>
            </Input>
            <Input label="Table" style="text" editable="false">
               <Default>${objectname}</Default>
            </Input>
            <Command><SQL><![CDATA[drop table "${schema}"."${objectname}"]]></SQL></Command>
            <Confirm>
               Really drop table ${schema}.${objectname}?
            </Confirm>
            <Result>
               Table ${schema}.${objectname} has been dropped!
            </Result>
         </Action>

         <Action id="derby-table-import-table-data" label="Import Table Data" icon="import"
                 class="tableDataImport"
                 doclink="http://www.dbvis.com/doclink/import-table"/>

         <Action id="derby-table-export" label="Export Table" icon="export"
                 class="tableExport"
                 doclink="http://www.dbvis.com/doclink/export-table"/>

         <!-- TABLE MAINTENANCE -->
                 <ActionGroup label="Maintenance">
           <If test="#util.isDatabaseVersionGTE(10,0)">
               <Action id="derby-table-maintanance-check" label="Check Table" reload="false">
                   <Input label="Schema" style="text" editable="false">
                      <Default>${schema}</Default>
                   </Input>
                   <Input label="Table" style="text" editable="false">
                     <Default>${objectname}</Default>
                   </Input>
                  <Confirm>Really check table ${objectname}?</Confirm>
                  <Message type="warning"><![CDATA[<html><p><b>CHECK TABLE</b> ensures that all of the indexes are consistent with the table(s).</p><p>It is recommended that you run this on an offline database after a backup.</p></html> ]]></Message>
                  <Command><SQL><![CDATA[VALUES SYSCS_UTIL.SYSCS_CHECK_TABLE('${schema}', '${objectname}')]]></SQL></Command>
               </Action>
               
               <Action id="derby-table-maintanance-compress" label="Compress Table" reload="false">
                   <Input label="Schema" style="text" editable="false">
                      <Default>${schema}</Default>
                   </Input>
                   <Input label="Table" style="text" editable="false">
                     <Default>${objectname}</Default>
                   </Input>
                 
                  <Input label="SEQUENTIAL" name="sequential" style="check" tip="When checked the operation is forced to run in sequential mode">
                     <Values>1</Values>
                  </Input>
                    <SetVar name="_sequential" value='#sequential.equals("1") ? "1" : "0"'/>


                  <Confirm>Really compress table ${objectname}?</Confirm>
                  <Message type="warning"><![CDATA[<html><p><b>COMPRESS TABLE</b> is used to reclaim unused, allocated space in table(s) and indexes.</p>
                  <b>Note:</b> This procedure acquires an exclusive table lock while being compressed.</html> ]]></Message>
                  <Command><SQL><![CDATA[call SYSCS_UTIL.SYSCS_COMPRESS_TABLE('${schema}', '${objectname}', ${_sequential})]]></SQL></Command>
               </Action>
                <If test="#util.isDatabaseVersionGTE(10,1)">
                   <!-- In-place compress only from 10.1 -->
                    <Action id="derby-table-maintanance-inplace-compress" label="Inplace Compress Table" reload="false">
                      <Input label="Schema" style="text" editable="false">
                         <Default>${schema}</Default>
                      </Input>
                      <Input label="Table" style="text" editable="false">
                        <Default>${objectname}</Default>
                      </Input>
 
                       <Input label="PURGE_ROWS" name="purgeRows" style="check" tip="When checked a single pass is made through the table which will purge committed deleted rows from the table">
                          <Values>1</Values>
                       </Input>
                       <Input label="DEFRAGMENT_ROWS" name="defragRows" style="check" tip="When checked  a single defragment pass is made which will move existing rows from the end of the table towards the front of the table.">
                          <Values>1</Values>
                       </Input>
                       <Input label="TRUNCATE_END" name="truncateEnd" style="check" tip="When checked all contiguous pages at the end of the table will be returned to the operating system">
                          <Values>1</Values>
                       </Input>
                         <SetVar name="_purgeRows" value='#purgeRows.equals("1") ? "1" : "0"'/>
                       <SetVar name="_defragRows" value='#defragRows.equals("1") ? "1" : "0"'/>
                       <SetVar name="_truncateEnd" value='#truncateEnd.equals("1") ? "1" : "0"'/>
                  
                       <Confirm>Really compress table ${objectname}?</Confirm>
                       <Message type="warning"><![CDATA[<html><p><b>INPLACE COMPRESS TABLE</b> is used to reclaim unused, allocated space in table(s) and indexes.</p>
                       <b>Note:</b> This procedure acquires an exclusive table lock while being compressed.</html> ]]></Message>
                       <Command><SQL><![CDATA[call SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE('${schema}', '${objectname}', ${_purgeRows}, ${_defragRows}, ${_truncateEnd})]]></SQL></Command>
                    </Action>
                </If>
            
           </If>
         </ActionGroup>  <!-- Maintenance -->
         <!-- END TABLE MAINTENANCE  -->
         <Separator/>

         <Action id="derby-table-create-index" label="Create Index" reload="true">
            <Input label="Schema" style="text" editable="false">
               <Default>${schema}</Default>
            </Input>
            <Input label="Table" style="text" editable="false">
               <Default>${objectname}</Default>
            </Input>
            <Input label="Index Name" name="indexname" style="text"/>
            <Input label="Unique" name="unique" style="check">
               <Values>unique</Values>
            </Input>

            <Input label="Columns" style="separator"/>

            <Input name="columns" style="grid">
               <Arg name="output" value='"${columnname}"${_sortorder}'/>
               <Arg name="newline" value=", "/>

               <Input name="columnname" label="Column Name" style="list">
                  <Values column="4">
                     <Command idref="getColumnNamesFor">
                        <Input name="table_catalog" value="${catalog}"/>
                        <Input name="table_schema" value="${schema}"/>
                        <Input name="table_name" value="${objectname}"/>
                     </Command>
                  </Values>
                  <Default>${0}</Default>
               </Input>
               <Input name="sortorder" label="Sort Order" style="radio">
                  <Labels>ASC|DESC|Default</Labels>
                  <Values>ASC|DESC|</Values>
                  <Default>ASC</Default>
               </Input>
               <SetVar name="_sortorder" value='#sortorder.equals("") ? "" : " " + #sortorder'/>
            </Input>

            <SetVar name="_unique" value='#unique.equals("") ? "" : " " + #unique'/>
            <SetVar name="_columns" value='#columns.trim().equals("") ? "" : "(" + #columns + ")"'/>
            <SetVar name="_indexname" value='#indexname.trim().equals("") ? "" : " " + #QB + #indexname + #QE'/>

            <Command>
               <SQL>
                  <![CDATA[create${_unique} index${_indexname} on "${schema}"."${objectname}" ${_columns}]]>
               </SQL>
            </Command>
            <Confirm>
               <![CDATA[Create index ${indexname}?]]>
            </Confirm>
            <Result>
               <![CDATA[Index ${indexname} created!]]>
            </Result>
         </Action>

         <Action id="derby-tabletrigger-create" label="Create Trigger" icon="add" reload="true"
                 doclink="http://www.dbvis.com/doclink/create-trigger">
            <Input label="Schema" style="text" editable="false">
               <Default>${schema}</Default>
            </Input>
            <Input label="Trigger" name="triggerName" style="text"/>
            <Input label="Trigger Time" name="triggerTime" style="radio">
               <Values>NO CASCADE BEFORE|AFTER</Values>
               <Default>AFTER</Default>
            </Input>
            <Input label="Trigger Event" name="triggerEvent" style="radio">
               <Values>DELETE|INSERT|UPDATE</Values>
               <Default>INSERT</Default>
            </Input>
            <Input label="Trigger Type" name="triggerType" style="radio">
               <Values>STATEMENT|ROW</Values>
               <Default>STATEMENT</Default>
            </Input>
            <Input label="Table" style="text" editable="false">
               <Default>${objectname}</Default>
            </Input> 
           
            <If test="#util.isDatabaseVersionGTE(10,1)">
                <Input label="When" style="separator" tip="boolean condition for trigger source to be executed"/>
            
                <Input name="when" style="text-editor" >
                   <Arg name="height" value="30"/>
                 </Input>
                 <SetVar name="_when" value='#when.equals("") or #triggerType.equals("STATEMENT") ? "" : "WHEN (" + #when +")"'/>
            </If>
            <Input label="Source" style="separator"/>
            <Input name="source" style="text-editor">
               <Default><![CDATA[
--
--  Insert your own trigger code here
--
    insert into anotherTable (col1, col2) values(val1, val2)]]>
               </Default>
            </Input>

            <SetVar name="refType" value='#triggerType.equals("STATEMENT") ? "_table" : ""'/>
            <SetVar name="_refd" value='#triggerEvent.equals("DELETE") ? "referencing old" + #refType + " as \"OLD_" + #objectname + "\"" : ""'/>
            <SetVar name="_refi" value='#triggerEvent.equals("INSERT") ? "referencing new" + #refType + " as \"NEW_" + #objectname + "\"" : ""'/>
            <SetVar name="_refu" value='#triggerEvent.equals("UPDATE") ? "referencing old" + #refType + " as \"OLD_" + #objectname + "\" new" + #refType + " as \"NEW_" + #objectname + "\"" : ""'/>

            <SetVar name="_ref1" value="#_refi.equals('') ? #_refd : #_refi"/>
            <SetVar name="_ref2" value="#_refu.equals('') ? #_ref1 : #_refu"/>

            <SetVar name="_references" value="#triggerTime.equals('BEFORE') ? '' : '\n' + #_ref2"/>

            <Command exectype="asis">
               <SQL><![CDATA[
create trigger "${schema}".${QB}${triggerName}${QE}
  ${triggerTime} ${triggerEvent}
  on "${schema}"."${objectname}"${_references}
  for each ${triggerType} mode db2sql
  ${_when}
${source}]]>
               </SQL>
            </Command>
            <Result>
               <![CDATA[Trigger <b>${schema}.${triggerName}</b> created.]]>
            </Result>
         </Action>

         <Separator/>

         <Action id="derby-table-script" label="Script Table" icon="scriptObject"
                 class="sqlBuilder"
                 classargs="script-dialog,SELECT,SELECT *,INSERT,UPDATE,DELETE,CREATE,DROP"/>

      </ActionGroup>

      <ActionGroup type="View">
         <Action id="derby-view-drop" label="Drop View" reload="true" icon="remove">
            <Input label="Schema" style="text" editable="false">
               <Default>${schema}</Default>
            </Input>
            <Input label="View" style="text" editable="false">
               <Default>${objectname}</Default>
            </Input>
            <Command><SQL><![CDATA[drop view "${schema}"."${objectname}"]]></SQL></Command>
            <Confirm>
               Really drop view ${schema}.${objectname}?
            </Confirm>
            <Result>
               View ${schema}.${objectname} has been dropped!
            </Result>
         </Action>

         <Action id="derby-view-export" label="Export View" icon="export"
                 class="viewExport"
                 doclink="http://www.dbvis.com/doclink/export-view"/>

         <Separator/>

         <Action id="derby-view-script" label="Script View" icon="scriptObject"
                 class="sqlBuilder"
                 classargs="script-dialog,SELECT,SELECT *,INSERT,UPDATE,DELETE,CREATE,DROP"/>

      </ActionGroup>

      <ActionGroup type="Sequences">
         <Action id="derby-sequences-create" label="Create Sequence" reload="true" icon="add">
            <Input label="Schema" name="_schema" style="list">
               <Values>
                  <Command>
                     <SQL>
            <![CDATA[SELECT SCHEMANAME FROM SYS.SYSSCHEMAS ORDER BY SCHEMANAME]]></SQL>
                  </Command>
               </Values>
               <Default>${schema}</Default>
            </Input>
            <Input label="Data Type" name="type" style="list">
               <Values>SMALLINT|INT|BIGINT</Values>
               <Default>INT</Default>
            </Input>
            <Input label="Sequence Name" name="sequenceName" style="text"/>
            <Input label="Start With" name="startWith" style="text">
               <Default>1</Default>
            </Input>
            <Input label="Increment By" name="increment" style="text">
               <Default>1</Default>
            </Input>
            <Input label="Cycle" name="cycle" style="radio">
               <Values>cycle|no cycle</Values>
               <Labels>Cycle|No Cycle</Labels>
               <Default>cycle</Default>
            </Input>
            <Command>
               <SQL>
                  <![CDATA[
 create sequence "${_schema}".${QB}${sequenceName}${QE}
   start with ${startWith}
   increment by ${increment}
   no maxvalue
   no minvalue
   ${cycle}]]></SQL>
            </Command>
            <Result>
               Sequence ${schema}.${sequenceName} created!
            </Result>
         </Action>
      </ActionGroup>

      <ActionGroup type="Sequence">
         <Action id="derby-sequence-drop" label="Drop Sequence" reload="true" icon="remove">
            <Input label="Schema" style="text" editable="false">
               <Default>${schema}</Default>
            </Input>
            <Input label="Sequence" style="text" editable="false">
               <Default>${objectname}</Default>
            </Input>
            <Command>
               <SQL><![CDATA[drop sequence "${schema}"."${objectname}" restrict]]></SQL>
            </Command>
            <Confirm>
               Really drop sequence ${schema}.${objectname}?
            </Confirm>
            <Result>
               Sequence ${schema}.${objectname} dropped!
            </Result>
         </Action>
      </ActionGroup>

      <ActionGroup type="Synonyms">
         <Action id="derby-synonyms-create" label="Create Synonym" reload="true" icon="add">
            <Input label="Synonym Schema" name="synonymSchema" style="list">
               <Values>
                  <Command>
                     <SQL><![CDATA[
SELECT
    SCHEMANAME
FROM
    SYS.SYSSCHEMAS
ORDER BY
    SCHEMANAME
]]></SQL>
                  </Command>
               </Values>
               <Default>${schema}</Default>
            </Input>
            <Input label="Synonym Name" name="synonymName" style="text"/>
            <Input label="Object Schema" name="objSchema" style="list">
               <Values>
                  <Command>
                     <SQL><![CDATA[
SELECT
    SCHEMANAME
FROM
    SYS.SYSSCHEMAS
ORDER BY
    SCHEMANAME
]]></SQL>
                  </Command>
               </Values>
               <Default>${schema}</Default>
            </Input>
            <Input label="Object Name" name="objName" style="text"/>
            <Command>
              <SQL><![CDATA[create synonym "${synonymSchema}".${QB}${synonymName}${QE} for "${objSchema}"."${objName}"]]></SQL>
            </Command>
            <Result>
               Alias ${aliasSchema}.${aliasName} created!
            </Result>
         </Action>
      </ActionGroup>

      <ActionGroup type="Synonym">
         <Action id="derby-synonym-drop" label="Drop Synonym" reload="true" icon="remove">
            <Input label="Schema" style="text" editable="false">
               <Default>${schema}</Default>
            </Input>
            <Input label="Synonym" style="text" editable="false">
               <Default>${objectname}</Default>
            </Input>
            <Command><SQL><![CDATA[drop synonym "${schema}"."${objectname}"]]></SQL></Command>
            <Confirm>
               Really drop synonym ${schema}.${objectname}?
            </Confirm>
            <Result>
               Synonym ${schema}.${objectname} has been dropped!
            </Result>
         </Action>

         <Separator/>

      </ActionGroup>

      <ActionGroup type="Index">
         <Action id="derby-index-drop" label="Drop Index" reload="true" icon="remove">
            <Input label="Schema" style="text" editable="false">
               <Default>${schema}</Default>
            </Input>
            <Input label="Index" style="text" editable="false">
               <Default>${objectname}</Default>
            </Input>
            <Command><SQL><![CDATA[drop index "${schema}"."${objectname}"]]></SQL></Command>
            <Confirm>
               Really drop index ${schema}.${objectname}?
            </Confirm>
            <Result>
               Index ${schema}.${objectname} dropped!
            </Result>
         </Action>

         <Action id="derby-index-rename" label="Rename Index" reload="true" icon="rename">
         
            <Input label="Schema" style="text" editable="false">
               <Default>${schema}</Default>
            </Input>
            <Input label="Index" style="text" editable="false">
               <Default>${objectname}</Default>
            </Input>
            <Input label="New Index Name" name="newIndex" style="text"/>
            <Command>
               <SQL><![CDATA[rename index "${objectname}" to ${QB}${newIndex}${QE}]]></SQL>
            </Command>
             <Message type="info"><![CDATA[<html><p>Rename index only possible in current schema.</p>
             <p>Make sure you are logged in as "current schema" to perform this operation.</p></html> ]]></Message>
                 
            <Confirm>
               Confirm rename of index "${objectname}" to ${newIndex}?
            </Confirm>
            <Result>
               Index ${objectname} renamed to ${newIndex}!
            </Result>
         </Action>

         <Separator/>

         <Action id="derby-index-script" label="Script Index" icon="scriptObject"
                 class="sqlBuilder"
                 classargs="script-dialog,CREATE,DROP"/>
      </ActionGroup>

      <ActionGroup type="Functions">
         <Action id="derby-functions-create" label="Create Function" reload="true" icon="add"
                 doclink="http://www.dbvis.com/doclink/create-function">
            <Input label="Function Owner" name="functionOwner" style="list">
               <Values>
                  <Command>
                     <SQL>
                        <![CDATA[
SELECT
    SCHEMANAME
FROM
    SYS.SYSSCHEMAS
ORDER BY
    SCHEMANAME
                        ]]>
                     </SQL>
                  </Command>
               </Values>
               <Default>${schema}</Default>
            </Input>
            <Input label="Function Name" name="functionName" style="text"/>
            <Input label="Return Data Type" name="returns" style="text">
               <Default>INTEGER</Default>
            </Input>
            <Input label="External Name" name="externalName" style="text">
               <Default>com.foo.Bar</Default>
            </Input>
            <Input label="Parameters" style="separator"/>
            <Input name="parameters" style="grid">
               <Arg name="output" value="${name} ${type}"/>
               <Arg name="newline" value=", "/>

               <Input name="name" label="Name" style="text"/>
               <Input name="type" label="Type" style="text">
                  <Default>INTEGER</Default>
               </Input>
            </Input>

            <SetVar name="_parameters" value='#parameters.trim().equals("") ? "()" : "(" + #parameters + ")"'/>

            <Command exectype="asis">
               <SQL>
                  <![CDATA[
CREATE FUNCTION "${functionOwner}".${QB}${functionName}${QE}
${_parameters}
RETURNS ${returns}
LANGUAGE JAVA
PARAMETER STYLE JAVA
EXTERNAL NAME '${externalName}'
                  ]]>
               </SQL>
            </Command>
            <Confirm>
               Create function "${functionOwner}".${functionName}?
            </Confirm>
            <Result>
               Function "${functionOwner}".${functionName} created!
            </Result>
         </Action>
      </ActionGroup>

     <ActionGroup type="Function">
         <Action id="derby-function-drop" label="Drop Function" reload="true" icon="remove">
         <Input label="Schema" style="text" editable="false">
               <Default>${schema}</Default>
            </Input>
            <Input label="Function" style="text" editable="false">
               <Default>${objectname}</Default>
            </Input>
            <Command><SQL><![CDATA[drop function "${schema}"."${objectname}"]]></SQL></Command>
            <Confirm>
               Really drop function ${schema}.${objectname}?
            </Confirm>
            <Result>
               Function ${schema}.${objectname} dropped!
            </Result>
         </Action>
         
         <Action id="derby-function-export" label="Export Function" icon="export"
                 class="functionExport"
                 doclink="http://www.dbvis.com/doclink/export-code-object"/>

         <Separator/>

         <Action id="derby-function-script" label="Script Function" icon="scriptObject"
                 class="sqlBuilder"
                 classargs="script-dialog,CALL,CREATE,DROP"/>

      </ActionGroup>

      <ActionGroup type="Procedures">
         <Action id="derby-procedures-create" label="Create Procedure" reload="true" icon="add"
                 doclink="http://www.dbvis.com/doclink/create-procedure">
            <Input label="Procedure Owner" name="procOwner" style="list">
               <Values>
                  <Command>
                     <SQL>
                        <![CDATA[
SELECT
    SCHEMANAME
FROM
    SYS.SYSSCHEMAS
ORDER BY
    SCHEMANAME
                        ]]>
                     </SQL>
                  </Command>
               </Values>
               <Default>${schema}</Default>
            </Input>
            <Input label="Procedure Name" name="procName" style="text"/>
            <Input label="External Name" name="externalName" style="text">
               <Default>com.foo.Bar</Default>
            </Input>

            <Input label="Parameters" style="separator"/>
            <Input name="parameters" style="grid">
               <Arg name="output" value="${direction} ${name} ${type}"/>
               <Arg name="newline" value=", "/>

               <Input name="direction" label="Direction" style="list">
                  <Values>IN|OUT|INOUT</Values>
                  <Default>IN</Default>
               </Input>
               <Input name="name" label="Name" style="text"/>
               <Input name="type" label="Type" style="text">
                  <Default>INTEGER</Default>
               </Input>
            </Input>

            <SetVar name="_parameters" value='#parameters.trim().equals("") ? "()" : "(" + #parameters + ")"'/>

            <Command exectype="asis">
               <SQL>
                  <![CDATA[
CREATE PROCEDURE "${procOwner}".${QB}${procName}${QE}
${_parameters}
LANGUAGE JAVA
PARAMETER STYLE JAVA
EXTERNAL NAME '${externalName}'
                  ]]>
               </SQL>
            </Command>
            <Confirm>
               Create procedure "${procOwner}".${procName}?
            </Confirm>
            <Result>
               Procedure "${procOwner}".${procName} created!
            </Result>
         </Action>
      </ActionGroup>
      
      <ActionGroup type="Procedure">
         <Action id="derby-procedure-drop" label="Drop Procedure" reload="true" icon="remove">
         <Input label="Schema" style="text" editable="false">
               <Default>${schema}</Default>
            </Input>
            <Input label="Procedure" style="text" editable="false">
               <Default>${objectname}</Default>
            </Input>
            <Command><SQL><![CDATA[drop procedure "${schema}"."${objectname}"]]></SQL></Command>
            <Confirm>
               Really drop procedure ${schema}.${objectname}?
            </Confirm>
            <Result>
               Procedure ${schema}.${objectname} dropped!
            </Result>
         </Action>
         
         <Action id="derby-procedure-export" label="Export Procedure" icon="export"
                 class="procedureExport"
                 doclink="http://www.dbvis.com/doclink/export-code-object"/>

         <Separator/>

         <Action id="derby-procedure-script" label="Script Procedure" icon="scriptObject"
                 class="sqlBuilder"
                 classargs="script-dialog,CALL,CREATE,DROP"/>

      </ActionGroup>

      <ActionGroup type="Trigger">
         <Action id="derby-trigger-drop" label="Drop Trigger" reload="true" icon="remove">
            <Input label="Schema" style="text" editable="false">
               <Default>${schema}</Default>
            </Input>
            <Input label="Trigger" style="text" editable="false">
               <Default>${objectname}</Default>
            </Input>
            <Command><SQL><![CDATA[drop trigger "${schema}"."${objectname}"]]></SQL></Command>
            <Confirm>
               Really drop trigger ${schema}.${objectname}?
            </Confirm>
            <Result>
               Trigger ${schema}.${objectname} dropped!
            </Result>
         </Action>
         
         <Action id="derby-trigger-export" label="Export Trigger" icon="export"
                 class="triggerExport"
                 doclink="http://www.dbvis.com/doclink/export-code-object"/>

      </ActionGroup>

   </ObjectsActionDef>

   <!-- =================================================================== -->
   <!-- Definition of the database objects tree structure -->
   <!-- =================================================================== -->

   <ObjectsTreeDef extends="false">

      <GroupNode type="Schemas" label="Schemas">
         <DataNode type="Schema" label="${derby.getSchemas.Schema}">
            <SetVar name="schema" value="${derby.getSchemas.Schema}"/>
            <SetVar name="schemaId" value="${derby.getSchemas.Schema Id}"/>
            <Command idref="derby.getSchemas">
               <Filter index="Schema" label="Name"/>
            </Command>

            <GroupNode type="Tables" label="Tables">
               <DataNode type="Table" label="${derby.getTables.Table Name}">
                  <SetVar name="objectname" value="${derby.getTables.Table Name}"/>
                  <SetVar name="rowcount" value="true"/>
                  <SetVar name="acceptInQB" value="true"/>
                  <Command idref="derby.getTables">
                     <Input name="schemaId" value="${schemaId}"/>
                     <Input name="tableType" value="'S','T'"/>
                  </Command>

                  <!-- Need to keep the objectname for the current table in
                       a new variable so that the viewers will be able to pick up
                       the correct input to display -->
                  <SetVar name="theTableName" value="${objectname}"/>

                  <!-- derby.getTriggers is used both to list all triggers in
                       the schema and triggers related to a specific table.
                       This variable is needed in order to either get all triggers
                       (even those not related to a table) or triggers that
                       really are associated with a table -->
                  <SetVar name="triggersCondition" value="and CAST(t.TABLENAME AS VARCHAR(1024)) = '${theTableName}'"/>
                  
                  <GroupNode type="Columns" label="Columns">
                     <DataNode type="Column" label="${getColumnDefinitions.COLUMN_NAME}"
                               label1="${getColumnDefinitions.TYPE_NAME}" isLeaf="true"
                               icon="#dataMap.get('getColumnDefinitions.IS_PRIMARY_KEY') eq true ? 'PrimaryKey' : 'Column'"
                               tip="#dataMap.get('getColumnDefinitions.IS_PRIMARY_KEY') eq true ? 'This is a primary key column' : ''">
                        <SetVar name="objectname" value="${getColumnDefinitions.COLUMN_NAME}"/>
                        <Command idref="getColumnDefinitions">
                           <Input name="catalog" value="${catalog}"/>
                           <Input name="objectname" value="${theTableName}"/>
                           <Input name="tableType" value="Table"/>
                           <Filter index="TYPE_NAME" label="Type"/>
                        </Command>
                     </DataNode>
                  </GroupNode>

                  <GroupNode type="Indexes" label="Indexes">
                     <DataNode type="Index" label="${derby.getIndexes.INDEX_NAME}"
                               label1="${derby.getIndexes.TABLE_SCHEMA}.${derby.getIndexes.TABLE_NAME}"
                               isLeaf="true">
                        <SetVar name="objectname" value="${derby.getIndexes.INDEX_NAME}"/>
                        <Command idref="derby.getIndexes">
                           <Input name="owner" value="${schema}"/>
                           <Input name="tableNamePattern" value="${theTableName}"/>
                           <Filter index="TABLE_NAME" label="Table Name"/>
                        </Command>
                     </DataNode>
                  </GroupNode>

                  <GroupNode type="Triggers" label="Triggers">
                     <DataNode type="Trigger" label="${derby.getTriggers.Trigger Name}" isLeaf="true">
                        <SetVar name="objectname" value="${derby.getTriggers.Trigger Name}"/>
                        <Command idref="derby.getTriggers">
                           <Input name="schemaId" value="${schemaId}"/>
                           <Input name="condition" value="${triggersCondition}"/>
                        </Command>
                     </DataNode>
                  </GroupNode>

               </DataNode>
            </GroupNode>

            <GroupNode type="Views" label="Views">
               <DataNode type="View" label="${derby.getTables.Table Name}">
                  <SetVar name="objectname" value="${derby.getTables.Table Name}"/>
                  <SetVar name="rowcount" value="true"/>
                  <SetVar name="acceptInQB" value="true"/>
                  <Command idref="derby.getTables">
                     <Input name="schemaId" value="${schemaId}"/>
                     <Input name="tableType" value="'V'"/>
                  </Command>
                  
                  <!-- Need to keep the objectname for the current table in
                       a new variable so that the viewers will be able to pick up
                       the correct input to display -->
                  <SetVar name="theTableName" value="${objectname}"/>
                  
                  <GroupNode type="Columns" label="Columns">
                     <DataNode type="Column" label="${getColumnDefinitions.COLUMN_NAME}"
                               label1="${getColumnDefinitions.TYPE_NAME}" isLeaf="true"
                               icon="#dataMap.get('getColumnDefinitions.IS_PRIMARY_KEY') eq true ? 'PrimaryKey' : 'Column'"
                               tip="#dataMap.get('getColumnDefinitions.IS_PRIMARY_KEY') eq true ? 'This is a primary key column' : ''">
                        <SetVar name="objectname" value="${getColumnDefinitions.COLUMN_NAME}"/>
                        <Command idref="getColumnDefinitions">
                           <Input name="catalog" value="${catalog}"/>
                           <Input name="objectname" value="${theTableName}"/>
                           <Input name="tableType" value="View"/>
                           <Filter index="TYPE_NAME" label="Type"/>
                        </Command>
                     </DataNode>
                  </GroupNode>
               </DataNode>
            </GroupNode>

            <If test="#util.isDatabaseVersionGTE(10,6)">
               <GroupNode type="Sequences" label="Sequences">
                  <DataNode type="Sequence" label="${derby.getSequences.Sequence Name}" isLeaf="true">
                     <SetVar name="objectname" value="${derby.getSequences.Sequence Name}"/>
                     <Command idref="derby.getSequences">
                        <Input name="schemaId" value="${schemaId}"/>
                        <Input name="sequenceName" value="%"/>
                     </Command>
                  </DataNode>
               </GroupNode>
            </If>

            <GroupNode type="Synonyms" label="Synonyms">
               <DataNode type="Synonym" label="${derby.getSynonyms.Synonym Name}"
                         label1="${derby.getSynonyms.Target Table}"
                         isLeaf="true">
                  <SetVar name="objectname" value="${derby.getSynonyms.Synonym Name}"/>
                  <SetVar name="rowcount" value="true"/>
                  <SetVar name="acceptInQB" value="true"/>
                  <Command idref="derby.getSynonyms">
                     <Input name="schemaId" value="${schemaId}"/>
                     <Filter index="Target Table" label="Table Name"/>
                  </Command>
               </DataNode>
            </GroupNode>

            <SetVar name="theTableName" value="%"/>

            <GroupNode type="Indexes" label="Indexes">
               <DataNode type="Index" label="${derby.getIndexes.INDEX_NAME}"
                         label1="${derby.getIndexes.TABLE_SCHEMA}.${derby.getIndexes.TABLE_NAME}"
                         isLeaf="true">
                  <SetVar name="objectname" value="${derby.getIndexes.INDEX_NAME}"/>
                  <Command idref="derby.getIndexes">
                     <Input name="owner" value="${schema}"/>
                     <Input name="tableNamePattern" value="%"/>
                     <Filter index="TABLE_NAME" label="Table Name"/>
                  </Command>
               </DataNode>
            </GroupNode>

            <GroupNode type="Functions" label="Functions">
               <DataNode type="Function" label="${derby.getFunctions.Name}" isLeaf="true">
                  <SetVar name="objectname" value="${derby.getFunctions.Name}"/>
                  <Command idref="derby.getFunctions">
                     <Input name="schemaId" value="${schemaId}"/>
                     <Input name="functionType" value="'F'"/>
                  </Command>
               </DataNode>
            </GroupNode>

            <GroupNode type="Procedures" label="Procedures">
               <DataNode type="Procedure" label="${derby.getFunctions.Name}" isLeaf="true">
                  <SetVar name="objectname" value="${derby.getFunctions.Name}"/>
                  <Command idref="derby.getFunctions">
                     <Input name="schemaId" value="${schemaId}"/>
                     <Input name="functionType" value="'P'"/>
                  </Command>
               </DataNode>
            </GroupNode>

            <!-- derby.getTriggers is used both to list all triggers in
                 the schema and triggers related to a specific table.
                 This variable is needed in order to either get all triggers
                 (even those not related to a table) or triggers that
                 really are associated with a table -->
            <SetVar name="triggersCondition" value=""/>
            
            <GroupNode type="Triggers" label="Triggers">
               <DataNode type="Trigger" label="${derby.getTriggers.Trigger Name}" isLeaf="true">
                  <SetVar name="objectname" value="${derby.getTriggers.Trigger Name}"/>
                  <Command idref="derby.getTriggers">
                     <Input name="schemaId" value="${schemaId}"/>
                     <Input name="condition" value=""/>
                  </Command>
               </DataNode>
            </GroupNode>
         </DataNode>
      </GroupNode>

   </ObjectsTreeDef>

   <!-- =================================================================== -->
   <!-- Definition of the database objects views -->
   <!-- =================================================================== -->

   <ObjectsViewDef extends="true">

      <ObjectView type="Schemas">
         <DataView id="generic-schemas-schemas" action="drop"/>

         <DataView id="derby-schemas-schemas" icon="Schemas" label="Schemas" viewer="grid">
            <Command idref="derby.getSchemas"/>
         </DataView>
      </ObjectView>

      <ObjectView type="Schema" action="drop"/>

      <ObjectView type="Tables">
         <DataView id="generic-tables-tables" action="drop"/>
         <DataView id="generic-tables-references" action="drop"/>

         <DataView id="derby-tables-tables" icon="Tables" label="Tables" viewer="grid">
            <Input name="menuItem" value="Open in New Tab...">
               <Input name="action" value="open-object-in-new-tab-command ${schema||Schema}${object||Table Name}"/>
            </Input>
            <Input name="menuItem" value="Open in Floating Tab...">
               <Input name="action" value="open-object-in-floating-tab-command ${schema||Schema}${object||Table Name}"/>
            </Input>
            <Input name="menuItem" value="Script: SELECT ALL">
                <Input name="command" value="select * from ${schema||Schema}${object||Table Name}"/>
             </Input>
             <Input name="menuItem" value="Script: DROP TABLE">
                <Input name="command" value="drop table ${schema||Schema}${object||Table Name}"/>
             </Input>

            <Command idref="derby.getTables">
               <Input name="schemaId" value="${schemaId}"/>
               <Input name="tableType" value="'T','S'"/>
            </Command>
         </DataView>
         <DataView id="derby-tables-references" icon="References" label="References" viewer="tables-refs"
                   doclink="http://www.dbvis.com/doclink/show-references">
            <Command idref="getTables">
               <Input name="schema" value="${schema}"/>
               <Input name="objectname" value="%"/>
               <Input name="tableType" value="TABLE,SYSTEM TABLE"/>
            </Command>
         </DataView>
      </ObjectView>

      <ObjectView type="Table">
         <DataView id="generic-table-grants" action="drop"/>

         <DataView id="generic-table-ddl">
            <Input name="formatSQL" value="true"/>
            <Message/>
         </DataView>
      </ObjectView>

      <ObjectView type="Indexes">
         <DataView id="generic-indexes-indexes" action="drop"/>

         <DataView id="derby-indexes-indexes" icon="Indexes" label="Indexes" viewer="grid">
            <Command idref="derby.getIndexes">
               <Input name="owner" value="${schema}"/>
               <Input name="tableNamePattern" value="${theTableName}"/>
            </Command>
         </DataView>
      </ObjectView>

      <ObjectView type="Index">
         <DataView id="generic-index-index" action="drop"/>

         <DataView id="derby-index-index" icon="Index" label="Index" viewer="node-form"/>
         <DataView id="derby-index-ddl" icon="Source" label="DDL" viewer="ddl">
            <Input name="objectType" value="Index"/>
            <Input name="formatSQL" value="true"/>
         </DataView>
      </ObjectView>

      <ObjectView type="Views">
         <DataView id="derby-views-views" icon="Views" label="Views" viewer="grid">
            <Input name="menuItem" value="Open in New Tab...">
               <Input name="action" value="open-object-in-new-tab-command ${schema||Schema}${object||Table Name}"/>
            </Input>
            <Input name="menuItem" value="Open in Floating Tab...">
               <Input name="action" value="open-object-in-floating-tab-command ${schema||Schema}${object||Table Name}"/>
            </Input>
            <Input name="menuItem" value="Script: SELECT ALL">
                <Input name="command" value="select * from ${schema||Schema}${object||Table Name}"/>
             </Input>
             <Input name="menuItem" value="Script: DROP VIEW">
                <Input name="command" value="drop view ${schema||Schema}${object||Table Name}"/>
             </Input>

            <Command idref="derby.getTables">
               <Input name="schemaId" value="${schemaId}"/>
               <Input name="tableType" value="'V'"/>
            </Command>
         </DataView>
      </ObjectView>

      <ObjectView type="View">
         <DataView id="derby-view-info" icon="Info" label="Info" viewer="node-form"/>
         <DataView id="derby-view-data" icon="Data" label="Data" viewer="table-data"/>
         <DataView id="derby-view-rowcount" icon="RowCount" label="Row Count" viewer="table-rowcount"/>
         <DataView id="derby-view-ddl" icon="Source" label="DDL" viewer="ddl">
            <Input name="objectType" value="View"/>
            <Input name="formatSQL" value="true"/>
         </DataView>
      </ObjectView>

      <ObjectView type="Sequences">
         <DataView id="derby-sequences-sequences" icon="Sequences" label="Sequences" viewer="grid">
            <Command idref="derby.getSequences">
               <Input name="schemaId" value="${schemaId}"/>
               <Input name="sequenceName" value="%"/>
            </Command>
         </DataView>
      </ObjectView>

      <ObjectView type="Sequence">
         <DataView id="derby-sequence-info" icon="Info" label="Info" viewer="form">
            <Command idref="derby.getSequences">
               <Input name="schemaId" value="${schemaId}"/>
               <Input name="sequenceName" value="${objectname}"/>
            </Command>
         </DataView>
      </ObjectView>

      <ObjectView type="Synonyms">
         <DataView id="derby-synonyms-synonyms" icon="Synonyms" label="Synonyms" viewer="grid">
            <Command idref="derby.getSynonyms">
               <Input name="schemaId" value="${schemaId}"/>
            </Command>
         </DataView>
      </ObjectView>

      <ObjectView type="Synonym">
         <DataView id="derby-synonym-info" icon="Info" label="Info" viewer="node-form"/>
      </ObjectView>

      <ObjectView type="Functions">
         <DataView id="derby-functions-functions" icon="Functions" label="Functions" viewer="grid">
            <Command idref="derby.getFunctions">
               <Input name="schemaId" value="${schemaId}"/>
               <Input name="functionType" value="'F'"/>
            </Command>
         </DataView>
      </ObjectView>

      <ObjectView type="Function">
         <DataView classargs="FUNCTION" id="derby-function-functioneditor" icon="SourceEditor" label="Function Editor" viewer="ProcedureViewer"
                   doclink="http://www.dbvis.com/doclink/edit-code-object"/>
         <DataView id="derby-function-info" icon="Info" label="Info" viewer="node-form"/>
      </ObjectView>

      <ObjectView type="Procedures">
         <DataView id="generic-procedures-procedures" action="drop"/>

         <DataView id="derby-procedures-procedures" icon="Procedures" label="Procedures" viewer="grid">
            <Command idref="derby.getFunctions">
               <Input name="schemaId" value="${schemaId}"/>
               <Input name="functionType" value="'P'"/>
            </Command>
         </DataView>
      </ObjectView>

      <ObjectView type="Procedure">
         <DataView id="generic-procedure-columns" action="drop"/>

         <DataView classargs="PROCEDURE" id="derby-procedure-procedureeditor" icon="SourceEditor" label="Procedure Editor" viewer="ProcedureViewer"
                   doclink="http://www.dbvis.com/doclink/edit-code-object"/>
         <DataView id="derby-procedure-info" icon="Info" label="Info" viewer="node-form"/>
      </ObjectView>

      <ObjectView type="Triggers">
         <DataView id="derby-triggers-triggers" icon="Triggers" label="Triggers" viewer="grid">
            <Command idref="derby.getTriggers">
               <Input name="schemaId" value="${schemaId}"/>
               <Input name="condition" value="${triggersCondition}"/>
            </Command>
         </DataView>
      </ObjectView>

      <ObjectView type="Trigger">
         <DataView classargs="TRIGGER" id="derby-trigger-triggereditor" icon="SourceEditor" label="Trigger Editor" viewer="ProcedureViewer"
                   doclink="http://www.dbvis.com/doclink/edit-code-object"/>
         <DataView id="derby-trigger-info" icon="Info" label="Info" viewer="node-form"/>
      </ObjectView>

   </ObjectsViewDef>

</DatabaseProfile>
