Ejemplo n.º 1
0
  public static final AccountTypeWS getWS(
      Integer id,
      Integer entityId,
      String invoiceDesign,
      Date dateCreated,
      BigDecimal creditNotificationLimit1,
      BigDecimal creditNotificationLimit2,
      BigDecimal creditLimit,
      InvoiceDeliveryMethodDTO invoiceDeliveryMethod,
      Integer currencyId,
      Integer languageId,
      String description,
      MainSubscriptionWS mainSubscription,
      Set<AccountInformationTypeDTO> informationTypes,
      Set<PaymentMethodTypeDTO> paymentMethodTypes,
      Integer preferredNotificationAitId) {

    AccountTypeWS ws = new AccountTypeWS();
    ws.setId(id);
    ws.setEntityId(entityId);
    ws.setInvoiceDesign(invoiceDesign);
    ws.setDateCreated(dateCreated);
    ws.setCreditNotificationLimit1(
        creditNotificationLimit1 != null ? creditNotificationLimit1.toString() : null);
    ws.setCreditNotificationLimit2(
        creditNotificationLimit2 != null ? creditNotificationLimit2.toString() : null);
    ws.setCreditLimit(creditLimit != null ? creditLimit.toString() : null);
    ws.setInvoiceDeliveryMethodId(
        invoiceDeliveryMethod != null ? invoiceDeliveryMethod.getId() : null);
    ws.setCurrencyId(currencyId);
    ws.setLanguageId(languageId);
    ws.setMainSubscription(mainSubscription);

    if (description != null) {
      ws.setName(description, Constants.LANGUAGE_ENGLISH_ID);
    }

    if (null != informationTypes && informationTypes.size() > 0) {
      List<Integer> informationTypeIds = new ArrayList<Integer>();
      for (AccountInformationTypeDTO ait : informationTypes) {
        informationTypeIds.add(ait.getId());
      }
      if (!informationTypeIds.isEmpty()) {
        ws.setInformationTypeIds(
            informationTypeIds.toArray(new Integer[informationTypeIds.size()]));
      }
    }

    if (null != paymentMethodTypes && paymentMethodTypes.size() > 0) {
      List<Integer> paymentMethodTypeIds = new ArrayList<Integer>(0);
      for (PaymentMethodTypeDTO paymentMethodType : paymentMethodTypes) {
        paymentMethodTypeIds.add(paymentMethodType.getId());
      }
      ws.setPaymentMethodTypeIds(
          paymentMethodTypeIds.toArray(new Integer[paymentMethodTypeIds.size()]));
    }

    ws.setpreferredNotificationAitId(preferredNotificationAitId);
    return ws;
  }
Ejemplo n.º 2
0
  public boolean delete() {

    if (accountTypeDTO.getCustomers().size() > 0) {
      return false;
    }

    for (AccountInformationTypeDTO ait : accountTypeDTO.getInformationTypes()) {
      new AccountInformationTypeBL(ait.getId()).delete();
    }
    accountTypeDTO.getInformationTypes().clear();
    accountTypeDAS.delete(accountTypeDTO);
    return true;
  }