logger.info("registryEntires:" + registryEntires.size());
Iterator registryEntiresIterator = registryEntires.iterator();
while(registryEntiresIterator.hasNext())
{
RegistryVO registryVO = (RegistryVO)registryEntiresIterator.next();
logger.info("registryVO:" + registryVO.getReferencingEntityName() + ":" + registryVO.getReferencingEntityId() + ":" + registryVO.getReferencingEntityCompletingName() + ":" + registryVO.getReferencingEntityCompletingId());
boolean add = true;
String key = "" + registryVO.getReferencingEntityCompletingName() + "_" + registryVO.getReferencingEntityCompletingId();
//String key = "" + registryVO.getReferencingEntityName() + "_" + registryVO.getReferencingEntityId();
ReferenceBean existingReferenceBean = (ReferenceBean)entries.get(key);
if(existingReferenceBean == null)
{
existingReferenceBean = new ReferenceBean();
logger.info("Adding referenceBean to entries with key:" + key);
entries.put(key, existingReferenceBean);
referenceBeanList.add(existingReferenceBean);
}
ReferenceVersionBean referenceVersionBean = new ReferenceVersionBean();
if(registryVO.getReferencingEntityName().indexOf("Content") > -1)
{
try
{
ContentVersionVO contentVersion = ContentVersionController.getContentVersionController().getContentVersionVOWithId(new Integer(registryVO.getReferencingEntityId()), db);
//logger.info("content: " + contentVersion.getOwningContent().getContentId() + " - contentVersion: " + contentVersion.getId());
Boolean hasVersion = checkedLanguageVersions.get("" + contentVersion.getContentId() + "_" + contentVersion.getLanguageId());
if(hasVersion != null && onlyOneVersionPerLanguage)
{
continue;
//referenceBeanList.remove(existingReferenceBean);
}
else if(excludeInternalContentReferences && contentVersion.getContentId().equals(contentId))
{
logger.info("Skipping internal reference " + contentId + " had on itself.");
referenceBeanList.remove(existingReferenceBean);
}
else
{
ContentVO contentVO = ContentController.getContentController().getContentVOWithId(contentVersion.getContentId(), db);
existingReferenceBean.setName(contentVO.getName());
existingReferenceBean.setReferencingCompletingObject(contentVO);
existingReferenceBean.setPath(ContentController.getContentController().getContentPath(contentVersion.getContentId(), false, true, db));
try
{
String userName = contentVersion.getVersionModifier();
if(userName == null || userName.equals(""))
userName = contentVO.getCreatorName();
InfoGluePrincipal user = UserControllerProxy.getController().getUser(userName);
if(user != null)
existingReferenceBean.setContactPersonEmail(user.getEmail());
else
existingReferenceBean.setContactPersonEmail(userName);
}
catch (Exception e)
{
logger.warn("Problem getting version modifier email: " + e.getMessage());
}
referenceVersionBean.setReferencingObject(contentVersion);
referenceVersionBean.getRegistryVOList().add(registryVO);
String assetExtraInfo = RegistryController.getController().getInlineAssetInformation(contentVersion.getVersionValue(), new Integer(registryVO.getEntityId()), contentVersion.getLanguageId(), null, true, db);
if(assetExtraInfo != null)
referenceVersionBean.setReferencingExtraInfo(assetExtraInfo);
logger.info("assetExtraInfo:" + assetExtraInfo);
checkedLanguageVersions.put("" + contentVersion.getContentId() + "_" + contentVersion.getLanguageId(), new Boolean(true));
}
}
catch(Exception e)
{
add = false;
logger.info("content:" + registryVO.getReferencingEntityId() + " did not exist - skipping..");
}
}
else
{
try
{
SiteNodeVersionVO siteNodeVersion = SiteNodeVersionController.getController().getSiteNodeVersionVOWithId(new Integer(registryVO.getReferencingEntityId()), db);
if(!siteNodeVersion.getIsActive())
add = false;
SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId(siteNodeVersion.getSiteNodeId(), db);
logger.info("siteNodeVersion:" + siteNodeVersion.getSiteNodeVersionId());
logger.info("siteNode:" + siteNodeVO.getId());
existingReferenceBean.setName(siteNodeVO.getName());
existingReferenceBean.setReferencingCompletingObject(siteNodeVO);
existingReferenceBean.setPath(SiteNodeController.getController().getSiteNodePath(siteNodeVO.getSiteNodeId(), false, true, db));
try
{
String userName = siteNodeVersion.getVersionModifier();
if(userName == null || userName.equals(""))
userName = siteNodeVO.getCreatorName();
InfoGluePrincipal user = UserControllerProxy.getController().getUser(userName);
if(user != null)
existingReferenceBean.setContactPersonEmail(user.getEmail());
else
existingReferenceBean.setContactPersonEmail(userName);
}
catch (Exception e)
{
logger.warn("Problem getting version modifier email: " + e.getMessage());
}
referenceVersionBean.setReferencingObject(siteNodeVersion);
referenceVersionBean.getRegistryVOList().add(registryVO);
LanguageVO masterLanguageVO = LanguageController.getController().getMasterLanguage(siteNodeVO.getRepositoryId(), db);
ContentVersionVO cvVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(siteNodeVO.getMetaInfoContentId(), masterLanguageVO.getId(), db);
String assetExtraInfo = RegistryController.getController().getInlineAssetInformation(cvVO.getVersionValue(), new Integer(registryVO.getEntityId()), masterLanguageVO.getLanguageId(), null, true, db);
logger.info("assetExtraInfo:" + assetExtraInfo);
if(assetExtraInfo != null)
referenceVersionBean.setReferencingExtraInfo(assetExtraInfo);
}
catch(Exception e)
{
add = false;
logger.info("siteNode:" + registryVO.getReferencingEntityId() + " did not exist - skipping:" + e.getMessage());
}
}
logger.info("Add:" + add);
if(add)