use of org.whole.lang.reflect.FeatureDescriptor 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.reflect.FeatureDescriptor in project whole by wholeplatform.
the class WholeNodeEditPolicy method getConnectionCompleteCommand.
protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
FeatureDescriptor fd = getNodeEditPart().getTargetConnectionFeature(request);
if (fd == null)
return UnexecutableCommand.INSTANCE;
ConnectionCreateCommand cmd = (ConnectionCreateCommand) request.getStartCommand();
if (cmd == null)
return UnexecutableCommand.INSTANCE;
cmd.setConnection((IEntity) request.getNewObject());
cmd.setTarget(getNode());
cmd.setTargetFeature(fd);
return cmd;
}
use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class XmlSpecific2XsiBuilderAdapter method mixedStructuralEntity_.
protected MappingContext mixedStructuralEntity_(EntityDescriptor<?> context) {
if (!hasMixedStructuralMapping(context))
return null;
FeatureDescriptor fd = getMixedStructuralFeature(context);
EntityDescriptor<?> ed = getMixedStructuralType(context);
builder.wFeature(fd);
builder.wEntity_(ed);
return MappingContext.create(ed, fd, true, true);
}
use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class XmlSpecific2XsiBuilderAdapter method elementEntity_.
protected MappingContext elementEntity_(EntityDescriptor<?> context, QName name, Attributes attributes) {
// TODO test!!!
// EntityDescriptor<?> ed = ap.hasExplicitType() ? ap.getExplicitType() : getElementEntityMapping(context, name);
EntityDescriptor<?> ed = getElementEntityMapping(context, name);
if (SchemaUtils.isAnyType(ed))
ed = getElementEntityMapping(CommonsEntityDescriptorEnum.RootFragment, name);
if (ed == null)
throw new IllegalStateException("missing mapping");
FeatureDescriptor fd = calculateFeatureDescriptor(context, name);
if (!EntityUtils.isComposite(context))
builder.wFeature(fd);
// FIXME abstract/union types
if (!EntityUtils.isData(ed) && !(ed.isAbstract() && ed.isPolymorphic())) {
// was getConcreteSubtypesInLanguage().size() > 1)) {
;
builder.wEntity_(ed);
attributeEntities(ed, attributes);
}
return MappingContext.create(ed, fd, false);
}
use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class XmlSpecific2XsiBuilderAdapter method calculateFeatureDescriptor.
protected FeatureDescriptor calculateFeatureDescriptor(EntityDescriptor<?> context, QName name) {
Collection<FeatureDescriptor> fds = getElementFeatureMappings(context, name);
if (fds.size() > 1) {
List<FeatureDescriptor> contextFeatures = context.getEntityFeatureDescriptors();
FeatureDescriptor contextFeature;
int index = builder.wCurrentIndexOf();
while (index < contextFeatures.size() && !fds.contains(contextFeature = contextFeatures.get(index)) && contextFeature.isOptional()) index++;
return context.getEntityFeatureDescriptor(index);
} else
return fds.iterator().next();
}
Aggregations