public static String getEntityName(Class entity) { if (mappedName.get(entity) != null) { return mappedName.get(entity); } String name = null; Table table = (Table) entity.getAnnotation(Table.class); if (table != null && table.name() != null && !table.name().isEmpty()) { name = table.name(); } else { Entity entityAnnotation = (Entity) entity.getAnnotation(Entity.class); if (entityAnnotation != null && entityAnnotation.name() != null && !entityAnnotation.name().isEmpty()) { name = entityAnnotation.name(); } else { name = entity.getSimpleName(); } } mappedName.put(entity, name); return name; }
@Override void addWidgets() { widget("EntityTypeList", EntityTypeSet, new PortRest("entity_type_item", EntityType.name())); widget("EntityTypeItem", EntityType, new PortRest("entity_type_page", EntityType.name())); widget( "ListingTable", EntityType, new PortRest("table_head", PropertyType.name()), new PortRest("table_line", Entity.name())); widget("TableHead", PropertyType); widget("TableLine", Entity, new PortRest("line_cell", Property.name())); widget("TableCell", Property); }
@Override void addWidgets() { widget("EntityTypeList", EntityTypeSet, new PortRest("entity_type_item", EntityType.name())); widget("EntityTypeItem", EntityType, new PortRest("entity_type_page", EntityType.name())); widget("EntityTitle2", EntityType, new PortRest("entity_list", EntityType.name())); widget("EntityOrderedList", EntityType, new PortRest("entity_item", Entity.name())); widget("EntityItem2", Entity, new PortRest("property_value", Property.name())); widget("SimpleValue", Property); widget("SimpleValue2", Property); widget("SimpleValue3", Property); widget("SimpleValue4", Property); widget("SimpleValue5", Property); }
public static Entity parseElement(Element ele, int level) { Entity entity = new Entity(); entity.name = ele.getName(); entity.content = ele.getTextTrim(); entity.level = level; if (ele.attributeCount() > 0) { entity.attributes = new HashMap<String, String>(); for (int i = 0; i < ele.attributeCount(); i++) { Attribute attr = ele.attribute(i); entity.attributes.put(attr.getName(), attr.getText()); } } List<Element> cEs = ele.elements(); if (cEs.size() > 0) { entity.children = new HashMap<String, Entity>(); for (int i = 0; i < cEs.size(); i++) { entity.children.put(cEs.get(i).getName(), parseElement(cEs.get(i), level + 1)); } } return entity; }