Clone a ContentComponent with VCM/DP Api (7.3.1.1)

Hi chic@s,

I try to copy a Instance of a ContentComponent (as ImageComponent,

QueryComponent etc.) with VCM/DP api.

This is my code (temp is an istance of QueryComponent):

-----------------------------------------------------------------

//Retrieve ContentType of temp

ContentType ct = (ContentType) temp.getObjectType();

//Save a XML of Component temp

String newXml = temp.toXML();

//Generate new GUID

String guid = GUID.generateString();

//Make new XML

//Moify XML

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

DocumentBuilder builder = factory.newDocumentBuilder();

Document document = builder.parse(new InputSource(new

StringReader(newXml)));

NodeList nl = document.getElementsByTagName("VignVCMId");

nl.item(0).removeChild(nl.item(0).getChildNodes().item(0));

nl = document.getElementsByTagName("id");

nl.item(0).removeChild(nl.item(0).getChildNodes().item(0));

nl.item(0).appendChild(document.createTextNode(guid));

//Preparing output

StringWriter salida = new StringWriter();

TransformerFactory.newInstance().newTransformer().transform(new

DOMSource(document), new StreamResult(salida));

out.println("<textarea cols='50' rows='20'>");

out.println("New XML: "+ salida);

//copia is a name of new ContentComponent

ContentComponent copia = null;

ObjectType ot = temp.getObjectType();

//Retrieve copia from a newXML

copia = (ContentComponent)ManagedObject.importXML(new

ObjectTypeRef(temp.getObjectType()), salida.toString(), false);

----------------------------------------------------------------------------------

When I try to print a value of copia.toXML() the value of VignVCMId is

empty.

If I try to commit the object copia (copia.commit()), I encountred an

error;

javax.ejb.RemoveException.

We have any idea?

Thanks in advance

Nico

Comments

docs

even i we log in vgndeveloper and try to download the docs, its prompting to vignette connect, when i registered the form of vignette connect, its still verifying my account from past many days,is there any other ways to get the docs directly with vgndeveloper login id?

thanks in advance

sweta

Vignette docs

Hi Sweta,

 I don't think you can get Vignette documents for free of cost, I mean unless we buy the product we are not accessible to the documents. You need to have the credentials to login to Vignette connect in order to download the documentation. Valid credentials for downloading documents will not be provided unless we buy the product.

 

- Ganesh.