// creator, modifier
if ("user".equals(raw)) {
String login = (String) clipboard.remove("user");
String realm = (String) clipboard.remove("realm");
String name = getCharacters();
User user = new UserImpl(login, realm, name);
clipboard.put("user", user);
}
// date
else if ("date".equals(raw)) {
try {
Date d = dateFormat.parse(getCharacters());
clipboard.put("date", d);
} catch (ParseException e) {
throw new IllegalStateException("Reading date failed: '" + getCharacters() + "'");
}
}
// publishing start date
else if (contentReaderContext == Context.Publish && "from".equals(raw)) {
try {
Date d = dateFormat.parse(getCharacters());
clipboard.put("publish.start", d);
} catch (ParseException e) {
throw new IllegalStateException("Reading publishing start date failed: '" + getCharacters() + "'");
}
}
// publishing end date
else if (contentReaderContext == Context.Publish && "to".equals(raw)) {
try {
Date d = dateFormat.parse(getCharacters());
if (d.getTime() < Times.MAX_DATE)
clipboard.put("publish.end", d);
} catch (ParseException e) {
throw new IllegalStateException("Reading publishing end date failed: '" + getCharacters() + "'");
}
}
// created
else if (contentReaderContext == Context.Creation && "created".equals(raw)) {
User owner = (User) clipboard.remove("user");
Date date = (Date) clipboard.remove("date");
if (date == null)
throw new IllegalStateException("Creation date not found");
setCreated(owner, date);
contentReaderContext = Context.Unknown;
}
// modified
else if (contentReaderContext == Context.Modification && "modified".equals(raw)) {
User modifier = (User) clipboard.remove("user");
Date date = (Date) clipboard.remove("date");
if (date == null)
throw new IllegalStateException("Modification date not found");
setModified(modifier, date);
contentReaderContext = Context.Unknown;
}
// published
else if (contentReaderContext == Context.Publish && "published".equals(raw)) {
User publisher = (User) clipboard.remove("user");
Date startDate = (Date) clipboard.remove("publish.start");
if (startDate == null)
throw new IllegalStateException("Publication start date not found");
Date endDate = (Date) clipboard.remove("publish.end");
setPublished(publisher, startDate, endDate);
contentReaderContext = Context.Unknown;
}
// owner
else if (contentReaderContext == Context.Security && "owner".equals(raw)) {
User owner = (User) clipboard.remove("user");
if (owner == null)
throw new IllegalStateException("Owner not found");
setOwner(owner);
}