Exemplo n.º 1
0
  /**
   * A helper method for creating a PartyRelationship entity from partyIdTo to partyIdFrom with
   * specified partyRelationshipTypeId, roleTypeIdFrom, a List of valid roles for the to-party, and
   * a flag to expire any existing relationships between the two parties of the same type. The idea
   * is that several services would do validation and then use this method to do all the work.
   *
   * @param partyIdTo
   * @param partyIdFrom
   * @param roleTypeIdFrom
   * @param partyRelationshipTypeId
   * @param securityGroupId
   * @param validToPartyRoles List of roleTypeIds which are valid for the partyIdTo in the create
   *     relationship. It will cycle through until the first of these roles is actually associated
   *     with partyIdTo and then create a PartyRelationship using that roleTypeId. If none of these
   *     are associated with partyIdTo, then it will return false
   * @param fromDate
   * @param expireExistingRelationships If set to true, will look for all existing
   *     PartyRelationships of partyIdFrom, partyRelationshipTypeId and expire all of them as of the
   *     passed in fromDate
   * @return false if no relationship was created or true if operation succeeds
   */
  public static boolean createNewPartyToRelationship(
      String partyIdTo,
      String partyIdFrom,
      String roleTypeIdFrom,
      String partyRelationshipTypeId,
      String securityGroupId,
      List<String> validToPartyRoles,
      Timestamp fromDate,
      boolean expireExistingRelationships,
      GenericValue userLogin,
      Delegator delegator,
      LocalDispatcher dispatcher)
      throws GenericEntityException, GenericServiceException {

    return org.opentaps.common.party.PartyHelper.createNewPartyToRelationship(
        partyIdTo,
        partyIdFrom,
        roleTypeIdFrom,
        partyRelationshipTypeId,
        securityGroupId,
        validToPartyRoles,
        fromDate,
        expireExistingRelationships,
        userLogin,
        delegator,
        dispatcher);
  }