@Override public Collection<Model> apply(final Model input) { final ArrayList<Model> children = Lists.<Model>newArrayList(); final Entity parent = ((Entity) input); Entity _superType = parent.getSuperType(); boolean _notEquals = (!Objects.equal(_superType, null)); if (_notEquals) { Entity _superType_1 = parent.getSuperType(); children.add(_superType_1); } EList<Property> _properties = parent.getProperties(); Collection<Model> _referenceModels = this.getReferenceModels(_properties); children.addAll(_referenceModels); return children; } }
public static EList<Type> getReferencedTypes(Entity entity) { EList<Type> types = new BasicEList<Type>(); for (Property property : entity.getProperties()) { types.addAll(getReferencedTypes(property)); } types.add(entity.getSuperType()); return types; }
private static List<Property> getFlatProperties(Entity entity) { List<Property> properties = new ArrayList<Property>(); TreeIterator<EObject> iter = entity.eAllContents(); while (iter.hasNext()) { EObject obj = iter.next(); if (obj instanceof Property) { Property property = (Property) obj; properties.add(property); } } if (entity.getSuperType() != null) { properties.addAll(getFlatProperties(entity.getSuperType())); } return properties; } }
public static EList<Type> getReferencedTypes(Entity entity) { EList<Type> types = new BasicEList<Type>(); for (Property property : entity.getProperties()) { types.addAll(getReferencedTypes(property)); } types.add(entity.getSuperType()); return types; }
@Check public void checkCircularRefInSuperType(final Entity entity) { Entity _superType = entity.getSuperType(); boolean _notEquals = (!Objects.equal(_superType, null)); if (_notEquals) { try { Entity _superType_1 = entity.getSuperType(); boolean _hasCircularReference = ValidatorUtils.hasCircularReference(entity, _superType_1, ValidatorUtils.entityTypeToChildrenSupplierFunction); if (_hasCircularReference) { this.error(DatatypeSystemMessage.ERROR_SUPERTYPE_CIRCULAR_REF, entity, DatatypePackage.Literals.ENTITY__SUPER_TYPE); } } catch (final Throwable _t) { if (_t instanceof Exception) { final Exception e = (Exception)_t; e.printStackTrace(); } else { throw Exceptions.sneakyThrow(_t); } } } }
private static void removeSuperTypeModelReference(Entity entity) { Iterator<ModelReference> iter = entity.getReferences().iterator(); while (iter.hasNext()) { ModelReference reference = iter.next(); ModelReference superTypeReference = ModelIdFactory.newInstance(entity.getSuperType()).asModelReference(); if (EcoreUtil.equals(superTypeReference, reference)) { iter.remove(); } } }
public static EList<Type> getReferencedTypes(final Type type) { BasicEList<Type> types = new BasicEList<Type>(); types.add(type); if ((type instanceof Entity)) { Entity entityType = ((Entity) type); EList<Property> _properties = entityType.getProperties(); for (final Property property : _properties) { EList<Type> _referencedTypes = Utils.getReferencedTypes(property); types.addAll(_referencedTypes); } Entity _superType = entityType.getSuperType(); types.add(_superType); } return types; }
private static List<Property> getFlatProperties(FunctionblockModel fbm) { List<Property> properties = new ArrayList<Property>(); TreeIterator<EObject> iter = fbm.eAllContents(); while (iter.hasNext()) { EObject obj = iter.next(); if (obj instanceof Property) { Property property = (Property) obj; properties.add(property); if (property.getType() instanceof ObjectPropertyType) { ObjectPropertyType objectType = (ObjectPropertyType) property.getType(); if (objectType.getType() instanceof Entity) { // only flatten entities Entity entity = (Entity) ((ObjectPropertyType) property.getType()).getType(); List<Property> entityProperties = getFlatProperties(entity); entity.getProperties().addAll(entityProperties); if (entity.getSuperType() != null) { removeSuperTypeModelReference(entity); } entity.getProperties().stream().filter(p -> p.getType() instanceof ObjectPropertyType) .forEach(p -> createReference(entity, (ObjectPropertyType) p.getType())); } } } } if (fbm.getSuperType() != null) { properties.addAll(getFlatProperties(fbm.getSuperType())); } return properties; }
_builder.newLine(); Entity _superType = entity.getSuperType(); boolean _notEquals = (!Objects.equal(_superType, null)); if (_notEquals) { _builder.append(_firstUpper, ""); _builder.append(" extends "); Entity _superType_1 = entity.getSuperType(); String _name_2 = _superType_1.getName(); String _firstUpper_1 = StringExtensions.toFirstUpper(_name_2);
_builder.newLine(); Entity _superType = entity.getSuperType(); boolean _tripleNotEquals = (_superType != null); if (_tripleNotEquals) { _builder.append(_firstUpper, ""); _builder.append(" extends "); Entity _superType_1 = entity.getSuperType(); String _name_2 = _superType_1.getName(); String _firstUpper_1 = StringExtensions.toFirstUpper(_name_2);