use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class AbstractEntity method notifyAdded.
protected final void notifyAdded(int index, IEntity newValue, boolean isContainment) {
IEntity owner = wGetOwner();
if (!EntityUtils.isNull(owner) && EntityUtils.isNotResolver(owner)) {
EntityDescriptor<?> ownerEd = owner.wGetEntityDescriptor();
FeatureDescriptor ownerFd = owner.wGetFeatureDescriptor(this);
// was isContainment = !ownerEd.getEntityFeatureDescriptor(ownerFd).isReference();
FeatureDescriptor oppositeFd;
EntityDescriptor<?> oppositeEd;
if (ownerEd.has(ownerFd)) {
// ownerEd.getEntityDescriptor(ownerFd);
oppositeEd = ownerFd.getEntityDescriptor();
// ownerEd.getOppositeFeatureDescriptor(ownerFd);
oppositeFd = ownerFd.getOppositeFeatureDescriptor();
} else {
oppositeEd = newValue.wGetEntityDescriptor();
oppositeFd = oppositeEd.getDirectFeatureDescriptor(ownerFd);
if (oppositeFd != null)
ownerEd = oppositeEd.getEntityDescriptor(oppositeFd);
}
final EntityDescriptor<?> featureEd = ownerEd.getEntityDescriptor(ownerFd);
final boolean isToMany = featureEd.isToManyRelationship();
final boolean isToManyImpl = isToMany && Matcher.matchImpl(featureEd, this);
if (oppositeFd != null && isToManyImpl)
newValue.wAdd(oppositeFd, owner, true);
}
final InternalIEntity internalNewValue = (InternalIEntity) newValue;
if (isContainment) {
internalNewValue.wSetModel(wGetActualModel());
internalNewValue.wSetParent(this);
} else {
if (!EntityUtils.hasParent(newValue))
internalNewValue.wSetModel(wGetActualModel());
internalNewValue.wAddInverseAdjacent(this);
}
FeatureDescriptor fd = CommonsFeatureDescriptorEnum.composite_element;
IEntity newValue0 = newValue.wGetAdaptee(false);
wGetEntityChangeEventHandler().notifyAdded(this, fd, index, newValue0);
wGetCompoundChangeEventHandler().notifyAdded(this, fd, index, newValue0);
}
use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class AbstractEntity method notifyChanged.
protected final void notifyChanged(short oldValue, short newValue) {
if (newValue == oldValue)
return;
FeatureDescriptor fd = CommonsFeatureDescriptorEnum.data_value;
wGetEntityChangeEventHandler().notifyChanged(this, fd, oldValue, newValue);
wGetCompoundChangeEventHandler().notifyChanged(this, fd, oldValue, newValue);
}
use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class AbstractEntity method notifyChanged.
protected final void notifyChanged(long oldValue, long newValue) {
if (newValue == oldValue)
return;
FeatureDescriptor fd = CommonsFeatureDescriptorEnum.data_value;
wGetEntityChangeEventHandler().notifyChanged(this, fd, oldValue, newValue);
wGetCompoundChangeEventHandler().notifyChanged(this, fd, oldValue, newValue);
}
use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class AbstractEntity method notifyRequested.
protected final long notifyRequested(long value) {
if (requestNotificationDisabled)
return value;
FeatureDescriptor fd = CommonsFeatureDescriptorEnum.data_value;
long result = wGetEntityRequestEventHandler().notifyRequested(this, fd, value);
return wGetCompoundRequestEventHandler().notifyRequested(this, fd, result);
}
use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class AbstractEntityAdapter method wSet.
public void wSet(FeatureDescriptor fd, IEntity value) {
FeatureDescriptor adapteeFeatureDescriptor = wGetAdapteeFeatureDescriptor(fd);
// if (adapteeFeatureDescriptor == null)
// throw new IllegalArgumentException("The feature: "+fd+" is not supported by the adaptee: "+adaptee.wGetEntityDescriptor());
wGetAdaptee(false).wSet(adapteeFeatureDescriptor == null ? fd : adapteeFeatureDescriptor, value);
}
Aggregations