}
}
if(repositoryVO != null)
{
LanguageVO languageVO = LanguageController.getController().getMasterLanguage(repositoryVO.getRepositoryId());
ContentVO parentContent = ContentController.getContentController().getContentVOWithPath(repositoryVO.getId(), restString, true, this.getInfoGluePrincipal());
logger.info("parentContent:" + parentContent);
ContentVO newContentVO = ContentController.getContentController().create(parentContent.getId(), contentTypeDefinitionVO.getContentTypeDefinitionId(), parentContent.getRepositoryId(), remoteContentVO);
logger.info("Now we want to create the version also on:" + newContentVO.getName());
ContentVersionVO contentVersionVO = new ContentVersionVO();
contentVersionVO.setVersionComment("deployment");
contentVersionVO.setVersionModifier(this.getInfoGluePrincipal().getName());
if(remoteContentVO.getVersions() != null && remoteContentVO.getVersions().length > 0)
{
contentVersionVO.setVersionValue(remoteContentVO.getVersions()[0]);
ContentVersionController.getContentVersionController().create(newContentVO.getId(), languageVO.getId(), contentVersionVO, null);
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
break;
}
}
/*
ContentVO contentVO = ContentController.getContentController().getContentVOWithId(new Integer(missingLocalContentId).intValue());
if(contentVO != null)
{
LanguageVO languageVO = LanguageController.getController().getMasterLanguage(contentVO.getRepositoryId());
String fullPath = ContentController.getContentController().getContentPath(contentVO.getId(), true, true);
ContentVersionVO contentVersionVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(contentVO.getId(), languageVO.getId());
if(contentVersionVO != null)
contentVO.setVersions(new String[]{contentVersionVO.getVersionValue()});
contentVO.setFullPath(fullPath);
missingComponents.add(contentVO);
}
*/
}
}
String[] deviatingRemoteContentIdArray = this.getRequest().getParameterValues("deviatingContentId");
//logger.info("deviatingRemoteContentIdArray:" + deviatingRemoteContentIdArray);
List components = ContentController.getContentController().getContentVOWithContentTypeDefinition("HTMLTemplate");
if(deviatingRemoteContentIdArray != null)
{
for(int i=0; i<deviatingRemoteContentIdArray.length; i++)
{
String deviatingRemoteContentId = deviatingRemoteContentIdArray[i];
//String deviatingContentName = deviatingRemoteContentIdArray[i];
//logger.info("Updating deviatingContentName:" + deviatingContentName);
Iterator remoteContentVOListIterator = remoteContentVOList.iterator();
while(remoteContentVOListIterator.hasNext())
{
ContentVO remoteContentVO = (ContentVO)remoteContentVOListIterator.next();
//logger.info("remoteContentVO:" + remoteContentVO.getName());
if(remoteContentVO.getId().toString().equals(deviatingRemoteContentId))
{
String[] versionValues = remoteContentVO.getVersions();
if(versionValues != null && versionValues.length > 0)
{
String remoteVersionValue = versionValues[0];
Iterator componentsIterator = components.iterator();
ContentVO localContentVO = null;
while(componentsIterator.hasNext())
{
ContentVO candidate = (ContentVO)componentsIterator.next();
if(candidate.getName().equals(remoteContentVO.getName()))
{
localContentVO = candidate;
}
}
LanguageVO languageVO = LanguageController.getController().getMasterLanguage(localContentVO.getRepositoryId());
ContentVersionVO contentVersionVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(localContentVO.getId(), languageVO.getId());
if(contentVersionVO != null)
{
contentVersionVO.setVersionValue(remoteVersionValue);
//logger.info("Updating :" + localContentVO.getName() + " with new latest versionValue");
ContentVersionController.getContentVersionController().update(contentVersionVO.getId(), contentVersionVO);
}
}
}
}
}
}
}
else
{
logger.info("Updating components with push....");
Map input = new HashMap();
String[] missingLocalContentIdArray = this.getRequest().getParameterValues("missingContentId");
logger.info("missingLocalContentIdArray:" + missingLocalContentIdArray);
List missingComponents = new ArrayList();
if(missingLocalContentIdArray != null)
{
for(int i=0; i<missingLocalContentIdArray.length; i++)
{
String missingLocalContentId = missingLocalContentIdArray[i];
ContentVO contentVO = ContentController.getContentController().getContentVOWithId(new Integer(missingLocalContentId).intValue());
if(contentVO != null)
{
LanguageVO languageVO = LanguageController.getController().getMasterLanguage(contentVO.getRepositoryId());
String fullPath = ContentController.getContentController().getContentPath(contentVO.getId(), true, true);
ContentVersionVO contentVersionVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(contentVO.getId(), languageVO.getId());
if(contentVersionVO != null)
{
contentVO.setVersions(new String[]{contentVersionVO.getVersionValue()});
contentVO.setVersionComments(new String[]{"BBBBBB:" + contentVersionVO.getVersionComment()});
}
contentVO.setFullPath(fullPath);
missingComponents.add(contentVO);
}
}
}
String[] deviatingLocalContentIdArray = this.getRequest().getParameterValues("deviatingContentId");
logger.info("deviatingLocalContentIdArray:" + deviatingLocalContentIdArray);
List deviatingComponents = new ArrayList();
if(deviatingLocalContentIdArray != null)
{
for(int i=0; i<deviatingLocalContentIdArray.length; i++)
{
String deviatingLocalContentId = deviatingLocalContentIdArray[i];
ContentVO contentVO = ContentController.getContentController().getContentVOWithId(new Integer(deviatingLocalContentId).intValue());
if(contentVO != null)
{
LanguageVO languageVO = LanguageController.getController().getMasterLanguage(contentVO.getRepositoryId());
String fullPath = ContentController.getContentController().getContentPath(contentVO.getId(), true, true);
ContentVersionVO contentVersionVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(contentVO.getId(), languageVO.getId());
if(contentVersionVO != null)
{
contentVO.setVersions(new String[]{contentVersionVO.getVersionValue()});
contentVO.setVersionComments(new String[]{"AAAAAAA:" + contentVersionVO.getVersionComment()});
}