use of com.alibaba.json.test.entity.case2.Category in project fastjson by alibaba.
the class CircularReferenceTest method test_0.
public void test_0() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
ObjectOutputStream objectOut = new ObjectOutputStream(out);
Category p = new Category();
p.setId(1);
p.setName("root");
{
Category child = new Category();
child.setId(2);
child.setName("child");
p.getChildren().add(child);
child.setParent(p);
}
objectOut.writeObject(p);
}
use of com.alibaba.json.test.entity.case2.Category in project kie-wb-common by kiegroup.
the class Bpmn2JsonUnmarshaller method revisitGroups.
public void revisitGroups(Definitions def) {
List<RootElement> rootElements = def.getRootElements();
Category defaultCat = Bpmn2Factory.eINSTANCE.createCategory();
defaultCat.setName("default");
for (RootElement root : rootElements) {
if (root instanceof Process) {
Process process = (Process) root;
List<Artifact> processArtifacts = process.getArtifacts();
if (processArtifacts != null) {
for (Artifact ar : processArtifacts) {
if (ar instanceof Group) {
Group group = (Group) ar;
Iterator<FeatureMap.Entry> iter = group.getAnyAttribute().iterator();
while (iter.hasNext()) {
FeatureMap.Entry entry = iter.next();
if (entry.getEStructuralFeature().getName().equals("categoryval")) {
CategoryValue catval = Bpmn2Factory.eINSTANCE.createCategoryValue();
catval.setValue((String) entry.getValue());
defaultCat.getCategoryValue().add(catval);
group.setCategoryValueRef(catval);
}
}
}
}
}
}
}
// only add category if it includes at least one categoryvalue
if (defaultCat.getCategoryValue() != null && defaultCat.getCategoryValue().size() > 0) {
rootElements.add(defaultCat);
}
}
Aggregations