}
if(contentVersion != null)
{
//The contentVersion in here is the version we have done something with...
PublicationDetail publicationDetail = new PublicationDetailImpl();
publicationDetail.setCreationDateTime(DateHelper.getSecondPreciseDate());
publicationDetail.setDescription(event.getDescription());
publicationDetail.setEntityClass(entityClass);
publicationDetail.setEntityId(contentVersion.getId());
publicationDetail.setName(event.getName());
publicationDetail.setTypeId(event.getTypeId());
publicationDetail.setPublication((PublicationImpl)publication);
publicationDetail.setCreator(event.getCreator());
Collection publicationDetails = publication.getPublicationDetails();
if(publicationDetails == null)
publication.setPublicationDetails(new ArrayList());
publication.getPublicationDetails().add(publicationDetail);
db.remove(event);
}
}
// Publish sitenodeversions
if(entityClass.equals(SiteNodeVersion.class.getName()))
{
MediumSiteNodeVersionImpl siteNodeVersion = null;
//SiteNodeVersion oldSiteNodeVersion = SiteNodeVersionController.getController().getSiteNodeVersionWithId(entityId, db);
MediumSiteNodeVersionImpl oldSiteNodeVersion = SiteNodeVersionController.getController().getMediumSiteNodeVersionWithId(entityId, db);
if(oldSiteNodeVersion != null && oldSiteNodeVersion.getSiteNodeId() != null && typeId.intValue() == EventVO.UNPUBLISH_LATEST.intValue())
{
oldSiteNodeVersion.setIsActive(new Boolean(false));
siteNodeVersion = oldSiteNodeVersion;
}
/*
else if(oldSiteNodeVersion != null && oldSiteNodeVersion.getOwningSiteNode() != null && typeId.intValue() == EventVO.UNPUBLISH_ALL.intValue())
{
//We just set the published version to not active.
siteNodeVersion.setIsActive(new Boolean(false));
}
*/
else if(oldSiteNodeVersion != null && oldSiteNodeVersion.getSiteNodeId() != null)
{
List<EventVO> events = new ArrayList<EventVO>();
SiteNodeVersionVO newSiteNodeVersionVO = SiteNodeStateController.getController().changeState(entityId, siteNodeVO, SiteNodeVersionVO.PUBLISHED_STATE, "Published", overrideVersionModifyer, infoGluePrincipal, db, oldSiteNodeVersion.getSiteNodeId(), events);
siteNodeVersion = SiteNodeVersionController.getController().getMediumSiteNodeVersionWithId(newSiteNodeVersionVO.getId(), db);
}
if(siteNodeVersion != null)
{
//The siteNodeVersion in here is the version we have done something with...
PublicationDetail publicationDetail = new PublicationDetailImpl();
publicationDetail.setCreationDateTime(DateHelper.getSecondPreciseDate());
publicationDetail.setDescription(event.getDescription());
publicationDetail.setEntityClass(entityClass);
publicationDetail.setEntityId(siteNodeVersion.getId());
publicationDetail.setName(event.getName());
publicationDetail.setTypeId(event.getTypeId());
publicationDetail.setPublication((PublicationImpl)publication);
publicationDetail.setCreator(event.getCreator());
Collection publicationDetails = publication.getPublicationDetails();
if(publicationDetails == null)
publication.setPublicationDetails(new ArrayList());