public DomainModel(JpqlEntityModel... initialEntities) { for (JpqlEntityModel initialEntity : initialEntities) { add(initialEntity); } }
private HintResponse hintEntityName(String lastWord) { List<JpqlEntityModel> matchingEntities = model.findEntitiesStartingWith(lastWord); List<Option> options = new ArrayList<>(); for (JpqlEntityModel entity : matchingEntities) { options.add(new Option(entity.getName(), entity.getUserFriendlyName())); } return new HintResponse(options, lastWord); }
try { String entityName = child0.token.getText(); JpqlEntityModel entity = model.getEntityByName(entityName); effectiveEntityName = entity.getName(); stack.peekLast().addEntityVariable(variableName, entity);
public DomainModel produce() { Collection<MetaClass> classes = metadata.getSession().getClasses(); DomainModel result = new DomainModel(extendedEntities, metadata); EntityBuilder builder = new EntityBuilder(); for (MetaClass aClass : classes) { builder.startNewEntity(aClass.getName()); Collection<MetaProperty> props = aClass.getProperties(); for (MetaProperty prop : props) { if (metadataTools.isPersistent(prop)) addProperty(builder, aClass, prop); } JpqlEntityModel entity = builder.produce(); result.add(entity); } return result; }
variableContext.addEntityVariable(variableName, model.getEntityByName(child0.getText())); } catch (UnknownEntityNameException e) { invalidNodes.add(new ErrorRec(this,
try { DomainModel model = queryTree.getModel(); JpqlEntityModel entity = model.getEntityByName(entityName); String currentVariableName = pathNode.getEntityVariableName(); PathNode currentPathNode = new PathNode(pathNode.getToken(), currentVariableName); entity = model.getEntityByName(entityName);
@Override public Pointer next(DomainModel model, String field) { Attribute attribute = entity.getAttributeByName(field); if (attribute == null) { return NoPointer.instance(); } if (!attribute.isEntityReferenceAttribute()) { return new SimpleAttributePointer(entity, attribute); } String targetEntityName = attribute.getReferencedEntityName(); try { JpqlEntityModel targetEntity = model.getEntityByName(targetEntityName); return attribute.isCollection() ? new CollectionPointer(targetEntity) : new EntityPointer(targetEntity); } catch (UnknownEntityNameException e) { return NoPointer.instance(); } }
Attribute entityAttribute = entity.getAttributeByName(fieldName); if (entityAttribute != null && entityAttribute.isEntityReferenceAttribute()) { entity = model.getEntityByName(entityAttribute.getReferencedEntityName()); if (!collectionSelect) { collectionSelect = entityAttribute.isCollection();