Tabnine Logo
SIComposite.getFieldList
Code IndexAdd Tabnine to your IDE (free)

How to use
getFieldList
method
in
org.opensingular.form.SIComposite

Best Java code snippets using org.opensingular.form.SIComposite.getFieldList (Showing top 6 results out of 315)

origin: org.opensingular/singular-form-core

private Collection<SIComposite> detectIntancesToDelete(SType<?> listField, SIComposite instance,
    SIComposite previousInstance) {
  String fieldName = listField.getNameSimple();
  Map<String, SIComposite> previousKeys = new HashMap<>();
  for (SIComposite item : previousInstance.getFieldList(fieldName, SIComposite.class).getChildren()) {
    previousKeys.put(FormKey.fromInstance(item).toStringPersistence(), item);
  }
  for (SIComposite item : instance.getFieldList(fieldName, SIComposite.class).getChildren()) {
    Optional<FormKey> keyToPreserve = FormKey.fromInstanceOpt(item);
    if (keyToPreserve.isPresent()) {
      previousKeys.remove(keyToPreserve.get().toStringPersistence());
    }
  }
  return previousKeys.values();
}
origin: org.opensingular/singular-form-core

protected void executeSelectField(@Nonnull FormKey key, INSTANCE mainInstance, TYPE mainType, SType<?> field) {
  SIList<SIComposite> listInstance = mainInstance.getFieldList(field.getNameSimple(), SIComposite.class);
  for (SType<?> detail : field.getLocalTypes()) {
    STypeComposite<?> detailType = (STypeComposite<?>) detail.getSuperType();
    for (RelationalSQLCommmand command : RelationalSQL.select(detailType.getContainedTypes())
        .where(mainType, key).toSQLScript()) {
      executeSelectCommandIntoSIList(command, listInstance);
    }
  }
}
origin: org.opensingular/singular-form-core

public void delete(@Nonnull FormKey key) {
  INSTANCE mainInstance = load(key);
  mainInstance.getAllChildren().stream().filter(field -> RelationalSQL.isListWithTableBound(field.getType()))
      .forEach(field -> {
        SIList<SIComposite> listInstance = mainInstance.getFieldList(field.getType().getNameSimple(),
            SIComposite.class);
        for (SIComposite item : listInstance.getChildren()) {
          String manyToManyTable = manyToManyTable(item);
          if (manyToManyTable != null) {
            executeManyToManyDelete(mainInstance, item, manyToManyTable);
          }
          deleteInternal(item.getType(), FormKey.fromInstance(item));
        }
      });
  deleteInternal(createType(), key);
}
origin: org.opensingular/singular-form-core

protected void updateFieldInternal(@Nonnull SIComposite instance, SIComposite previousPersistedInstance,
    Integer inclusionActor, SInstance field) {
  SIList<SIComposite> listInstance = instance.getFieldList(field.getType().getNameSimple(), SIComposite.class);
  SIList<SIComposite> previousListInstance = previousPersistedInstance
      .getFieldList(field.getType().getNameSimple(), SIComposite.class);
  for (SIComposite item : listInstance.getChildren()) {
    if (FormKey.containsKey(item))
      updateInternal(instance, locate(FormKey.fromInstance(item), previousListInstance), inclusionActor);
    else
      insertInternal(instance, inclusionActor);
  }
  for (SIComposite item : detectIntancesToDelete(field.getType(), instance, previousPersistedInstance)) {
    deleteInternal(item.getType(), FormKey.fromInstance(item));
  }
}
origin: org.opensingular/exemplos-form

public void addObrasProcesso(){
  final STypeList<STypeObra, SIComposite> obrasProcesso = this.addFieldListOf(FIELD_OBRAS_PROCESSO, STypeObra.class);
  obrasProcesso.asAtr().itemLabel("Obra");
  obrasProcesso.withView(new SViewListByMasterDetail(),
    view -> view.col(obrasProcesso.getElementsType().getFieldValorSolicitado()), 
    view -> view.col(obrasProcesso.getElementsType().getFieldValorContratado()), 
    view -> view.col("Valor Empenhado", instancia -> {
      final BigDecimal valorEmpenhado = ((SIComposite)instancia).getFieldList(STypeObra.FIELD_VALORES_EMPENHADOS, SIComposite.class)
        .stream().map(instanciaComposta -> (BigDecimal) Value.of(instanciaComposta, STypeValorEmpenhadoObra.FIELD_VALOR_EMPENHADO))
        .filter(valor -> valor != null)
        .reduce(BigDecimal.ZERO, BigDecimal::add);
      
      return ConversorToolkit.printNumber(valorEmpenhado, 2);
    }),
    view -> view.col(getFieldObrasProcesso().getElementsType().getFieldNumContrato()));
}

origin: org.opensingular/singular-form-samples

public void addObrasProcesso(){
  final STypeList<STypeObra, SIComposite> obrasProcesso = this.addFieldListOf(FIELD_OBRAS_PROCESSO, STypeObra.class);
  obrasProcesso.asAtr().itemLabel("Obra");
  obrasProcesso.withView(new SViewListByMasterDetail(),
    view -> view.col(obrasProcesso.getElementsType().getFieldValorSolicitado()), 
    view -> view.col(obrasProcesso.getElementsType().getFieldValorContratado()), 
    view -> view.col("Valor Empenhado", instance -> {
      final BigDecimal valorEmpenhado = ((SIComposite)instance).getFieldList(STypeObra.FIELD_VALORES_EMPENHADOS, SIComposite.class)
        .stream().map(compositeInstance -> (BigDecimal) Value.of(compositeInstance, STypeValorEmpenhadoObra.FIELD_VALOR_EMPENHADO))
        .filter(valor -> valor != null)
        .reduce(BigDecimal.ZERO, BigDecimal::add);
      
      return ConversorToolkit.printNumber(valorEmpenhado, 2);
    }),
    view -> view.col(getFieldObrasProcesso().getElementsType().getFieldNumContrato()));
}

org.opensingular.formSICompositegetFieldList

Popular methods of SIComposite

  • getField
  • getFields
    List only those fields already instantiated. OBS: field instantiation occurs automatically when its
  • getType
  • findNearest
  • getDocument
  • setValue
  • asAtr
  • findDescendant
  • asAtrAnnotation
  • asAtrBootstrap
  • clearInstance
  • createField
  • clearInstance,
  • createField,
  • findFieldIndex,
  • findFieldIndexOpt,
  • getAllChildren,
  • getAllFields,
  • getDictionary,
  • getFieldLocalWithoutCreating,
  • getFieldOpt

Popular in Java

  • Finding current android device location
  • setRequestProperty (URLConnection)
  • addToBackStack (FragmentTransaction)
  • getContentResolver (Context)
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now