@Override public void fillInstance(SIComposite ins, Content obj) { hydrate(ins, obj); }
@Override public void fillInstance(SIComposite ins, Content obj) { hydrate(ins, obj); }
private static void fromMap(Map<String, Content> map, SIComposite instance) { for (Map.Entry<String, Content> entry : map.entrySet()) { hydrate(instance.getField(entry.getKey()), entry.getValue()); } }
private static void fromList(List<Content> list, SIList sList) { for (Content o : list) { SInstance newInstance = sList.addNew(); hydrate(newInstance, o); } }
private static void fromMap(Map<String, Content> map, SIComposite instancia) { for (Map.Entry<String, Content> entry : map.entrySet()) { hydrate(instancia.getField(entry.getKey()), entry.getValue()); } }
private static void fromList(List<Content> list, SIList sList) { for (Content o : list) { SInstance novo = sList.addNew(); hydrate(novo, o); } }
public static void restoreState(final SInstance instance, final FormState state) { instance.clearInstance(); hydrate(instance, state.value); }
public static void restoreState(final SInstance instance, final FormState state) { instance.clearInstance(); hydrate(instance, state.value); }
/** Copia os valores de uma instância para outra. Presupõem que as instâncias são do mesmo tipo. */ public static void copyValues(SInstance origin, SInstance target) { target.clearInstance(); hydrate(target, dehydrate(origin)); }
/** Copia os valores de uma instância para outra. Presupõem que as instâncias são do mesmo tipo. */ public static void copyValues(SInstance origin, SInstance target) { target.clearInstance(); hydrate(target, dehydrate(origin)); }
@Override public void setValue(Object obj) { if(obj instanceof SIComposite){ clearInstance(); Value.hydrate(this, Value.dehydrate((SInstance) obj)); }else{ throw new SingularFormException("SIComposite só suporta valores de mesmo tipo", this); } }
@Override public void setValue(Object obj) { if(obj instanceof SIComposite){ clearInstance(); Value.hydrate(this, Value.dehydrate((SInstance) obj)); }else{ throw new SingularFormException("SIComposite só suporta valores de mesmo tipo"); } }
/** * @return A ready to persist object containing all getAnnotations from this instance and its children mapped by its * classifier */ @SuppressWarnings("unchecked") public Map<String, SIList<SIAnnotation>> persistentAnnotationsClassified() { Map<String, SIList<SIAnnotation>> classifiedAnnotations = new HashMap<>(); if (annotations != null) { for(SIAnnotation annotation : annotations) { SIList<SIAnnotation> list = classifiedAnnotations.get(annotation.getClassifier()); if (list == null) { list = newAnnotationList(annotations.getDocument()); classifiedAnnotations.put(annotation.getClassifier(), list); } list.addNew(a -> Value.hydrate(a, Value.dehydrate(annotation))); } } return classifiedAnnotations; }
/** * @return A ready to persist object containing all getAnnotations from this instance and its children mapped by its * classifier */ @SuppressWarnings("unchecked") public Map<String, SIList<SIAnnotation>> persistentAnnotationsClassified() { Map<String, SIList<SIAnnotation>> classifiedAnnotations = new HashMap<>(); if (annotations != null) { for(SIAnnotation annotation : annotations) { SIList<SIAnnotation> list = classifiedAnnotations.get(annotation.getClassifier()); if (list == null) { list = newAnnotationList(annotations.getDocument()); classifiedAnnotations.put(annotation.getClassifier(), list); } list.addNew(a -> Value.hydrate(a, Value.dehydrate(annotation))); } } return classifiedAnnotations; }
public SProviderBuilder display(String freemakerTemplate) { type.asAtrProvider().asAtrProvider().displayFunction((IFunction<Content, String>) (content) -> { SType elementsType; if (type.isList()) { elementsType = ((STypeList) type).getElementsType(); } else { elementsType = type; } SInstance dummy = elementsType.newInstance(); Value.hydrate(dummy, content); hydrate(dummy, content); return FormFreemarkerUtil.merge(dummy, freemakerTemplate); }); addConverter(); return new SProviderBuilder(super.type); }
public SProviderBuilder display(String freemakerTemplate) { type.asAtrProvider().asAtrProvider().displayFunction((IFunction<Content, String>) (content) -> { SType elementsType; if (type.isList()) { elementsType = ((STypeList) type).getElementsType(); } else { elementsType = type; } SInstance dummy = elementsType.newInstance(); Value.hydrate(dummy, content); hydrate(dummy, content); return FormFreemarkerUtil.get().merge(dummy, freemakerTemplate, false, true); }); addConverter(); return new SProviderBuilder(super.type); }
public SSelectionDisplayBuilder id(SType id) { type.asAtrProvider().asAtrProvider().idFunction((IFunction<Value.Content, String>) (content) -> { SType elementsType; if (type.isList()) { elementsType = ((STypeList) type).getElementsType(); } else { elementsType = type; } SInstance ins = elementsType.newInstance(); Value.hydrate(ins, content); if (ins instanceof SIComposite) { return String.valueOf(((SIComposite) ins).getValue(id)); } return String.valueOf(ins.getValue()); }); return new SSelectionDisplayBuilder(super.type); }
public SSelectionDisplayBuilder id(SType id) { type.asAtrProvider().asAtrProvider().idFunction((IFunction<Value.Content, String>) (content) -> { SType elementsType; if (type.isList()) { elementsType = ((STypeList) type).getElementsType(); } else { elementsType = type; } SInstance ins = elementsType.newInstance(); Value.hydrate(ins, content); if (ins instanceof SIComposite) { return String.valueOf(((SIComposite) ins).getValue(id)); } return String.valueOf(ins.getValue()); }); return new SSelectionDisplayBuilder(super.type); }
public SProviderBuilder display(final SType display) { type.asAtrProvider().asAtrProvider().displayFunction((IFunction<Content, String>) (content) -> { SType elementsType; if (type.isList()) { elementsType = ((STypeList) type).getElementsType(); } else { elementsType = type; } SInstance ins = elementsType.newInstance(); Value.hydrate(ins, content); Object v; if (ins instanceof SIComposite) { v = ((SIComposite) ins).getValue(display); } else { v = ins.getValue(); } return v == null ? StringUtils.EMPTY : v.toString(); }); addConverter(); return new SProviderBuilder(super.type); }
public SProviderBuilder display(final SType display) { type.asAtrProvider().asAtrProvider().displayFunction((IFunction<Content, String>) (content) -> { SType elementsType; if (type.isList()) { elementsType = ((STypeList) type).getElementsType(); } else { elementsType = type; } SInstance ins = elementsType.newInstance(); Value.hydrate(ins, content); Object v; if (ins instanceof SIComposite) { v = ((SIComposite) ins).getValue(display); } else { v = ins.getValue(); } return v == null ? StringUtils.EMPTY : v.toString(); }); addConverter(); return new SProviderBuilder(super.type); }