本文整理了Java中org.opensingular.form.util.transformer.Value.copyValues()
方法的一些代码示例,展示了Value.copyValues()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Value.copyValues()
方法的具体详情如下:
包路径:org.opensingular.form.util.transformer.Value
类名称:Value
方法名:copyValues
[英]Copia os valores de uma instância para outra. Presupõem que as instâncias são do mesmo tipo.
[中]乌马研究所的价值观。假设他们是圣母院院长。
代码示例来源:origin: org.opensingular/form-core
/** Copia os valores de um formulário para outro. Presupõem que os formulários são do mesmo tipo. */
public static void copyValues(SDocument origin, SDocument destiny) {
copyValues(origin.getRoot(), destiny.getRoot());
}
代码示例来源:origin: org.opensingular/singular-form-core
/** Copia os valores de um formulário para outro. Presupõem que os formulários são do mesmo tipo. */
public static void copyValues(SDocument origin, SDocument destiny) {
copyValues(origin.getRoot(), destiny.getRoot());
}
代码示例来源:origin: org.opensingular/singular-form-core
/**
* Loads a collection of getAnnotations onte this instance and its children. The <code>targetId</code> field of the
* getAnnotation denotes which field that getAnnotation is referring to. Se a intenção é recarregar as anotações é
* preciso chamar o método {@link #clear()} antes
*
* @param annotations to be loaded into the instance.
*/
public void loadAnnotations(SIList<SIAnnotation> annotations) {
Map<Integer, SInstance> instancesById = new HashMap<>();
SInstances.streamDescendants(document.getRoot(), true).forEach(i -> instancesById.put(i.getId(), i));
for (SIAnnotation annotation : annotations) {
SIAnnotation newAnnotation = newAnnotation();
Value.copyValues(annotation, newAnnotation);
correctReference(newAnnotation, document, instancesById);
}
}
代码示例来源:origin: org.opensingular/form-core
/**
* Loads a collection of getAnnotations onte this instance and its children. The <code>targetId</code> field of the
* getAnnotation denotes which field that getAnnotation is referring to. Se a intenção é recarregar as anotações é
* preciso chamar o método {@link #clear()} antes
*
* @param annotations to be loaded into the instance.
*/
public void loadAnnotations(SIList<SIAnnotation> annotations) {
Map<Integer, SInstance> instancesById = new HashMap<>();
SInstances.streamDescendants(document.getRoot(), true).forEach(i -> instancesById.put(i.getId(), i));
for (SIAnnotation annotation : annotations) {
SIAnnotation newAnnotation = newAnnotation();
Value.copyValues(annotation, newAnnotation);
correctReference(newAnnotation, document, instancesById);
}
}
代码示例来源:origin: org.opensingular/singular-form-core
@Nonnull
private E addElementInternal(@Nonnull E instance, boolean atEnd, int index) {
if (instance.getDocument() == getDocument()) {
return addInternal(instance, atEnd, index);
} else {
E copy = getElementsType().newInstance(getDocument());
Value.copyValues(instance, copy);
return addInternal(copy, atEnd, index);
}
}
代码示例来源:origin: org.opensingular/server-commons
private void copyValuesAndAnnotations(SDocument source, SDocument target) {
Value.copyValues(source, target);
copyIdValues(source.getRoot(), target.getRoot());
target.getDocumentAnnotations().copyAnnotationsFrom(source);
}
代码示例来源:origin: org.opensingular/singular-form-core
/**
* Copia para o documento atual todas as anotação do documento fonte que tiverem um caminho corresponde no documento
* atual.
*/
public void copyAnnotationsFrom(SDocument source) {
Objects.requireNonNull(source);
DocumentAnnotations sourceAnnotations = source.getDocumentAnnotations();
if (sourceAnnotations.hasAnnotations()) {
for (SIAnnotation sourceAnnotation : sourceAnnotations.annotations) {
source.findInstanceById(sourceAnnotation.getTargetId()).ifPresent(si -> {
String pathFromRoot = si.getPathFromRoot();
//localiza a instancia correspondente no formulario destino
SInstance targetInstance = document.getRoot();
if (pathFromRoot != null){
targetInstance = document.getRoot().getFieldOpt(pathFromRoot).orElse(targetInstance);
}
//Copiando todos os valores da anotação (inclusive o id na sinstance antiga)
SIAnnotation targetAnnotation = getAnnotationOrCreate(targetInstance, sourceAnnotation.getClassifier());
Value.copyValues(sourceAnnotation, targetAnnotation);
//Corrigindo o ID
targetAnnotation.setTarget(targetInstance);
});
}
}
}
代码示例来源:origin: org.opensingular/form-core
/**
* Copia para o documento atual todas as anotação do documento fonte que tiverem um caminho corresponde no documento
* atual.
*/
public void copyAnnotationsFrom(SDocument source) {
Objects.requireNonNull(source);
DocumentAnnotations sourceAnnotations = source.getDocumentAnnotations();
if (sourceAnnotations.hasAnnotations()) {
for (SIAnnotation sourceAnnotation : sourceAnnotations.annotations) {
source.findInstanceById(sourceAnnotation.getTargetId()).ifPresent(si -> {
String pathFromRoot = si.getPathFromRoot();
//localiza a instancia correspondente no formulario destino
SInstance targetInstance = document.getRoot();
if (pathFromRoot != null){
targetInstance = ((SIComposite) document.getRoot()).getField(pathFromRoot);
}
//Copiando todos os valores da anotação (inclusive o id na sinstance antiga)
SIAnnotation targetAnnotation = getAnnotationOrCreate(targetInstance, sourceAnnotation.getClassifier());
Value.copyValues(sourceAnnotation, targetAnnotation);
//Corrigindo o ID
targetAnnotation.setTarget(targetInstance);
});
}
}
}
代码示例来源:origin: org.opensingular/singular-form-wicket
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
super.onSubmit(target, form);
SInstance source = innerSingularFormPanel.getInstance();
SInstance copy = source.getDocument().getDocumentFactoryRef().get().createInstance(source.getDocument().getRootRefType().orElseThrow(() -> new SingularFormException("Null rootRefType")), false);
Value.copyValues(source, copy);
dataTableFilter.setFilter(copy);
resultTable.setVisible(true);
target.add(resultTable);
}
};
代码示例来源:origin: org.opensingular/singular-requirement-module
private static void copyValuesAndAnnotations(SDocument source, SDocument target) {
target.initRestoreMode();
Value.copyValues(source, target);
copyIdValues(source.getRoot(), target.getRoot());
target.setLastId(source.getLastId());
target.getDocumentAnnotations().copyAnnotationsFrom(source);
target.finishRestoreMode();
}
代码示例来源:origin: org.opensingular/singular-requirement-commons
private static void copyValuesAndAnnotations(SDocument source, SDocument target) {
target.initRestoreMode();
Value.copyValues(source, target);
copyIdValues(source.getRoot(), target.getRoot());
target.setLastId(source.getLastId());
target.getDocumentAnnotations().copyAnnotationsFrom(source);
target.finishRestoreMode();
}
代码示例来源:origin: org.opensingular/singular-server-commons
private static void copyValuesAndAnnotations(SDocument source, SDocument target) {
target.initRestoreMode();
Value.copyValues(source, target);
copyIdValues(source.getRoot(), target.getRoot());
target.setLastId(source.getLastId());
target.getDocumentAnnotations().copyAnnotationsFrom(source);
target.finishRestoreMode();
}
内容来源于网络,如有侵权,请联系作者删除!