* @throws WGAPIException
*/
public void changeContentType(WGContentType contentType) throws WGAPIException {
// master task to check for unreleased content
MasterSessionTask checkUnreleasedContent = new MasterSessionTask(getDatabase()) {
protected void exec(WGDatabase db) throws Throwable {
Iterator contents = getAllContent().iterator();
while (contents.hasNext()) {
WGContent content = (WGContent) contents.next();
if (!content.getStatus().equals(WGContent.STATUS_RELEASE)) {
throw new WGIllegalStateException("ContentType cannot be changed bc. there is unreleased content in draft or review state.");
}
}
}
};
// check for unreleased content
try {
checkUnreleasedContent.runWithExceptions();
} catch (WGAPIException e) {
throw e;
} catch (Throwable e) {
throw new WGAPIException(e.getMessage(), e);
}