0% found this document useful (0 votes)
224 views

ADK Programming

1. This code creates objects in a database and connects them with relationships. It creates a "Micro Computer" object, then creates additional objects for "System Box", "Mouse", "Monitor", and "Keyboard" and connects them to the "Micro Computer" object with relationships. It uses the DomainObject and DomainRelationship classes to programmatically create and connect the objects in the database.

Uploaded by

siddu1790
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
224 views

ADK Programming

1. This code creates objects in a database and connects them with relationships. It creates a "Micro Computer" object, then creates additional objects for "System Box", "Mouse", "Monitor", and "Keyboard" and connects them to the "Micro Computer" object with relationships. It uses the DomainObject and DomainRelationship classes to programmatically create and connect the objects in the database.

Uploaded by

siddu1790
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1. Creating Objects and Connecting the Objects with relationship import com.matrixone.apps.domain.DomainObject; import com.matrixone.apps.domain.DomainRelationship; import matrix.db.

Context; import matrix.db.RelationshipType; import matrix.util.MatrixException; public class ConnectDatabase { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub try { @SuppressWarnings("deprecation") Context conObj = new Context(":bos","http://localhost:8080/enovia/"); conObj.setUser("creator"); conObj.setPassword(""); conObj.connect(); System.out.println("connected ..............."); DomainObject dobj=new DomainObject(); DomainObject dobj1=new DomainObject(); dobj.createObject(conObj,"Micro Computer","MC","A","ComputerPolicy","ComputerVault"); dobj1.createAndConnect(conObj,"System Box","SB","A","ComputerPolicy","ComputerVault","MicrocomputerAssembly",dobj,true); dobj1.createAndConnect(conObj,"Mouse","Mouse","A","ComputerPolicy","ComputerVault","Microcom puterAssembly",dobj,true); dobj1.createAndConnect(conObj,"Monitor","Monitor","A","ComputerPolicy","ComputerVault","Microc omputerAssembly",dobj,true); dobj1.createAndConnect(conObj,"Keyboard","KB","A","ComputerPolicy","ComputerVault","Microcomp uterAssembly",dobj,true); //findAndUpdateHighImpactProjects(context); conObj.disconnect(); } catch (MatrixException e) { // TODO Auto-generated catch block e.printStackTrace();

} } }

You might also like