private void setOutParameters(final SqlPreparedStatement statement) throws SQLException {
    // gestion de generatedKey
    final DtObject dto = (DtObject) getValue("DTO");
    final DtDefinition dtDefinition = DtObjectUtil.findDtDefinition(dto);
    final DtField pk = dtDefinition.getIdField().get();

    final Object key = statement.getGeneratedKey(pk.getName(), pk.getDomain());
    pk.getDataAccessor().setValue(dto, key);
  }
 private ValidationUserException(
     final MessageText messageText, final String constFieldName, final DtObject dto) {
   super(messageText);
   Assertion.checkNotNull(dto, "L'objet est obligatoire");
   Assertion.checkArgNotEmpty(constFieldName, "Le champs est obligatoire");
   // -----
   final DtField dtField = DtObjectUtil.findDtDefinition(dto).getField(constFieldName);
   uiErrors.add(new UiError(dto, dtField, messageText));
 }
  public static void initData(final AccountManager accountManager) {
    final Account testAccount0 =
        new AccountBuilder("0")
            .withDisplayName("John doe")
            .withEmail("*****@*****.**")
            .build();
    final Account testAccount1 =
        new AccountBuilder("1")
            .withDisplayName("Palmer Luckey")
            .withEmail("*****@*****.**")
            .build();
    final Account testAccount2 =
        new AccountBuilder("2")
            .withDisplayName("Bill Clinton")
            .withEmail("*****@*****.**")
            .build();
    accountManager.getStore().saveAccounts(Arrays.asList(testAccount0, testAccount1, testAccount2));

    final URI<Account> accountURI1 = DtObjectUtil.createURI(Account.class, testAccount1.getId());
    final URI<Account> accountURI2 = DtObjectUtil.createURI(Account.class, testAccount2.getId());

    final AccountGroup testAccountGroup1 = new AccountGroup("100", "TIME's cover");
    final URI<AccountGroup> group1Uri =
        DtObjectUtil.createURI(AccountGroup.class, testAccountGroup1.getId());
    accountManager.getStore().saveGroup(testAccountGroup1);

    accountManager.getStore().attach(accountURI1, group1Uri);
    accountManager.getStore().attach(accountURI2, group1Uri);

    final AccountGroup groupAll = new AccountGroup("ALL", "Everyone");
    final URI<AccountGroup> groupAllUri =
        DtObjectUtil.createURI(AccountGroup.class, groupAll.getId());
    accountManager.getStore().saveGroup(groupAll);
    accountManager.getStore().attach(accountURI1, groupAllUri);
    accountManager.getStore().attach(accountURI2, groupAllUri);

    // ---create 5 000 noisy data
    final List<Account> accounts = createAccounts();
    for (final Account account : accounts) {
      final URI<Account> accountUri = DtObjectUtil.createURI(Account.class, account.getId());
      accountManager.getStore().attach(accountUri, groupAllUri);
    }
    accountManager.getStore().saveAccounts(accounts);
  }
 /** {@inheritDoc} */
 @Override
 public SearchIndexDefinition findIndexDefinitionByKeyConcept(
     final Class<? extends KeyConcept> keyConceptClass) {
   final SearchIndexDefinition indexDefinition =
       findIndexDefinitionByKeyConcept(DtObjectUtil.findDtDefinition(keyConceptClass));
   Assertion.checkNotNull(
       indexDefinition,
       "No SearchIndexDefinition was defined for this keyConcept : {0}",
       keyConceptClass.getSimpleName());
   return indexDefinition;
 }
 /**
  * Publie une liste de référence.
  *
  * @param dtObjectClass Class associée
  * @param code Code
  */
 public void publish(final Class<O> dtObjectClass, final String code) {
   final DtDefinition dtDefinition = DtObjectUtil.findDtDefinition(dtObjectClass);
   action
       .getModel()
       .put(contextKey, new UiMdList<O>(new DtListURIForMasterData(dtDefinition, code)));
 }
 private static Object getValue(final DtObject dto, final String fieldName) {
   final DtDefinition dtDefinition = DtObjectUtil.findDtDefinition(dto);
   final DtField dtField = dtDefinition.getField(fieldName);
   return dtField.getDataAccessor().getValue(dto);
 }