private boolean FindAcceptedPaymentType(
     AcceptedPaymentType acceptedPaymentType, List<AcceptedPaymentType> acceptedPaymentTypes) {
   for (AcceptedPaymentType newAcceptedPaymentType : acceptedPaymentTypes) {
     if ((newAcceptedPaymentType.getTransactionTypeEntity().getTransactionId().shortValue()
             == acceptedPaymentType.getTransactionTypeEntity().getTransactionId().shortValue())
         && (newAcceptedPaymentType.getPaymentTypeEntity().getId().shortValue())
             == acceptedPaymentType.getPaymentTypeEntity().getId().shortValue()) {
       return true;
     }
   }
   return false;
 }
 private boolean IsDeleted(AcceptedPaymentType a, List<AcceptedPaymentType> list) {
   if ((list == null) || (list.size() == 0)) {
     return true;
   }
   for (AcceptedPaymentType type : list) {
     if ((type.getTransactionTypeEntity().getTransactionId().shortValue()
             == a.getTransactionTypeEntity().getTransactionId().shortValue())
         && (type.getPaymentTypeEntity().getId().shortValue()
             == a.getPaymentTypeEntity().getId().shortValue())) {
       return false;
     }
   }
   return true;
 }
 private void compare(
     List<PaymentTypeEntity> entityList, List<AcceptedPaymentType> acceptedPaymentTypeList) {
   Assert.assertTrue(entityList.size() == acceptedPaymentTypeList.size());
   for (AcceptedPaymentType acceptedPaymentType : acceptedPaymentTypeList) {
     Assert.assertTrue(FindEntity(entityList, acceptedPaymentType.getPaymentTypeEntity()));
   }
 }
 private boolean Find(PaymentTypes paymentType, List<AcceptedPaymentType> acceptedPaymentTypes) {
   for (AcceptedPaymentType acceptedPaymentType : acceptedPaymentTypes) {
     if (acceptedPaymentType.getPaymentTypeEntity().getId().shortValue()
         == paymentType.getValue().shortValue()) {
       return true;
     }
   }
   return false;
 }
  public List<PaymentTypeEntity> getAcceptedPaymentTypesForATransaction(
      Short localeId, Short transactionId) throws PersistenceException {

    HashMap<String, Object> queryParameters = new HashMap<String, Object>();
    queryParameters.put("transactionId", transactionId);

    List<AcceptedPaymentType> acceptedPaymentTypeList =
        executeNamedQuery(
            NamedQueryConstants.GET_ACCEPTED_PAYMENT_TYPES_FOR_A_TRANSACTION, queryParameters);
    List<PaymentTypeEntity> paymentTypeList = new ArrayList<PaymentTypeEntity>();
    for (AcceptedPaymentType acceptedPaymentType : acceptedPaymentTypeList) {
      PaymentTypeEntity paymentTypeEntity = acceptedPaymentType.getPaymentTypeEntity();
      // the localeId is set so when the paymentTypeEntity.getName is
      // called the localeId will be used
      // to determine what the name to match with that localeId
      paymentTypeList.add(paymentTypeEntity);
    }

    return paymentTypeList;
  }