<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you 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.
-->

<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
    <description>Party Component Services</description>
    <vendor>OFBiz</vendor>
    <version>1.0</version>

    <!-- Party view services -->
    <service name="findParty" engine="java"
        location="org.apache.ofbiz.party.party.PartyServices" invoke="findParty">
        <description>General Party Find Service, Used in the findparty page in the Party Manager, etc</description>
        <attribute name="extInfo" type="String" mode="IN" optional="true"/>
        <attribute name="roleTypeId" type="String" mode="IN" optional="true"/> <!-- can be null or ANY to include any -->
        <attribute name="VIEW_INDEX" type="String" mode="IN" optional="true"/>
        <attribute name="VIEW_SIZE" type="String" mode="IN" optional="true"/>
        <attribute name="lookupFlag" type="String" mode="IN" optional="true"/>
        <attribute name="showAll" type="String" mode="IN" optional="true"/>
        <attribute name="partyId" type="String" mode="IN" optional="true"/> <!-- does a LIKE compare on this, can do partial, case insensitive, etc -->
        <attribute name="partyTypeId" type="String" mode="IN" optional="true"/>
        <attribute name="userLoginId" type="String" mode="IN" optional="true"/> <!-- does a LIKE compare on this, can do partial, case insensitive, etc -->
        <attribute name="groupName" type="String" mode="IN" optional="true"/>
        <attribute name="firstName" type="String" mode="IN" optional="true"/>
        <attribute name="lastName" type="String" mode="IN" optional="true"/>
        <attribute name="address1" type="String" mode="IN" optional="true"/>
        <attribute name="address2" type="String" mode="IN" optional="true"/>
        <attribute name="city" type="String" mode="IN" optional="true"/>
        <attribute name="stateProvinceGeoId" type="String" mode="IN" optional="true"/>
        <attribute name="postalCode" type="String" mode="IN" optional="true"/>
        <attribute name="infoString" type="String" mode="IN" optional="true"/> <!-- the ContactMech infoString -->
        <attribute name="countryCode" type="String" mode="IN" optional="true"/>
        <attribute name="areaCode" type="String" mode="IN" optional="true"/>
        <attribute name="contactNumber" type="String" mode="IN" optional="true"/>
        <attribute name="inventoryItemId" type="String" mode="IN" optional="true"/> <!-- does a LIKE compare on this -->
        <attribute name="serialNumber" type="String" mode="IN" optional="true"/> <!-- does a LIKE compare on this -->
        <attribute name="softIdentifier" type="String" mode="IN" optional="true"/> <!-- does a LIKE compare on this -->
        <attribute name="partyRelationshipTypeId" type="String" mode="IN" optional="true"/>
        <attribute name="ownerPartyIds" type="List" mode="IN" optional="true"/><!-- Lead Owners Parties -->
        <attribute name="sortField" type="String" mode="IN" optional="true"/>

        <attribute name="roleTypes" type="List" mode="OUT" optional="false"/>
        <attribute name="partyTypes" type="List" mode="OUT" optional="false"/>
        <attribute name="currentRole" type="org.apache.ofbiz.entity.GenericValue" mode="OUT" optional="true"/>
        <attribute name="currentPartyType" type="org.apache.ofbiz.entity.GenericValue" mode="OUT" optional="true"/>
        <attribute name="currentStateGeo" type="org.apache.ofbiz.entity.GenericValue" mode="OUT" optional="true"/>
        <attribute name="viewIndex" type="Integer" mode="OUT" optional="false"/>
        <attribute name="viewSize" type="Integer" mode="OUT" optional="false"/>
        <attribute name="partyList" type="List" mode="OUT" optional="false"/>
        <attribute name="partyListSize" type="Integer" mode="OUT" optional="false"/>
        <attribute name="paramList" type="String" mode="OUT" optional="false"/>
        <attribute name="highIndex" type="Integer" mode="OUT" optional="false"/>
        <attribute name="lowIndex" type="Integer" mode="OUT" optional="false"/>
        <attribute name="sortField" type="String" mode="OUT" optional="true"/>
    </service>

    <service name="performFindParty" engine="java"
        location="org.apache.ofbiz.party.party.PartyServices" invoke="performFindParty">
        <description>General Party Find Service, duplicated for screen widget purpose, Used in the new findparty page in the Party Manager, etc</description>
        <attribute name="roleTypeId" type="String" mode="IN" optional="true"/> <!-- can be null or ANY to include any -->
        <attribute name="noConditionFind" type="String" mode="IN" optional="true" default-value="N"/>
        <attribute name="extInfo" type="String" mode="IN" optional="true"/>
        <attribute name="extCond" type="org.apache.ofbiz.entity.condition.EntityCondition" mode="IN" optional="true">
            <description>EntityCondition that can be send to this service to manage complex search case</description>
        </attribute>
        <attribute name="partyId" type="String" mode="IN" optional="true"/> <!-- does a LIKE compare on this, can do partial, case insensitive, etc -->
        <attribute name="partyTypeId" type="String" mode="IN" optional="true"/>
        <attribute name="userLoginId" type="String" mode="IN" optional="true"/> <!-- does a LIKE compare on this, can do partial, case insensitive, etc -->
        <attribute name="externalId" type="String" mode="IN" optional="true"/>
        <attribute name="groupName" type="String" mode="IN" optional="true"/>
        <attribute name="firstName" type="String" mode="IN" optional="true"/>
        <attribute name="lastName" type="String" mode="IN" optional="true"/>
        <attribute name="address1" type="String" mode="IN" optional="true"/>
        <attribute name="address2" type="String" mode="IN" optional="true"/>
        <attribute name="city" type="String" mode="IN" optional="true"/>
        <attribute name="stateProvinceGeoId" type="String" mode="IN" optional="true"/>
        <attribute name="postalCode" type="String" mode="IN" optional="true"/>
        <attribute name="infoString" type="String" mode="IN" optional="true"/> <!-- the ContactMech infoString -->
        <attribute name="countryCode" type="String" mode="IN" optional="true"/>
        <attribute name="areaCode" type="String" mode="IN" optional="true"/>
        <attribute name="contactNumber" type="String" mode="IN" optional="true"/>
        <attribute name="idValue" type="String" mode="IN" optional="true"/>
        <attribute name="partyIdentificationTypeId" type="String" mode="IN" optional="true"/>
        <attribute name="inventoryItemId" type="String" mode="IN" optional="true"/> <!-- does a LIKE compare on this -->
        <attribute name="serialNumber" type="String" mode="IN" optional="true"/> <!-- does a LIKE compare on this -->
        <attribute name="softIdentifier" type="String" mode="IN" optional="true"/> <!-- does a LIKE compare on this -->
        <attribute name="partyRelationshipTypeId" type="String" mode="IN" optional="true"/>
        <attribute name="ownerPartyIds" type="List" mode="IN" optional="true"/><!-- Lead Owners Parties -->
        <attribute name="sortField" type="String" mode="IN" optional="true"/>
        <attribute name="partyClassificationGroupId" type="List" mode="IN" optional="true"/>

        <attribute name="listIt" type="org.apache.ofbiz.entity.util.EntityListIterator" mode="OUT" optional="true"/>
    </service>

    <service name="getPartyContactMechValueMaps" engine="java"
            transaction-timeout="7200"
            location="org.apache.ofbiz.party.contact.ContactMechServices" invoke="getPartyContactMechValueMaps" auth="true">
        <description>Get Contact Mechs associated with party. It produces a list of Maps (valueMaps) which can contain a list of contactMechPurposes, a partyContactMech Map, contactMechtype Map and a contactMech Map</description>
        <attribute name="partyId" type="String" mode="IN" optional="true"/>
        <attribute name="contactMechTypeId" type="String" mode="IN" optional="true"/>
        <attribute name="showOld" type="Boolean" mode="IN" optional="true"/>
        <attribute name="userLogin" type="org.apache.ofbiz.entity.GenericValue" mode="IN" optional="true"/>
        <attribute name="valueMaps" type="java.util.List" mode="OUT" optional="true"/>
    </service>
    <service name="getPerson" engine="java"
            location="org.apache.ofbiz.party.party.PartyServices" invoke="getPerson">
        <description>Gets a person entity from the cache/database</description>
        <attribute name="partyId" type="String" mode="IN"/>
        <attribute name="lookupPerson" type="org.apache.ofbiz.entity.GenericValue" mode="OUT"/>
    </service>

    <service name="getPartiesFromExactEmail" engine="java"
            location="org.apache.ofbiz.party.party.PartyServices" invoke="getPartiesFromExactEmail">
        <description>Gets a collection of parties from an exact email address, uses SQL EQUALS</description>
        <attribute name="email" type="String" mode="IN"/>
        <attribute name="parties" type="java.util.Collection" mode="OUT" optional="true"/>
    </service>

    <service name="getPartiesFromPartOfEmail" engine="java"
            location="org.apache.ofbiz.party.party.PartyServices" invoke="getPartiesFromPartOfEmail">
        <description>Gets a collection of parties from a part of an email address, uses SQL LIKE</description>
        <attribute name="email" type="String" mode="IN"/>
        <attribute name="parties" type="java.util.Collection" mode="OUT" optional="true"/>
    </service>

    <service name="getPartiesFromPartOfUserloginId" engine="java"
            location="org.apache.ofbiz.party.party.PartyServices" invoke="getPartiesFromPartOfUserloginId">
        <description>Gets a collection of parties from a part of an UserloginId, uses SQL LIKE</description>
        <attribute name="userLoginId" type="String" mode="IN"/>
        <attribute name="parties" type="java.util.Collection" mode="OUT" optional="true"/>
    </service>

    <service name="getPartiesFromName" engine="java"
            location="org.apache.ofbiz.party.party.PartyServices" invoke="getPartiesFromPerson">
        <description>Gets a collection of parties from a first/last name, uses SQL LIKE</description>
        <attribute name="firstName" type="String" mode="IN" optional="true"/>
        <attribute name="lastName" type="String" mode="IN" optional="true"/>
        <attribute name="parties" type="java.util.Collection" mode="OUT" optional="true"/>
    </service>

    <service name="getPartiesFromGroupName" engine="java"
            location="org.apache.ofbiz.party.party.PartyServices" invoke="getPartiesFromPartyGroup">
        <description>Gets a collection of parties from a group name, uses SQL LIKE</description>
        <attribute name="groupName" type="String" mode="IN" optional="false"/>
        <attribute name="parties" type="java.util.Collection" mode="OUT" optional="true"/>
    </service>

    <service name="getPartiesFromExternalId" engine="java"
            location="org.apache.ofbiz.party.party.PartyServices" invoke="getPartiesFromExternalId">
        <description>Gets a list of parties from a party externalId </description>
        <attribute name="externalId" type="String" mode="IN" optional="false"/>
        <attribute name="parties" type="java.util.List" mode="OUT" optional="true"/>
    </service>
    
    <service name="getPartiesByRelationship" engine="groovy"
        location="component://party/src/main/groovy/org/apache/ofbiz/party/party/PartyServicesScript.groovy" invoke="getPartiesByRelationship">
        <description>Gets all parties related to partyIdFrom through the PartyRelationship entity</description>
        <auto-attributes mode="IN" include="all" optional="true" entity-name="PartyRelationship"/>
        <attribute name="parties" type="java.util.Collection" mode="OUT" optional="true"/>
        <override name="partyIdFrom" optional="false"/>
    </service>

    <service name="getParentOrganizations" engine="groovy"
            location="component://party/src/main/groovy/org/apache/ofbiz/party/party/PartyServicesScript.groovy" invoke="getParentOrganizations">
        <description>
            Gets Parent Organizations for an Organization Party.
            This uses the PartyRelationship table with partyRelationshipTypeId="GROUP_ROLLUP".
            The Parent Organization will be in the relationship on either side with roleTypeId="PARENT_ORGANIZATION".
            The Child Organization will be in the relationship on either side with roleTypeId="ORGANIZATION_UNIT", or any child of that type.
            The getParentsOfParents attribute defaults to Y.
            The parentOrganizationPartyIdList coming out will contain the original organizationPartyId.
        </description>
        <attribute name="organizationPartyId" type="String" mode="IN" optional="false">
            <type-validate>
                <fail-property resource="PartyErrorUiLabels" property="PartyRequiredFieldMissingOrganizationPartyId"/>
            </type-validate>
        </attribute>
        <attribute name="getParentsOfParents" type="String" mode="IN" optional="true"/>
        <attribute name="parentOrganizationPartyIdList" type="List" mode="OUT" optional="false">
            <type-validate>
                <fail-property resource="PartyErrorUiLabels" property="PartyRequiredFieldMissingParentOrganizationPartyIdList"/>
            </type-validate>
        </attribute>
    </service>

    <service name="getChildRoleTypes" engine="groovy"
            location="component://party/src/main/groovy/org/apache/ofbiz/party/party/PartyServicesScript.groovy" invoke="getChildRoleTypes">
        <description>
            Get Child RoleTypes.
            The childRoleTypeIdList coming out will contain the original roleTypeId.
        </description>
        <attribute name="roleTypeId" type="String" mode="IN" optional="false">
            <type-validate>
                <fail-property resource="PartyErrorUiLabels" property="PartyRequiredFieldMissingRoleTypeId"/>
            </type-validate>
        </attribute>
        <attribute name="childRoleTypeIdList" type="List" mode="OUT" optional="false">
            <type-validate>
                <fail-property resource="PartyErrorUiLabels" property="PartyRequiredFieldMissingChildRoleTypeIdList"/>
            </type-validate>
        </attribute>
    </service>

    <!-- PostalAddressBoundary -->
    <service name="getPostalAddressBoundary" engine="groovy"
            location="component://party/src/main/groovy/org/apache/ofbiz/party/party/PartyServicesScript.groovy" invoke="getPostalAddressBoundary">
        <description>Get all Postal Address Boundaries</description>
        <permission-service service-name="partyBasePermissionCheck" main-action="VIEW"/>
        <attribute name="contactMechId" type="String" mode="IN" optional="false">
            <type-validate>
                <fail-property resource="PartyErrorUiLabels" property="PartyRequiredFieldMissingContactMechId"/>
            </type-validate>
        </attribute>
        <attribute name="geos" type="java.util.List" mode="OUT" optional="true"/>
    </service>
    
    <service name="getRelatedParties" engine="groovy"
        location="component://party/src/main/groovy/org/apache/ofbiz/party/party/PartyServicesScript.groovy" invoke="getRelatedParties">
        <description>
            Get Parties Related to a Party
            - The relatedPartyIdList coming out will include the original partyIdFrom
            - The includeFromToSwitched and recurse attributes should by "Y" or "N" and default to N.
            - The useCache attribute should be "true" or "false", defaults to "false"
        </description>
        <attribute name="partyIdFrom" type="String" mode="IN" optional="false"/>
        <attribute name="partyRelationshipTypeId" type="String" mode="IN" optional="true"/>
        <attribute name="roleTypeIdFrom" type="String" mode="IN" optional="true"/>
        <attribute name="roleTypeIdFromInclueAllChildTypes" type="String" mode="IN" optional="true"/>
        <attribute name="roleTypeIdTo" type="String" mode="IN" optional="true"/>
        <attribute name="roleTypeIdToIncludeAllChildTypes" type="String" mode="IN" optional="true"/>
        <attribute name="includeFromToSwitched" type="String" mode="IN" optional="true"/>
        <attribute name="recurse" type="String" mode="IN" optional="true"/>
        <attribute name="useCache" type="String" mode="IN" optional="true"/>
        <attribute name="relatedPartyIdList" type="List" mode="OUT" optional="false">
            <type-validate>
                <fail-property resource="PartyErrorUiLabels" property="PartyRequiredFieldMissingRelatedPartyIdList"/>
            </type-validate>
        </attribute>
    </service>
</services>
