Map<String, RevisionPropertyTypeDesc> propertyDesc = new HashMap<String, RevisionPropertyTypeDesc>();
int count = 0;
for (String property : spec.getChangesetPropertyNames())
{
EventPropertyGetter fullGetter = spec.getBaseEventType().getGetter(property);
int propertyNumber = count;
int[] propGroupsProperty = propsPerGroup.get(property);
final RevisionGetterParameters parameters = new RevisionGetterParameters(property, propertyNumber, fullGetter, propGroupsProperty);
// if there are no groups (full event property only), then simply use the full event getter
EventPropertyGetter revisionGetter = new EventPropertyGetter() {
public Object get(EventBean eventBean) throws PropertyAccessException
{
RevisionEventBeanDeclared riv = (RevisionEventBeanDeclared) eventBean;
return riv.getVersionedValue(parameters);
}
public boolean isExistsProperty(EventBean eventBean)
{
return true;
}
public Object getFragment(EventBean eventBean)
{
return null; // fragments no provided by revision events
}
};
Class type = spec.getBaseEventType().getPropertyType(property);
RevisionPropertyTypeDesc propertyTypeDesc = new RevisionPropertyTypeDesc(revisionGetter, parameters, type);
propertyDesc.put(property, propertyTypeDesc);
count++;
}
for (String property : spec.getBaseEventOnlyPropertyNames())
{
final EventPropertyGetter fullGetter = spec.getBaseEventType().getGetter(property);
// if there are no groups (full event property only), then simply use the full event getter
EventPropertyGetter revisionGetter = new EventPropertyGetter() {
public Object get(EventBean eventBean) throws PropertyAccessException
{
RevisionEventBeanDeclared riv = (RevisionEventBeanDeclared) eventBean;
EventBean bean = riv.getLastBaseEvent();
if (bean == null) {
return null;
}
return fullGetter.get(bean);
}
public boolean isExistsProperty(EventBean eventBean)
{
return true;
}
public Object getFragment(EventBean eventBean)
{
return null; // fragments no provided by revision events
}
};
Class type = spec.getBaseEventType().getPropertyType(property);
RevisionPropertyTypeDesc propertyTypeDesc = new RevisionPropertyTypeDesc(revisionGetter, null, type);
propertyDesc.put(property, propertyTypeDesc);
count++;
}
count = 0;
for (String property : spec.getKeyPropertyNames())
{
final int keyPropertyNumber = count;
EventPropertyGetter revisionGetter;
if (spec.getKeyPropertyNames().length == 1) {
revisionGetter = new EventPropertyGetter() {
public Object get(EventBean eventBean) throws PropertyAccessException
{
RevisionEventBeanDeclared riv = (RevisionEventBeanDeclared) eventBean;
return riv.getKey();
}
public boolean isExistsProperty(EventBean eventBean)
{
return true;
}
public Object getFragment(EventBean eventBean)
{
return null;
}
};
}
else {
revisionGetter = new EventPropertyGetter() {
public Object get(EventBean eventBean) throws PropertyAccessException
{
RevisionEventBeanDeclared riv = (RevisionEventBeanDeclared) eventBean;
MultiKeyUntyped key = (MultiKeyUntyped) riv.getKey();
if (key == null) {