@Override public STypePdfHealth getType() { return (STypePdfHealth) super.getType(); } }
@Override public T getType() { return (T) super.getType(); } }
@Override public STypePdfHealth getType() { return (STypePdfHealth) super.getType(); } }
@Nonnull @Override public STypeModeloSEI getType() { return (STypeModeloSEI) super.getType(); }
private JSWrapperInstance<SInstance>[] getFieldsWrappers() { if (fieldsWrappers == null) { fieldsWrappers = new JSWrapperInstance[getInstance().getType().size()]; } return fieldsWrappers; }
@Override default List<Value.Content> load(SIComposite ins, String query) { final SCompositeListBuilder builder = new SCompositeListBuilder((STypeComposite<SIComposite>) ins.getType(), ins); fill(builder, query); final List<Value.Content> listMap = new ArrayList<>(); builder.getList().forEach(i -> listMap.add(Value.dehydrate(i))); return listMap; }
protected List<SInstance> getContainerInstances(SIComposite instance) { List<SInstance> result = new ArrayList<>(); for (RelationalFK fk : RelationalSQL.tableFKs(instance.getType())) { Optional<SInstance> containerInstance = findAncestor(instance, fk.getForeignType()); if (!containerInstance.isPresent()) { containerInstance = findDescendant(instance, fk.getForeignType()); } containerInstance.ifPresent(result::add); } return result; } }
/** * Retorna todos os campos do tipo, instanciando os que ainda não foram. * * @return instancias dos campos */ @Nonnull public List<SInstance> getAllFields() { for (SType<?> field : getType().getFields()) getField(field.getNameSimple()); return getFields(); }
private SInstance createField(int fieldIndex) { SType<?> fieldType = getType().getField(fieldIndex); SInstance instance = fieldType.newInstance(getDocument()); if (fields == null) { fields = new FieldMapOfRecordInstance(getType().size()); } fields.set(fieldIndex, instance); instance.setParent(this); return instance; }
private SInstance createField(int fieldIndex) { SType<?> fieldType = getType().getField(fieldIndex); SInstance instance = fieldType.newInstance(getDocument()); if (fields == null) { fields = new FieldMapOfRecordInstance(getType().size()); } fields.set(fieldIndex, instance); instance.setParent(this); return instance; }
/** * Retorna todos os campos do tipo, instanciando os que ainda não foram. * * @return instancias dos campos */ public List<SInstance> getAllFields() { for (SType<?> field : getType().getFields()) getField(field.getNameSimple()); return getFields(); }
/** * Procura o índice do elemento solicitado dentro da lista de campo ou * retorna -1 se o campo não existir no tipo composto. */ private int findFieldIndexOpt(PathReader pathReader) { if (pathReader.isIndex()) { throw new SingularFormException(pathReader.getErrorMsg(this, "Não é uma lista"), this); } return getType().findIndexOf(pathReader.getToken()); }
@Override final <T> T getValueWithDefaultIfNull(PathReader pathReader, Class<T> resultClass) { SInstance instance = getFieldLocalWithoutCreating(pathReader); if (instance != null) { return instance.getValueWithDefaultIfNull(pathReader.next(), resultClass); } SType<?> tipo = SFormUtil.resolveFieldType(getType(), pathReader); return tipo.getAttributeValueOrDefaultValueIfNull(resultClass); }
/** * Procura o índice do elemento solicitado dentro da lista de campo ou * retorna -1 se o campo não existir no tipo composto. */ private int findFieldIndexOpt(PathReader pathReader) { if (pathReader.isIndex()) { throw new SingularFormException(pathReader.getErrorMsg(this, "Não é uma lista")); } return getType().findIndexOf(pathReader.getToken()); }
@Override public void fillInstance(SInstance ins, T obj) { if (!(ins instanceof SIComposite)) { throw new SingularFormException("AutoSICompositeConverter somente funciona com instancias compostas.", ins); } final SIComposite cins = (SIComposite) ins; final GetterHandler getterHandler = new Mirror().on(obj).get(); cins.getType().getFields().forEach(f -> cins.setValue(f, getterHandler.field(f.getNameSimple()))); }
@Override public void fillInstance(SInstance ins, T obj) { if (!(ins instanceof SIComposite)) { throw new SingularFormException("AutoSICompositeConverter somente funciona com instancias compostas."); } final SIComposite cins = (SIComposite) ins; final GetterHandler getterHandler = new Mirror().on(obj).get(); cins.getType().getFields().forEach(f -> cins.setValue(f, getterHandler.field(f.getNameSimple()))); }
protected List<INSTANCE> executeSelectCommand(RelationalSQLCommmand command) { return db.query(command.getSQL(), command.getParameters(), command.getLimitOffset(), command.getLimitRows(), rs -> { INSTANCE instance = createInstance(); command.setInstance(instance); FormKey.setOnInstance(instance, tupleKey(rs, RelationalSQL.tablePK(instance.getType()))); RelationalSQL.persistenceStrategy(instance.getType()).load(instance, tuple(rs, command)); return instance; }); }
protected List<SIComposite> executeSelectCommandIntoSIList(RelationalSQLCommmand command, SIList<SIComposite> listInstance) { return db.query(command.getSQL(), command.getParameters(), command.getLimitOffset(), command.getLimitRows(), rs -> { SIComposite instance = listInstance.addNew(); command.setInstance(instance); List<String> pk = RelationalSQL.tablePK(RelationalSQL.tableContext(instance.getType())); FormKey.setOnInstance(instance, tupleKey(rs, pk)); RelationalSQL.persistenceStrategy(instance.getType()).load(instance, tuple(rs, command)); return instance; }); }