return (T) from.getAttributeAsObject(Field.OBJECT);
}
@Override
public ListGridRecord copyValues(T from) {
ListGridRecord record = new ListGridRecord();
record.setAttribute(Field.ID, from.getId());
record.setAttribute(Field.SUBJECT, from.getSubjectName());
record.setAttribute(Field.STATUS, from.getStatus().name());
record.setAttribute(Field.CONFIGURATION, from.getConfiguration());
record.setAttribute(Field.DURATION, from.getDuration());
record.setAttribute(Field.ERROR_MESSAGE, from.getErrorMessage());
record.setAttribute(Field.CREATED_TIME, new Date(from.getCreatedTime()));
// if it is still in progress, the modified time (which we label as "date completed") is meaningless since it isn't completed yet
if (from.getStatus() != ConfigurationUpdateStatus.INPROGRESS) {
record.setAttribute(Field.MODIFIED_TIME, new Date(from.getModifiedTime()));
}
if (from.getAbstractGroupConfigurationUpdate() != null) {
record.setAttribute(Field.GROUP_CONFIG_UPDATE_ID, from.getAbstractGroupConfigurationUpdate().getId());
record.setAttribute(Field.GROUP_ID, from.getAbstractGroupConfigurationUpdate().getGroup().getId()); // note group must be eagerly loaded here
}
// for ancestry handling
Resource resource = from.getResource();
record.setAttribute(AncestryUtil.RESOURCE_ID, resource.getId());
record.setAttribute(AncestryUtil.RESOURCE_NAME, resource.getName());
record.setAttribute(AncestryUtil.RESOURCE_ANCESTRY, resource.getAncestry());
record.setAttribute(AncestryUtil.RESOURCE_TYPE_ID, resource.getResourceType().getId());
record.setAttribute(Field.OBJECT, from);
return record;
}