throw new WGBackendException("Could not publish document " + getContentKey().toString() + " because it could not be saved");
}
synchronized ( db ) {
WGWorkflow workflow = getWorkflow();
if (getDatabase().isProjectMode()) {
release(comment, workflow);
this.addWorkflowHistoryEntry("Released in project mode");
}
else {
boolean result = workflow.publish(comment);
if (result == false) {
this.setStatus(WGContent.STATUS_REVIEW);
this.addWorkflowHistoryEntry("Submitted for approval");
WGContentEvent event = new WGContentEvent(WGContentEvent.TYPE_STATUSCHANGED, getDocumentKey(), getStructEntry().getContentType().getName(), getDatabase());
event.setContent(this);
getDatabase().fireContentEvent(event);
// Automatic approval - approve method will automatically release content if workflow was done
if (getDatabase().isAutoApprove()) {
while (result == false && workflow.isApprovableByUser()) {
result = approve("Automatic approval for user '" + getDatabase().getSessionContext().getUser() + "'", workflow);
}
}
}