use of org.whole.lang.queries.model.Expression in project whole by wholeplatform.
the class PojoUtils method getReadOnlyFields.
public static Set<Name> getReadOnlyFields(PojoDeclaration pojoDeclaration) {
Set<Name> readOnlyFields = new HashSet<Name>();
IBindingManager bindings = BindingManagerFactory.instance.createArguments();
Expression findAllReadOnlyFields = (Expression) PojoTemplateManager.instance().create("findAllReadOnlyFields");
for (Name readOnlyField : BehaviorUtils.<Name>compileAndLazyEvaluate(findAllReadOnlyFields, pojoDeclaration, bindings)) readOnlyFields.add(readOnlyField);
return readOnlyFields;
}
use of org.whole.lang.queries.model.Expression in project whole by wholeplatform.
the class PojoUtils method findConstructor.
public static Constructor findConstructor(PojoDeclaration pojoDeclaration) {
IBindingManager bindings = BindingManagerFactory.instance.createArguments();
Expression findParameterByTemplate = (Expression) PojoTemplateManager.instance().create("findParameterByTemplate");
List<Constructor> constructors = getConstructors(pojoDeclaration);
int[] supportedFields = new int[constructors.size()];
Expression findAllReadOnlyFields = (Expression) PojoTemplateManager.instance().create("findAllReadOnlyFields");
IEntityIterator<Name> iterator = BehaviorUtils.<Name>compileAndLazyEvaluate(findAllReadOnlyFields, pojoDeclaration, bindings);
int readOnlyFieldCount = 0;
while (iterator.hasNext()) {
iterator.next();
for (int i = 0; i < supportedFields.length; i++) if (BehaviorUtils.evaluateFirstResult(findParameterByTemplate, constructors.get(i), bindings) != null)
supportedFields[i]++;
readOnlyFieldCount++;
}
for (int i = 0; i < supportedFields.length; i++) if (supportedFields[i] >= readOnlyFieldCount)
return constructors.get(i);
return constructors.get(supportedFields.length - 1);
}
use of org.whole.lang.queries.model.Expression in project whole by wholeplatform.
the class QueriesInterpreterVisitor method visit.
@Override
public void visit(FeatureStep entity) {
IEntity self = getSelfEntity(entity);
String featureName = entity.getValue();
FeatureDescriptor fd = self.wGetLanguageKit().getFeatureDescriptorEnum().valueOf(featureName);
if (fd == null || !self.wContains(fd))
visit((Expression) entity);
else
setResult(self.wGet(fd));
}
use of org.whole.lang.queries.model.Expression in project whole by wholeplatform.
the class ActionsUIContentAssistVisitor method createNotEqualsQuery.
protected IEntity createNotEqualsQuery(IEntity prototype) {
Expression expression = createStageUpFragment(Expression, EntityUtils.clone(prototype));
QueriesEntityFactory qef = QueriesEntityFactory.instance;
return qef.createNot(qef.createExpressionTest(qef.createPointwiseEquals(qef.createSelfStep(), expression)));
}
use of org.whole.lang.queries.model.Expression in project whole by wholeplatform.
the class PojoUtils method findProductDeclarationByTemplateName.
public static ProductDeclaration findProductDeclarationByTemplateName(EntityDescriptor<?> ed, Library library) {
PojoEntityFactory pef = PojoEntityFactory.instance;
Expression findProductDeclarationByTemplateName = (Expression) PojoTemplateManager.instance().create("findProductDeclarationByTemplateName");
Name templateName = pef.createName(ed.getName());
IBindingManager bindings = BindingManagerFactory.instance.createArguments();
bindings.wDef("templateName", templateName);
return BehaviorUtils.evaluateFirstResult(findProductDeclarationByTemplateName, library, bindings);
}
Aggregations