コード例 #1
0
  public DataBinder<CreditLimitDTO> getDataBinder() {
    if (dataBinder == null) {

      final LocalSettings localSettings = settingsService.getLocalSettings();

      final PropertyBinder<AccountType> keyBinder =
          PropertyBinder.instance(AccountType.class, "accountTypeIds");
      final PropertyBinder<BigDecimal> limitValueBinder =
          PropertyBinder.instance(
              BigDecimal.class,
              "newCreditLimits",
              localSettings.getNumberConverter().negativeToAbsolute());
      final PropertyBinder<BigDecimal> upperLimitValueBinder =
          PropertyBinder.instance(
              BigDecimal.class, "newUpperCreditLimits", localSettings.getNumberConverter());

      final MapBinder<AccountType, BigDecimal> limitBinder =
          MapBinder.instance(keyBinder, limitValueBinder);
      final MapBinder<AccountType, BigDecimal> upperLimitBinder =
          MapBinder.instance(keyBinder, upperLimitValueBinder);

      final BeanBinder<CreditLimitDTO> binder = BeanBinder.instance(CreditLimitDTO.class);
      binder.registerBinder("limitPerType", limitBinder);
      binder.registerBinder("upperLimitPerType", upperLimitBinder);
      dataBinder = binder;
    }
    return dataBinder;
  }
コード例 #2
0
  public DataBinder<Invoice> getDataBinder() {
    if (dataBinder == null) {
      final BeanBinder<? extends CustomFieldValue> customValueBinder =
          BeanBinder.instance(PaymentCustomFieldValue.class);
      customValueBinder.registerBinder(
          "field", PropertyBinder.instance(PaymentCustomField.class, "field"));
      customValueBinder.registerBinder(
          "value", PropertyBinder.instance(String.class, "value", HtmlConverter.instance()));

      final LocalSettings localSettings = settingsService.getLocalSettings();
      final BeanBinder<Invoice> binder = BeanBinder.instance(Invoice.class);
      binder.registerBinder(
          "from",
          PropertyBinder.instance(AccountOwner.class, "from", AccountOwnerConverter.instance()));
      binder.registerBinder(
          "to",
          PropertyBinder.instance(AccountOwner.class, "to", AccountOwnerConverter.instance()));
      binder.registerBinder(
          "transferType",
          PropertyBinder.instance(
              TransferType.class, "type", ReferenceConverter.instance(TransferType.class)));
      binder.registerBinder(
          "destinationAccountType",
          PropertyBinder.instance(
              AccountType.class, "destType", ReferenceConverter.instance(AccountType.class)));
      binder.registerBinder(
          "amount",
          PropertyBinder.instance(BigDecimal.class, "amount", localSettings.getNumberConverter()));
      binder.registerBinder("description", PropertyBinder.instance(String.class, "description"));
      binder.registerBinder(
          "customValues", BeanCollectionBinder.instance(customValueBinder, "customValues"));

      final BeanBinder<InvoicePayment> scheduledPayments =
          BeanBinder.instance(InvoicePayment.class);
      scheduledPayments.registerBinder(
          "date",
          PropertyBinder.instance(Calendar.class, "date", localSettings.getRawDateConverter()));
      scheduledPayments.registerBinder(
          "amount",
          PropertyBinder.instance(BigDecimal.class, "amount", localSettings.getNumberConverter()));
      binder.registerBinder(
          "payments", BeanCollectionBinder.instance(scheduledPayments, "payments"));

      dataBinder = binder;
    }
    return dataBinder;
  }
コード例 #3
0
  public DataBinder<Collection<DefaultBrokerCommissionDTO>> getDataBinder() {
    if (dataBinder == null) {
      final LocalSettings localSettings = settingsService.getLocalSettings();

      final BeanBinder<DefaultBrokerCommissionDTO> beanBinder =
          BeanBinder.instance(DefaultBrokerCommissionDTO.class);
      beanBinder.registerBinder(
          "id", PropertyBinder.instance(Long.class, "id", IdConverter.instance()));
      beanBinder.registerBinder(
          "brokerCommission", PropertyBinder.instance(BrokerCommission.class, "brokerCommission"));
      beanBinder.registerBinder("type", PropertyBinder.instance(Type.class, "type"));
      beanBinder.registerBinder(
          "value",
          PropertyBinder.instance(BigDecimal.class, "value", localSettings.getNumberConverter()));
      beanBinder.registerBinder("count", PropertyBinder.instance(Integer.class, "count"));
      beanBinder.registerBinder(
          "when", PropertyBinder.instance(BrokerCommission.When.class, "when"));

      final BeanCollectionBinder<DefaultBrokerCommissionDTO> defaultBrokerCommissionsBinder =
          BeanCollectionBinder.instance(beanBinder, ArrayList.class);
      dataBinder = defaultBrokerCommissionsBinder;
    }
    return dataBinder;
  }