else if(contentVO.getCreatorName() == null)
contentVO.setCreatorName(this.principal.getName());
ContentVO newContentVO = contentControllerProxy.acCreate(this.principal, contentVO.getParentContentId(), contentVO.getContentTypeDefinitionId(), contentVO.getRepositoryId(), contentVO);
if(newContentVO != null)
statusBean.getCreatedBeans().add(new CreatedEntityBean(ContentVO.class.getName(), new Long(newContentVO.getId())));
@SuppressWarnings("unchecked")
List<Map<String, Object>> contentVersions = (List<Map<String, Object>>)content.get("contentVersions");
if (contentVersions == null)
{
logger.info("Content had no versions. Maybe its a folder. IsBranch: " + isBranch);
}
else
{
Iterator<Map<String, Object>> contentVersionIterator = contentVersions.iterator();
while(contentVersionIterator.hasNext())
{
Map<String, Object> contentVersion = contentVersionIterator.next();
Integer languageId = (Integer)contentVersion.get("languageId");
Integer stateId = (Integer)contentVersion.get("stateId");
Boolean allowHTMLContent = (Boolean)contentVersion.get("allowHTMLContent");
Boolean allowExternalLinks = (Boolean)contentVersion.get("allowExternalLinks");
Boolean allowDollarSigns = (Boolean)contentVersion.get("allowDollarSigns");
Boolean allowAnchorSigns = (Boolean)contentVersion.get("allowAnchorSigns");
if(allowHTMLContent == null)
allowHTMLContent = new Boolean(false);
if(allowExternalLinks == null)
allowExternalLinks = new Boolean(false);
if(allowDollarSigns == null)
allowDollarSigns = new Boolean(false);
if(allowAnchorSigns == null)
allowAnchorSigns = new Boolean(true);
logger.info("languageId:" + languageId);
logger.info("stateId:" + stateId);
logger.info("allowHTMLContent:" + allowHTMLContent);
logger.info("allowExternalLinks:" + allowExternalLinks);
logger.info("allowDollarSigns:" + allowDollarSigns);
logger.info("allowAnchorSigns:" + allowAnchorSigns);
ContentVersionVO contentVersionVO = new ContentVersionVO();
contentVersionVO.setLanguageId(languageId);
if(contentVersionVO.getVersionModifier() == null)
contentVersionVO.setVersionModifier(this.principal.getName());
@SuppressWarnings("unchecked")
Map<String, String> attributes = (Map<String, String>)contentVersion.get("contentVersionAttributes");
DOMBuilder domBuilder = new DOMBuilder();
Document document = domBuilder.createDocument();
Element rootElement = domBuilder.addElement(document, "root");
domBuilder.addAttribute(rootElement, "xmlns", "x-schema:Schema.xml");
Element attributesRoot = domBuilder.addElement(rootElement, "attributes");
Iterator<String> attributesIterator = attributes.keySet().iterator();
while(attributesIterator.hasNext())
{
String attributeName = attributesIterator.next();
String attributeValue = attributes.get(attributeName);
attributeValue = cleanAttributeValue(attributeValue, allowHTMLContent, allowExternalLinks, allowDollarSigns, allowAnchorSigns);
Element attribute = domBuilder.addElement(attributesRoot, attributeName);
domBuilder.addCDATAElement(attribute, attributeValue);
}
contentVersionVO.setVersionValue(document.asXML());
ContentVersionVO newContentVersionVO = contentVersionControllerProxy.acCreate(this.principal, newContentVO.getId(), languageId, contentVersionVO);
Integer newContentVersionId = newContentVersionVO.getId();
statusBean.getCreatedBeans().add(new CreatedEntityBean(ContentVersionVO.class.getName(), new Long(newContentVersionId)));
@SuppressWarnings("unchecked")
List<RemoteAttachment> digitalAssets = (List<RemoteAttachment>)contentVersion.get("digitalAssets");
logger.info("digitalAssets:" + digitalAssets);
if(digitalAssets != null)
{
Iterator<RemoteAttachment> digitalAssetIterator = digitalAssets.iterator();
while(digitalAssetIterator.hasNext())
{
RemoteAttachment remoteAttachment = digitalAssetIterator.next();
logger.info("digitalAssets in ws:" + remoteAttachment);
DigitalAssetVO newAsset = new DigitalAssetVO();
newAsset.setAssetContentType(remoteAttachment.getContentType());
newAsset.setAssetKey(remoteAttachment.getName());
newAsset.setAssetFileName(remoteAttachment.getFileName());
newAsset.setAssetFilePath(remoteAttachment.getFilePath());
newAsset.setAssetFileSize(new Integer(new Long(remoteAttachment.getBytes().length).intValue()));
//is = new FileInputStream(renamedFile);
InputStream is = new ByteArrayInputStream(remoteAttachment.getBytes());
DigitalAssetVO newDigitalAssetVO = DigitalAssetController.create(newAsset, is, newContentVersionId, principal);
if(newDigitalAssetVO != null)
statusBean.getCreatedBeans().add(new CreatedEntityBean(DigitalAssetVO.class.getName(), new Long(newDigitalAssetVO.getId())));
}
}
@SuppressWarnings("unchecked")
List<String> contentCategories = (List<String>)contentVersion.get("contentCategories");