use of com.ramussoft.common.event.QualifierEvent in project ramus by Vitaliy-Yakovchuk.
the class HierarchicalPlugin method init.
@Override
public void init(final Engine engine, AccessRules accessor) {
super.init(engine, accessor);
hierarhicalAttribute = engine.getSystemAttribute(HIERARHICAL_ATTRIBUTE);
if (hierarhicalAttribute == null) {
hierarhicalAttribute = engine.createSystemAttribute(new AttributeType(getName(), getTypeName(), true));
hierarhicalAttribute.setName(HIERARHICAL_ATTRIBUTE);
engine.updateAttribute(hierarhicalAttribute);
}
engine.setPluginProperty(getName(), HIERARHICAL_ATTRIBUTE, hierarhicalAttribute);
engine.addQualifierListener(new QualifierAdapter() {
@Override
public void qualifierCreated(QualifierEvent event) {
if (event.isJournaled())
return;
if (StandardAttributesPlugin.isDisableAutoupdate(engine))
return;
Qualifier qualifier = event.getNewQualifier();
if (qualifier.isSystem())
return;
qualifier.getSystemAttributes().add(hierarhicalAttribute);
engine.updateQualifier(qualifier);
}
});
}
Aggregations