Esempio n. 1
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;
  }
 public BeanCollectionBinder<Map<String, Object>> getAccountTypeBinderWithScheduling() {
   if (accountTypeBinderWithScheduling == null) {
     final BeanBinder<Map<String, Object>> binder = DataBinderHelper.accountTypeBinder();
     binder.registerBinder(
         "allowsScheduledPayments",
         PropertyBinder.instance(Boolean.TYPE, "allowsScheduledPayments"));
     accountTypeBinderWithScheduling = BeanCollectionBinder.instance(binder);
   }
   return accountTypeBinderWithScheduling;
 }
  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;
  }
 public BeanCollectionBinder<Map<String, Object>> getAccountTypeBinder() {
   if (accountTypeBinder == null) {
     accountTypeBinder = BeanCollectionBinder.instance(DataBinderHelper.accountTypeBinder());
   }
   return accountTypeBinder;
 }