Пример #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<MessageQuery> getDataBinder() {
   if (dataBinder == null) {
     final BeanBinder<MessageQuery> binder = BeanBinder.instance(MessageQuery.class);
     binder.registerBinder("messageBox", PropertyBinder.instance(MessageBox.class, "messageBox"));
     binder.registerBinder("rootType", PropertyBinder.instance(RootType.class, "rootType"));
     binder.registerBinder(
         "relatedMember", PropertyBinder.instance(Member.class, "relatedMember"));
     binder.registerBinder("category", PropertyBinder.instance(MessageCategory.class, "category"));
     binder.registerBinder("keywords", PropertyBinder.instance(String.class, "keywords"));
     binder.registerBinder("pageParameters", DataBinderHelper.pageBinder());
     dataBinder = binder;
   }
   return dataBinder;
 }
Пример #3
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 DataBinder<MemberAccountTypeQuery> getQueryBinder() {
   if (queryBinder == null) {
     final BeanBinder<MemberAccountTypeQuery> binder =
         BeanBinder.instance(MemberAccountTypeQuery.class);
     binder.registerBinder(
         "owner",
         PropertyBinder.instance(
             Member.class, "ownerId", ReferenceConverter.instance(Member.class)));
     binder.registerBinder(
         "canPay",
         PropertyBinder.instance(
             AccountOwner.class, "canPayOwnerId", AccountOwnerConverter.zeroIsSystemInstance()));
     binder.registerBinder("currency", PropertyBinder.instance(Currency.class, "currencyId"));
     binder.registerBinder(
         "relatedToGroups", SimpleCollectionBinder.instance(MemberGroup.class, "memberGroupId"));
     queryBinder = binder;
   }
   return queryBinder;
 }
 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;
 }
 private DataBinder<ScheduledPaymentQuery> getDataBinder() {
   if (dataBinder == null) {
     final BeanBinder<ScheduledPaymentQuery> binder =
         BeanBinder.instance(ScheduledPaymentQuery.class);
     final LocalSettings localSettings =
         SettingsHelper.getLocalSettings(getServlet().getServletContext());
     binder.registerBinder(
         "accountType", PropertyBinder.instance(AccountType.class, "accountType"));
     binder.registerBinder(
         "searchType",
         PropertyBinder.instance(ScheduledPaymentQuery.SearchType.class, "searchType"));
     binder.registerBinder(
         "statusGroup",
         PropertyBinder.instance(ScheduledPaymentQuery.StatusGroup.class, "statusGroup"));
     binder.registerBinder("period", DataBinderHelper.periodBinder(localSettings, "period"));
     binder.registerBinder("member", PropertyBinder.instance(Member.class, "member"));
     binder.registerBinder("pageParameters", DataBinderHelper.pageBinder());
     dataBinder = binder;
   }
   return dataBinder;
 }
 public DataBinder<CustomFieldPossibleValue> getDataBinder() {
   if (dataBinder == null) {
     final BeanBinder<CustomFieldPossibleValue> binder =
         BeanBinder.instance(CustomFieldPossibleValue.class);
     binder.registerBinder(
         "id", PropertyBinder.instance(Long.class, "id", IdConverter.instance()));
     binder.registerBinder("field", PropertyBinder.instance(CustomField.class, "field"));
     binder.registerBinder(
         "parent", PropertyBinder.instance(CustomFieldPossibleValue.class, "parent"));
     binder.registerBinder("value", PropertyBinder.instance(String.class, "value"));
     binder.registerBinder("enabled", PropertyBinder.instance(Boolean.TYPE, "enabled"));
     binder.registerBinder("defaultValue", PropertyBinder.instance(Boolean.TYPE, "defaultValue"));
     dataBinder = binder;
   }
   return dataBinder;
 }
  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;
  }