ContentVersion contentVersion = ContentVersionController.getContentVersionController().getContentVersionWithId(entityId, db);
Collection contentVersions = new ArrayList();
contentVersions.add(contentVersion);
logger.info("Added contentVersion:" + contentVersion.getId());
digitalAsset = new DigitalAssetImpl();
digitalAsset.setValueObject(digitalAssetVO);
if(CmsPropertyHandler.getEnableDiskAssets().equals("false"))
digitalAsset.setAssetBlob(is);
digitalAsset.setContentVersions(contentVersions);
db.create(digitalAsset);
contentVersion.getDigitalAssets().add(digitalAsset);
}
else if(entity.equalsIgnoreCase(UserProperties.class.getName()))
{
UserProperties userProperties = UserPropertiesController.getController().getUserPropertiesWithId(entityId, db);
Collection userPropertiesList = new ArrayList();
userPropertiesList.add(userProperties);
logger.info("Added userProperties:" + userProperties.getId());
digitalAsset = new DigitalAssetImpl();
digitalAsset.setValueObject(digitalAssetVO);
if(CmsPropertyHandler.getEnableDiskAssets().equals("false"))
digitalAsset.setAssetBlob(is);
digitalAsset.setUserProperties(userPropertiesList);
db.create(digitalAsset);
userProperties.getDigitalAssets().add(digitalAsset);
}
else if(entity.equalsIgnoreCase(RoleProperties.class.getName()))
{
RoleProperties roleProperties = RolePropertiesController.getController().getRolePropertiesWithId(entityId, db);
Collection rolePropertiesList = new ArrayList();
rolePropertiesList.add(roleProperties);
logger.info("Added roleProperties:" + roleProperties.getId());
digitalAsset = new DigitalAssetImpl();
digitalAsset.setValueObject(digitalAssetVO);
if(CmsPropertyHandler.getEnableDiskAssets().equals("false"))
digitalAsset.setAssetBlob(is);
digitalAsset.setRoleProperties(rolePropertiesList);
db.create(digitalAsset);
roleProperties.getDigitalAssets().add(digitalAsset);
}
else if(entity.equalsIgnoreCase(GroupProperties.class.getName()))
{
GroupProperties groupProperties = GroupPropertiesController.getController().getGroupPropertiesWithId(entityId, db);
Collection groupPropertiesList = new ArrayList();
groupPropertiesList.add(groupProperties);
logger.info("Added groupProperties:" + groupProperties.getId());
digitalAsset = new DigitalAssetImpl();
digitalAsset.setValueObject(digitalAssetVO);
if(CmsPropertyHandler.getEnableDiskAssets().equals("false"))
digitalAsset.setAssetBlob(is);
digitalAsset.setGroupProperties(groupPropertiesList);