public ContentTypeDefinitionVO update(Integer parentContentTypeDefinitionId, ContentTypeDefinitionVO contentTypeDefinitionVO) throws ConstraintException, SystemException
{
Database db = CastorDatabaseService.getDatabase();
ContentTypeDefinition contentTypeDefinition = null;
beginTransaction(db);
try
{
contentTypeDefinition = (ContentTypeDefinition)getObjectWithId(ContentTypeDefinitionImpl.class, contentTypeDefinitionVO.getId(), db);
contentTypeDefinition.setVO(contentTypeDefinitionVO);
//Remove from old children collection
if(contentTypeDefinition.getParent() != null)
{
contentTypeDefinition.getParent().getChildren().remove(contentTypeDefinition);
}
if(parentContentTypeDefinitionId != null && parentContentTypeDefinitionId != -1)
{
ContentTypeDefinition parentContentTypeDefinition = ContentTypeDefinitionController.getController().getContentTypeDefinitionWithId(parentContentTypeDefinitionId, db);
contentTypeDefinition.setParent((ContentTypeDefinitionImpl)parentContentTypeDefinition);
parentContentTypeDefinition.getChildren().add(contentTypeDefinition);
}
else
{
contentTypeDefinition.setParent(null);
}