Package org.infoglue.cms.entities.management

Examples of org.infoglue.cms.entities.management.UserPropertiesVO


            logger.info("principalName:" + principalName);
            logger.info("principal:" + principal);
            logger.info("languageId:" + languageId);
            logger.info("contentTypeDefinitionId:" + contentTypeDefinitionId);
           
            UserPropertiesVO userPropertiesVO = new UserPropertiesVO();
            userPropertiesVO.setUserName(principal.getName());
           
          Collection userPropertiesVOList = UserPropertiesController.getController().getUserPropertiesVOList(principal.getName(), languageId);
        Iterator userPropertiesVOListIterator = userPropertiesVOList.iterator();
        while(userPropertiesVOListIterator.hasNext())
        {
          UserPropertiesVO userProperties = (UserPropertiesVO)userPropertiesVOListIterator.next();

          if(userProperties != null && userProperties.getLanguageId().equals(languageId) && userProperties.getValue() != null)
          {
            userPropertiesVO = userProperties;
            break;
          }
        }
           
            logger.info("userPropertiesAttributesMap:" + userPropertiesAttributesMap.size());
           
            DOMBuilder domBuilder = new DOMBuilder();
            Document document = domBuilder.createDocument();
            Element rootElement = null;
            Element attributesRoot = null;
           
            logger.info("keepExistingAttributes:" + keepExistingAttributes);
            if(keepExistingAttributes && userPropertiesVO.getValue() != null)
          {
        String propertyXML = userPropertiesVO.getValue();
        document = domBuilder.getDocument(propertyXML);
       
            attributesRoot = (Element)document.getRootElement().element("attributes");
          }
          else
          {
              rootElement = domBuilder.addElement(document, "article");
              attributesRoot = domBuilder.addElement(rootElement, "attributes");
          }
           
            logger.info("attributesRoot:" + attributesRoot);
            logger.info("XML before:" + document.asXML());

            Iterator attributesIterator = userPropertiesAttributesMap.keySet().iterator();
            while(attributesIterator.hasNext())
            {
                String attributeName  = (String)attributesIterator.next();
                String attributeValue = (String)userPropertiesAttributesMap.get(attributeName);
               
                logger.info(attributeName + "=" + attributeValue);
               
                List<Element> elements = attributesRoot.elements(attributeName);
                logger.info("elements:" + elements.size());
                for(Element attribute : elements)
                {
                  logger.info("attribute:" + attribute);
                    if(attribute != null)
                      attributesRoot.remove(attribute);                 
                }
                Element attribute = domBuilder.addElement(attributesRoot, attributeName);
                
                logger.info("attribute after:" + attribute);
               
                domBuilder.addCDATAElement(attribute, attributeValue);
            }                 
           
            logger.info("XML:" + document.asXML());
           
            userPropertiesVO.setValue(document.asXML());
           
            UserPropertiesVO newUserPropertiesVO = userPropertiesController.update(new Integer(languageId), new Integer(contentTypeDefinitionId), userPropertiesVO);
            newUserPropertiesId = newUserPropertiesVO.getId().intValue();
           
      List existingDigitalAssetVOList = userPropertiesController.getDigitalAssetVOList(newUserPropertiesId);
           
          List digitalAssets = assets;
         
          logger.info("digitalAssets:" + digitalAssets);
          //logger.info("digitalAssets:" + digitalAssets.size());
          if(digitalAssets != null)
          {
              Iterator digitalAssetIterator = digitalAssets.iterator();
              while(digitalAssetIterator.hasNext())
              {
                  RemoteAttachment remoteAttachment = (RemoteAttachment)digitalAssetIterator.next();
                logger.info("digitalAssets in ws:" + remoteAttachment);
                //logger.info("remoteAttachment:" + remoteAttachment.getName() + ":" + remoteAttachment.getSize() + ":" + remoteAttachment.getFilePath());
               
                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());

          Iterator existingDigitalAssetVOListIterator = existingDigitalAssetVOList.iterator();
          while(existingDigitalAssetVOListIterator.hasNext())
          {
            DigitalAssetVO assetVO = (DigitalAssetVO)existingDigitalAssetVOListIterator.next();
            //logger.info("assetVO:" + assetVO.getAssetKey());
            if(assetVO.getAssetKey().equals(newAsset.getAssetKey()))
            {
              //logger.info("Removing:" + assetVO.getAssetKey() + ":" + assetVO.getAssetFileName());
              DigitalAssetController.getController().delete(assetVO.getId(), UserProperties.class.getName(), newUserPropertiesId);
            }
          }
         
                DigitalAssetController.create(newAsset, is, UserProperties.class.getName(), newUserPropertiesVO.getId());
            }  
          }

          if(forcePublication)
          {
        NotificationMessage notificationMessage = new NotificationMessage("RemoteUserProperties.updateUserProperties", UserPropertiesImpl.class.getName(), principalName, NotificationMessage.PUBLISHING, newUserPropertiesVO.getId(), newUserPropertiesVO.getUserName());
        ChangeNotificationController.getInstance().addNotificationMessage(notificationMessage);
          }
        }
        catch(Throwable e)
        {
View Full Code Here


  private ConstraintExceptionBuffer ceb;
 
  public UpdateUserPropertiesAction()
  {
    userPropertiesVO = new UserPropertiesVO();
    this.ceb = new ConstraintExceptionBuffer()
  }
View Full Code Here

TOP

Related Classes of org.infoglue.cms.entities.management.UserPropertiesVO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.