AnsweredAssumed Answered

Update Tag values for the content

Question asked by naval on Oct 19, 2012
I have list of tag values coming from xml and want to update the tag values for the content.
I am trying by below lines but it is not working

      NamedValue[] ratingProps = new NamedValue[1];
      ratingProps[0] = Utils.createNamedValue(
            "{"   + NamespaceService.CONTENT_MODEL_1_0_URI + "}" + "taggable", "TagValue");

      System.out.println("freeTextResultObject.getArticleId()"+ratingProps[0].getValue());
      AuthenticationUtils.startSession("admin", "admin");
      
      store = new Store(Constants.WORKSPACE_STORE,
            KnowledgeBaseConstants.SPACE_STORE);
      Reference ref = new Reference(store,freeTextResultObject.getArticleId(), null);
      Predicate predicate = new Predicate(new Reference[] { ref },store, null);

      CMLUpdate[] cmlUpdate = new CMLUpdate[1];
      CMLUpdate update = new CMLUpdate();
      update.setWhere(predicate);
      update.setProperty(ratingProps);
      cmlUpdate[0] = update;
      CML cml = new CML();
      cml.setUpdate(cmlUpdate);
      WebServiceFactory.getRepositoryService().update(cml);

Please guide if i am missing something.

Outcomes