<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2017 Evolveum
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<resource oid="04afeda6-394b-11e6-8cbe-abf7ff430056"
    xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
    xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"
    xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"
    xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"
    xmlns:icfc="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3"
    xmlns:my="http://myself.me/schemas/whatever">

       <name>Localhost PostgreSQL DBTable</name>

    <connectorRef type="ConnectorType">
        <filter>
            <q:text>c:connectorType = "org.identityconnectors.databasetable.DatabaseTableConnector"</q:text>
          </filter>
    </connectorRef>

    <connectorConfiguration>

        <icfc:configurationProperties
        xmlns:icscdbtable="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/bundle/com.evolveum.polygon.connector-databasetable/org.identityconnectors.databasetable.DatabaseTableConnector">
            <icscdbtable:port>5432</icscdbtable:port>
            <icscdbtable:host>localhost</icscdbtable:host>
            <icscdbtable:user>midpoint_tests</icscdbtable:user>
            <icscdbtable:password><clearValue>secret</clearValue></icscdbtable:password>
            <icscdbtable:database>midpoint_tests</icscdbtable:database>
            <icscdbtable:table>idrepo</icscdbtable:table>
            <icscdbtable:keyColumn>userId</icscdbtable:keyColumn>
            <icscdbtable:passwordColumn>password</icscdbtable:passwordColumn>
            <icscdbtable:jdbcDriver>org.postgresql.Driver</icscdbtable:jdbcDriver>
            <icscdbtable:jdbcUrlTemplate>jdbc:postgresql://%h:%p/%d</icscdbtable:jdbcUrlTemplate>
            <icscdbtable:enableEmptyString>false</icscdbtable:enableEmptyString>
            <icscdbtable:rethrowAllSQLExceptions>true</icscdbtable:rethrowAllSQLExceptions>
            <icscdbtable:nativeTimestamps>false</icscdbtable:nativeTimestamps>
            <icscdbtable:allNative>false</icscdbtable:allNative>
        </icfc:configurationProperties>

    </connectorConfiguration>

    <schemaHandling>

        <objectType>
            <displayName>Default Account</displayName>
            <default>true</default>
            <objectClass>ri:AccountObjectClass</objectClass>
            <attribute>
                <ref>icfs:uid</ref>
                <displayName>User ID</displayName>
                <limitations>
                    <access>
                        <read>true</read>
                    </access>
                </limitations>
            </attribute>
            <attribute>
                <ref>icfs:name</ref>
                <displayName>Name</displayName>
                <limitations>
                    <minOccurs>0</minOccurs>
                    <access>
                           <read>true</read>
                        <add>true</add>
                        <modify>true</modify>
                    </access>
                </limitations>
                <outbound>
                    <source>
                        <path>$user/name</path>
                    </source>
                </outbound>
            </attribute>

            <attribute>
                <ref>ri:firstname</ref>
                <displayName>First name</displayName>
                <outbound>
                    <source>
                        <path>$user/givenName</path>
                    </source>
                </outbound>

            </attribute>
            <attribute>
                <ref>ri:lastname</ref>
                <displayName>Last name</displayName>
                <outbound>
                    <source>
                        <path>$user/familyName</path>
                    </source>
                </outbound>

            </attribute>
            <attribute>
                <ref>ri:fullname</ref>
                <displayName>Full name</displayName>
                <outbound>
                    <source>
                        <path>$user/fullName</path>
                    </source>
                </outbound>
            </attribute>

            <activation>
                <administrativeStatus>
                    <outbound/>
                </administrativeStatus>
            </activation>

            <credentials>
                <password>
                    <outbound/>
                </password>
            </credentials>

        </objectType>
    </schemaHandling>

    <capabilities xmlns:cap="http://midpoint.evolveum.com/xml/ns/public/resource/capabilities-3">
        <configured>
            <cap:activation>
                <cap:status>
                    <cap:attribute>ri:disabled</cap:attribute>
                    <cap:enableValue></cap:enableValue>
                    <cap:enableValue>false</cap:enableValue>
                    <cap:disableValue>true</cap:disableValue>
                </cap:status>
            </cap:activation>
        </configured>
    </capabilities>

</resource>
