<?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 Yellowbrick"
   minver="9.5"
   extends="generic">

   <!-- Server version mappings -->
   <!--  3.3.5 == 3.3 -->

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

   <InitCommands extends="true">

   </InitCommands>

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

   <Commands extends="true">

      <Command id="yellowbrick.getCatalogs">
         <SQL>
            <![CDATA[
select * from pg_catalog.pg_database
            ]]>
         </SQL>
         <ProcessDataSet action="movecolumn" index="datname" value="first"/>
         <ProcessDataSet action="addrow" index="first" value="${#db.loginDatabase}"/>
         <ProcessDataSet action="distinct" index="1"/>
         <ProcessDataSet action="sortcolumn" index="1"/>
      </Command>

      <Command id="yellowbrick.getConnectableDatabases">
         <SQL>
            <![CDATA[
SELECT
    *
FROM
    pg_catalog.pg_database
WHERE
    datallowconn IS true
AND datistemplate IS false
             ]]>
         </SQL>
         <ProcessDataSet action="movecolumn" index="datname" value="first"/>
         <ProcessDataSet action="addrow" index="last" value="${#db.loginDatabase}"/>
         <ProcessDataSet action="distinct" index="1"/>
         <ProcessDataSet action="sortcolumn" index="1"/>
      </Command>

      <Command id="yellowbrick.getSchemas">
         <SQL>
            <![CDATA[
SELECT n.nspname                                         AS "Name",
       r.usename                                         AS "Owner",
       pg_catalog.obj_description(n.oid, 'pg_namespace') AS "Comment"
FROM pg_catalog.pg_namespace n
   LEFT JOIN pg_catalog.pg_user r ON n.nspowner= r.usesysid
            ]]>
         </SQL>
         <ProcessDataSet action="sortcolumn" index="1"/>
      </Command>

      <Command id="yellowbrick.getSchemaNames">
         <SQL>
            <![CDATA[
SELECT n.nspname                                         AS "Name",
       r.usename                                         AS "Owner",
       pg_catalog.obj_description(n.oid, 'pg_namespace') AS "Comment"
FROM pg_catalog.pg_namespace n
   LEFT JOIN pg_catalog.pg_user r ON n.nspowner= r.usesysid
            ]]>
         </SQL>
         <ProcessDataSet action="sortcolumn" index="1"/>
         <!--Must have Filter element here since this command is fetched from code-->
         <Filter index="Name" label="Name"/>
      </Command>

      <Command id="yellowbrick.getTables">
         <SQL>
            <![CDATA[
SELECT c.relname                                     AS "Name",
       n.nspname                                     AS "Schema",
       pg_get_userbyid(c.relowner)                   AS "Owner",
       t.spcname                                     AS "Tablespace",
       c.relhasrules                                 AS "Has Rules",
       c.relisshared                                 AS "Is Shared",
       c.relnatts                                    AS "N Cols",
       pg_catalog.obj_description(c.oid, 'pg_class') AS "Comment"
FROM   pg_class c
   LEFT JOIN pg_namespace n   ON n.oid = c.relnamespace
   LEFT JOIN pg_tablespace t  ON t.oid = c.reltablespace
WHERE n.nspname LIKE '${schema}'
AND   c.relname LIKE '${table}'
AND c.relkind in ('r'::"char")
AND relnatts > 0
            ]]>
         </SQL>
         <ProcessDataSet action="sortcolumn" index="2,1"/>

      </Command>

      <Command id="yellowbrick.getViews">
         <SQL>
            <![CDATA[
SELECT c.relname                                      AS "Name",
       n.nspname                                      AS "Schema",
       pg_get_userbyid(c.relowner)                    AS "Owner",
       t.spcname                                      AS "Tablespace",
       c.relhasrules                                  AS "Has Rules",
       c.relisshared                                  AS "Is Shared",
       c.relnatts                                     AS "N Cols",
       pg_catalog.obj_description(c.oid, 'pg_class')  AS "Comment"
FROM   pg_class c
   LEFT JOIN pg_namespace n   ON n.oid = c.relnamespace
   LEFT JOIN pg_tablespace t  ON t.oid = c.reltablespace
WHERE c.relkind = 'v'::"char"
AND   n.nspname LIKE '${schema}'
AND   c.relname LIKE '${table}'
            ]]>
         </SQL>
         <ProcessDataSet action="sortcolumn" index="2,1"/>
      </Command>

      <!-- Getting functions and procedures. (Functions kind ='f', Procedures kind = 'p'  -->
      <Command id="yellowbrick.getFunctions">
         <SQL>
            <![CDATA[
SELECT p.proname AS "Function Name",
       n.nspname AS "Schema Name",
      CASE WHEN p.proretset THEN 'setof ' ELSE '' END ||
      pg_catalog.format_type(p.prorettype, NULL) AS "Result data type",
      pg_catalog.oidvectortypes(p.proargtypes) AS "Argument data types",
      r.usename AS "Owner",
      l.lanname AS "Language",
      pg_catalog.obj_description(p.oid, 'pg_proc') AS "Comment"
FROM pg_catalog.pg_proc p
   LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace
   LEFT JOIN pg_catalog.pg_language l ON l.oid = p.prolang
   LEFT JOIN pg_catalog.pg_user r ON r.usesysid = p.proowner
WHERE p.prorettype <> 'pg_catalog.cstring'::pg_catalog.regtype
   AND (p.proargtypes[0] IS NULL
      OR   p.proargtypes[0] <> 'pg_catalog.cstring'::pg_catalog.regtype)
   AND NOT p.proisagg
   AND n.nspname LIKE '${schema}'
            ]]>
         </SQL>
         <ProcessDataSet action="sortcolumn" index="2,1,3,4"/>
      </Command>

      <Command id="yellowbrick.getFunctionSource">
         <SQL>
            <![CDATA[
SELECT p.prosrc as "Source code"
FROM pg_catalog.pg_proc p
   LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace
WHERE n.nspname = '${schema}'
AND p.proname = '${funcname}';
            ]]>
         </SQL>
      </Command>

      <Command id="yellowbrick.getSequences">
         <SQL>
            <![CDATA[
SELECT c.relname                                                           AS "Sequence Name",
       n.nspname                                                           AS "Schema Name",
       c.oid                                                               AS "Rel Id",
       (pg_stat_get_blocks_fetched(c.oid) - pg_stat_get_blocks_hit(c.oid)) AS "Blocks Read",
       pg_stat_get_blocks_hit(c.oid)                                       AS "Blocks Hit",
       pg_catalog.obj_description(c.oid, 'pg_class')                       AS "Comment"
FROM   pg_class c
   LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind = 'S'::"char"
AND n.nspname LIKE '${schema}'
            ]]>
         </SQL>
         <ProcessDataSet action="sortcolumn" index="2,1"/>
      </Command>

      <Command id="yellowbrick.getSequence">
         <SQL>
               <![CDATA[
SELECT sequence_name AS "Sequence Name",
       last_value    AS "Last Value",
       max_value     AS "Max Value",
       min_value     AS "Min Value",
       cache_value   AS "Cache Value",
       log_cnt       AS "Log Cnt",
       is_cycled     AS "Is Cycled",
       is_called     AS "Is Called"
FROM "${schema}"."${seqname}"
]]>
         </SQL>
      </Command>

      <!-- ================================================================= -->
      <!-- DBA related commands requiring certain privileges in the database -->
      <!-- ================================================================= -->

      <Command id="yellowbrick.getUsers">
         <SQL>
            <![CDATA[
select * from pg_user
            ]]>
         </SQL>
         <ProcessDataSet action="sortcolumn" index="1"/>
      </Command>

      <Command id="yellowbrick.getRoles">
         <SQL>
            <![CDATA[
select * from pg_roles
            ]]>
         </SQL>
         <ProcessDataSet action="sortcolumn" index="1"/>
      </Command>

      <Command id="yellowbrick.getSettings">
         <SQL>
            <![CDATA[
select * from pg_settings
            ]]>
         </SQL>
         <ProcessDataSet action="sortcolumn" index="1"/>
      </Command>

      <Command id="yellowbrick.getSessions">
         <SQL>
            <![CDATA[
select * from pg_stat_activity
            ]]>
         </SQL>
      </Command>

      <Command id="yellowbrick.getLocks">
         <SQL>
            <![CDATA[
select * from pg_locks
            ]]>
         </SQL>
      </Command>

      <Command id="yellowbrick.getPrivileges">
         <SQL>
            <![CDATA[
SELECT
    table_catalog as "TABLE_CAT",
    table_schema AS "TABLE_SCHEM",
    table_name AS "TABLE_NAME",
    grantor AS "GRANTOR",
    grantee AS "GRANTEE",
    privilege_type AS "PRIVILEGE",
    with_hierarchy AS "IS_GRANTABLE"
FROM
    information_schema.table_privileges
WHERE
    table_catalog = '${catalog}'
AND table_schema = '${schema}'
AND table_name = '${objectname}'
            ]]>
         </SQL>
         <ProcessDataSet action="sortcolumn" index="6"/>
      </Command>

   </Commands>

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

   <ObjectsActionDef extends="false">

      <ActionGroup type="Databases">
         <Action id="yellowbrick-database-create" label="Create Database" reload="true"
            resetcatalogs="true" icon="add">
            <Input label="New Database Name" name="newDatabase" style="text"/>
            <Input label="Owner" name="owner" style="list">
               <Values>
                  <Command>
                     <SQL>
                        <![CDATA[select '' union select usename from pg_catalog.pg_user]]>
                     </SQL>
                  </Command>
               </Values>
            </Input>

            <Input label="Encoding" name="encoding" style="list">
               <Values>LATIN9|UTF8</Values>
               <Default>LATIN9</Default>
            </Input>

            <Input label="Max Connections" name="connlimit" style="number">
               <Default>-1</Default>
            </Input>

            <SetVar name="_owner" value='#owner.equals("") ? "" : "owner = \&quot;" + #owner + "\&quot;"'/>
            <SetVar name="_encoding" value='#encoding.equals("") ? "" : "encoding = &apos;" + #encoding + "&apos;"'/>

            <SetVar name="_connlimit" value='#connlimit.equals("-1") ? "" : "connection limit = " + #connlimit'/>
            <Command>
               <SQL>
                  <![CDATA[create database ${QB}${newDatabase}${QE} ${_owner} ${_template} ${_encoding} ${_connlimit}]]></SQL>
            </Command>
            <Confirm>
               Confirm create of database ${newDatabase}?
            </Confirm>
            <Result>
               Database ${newDatabase} created!
            </Result>
         </Action>
      </ActionGroup>

      <ActionGroup type="Catalog">
         <Action id="yellowbrick-database-drop" label="Drop Database" reload="true"
            resetcatalogs="true" icon="remove">
            <Message>
               <![CDATA[<html>
A database can only be dropped if there are no physical connections to it.
Make sure that the database node has never been expanded since connect and
that no <b>Object View</b>, <b>SQL Commander</b> or <b>Monitor</b> is
using the database before dropping it.
</html>
               ]]>
            </Message>
            <Input label="Database" style="text" editable="false">
               <Default>${catalog}</Default>
            </Input>
            <Command>
               <SQL>
                  <![CDATA[                  
drop database "${catalog}";
                  ]]>
               </SQL>
            </Command>
            <Confirm>
               Really drop database ${catalog}?
            </Confirm>
            <Result>
               database ${catalog} has been dropped!
            </Result>
         </Action>
      </ActionGroup>

      <ActionGroup type="Schemas">
         <Action id="yellowbrick-schemas-create-schema" label="Create Schema" reload="true" resetschemas="true" icon="add">
            <Input label="Schema" name="newschema" style="text" editable="true"/>
            <Input label="Authorization" name="authorization" style="list">
               <Values>
                  <Command>
                     <SQL>
                        <![CDATA[select '' union select usename from pg_user]]></SQL>
                  </Command>
               </Values>
            </Input>

            <SetVar name="_authorization" value='#authorization.equals("") ? "" : " authorization " + #authorization'/>

            <Command>
               <SQL>
                  <![CDATA[create schema ${QB}${newschema}${QE}${_authorization}]]></SQL>
            </Command>
            <Confirm>
               Create new schema ${newschema}?
            </Confirm>
         </Action>
      </ActionGroup>

      <ActionGroup type="Schema">
         <Action id="yellowbrick-schema-drop" label="Drop Schema" reload="true" resetschemas="true" icon="remove">
            <Input label="Schema" style="text" editable="false">
               <Default>${schema}</Default>
            </Input>
            <Input label="Cascade" name="cascade" style="check">
               <Values>cascade</Values>
            </Input>
            <Command>
               <SQL><![CDATA[drop schema "${schema}" ${cascade}]]></SQL>
            </Command>
            <Confirm>
               Really drop schema ${schema}?
            </Confirm>
         </Action>
         <Action id="yellowbrick-schema-comment" label="Comment Schema" reload="true">
            <Input label="Schema" style="text" editable="false">
               <Default>${schema}</Default>
            </Input>
            <Input label="Comment" name="comment" style="wrapped-text-editor">
               <Default>${yellowbrick.getSchemas.Comment}</Default>
            </Input>
            <Command>
               <SQL>
                  <![CDATA[comment on schema "${schema}" is '${comment}']]></SQL>
            </Command>
            <Confirm>
               Apply new comment on ${schema}?
            </Confirm>
         </Action>
         <Action id="yellowbrick-schema-export" label="Export Schema"
            icon="export" reload="false"
            class="schemaExport"
            doclink="/doclink/export-schema"/>
      </ActionGroup>

      <ActionGroup type="Tables">
         <Action id="yellowbrick-tables-create-table" label="Create Table"
            icon="add" reload="true"
            class="tableCreate"
            classargs="create"
            doclink="/doclink/create-table"/>
         <Action id="yellowbrick-tables-import-table-data"
            label="Import Table Data"
            icon="import"
            reload="true"
            class="tableDataImport"
            doclink="/doclink/import-table"/>
      </ActionGroup>

      <ActionGroup type="Table">
         <Action id="yellowbrick-tables-alter-table" label="Alter Table"
            icon="edit" reload="true"
            class="tableAlter"
            classargs="alter"
            doclink="/doclink/alter-table"/>

         <Action id="yellowbrick-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[alter table "${schema}"."${objectname}" rename 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="yellowbrick-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>
            <Input label="Use Command" name="useCommand" style="radio">
               <Values>TRUNCATE|DELETE</Values>
               <Default>TRUNCATE</Default>
            </Input>

            <SetVar name="_command" value="#useCommand.equals('TRUNCATE') ? 'truncate table' : 'delete from'"/>

            <Command>
               <SQL><![CDATA[${_command} "${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="yellowbrick-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>
            <Input label="Drop Dependent Object(s)" name="cascade" style="check"
               tip="Automatically drop objects that depend on the table (such as views)">
               <Values>cascade</Values>
            </Input>
            <Command>
               <SQL>
                  <![CDATA[drop table "${schema}"."${objectname}" ${cascade}]]></SQL>
            </Command>
            <Confirm>
               Really drop table ${schema}.${objectname}?
            </Confirm>
            <Result>
               Table ${schema}.${objectname} has been dropped!
            </Result>
         </Action>

         <Action id="yellowbrick-table-comment" label="Comment 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>
            <Input label="Comment" name="comment" style="wrapped-text-editor">
               <Default>${yellowbrick.getTables.Comment}</Default>
            </Input>
            <Command>
               <SQL>
                  <![CDATA[comment on table "${schema}"."${objectname}" is '${comment}']]></SQL>
            </Command>
            <Confirm>
               Apply new comment on ${schema}.${objectname}?
            </Confirm>
         </Action>

         <Action id="yellowbrick-table-import-table-data" label="Import Table Data" icon="import"
            class="tableDataImport"
            doclink="/doclink/import-table"/>

         <Action id="yellowbrick-table-export" label="Export Table" icon="export"
            class="tableExport"
            doclink="/doclink/export-table"/>

         <Separator/>

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

      <ActionGroup type="Column">
         <Action id="yellowbrick-column-comment" label="Comment Column" reload="true">
            <Input label="Schema" style="text" editable="false">
               <Default>${schema}</Default>
            </Input>
            <Input label="Table" style="text" editable="false">
               <Default>${theTableName}</Default>
            </Input>
            <Input label="Column" style="text" editable="false">
               <Default>${objectname}</Default>
            </Input>
            <Input label="Comment" name="comment" style="wrapped-text-editor">
               <Default>${getColumnDefinitions.COMMENT}</Default>
            </Input>
            <Command>
               <SQL>
                  <![CDATA[comment on column "${schema}"."${theTableName}"."${objectname}" is '${comment}']]></SQL>
            </Command>
            <Confirm>
               Apply new comment on ${schema}.${theTableName}.${objectname}?
            </Confirm>
         </Action>
      </ActionGroup>

      <ActionGroup type="View">
         <Action id="yellowbrick-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>
            <Input label="Cascade" name="cascade" style="check">
               <Values>cascade</Values>
            </Input>
            <Command>
               <SQL>
                  <![CDATA[drop view "${schema}"."${objectname}" ${cascade}]]></SQL>
            </Command>
            <Confirm>
               Really drop view ${schema}.${objectname}?
            </Confirm>
            <Result>
               View ${schema}.${objectname} has been dropped!
            </Result>
         </Action>

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

         <Action id="yellowbrick-view-comment" label="Comment View" reload="true">
            <Input label="Schema" style="text" editable="false">
               <Default>${schema}</Default>
            </Input>
            <Input label="View" style="text" editable="false">
               <Default>${objectname}</Default>
            </Input>
            <Input label="Comment" name="comment" style="wrapped-text-editor">
               <Default>${yellowbrick.getViews.Comment}</Default>
            </Input>
            <Command>
               <SQL>
                  <![CDATA[comment on view "${schema}"."${objectname}" is '${comment}']]></SQL>
            </Command>
            <Confirm>
               Apply new comment on ${schema}.${objectname}?
            </Confirm>
         </Action>

         <Action id="yellowbrick-view-export" label="Export View" icon="export"
            class="viewExport"
            doclink="/doclink/export-view"/>

         <Separator/>

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

      <!-- Procedure actions -->
      <ActionGroup type="Procedures">
         <Action id="yellowbrick-procedures-create" label="Create Procedure" reload="true" icon="add"
            doclink="/doclink/create-procedure">
            <Input label="Schema" style="text" editable="false">
               <Default>${schema}</Default>
            </Input>
            <Input label="Procedure" name="procedureName" style="text"/>
            <Input label="Options" style="separator"/>
            <Input label="Parameters" style="separator"/>

            <Input name="parameters" style="grid">
               <Arg name="output" value="${QB}${name}${QE} ${type}"/>
               <Arg name="newline" value=", "/>

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

            <SetVar name="_parameters" value='#parameters.trim().equals("") ? "()" : "(" + #parameters + ")"'/>
            <Input label="Source" style="separator"/>
            <Input name="body" style="text-editor">
               <Default>RAISE INFO 'My procedure executed';</Default>
            </Input>
            <Command exectype="asis">
               <SQL>
                  <![CDATA[
CREATE PROCEDURE "${schema}".${QB}${procedureName}${QE}
${_parameters}
LANGUAGE plpgsql  
AS $body$
BEGIN
   ${body}
 END;
$body$
]]>
               </SQL>
            </Command>
            <Result>
               <![CDATA[Procedure "${schema}"."${procedureName}" created!]]>
            </Result>
         </Action>
      </ActionGroup>

      <ActionGroup type="Procedure">
         <Action id="yellowbrick-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>
            <Input label="Cascade" name="cascade" style="check">
               <Values>cascade</Values>
            </Input>
            <Command>
               <SQL>
                  <![CDATA[drop Procedure "${schema}"."${objectname}" (${yellowbrick.getFunctions.Argument data types}) ${cascade}]]></SQL>
            </Command>
            <Confirm>
               Really drop Procedure ${schema}.${objectname}?
            </Confirm>
            <Result>
               Procedure ${schema}.${objectname} dropped!
            </Result>
         </Action>

         <Action id="yellowbrick-procedure-rename" label="Rename Procedure" reload="true" icon="rename">
            <Input label="Schema" style="text" editable="false">
               <Default>${schema}</Default>
            </Input>
            <Input label="Procedure" style="text" editable="false">
               <Default>${objectname}</Default>
            </Input>
            <Input label="New Procedure Name" name="newProcedure" style="text"/>
            <Command>
               <SQL>
                  <![CDATA[alter procedure "${schema}"."${objectname}" (${yellowbrick.getFunctions.Argument data types}) rename to ${QB}${newProcedure}${QE}]]></SQL>
            </Command>
            <Confirm>
               Confirm rename of procedure ${objectname} to ${newProcedure}?
            </Confirm>
            <Result>
               Procedure ${objectname} renamed to ${newProcedure}!
            </Result>
         </Action>

         <Action id="yellowbrick-procedure-comment" label="Comment Procedure" reload="true">
            <Input label="Schema" style="text" editable="false">
               <Default>${schema}</Default>
            </Input>
            <Input label="Procedure" style="text" editable="false">
               <Default>${objectname}</Default>
            </Input>
            <Input label="Comment" name="comment" style="wrapped-text-editor">
               <Default>${yellowbrick.getFunctions.Comment}</Default>
            </Input>
            <Command>
               <SQL>
                  <![CDATA[comment on procedure "${schema}"."${objectname}" (${yellowbrick.getFunctions.Argument data types}) is '${comment}']]></SQL>
            </Command>
            <Confirm>
               Apply new comment on ${schema}.${getDDLName}?
            </Confirm>
         </Action>

         <Action id="yellowbrick-procedure-export" label="Export Procedure" icon="export"
            class="procedureExport"
            doclink="/doclink/export-code-object"/>

         <Separator/>

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

      <!-- End Procedure actions -->


      <ActionGroup type="Sequences">
         <Action id="yellowbrick-sequences-create" label="Create Sequence" reload="true" icon="add">
            <Input label="Sequence Owner" name="owner" style="list">
               <Values>
                  <Command>
                     <SQL>
                        <![CDATA[
SELECT trim(n.nspname) FROM pg_catalog.pg_namespace n LEFT JOIN pg_catalog.pg_user r ON n.nspowner=r.usesysid
WHERE n.nspname NOT IN ('pg_catalog', 'information_schema', 'pg_toast') ORDER BY 1;
                        ]]>
                     </SQL>
                  </Command>
               </Values>
               <Default>${schema}</Default>
            </Input>
            <Input label="Sequence Name" name="sequenceName" style="text"/>
            <Input label="Start With" name="startWith" style="text">
               <Default>1</Default>
            </Input>
            <Command>
               <SQL>
                  <![CDATA[create sequence "${owner}".${QB}${sequenceName}${QE} start with ${startWith} ]]></SQL>
            </Command>
            <Result>
               Sequence ${owner}.${sequenceName} created!
            </Result>
         </Action>
      </ActionGroup>

      <ActionGroup type="Sequence">
         <Action id="yellowbrick-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>
            <Input label="Cascade" name="cascade" style="check">
               <Values>cascade</Values>
            </Input>
            <Command>
               <SQL>
                  <![CDATA[drop sequence "${schema}"."${objectname}" ${cascade}]]></SQL>
            </Command>
            <Confirm>
               Really drop sequence ${schema}.${objectname}?
            </Confirm>
            <Result>
               Sequence ${schema}.${objectname} dropped!
            </Result>
         </Action>

         <Action id="yellowbrick-sequence-comment" label="Comment Sequence" reload="true">
            <Input label="Schema" style="text" editable="false">
               <Default>${schema}</Default>
            </Input>
            <Input label="Sequence" style="text" editable="false">
               <Default>${objectname}</Default>
            </Input>
            <Input label="Comment" name="comment" style="wrapped-text-editor">
               <Default>${yellowbrick.getSequences.Comment}</Default>
            </Input>
            <Command>
               <SQL>
                  <![CDATA[comment on sequence "${schema}"."${objectname}" is '${comment}']]></SQL>
            </Command>
            <Confirm>
               Apply new comment on ${schema}.${objectname}?
            </Confirm>
         </Action>
         
         <Separator/>

         <Action id="yellowbrick-sequence-script" label="Script Sequence" icon="scriptObject"
            class="sqlBuilder"
            classargs="script-dialog,CREATE,DROP"/>
      </ActionGroup>

      <ActionGroup type="Tablespaces">
         <Action id="yellowbrick-tablespace-create" label="Create Tablespace" reload="true" icon="add">
            <Input label="Tablespace Name" name="tablespace" style="text"/>
            <Input label="Owner" name="owner" style="list">
               <Values>
                  <Command>
                     <SQL>
                        <![CDATA[select '' union select rolname from pg_catalog.pg_roles order by 1]]>
                     </SQL>
                  </Command>
               </Values>
            </Input>
            <Input label="Location" name="location" style="text"/>
            <SetVar name="_owner" value='#owner.equals("") ? "" : "owner \&quot;" + #owner + "\&quot;"'/>
            <Command>
               <SQL>
                  <![CDATA[create tablespace ${QB}${tablespace}${QE} ${_owner} location '${location}']]></SQL>
            </Command>
            <Confirm>
               Confirm create of tablespace ${tablespace}?
            </Confirm>
         </Action>
      </ActionGroup>

      <ActionGroup type="Tablespace">
         <Action id="yellowbrick-tablespace-drop" label="Drop Tablespace" reload="true" icon="remove">
            <Input label="Tablespace Name" style="text" editable="false">
               <Default>${objectname}</Default>
            </Input>
            <Command>
               <SQL><![CDATA[drop tablespace "${objectname}"]]></SQL>
            </Command>
            <Confirm>
               Really drop tablespace ${objectname}?
            </Confirm>
         </Action>
      </ActionGroup>

      <ActionGroup type="Settings">

         <If test="#util.isDatabaseVersionGTE(3,3)">
            <Action id="yellowbrick-settings-alter" label="Alter Setting" reload="true" icon="edit">
               <Input name="setting" label="Setting" runsetdefaultwhenvaluechanged="value,desc" style="list" linebreak="false">
                  <Values>
                     <Command>
                        <SQL><![CDATA[select name from pg_settings]]></SQL>
                     </Command>
                  </Values>
               </Input>
               <Input name="value" label="Value" style="text" linebreak="true">
                  <Default>
                     <Command>
                        <SQL>
                           <![CDATA[select setting from pg_settings where name = '${setting}']]></SQL>
                     </Command>
                  </Default>
               </Input>
               <Input label="Description" name="desc" style="text-editor" editable="false">
                  <Default>
                     <Command>
                        <SQL>
                           <![CDATA[select short_desc from pg_settings where name = '${setting}']]></SQL>
                     </Command>
                  </Default>
               </Input>
               <Input label="Apply Immediately" name="apply" style="check">
                  <Values>select pg_reload_conf();</Values>
                  <Default>true</Default>
               </Input>
               <Command>
                  <SQL>
                     <![CDATA[
alter system set ${setting} = '${value}';
${apply}
                     ]]>
                  </SQL>
               </Command>
               <Confirm>
                  Really alter setting ${setting}?
               </Confirm>
            </Action>

            <Action id="yellowbrick-settings-reset-all" label="Reset All" reload="true" icon="edit">
               <Input label="Apply Immediately" name="apply" style="check">
                  <Values>select pg_reload_conf();</Values>
                  <Default>true</Default>
               </Input>
               <Command>
                  <SQL>
                     <![CDATA[
alter system reset all;
${apply}
                    ]]>
                  </SQL>
               </Command>
               <Confirm>
                  Really reset all settings modified with Alter Setting or ALTER
                  SYSTEM?
               </Confirm>
            </Action>
         </If>

         <Action id="yellowbrick-reload-config" label="Reload Configuration">
            <Command>
               <SQL>
                  <![CDATA[
select pg_reload_conf();
                    ]]>
               </SQL>
            </Command>
            <Confirm>
               Really reload the configuration settings?
            </Confirm>
         </Action>
      </ActionGroup>

      <ActionGroup type="Users">
         <Action id="yellowbrick-users-create-user" label="Create User" reload="true" icon="add">
            <Input label="User" name="newuser" style="text" editable="true"/>
            <Input label="Password" name="password" style="text" editable="true"/>
            <Input label="In Role" name="role" style="list">
               <Values>
                  <Command>
                     <SQL>
                        <![CDATA[select '' union select rolname from pg_roles]]></SQL>
                  </Command>
               </Values>
            </Input>
            <SetVar name="_role" value='#role.equals("") ? "" : "in role " + "\""+ #role + "\""'/>
            
            <Input label="Create DB" name="createdb" style="check">
               <Values>CREATEDB</Values>
            </Input>
            <Input label="Create Role" name="createrole" style="check">
               <Values>CREATEROLE</Values>
            </Input>
            <Input label="Inherit" name="inherit" style="check">
               <Values>INHERIT</Values>
            </Input>
            <Input label="Super User" name="superuser" style="check">
               <Values>SUPERUSER</Values>
            </Input>
            <Input label="Login" name="login" style="check">
               <Values>LOGIN|NOLOGIN</Values>
                 <Default>LOGIN</Default>
            </Input>
            <Input label="Connection Limit" name="connectionlimit" style="number">
                 <Default>-1</Default>
            </Input>

            <SetVar name="_connectlimit" value="#connectionlimit > 0 ? 'CONNECTION LIMIT ' +  #connectionlimit  : ''"/>

            <Command>
               <SQL>
                  <![CDATA[create user ${QB}${newuser}${QE} with password '${password}' ${_role} ${createdb} ${superuser} ${login} ${_connectlimit} ${inherit}]]></SQL>
            </Command>
            <Confirm>
               Create new user ${newuser}?
            </Confirm>
         </Action>
      </ActionGroup>

      <ActionGroup type="User">
         <Action id="yellowbrick-user-drop-user" label="Drop User" reload="true" icon="remove">
            <Input label="User" style="text" editable="false">
               <Default>${objectname}</Default>
            </Input>

            <Command>
               <SQL><![CDATA[drop user "${objectname}"]]></SQL>
            </Command>
            <Confirm>
               Really drop user ${objectname}?
            </Confirm>
         </Action>
      </ActionGroup>

      <ActionGroup type="Roles">
        <Action id="yellowbrick-roles-create-role" label="Create Role" reload="true" icon="add">
           <Input label="Role" name="newrole" style="text" editable="true"/>
           <Input label="Password" name="password" style="text" editable="true"/>
           <Input label="In Role" name="role" style="list">
              <Values>
                 <Command>
                    <SQL>
                       <![CDATA[select '' union select rolname from pg_roles]]></SQL>
                 </Command>
              </Values>
           </Input>
           <SetVar name="_role" value='#role.equals("") ? "" : "in role " + "\""+ #role + "\""'/>

           <Input label="Create DB" name="createdb" style="check">
              <Values>CREATEDB</Values>
           </Input>
           <Input label="Create Role" name="createrole" style="check">
              <Values>CREATEROLE</Values>
           </Input>
           <Input label="Inherit" name="inherit" style="check">
              <Values>INHERIT</Values>
           </Input>
           <Input label="Super User" name="superuser" style="check">
              <Values>SUPERUSER</Values>
           </Input>
           <Input label="Login" name="login" style="check">
               <Values>LOGIN|NOLOGIN</Values>
              <!-- NO LOGIN Default for role -->
              <Default>NOLOGIN</Default>
           </Input>
           <Input label="Connection Limit" name="connectionlimit" style="number">
                <Default>-1</Default>
           </Input>

           <SetVar name="_connectlimit" value="#connectionlimit > 0 ? 'CONNECTION LIMIT ' +  #connectionlimit  : ''"/>

           <Command>
              <SQL>
                <![CDATA[create role ${QB}${newrole}${QE} with password '${password}' ${_role} ${createdb} ${superuser} ${login} ${_connectlimit} ${inherit}]]></SQL>
           </Command>
           <Confirm>
              Create new role ${newrole}?
           </Confirm>
        </Action>
     </ActionGroup>

     <ActionGroup type="Role">
       <Action id="yellowbrick-role-drop-role" label="Drop Role" reload="true" icon="remove">
         <Input label="User" style="text" editable="false">
            <Default>${objectname}</Default>
         </Input>

         <Command>
            <SQL><![CDATA[drop role "${objectname}"]]></SQL>
         </Command>
         <Confirm>
            Really drop role ${objectname}?
         </Confirm>
      </Action>
     </ActionGroup>

   </ObjectsActionDef>

   <!-- =================================================================== -->
   <!-- Definition of the database objects tree structure -->
   <!-- PostgreSQL only allows browsing default database specified in the -->
   <!-- URL. This definition simply makes non default databases  -->
   <!-- e.g catalogs as leaf nodes. -->
   <!-- All nodes below the default database is listed as owner.object -->
   <!-- =================================================================== -->

   <ObjectsTreeDef extends="false">

      <GroupNode type="Databases" label="Databases">
         <DataNode type="Catalog" label="${yellowbrick.getConnectableDatabases.datname}" is-catalog-database="true">
            <SetVar name="catalog" value="${yellowbrick.getConnectableDatabases.datname}"/>
            <Command idref="yellowbrick.getConnectableDatabases">
               <Filter index="datname" label="Name"/>
            </Command>

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

                  <GroupNode type="Tables" label="Tables">
                     <DataNode type="Table" label="${yellowbrick.getTables.Name}">
                        <SetVar name="objectname" value="${yellowbrick.getTables.Name}"/>
                        <SetVar name="rowcount" value="true"/>
                        <SetVar name="acceptInQB" value="true"/>
                        <Command idref="yellowbrick.getTables">
                           <Input name="schema" value="${schema}"/>
                           <Input name="table" value="%"/>
                        </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="schema" value="${schema}"/>
                                 <Input name="objectname" value="${theTableName}"/>
                                 <Input name="tableType" value="Table"/>
                                 <Filter index="TYPE_NAME" label="Type"/>
                              </Command>
                           </DataNode>
                        </GroupNode>

                     </DataNode>
                  </GroupNode>

                  <GroupNode type="Views" label="Views">
                     <DataNode type="View" label="${yellowbrick.getViews.Name}">
                        <SetVar name="objectname" value="${yellowbrick.getViews.Name}"/>
                        <SetVar name="rowcount" value="true"/>
                        <SetVar name="acceptInQB" value="true"/>
                        <Command idref="yellowbrick.getViews">
                           <Input name="schema" value="${schema}"/>
                           <Input name="table" value="%"/>
                        </Command>

                        <!-- Need to keep the objectname for the current view 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">
                              <SetVar name="objectname" value="${getColumnDefinitions.COLUMN_NAME}"/>
                              <Command idref="getColumnDefinitions">
                                 <Input name="catalog" value="${catalog}"/>
                                 <Input name="schema" value="${schema}"/>
                                 <Input name="objectname" value="${theTableName}"/>
                                 <Input name="tableType" value="View"/>
                                 <Filter index="TYPE_NAME" label="Type"/>
                              </Command>
                           </DataNode>
                        </GroupNode>
                     </DataNode>
                  </GroupNode>
                  

                  <SetVar name="theTableName" value="%"/>
                  <!-- Can see CREATE PROCEDURE in the 3.3.5 manual https://www.yellowbrick.com/docs/3.3.5/ybd_sqlref/create_procedure.html -->
                  <!-- As they state that the last number denotes compatible changes -->
                  <If test="#util.isDatabaseVersionGTE(3,3)">
                     <GroupNode type="Procedures" label="Procedures">
                        <DataNode type="Procedure" label="${yellowbrick.getFunctions.Procedure Name} (${yellowbrick.getFunctions.Argument data types})"
                           isLeaf="true">
                           <SetVar name="objectname" value="${yellowbrick.getFunctions.Procedure Name}"/>
                           <SetVar name="getDDLName" value="${yellowbrick.getFunctions.Procedure Name} (${yellowbrick.getFunctions.Argument data types})"/>
                           <Command idref="yellowbrick.getFunctions">
                              <Input name="schema" value="${schema}"/>
                              <Input name="kind" value="p"/>
                              <ProcessDataSet action="renamecolumn" index="Function Name" value="Procedure Name"/>
                           </Command>
                        </DataNode>
                     </GroupNode>
                  </If>

                  <GroupNode type="Sequences" label="Sequences">
                     <DataNode type="Sequence" label="${yellowbrick.getSequences.Sequence Name}" isLeaf="true">
                        <SetVar name="schema" value="${yellowbrick.getSequences.Schema Name}"/>
                        <SetVar name="objectname" value="${yellowbrick.getSequences.Sequence Name}"/>
                        <Command idref="yellowbrick.getSequences"/>
                     </DataNode>
                  </GroupNode>

               </DataNode>
            </GroupNode>

         </DataNode>
      </GroupNode>

      <!-- ================================================================= -->
      <!-- DBA Nodes -->
      <!-- ================================================================= -->

      <GroupNode type="DBA" label="DBA Views">
         <GroupNode type="Users" label="Users">
            <DataNode type="User" label="${yellowbrick.getUsers.usename}" isLeaf="true">
               <SetVar name="objectname" value="${yellowbrick.getUsers.usename}"/>
               <Command idref="yellowbrick.getUsers"/>
            </DataNode>
         </GroupNode>
         <GroupNode type="Roles" label="Roles">
            <DataNode type="Role" label="${yellowbrick.getRoles.rolname}" isLeaf="true">
               <SetVar name="objectname" value="${yellowbrick.getRoles.rolname}"/>
               <Command idref="yellowbrick.getRoles"/>
            </DataNode>
         </GroupNode>
         <GroupNode type="Settings" label="Settings" isLeaf="true"/>
         <GroupNode type="Locks" label="Locks" isLeaf="true"/>
         <GroupNode type="Sessions" label="Sessions" isLeaf="true"/>

      </GroupNode>

   </ObjectsTreeDef>

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

   <ObjectsViewDef extends="true">

      <ObjectView type="Databases">
         <DataView id="yellowbrick-databases-databases" icon="Catalog" label="Databases" viewer="grid">
            <Command idref="yellowbrick.getCatalogs"/>
            <Message>
               <![CDATA[
<html>
List of all available databases in the database server. 
</html>
               ]]>
            </Message>
         </DataView>
      </ObjectView>

      <ObjectView type="Catalog" drop-on-condition="always"/>

      <ObjectView type="Schemas">
         <DataView id="generic-schemas-schemas" drop-on-condition="always"/>

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

      <ObjectView type="Schema">
         <DataView id="generic-schema-tables" drop-on-condition="always"/>
         <DataView id="generic-schema-references" drop-on-condition="always"/>

         <DataView id="yellowbrick-schema-info" icon="Info" label="Info" viewer="node-form"/>
      </ObjectView>

      <ObjectView type="Tables">
         <DataView id="generic-tables-tables" drop-on-condition="always"/>
         <DataView id="generic-tables-references" drop-on-condition="always"/>

         <DataView id="yellowbrick-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||Name}"/>
            </Input>
            <Input name="menuItem" value="Open in Floating Tab...">
               <Input name="action" value="open-object-in-floating-tab-command ${schema||Schema}${object||Name}"/>
            </Input>
            <Input name="menuItem" value="Script: SELECT ALL">
               <Input name="command" value="select * from ${schema||Schema}${object||Name}"/>
            </Input>
            <Input name="menuItem" value="Script: DROP TABLE">
               <Input name="command" value="drop table ${schema||Schema}${object||Name}"/>
            </Input>

            <Command idref="yellowbrick.getTables">
               <Input name="schema" value="${schema}"/>
               <Input name="table" value="%"/>
            </Command>
         </DataView>
         <DataView id="yellowbrick-tables-references" icon="References" label="References" viewer="tables-refs"
            doclink="/doclink/show-references">
            <Command idref="getTables">
               <Input name="catalog" value="${catalog}"/>
               <Input name="schema" value="${schema}"/>
               <Input name="objectname" value="%"/>
               <Input name="tableType" value="SYSTEM TABLE,TABLE"/>
            </Command>
         </DataView>
      </ObjectView>

      <ObjectView type="Table">
         <DataView id="generic-table-info" drop-on-condition="always"/>

         <DataView id="yellowbrick-table-info" icon="Info" label="Info" viewer="form" order-before="0">
            <Command idref="yellowbrick.getTables">
               <Input name="schema" value="${schema}"/>
               <Input name="table" value="${objectname}"/>
            </Command>
         </DataView>
         <DataView id="generic-table-ddl">
            <Input name="formatSQL" value="true"/>
            <Message/>
         </DataView>
      </ObjectView>

      <ObjectView type="Views">
         <DataView id="yellowbrick-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||Name}"/>
            </Input>
            <Input name="menuItem" value="Open in Floating Tab...">
               <Input name="action" value="open-object-in-floating-tab-command ${schema||Schema}${object||Name}"/>
            </Input>
            <Input name="menuItem" value="Script: SELECT ALL">
               <Input name="command" value="select * from ${schema||Schema}${object||Name}"/>
            </Input>
            <Input name="menuItem" value="Script: DROP VIEW">
               <Input name="command" value="drop view ${schema||Schema}${object||Name}"/>
            </Input>

            <Command idref="yellowbrick.getViews">
               <Input name="schema" value="${schema}"/>
               <Input name="table" value="%"/>
            </Command>
         </DataView>
      </ObjectView>

      <ObjectView type="View">
         <DataView id="yellowbrick-view-info" icon="Info" label="Info" viewer="form">
            <Command idref="yellowbrick.getViews">
               <Input name="schema" value="${schema}"/>
               <Input name="table" value="${objectname}"/>
            </Command>
         </DataView>
         <DataView id="yellowbrick-view-columns" icon="Columns" label="Columns" viewer="grid">
            <Command idref="getColumns">
               <Input name="catalog" value="${catalog}"/>
               <Input name="schema" value="${schema}"/>
               <Input name="objectname" value="${objectname}"/>
            </Command>
         </DataView>
         <DataView id="yellowbrick-view-data" icon="Data" label="Data" viewer="table-data" doclink="/doclink/table-data"/>
         <DataView id="yellowbrick-view-rowcount" icon="RowCount" label="Row Count" viewer="table-rowcount"/>
         <DataView id="yellowbrick-view-grants" icon="TablePrivileges" label="Grants" viewer="grid">
            <Command idref="yellowbrick.getPrivileges">
               <Input name="catalog" value="${catalog}"/>
               <Input name="schema" value="${schema}"/>
               <Input name="objectname" value="${objectname}"/>
            </Command>
         </DataView>
         <DataView id="yellowbrick-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="yellowbrick-sequences-sequences" icon="Sequences" label="Sequences" viewer="grid">
            <Command idref="yellowbrick.getSequences"/>
         </DataView>
      </ObjectView>

      <ObjectView type="Sequence">
         <DataView id="yellowbrick-sequence-info" icon="Info" label="Info" viewer="form">
            <Command idref="yellowbrick.getSequence">
               <Input name="schema" value="${schema}"/>
               <Input name="seqname" value="${objectname}"/>
            </Command>
         </DataView>
         <DataView id="yellowbrick-sequence-ddl" icon="Source" label="DDL" viewer="ddl">
            <Input name="objectType" value="Sequence"/>
            <Input name="formatSQL" value="true"/>
         </DataView>
      </ObjectView>
      
      <ObjectView type="Procedures">
         <DataView id="generic-procedures-procedures" drop-on-condition="always"/>

         <DataView id="yellowbrick-procedures-Procedures" icon="Procedures" label="Procedures" viewer="grid">
            <Command idref="yellowbrick.getFunctions">
               <Input name="schema" value="${schema}"/>
               <Input name="kind" value="p"/>
            </Command>
         </DataView>
      </ObjectView>
      
      <ObjectView type="Procedure">
         <DataView id="generic-procedure-columns" drop-on-condition="always"/>

         <DataView classargs="PROCEDURE" id="yellowbrick-procedure-procedureeditor" icon="SourceEditor" label="Procedure Editor" viewer="procedure-editor"
            doclink="/doclink/edit-code-object">
         </DataView>
         <DataView id="yellowbrick-procedure-info" icon="Info" label="Info" viewer="node-form"/>
      </ObjectView>

      <!-- DBA views -->
      <ObjectView type="Users">
         <DataView id="yellowbrick-users-users" icon="Users" label="Users" viewer="grid">
            <Command idref="yellowbrick.getUsers"/>
         </DataView>
      </ObjectView>

      <ObjectView type="User">
         <DataView id="yellowbrick-user-info" icon="Info" label="Info" viewer="node-form"/>
      </ObjectView>

      <ObjectView type="Roles">
         <DataView id="yellowbrick-roles-roles" icon="Roles" label="Roles" viewer="grid">
            <Command idref="yellowbrick.getRoles"/>
         </DataView>
      </ObjectView>

      <ObjectView type="Role">
         <DataView id="yellowbrick-role-info" icon="Info" label="Info" viewer="node-form"/>
      </ObjectView>

      <ObjectView type="Settings">
         <DataView id="yellowbrick-settings-settings" icon="Settings" label="Settings" viewer="grid">
            <Command idref="yellowbrick.getSettings"/>
         </DataView>
      </ObjectView>

      <ObjectView type="Sessions">
         <DataView id="yellowbrick-sessions-sessions" icon="Sessions" label="Sessions" viewer="grid">
            <Command idref="yellowbrick.getSessions"/>
         </DataView>
      </ObjectView>

      <ObjectView type="Locks">
         <DataView id="yellowbrick-locks-locks" icon="Locks" label="Locks" viewer="grid">
            <Command idref="yellowbrick.getLocks"/>
         </DataView>
      </ObjectView>

   </ObjectsViewDef>

</DatabaseProfile>
