Справочник Пользователя для Red Hat Web Application Framework 6.1

Скачать
Страница из 230
Chapter 11. Services Tutorials
147
public String getSummary(DomainObject dobj) {
Note note = (Note)dobj;
// Truncate body text & remove any HTML.
return StringUtils.truncateString(note.getBody(),
200,
true);
}
...
Example 11-10. Core search metadata
11.6.1.2. Supplementary search metadata
The next set of optional methods allow for provision of auditing data that will be useful for
narrowing search results, namely creation and modification date and the party who performed
these two actions. This information can be trivially provided if the domain object already using
com.arsdigita.auditing
package:
...
public Date getCreationDate(DomainObject dobj) {
Note note = (Note)dobj;
BasicAuditTrail audit = BasicAuditTrail.retrieveForACSObject(note);
return audit == null ? null : audit.getCreationDate();
}
public Party getCreationParty(DomainObject dobj) {
Note note = (Note)dobj;
BasicAuditTrail audit = BasicAuditTrail.retrieveForACSObject(note);
return audit == null ? null : audit.getCreationParty();
}
public Date getLastMofidiedDate(DomainObject dobj) {
Note note = (Note)dobj;
BasicAuditTrail audit = BasicAuditTrail.retrieveForACSObject(note);
return audit == null ? null : audit.getLastModifiedDate();
}
public Party getLastMofidiedParty(DomainObject dobj) {
Note note = (Note)dobj;
BasicAuditTrail audit = BasicAuditTrail.retrieveForACSObject(note);
return audit == null ? null : audit.getLastModifiedParty();
}
...
Example 11-11. Supplementary search metadata