if (null == this.getContentIds()) {
return SUCCESS;
}
Iterator<String> iter = this.getContentIds().iterator();
List<Content> publishedContents = new ArrayList<Content>();
IContentManager contentManager = (IContentManager) this.getContentManager();
while (iter.hasNext()) {
String contentId = (String) iter.next();
Content contentToPublish = contentManager.loadContent(contentId, false);
String[] msgArg = new String[1];
if (null == contentToPublish) {
msgArg[0] = contentId;
this.addActionError(this.getText("error.content.contentToPublishNull", msgArg));
continue;
}
msgArg[0] = contentToPublish.getDescr();
if (!Content.STATUS_READY.equals(contentToPublish.getStatus())) {
String nextStep = this.getNextStep(contentToPublish);
if (null != nextStep && !Content.STATUS_READY.equals(nextStep)) {
String[] args = {contentToPublish.getId(), contentToPublish.getDescr(), contentToPublish.getStatus()};
this.addActionError(this.getText("error.content.publish.statusNotAllowed", args));
continue;
}
}
if (!this.isUserAllowed(contentToPublish)) {
this.addActionError(this.getText("error.content.userNotAllowedToPublishContent", msgArg));
continue;
}
this.getContentActionHelper().scanEntity(contentToPublish, this);
if (this.getFieldErrors().size()>0) {
this.addActionError(this.getText("error.content.publishingContentWithErrors", msgArg));
continue;
}
contentManager.insertOnLineContent(contentToPublish);
ApsSystemUtils.getLogger().info("Content '" + contentToPublish.getId()
+ "' published by user '" + this.getCurrentUser().getUsername() + "'");
publishedContents.add(contentToPublish);
}
//RIVISITARE LOGICA DI COSTRUZIONE LABEL