Skip to main content
17-Peridot
March 19, 2020
Question

How do I link two Document subtypes?

  • March 19, 2020
  • 0 replies
  • 881 views

Hi, everybody!
I have created a subtype of the Document using the following code:

package com.acme;

import wt.doc.WTDocument;
import wt.util.WTException;
import com.ptc.windchill.annotations.metadata.*;

@GenAsPersistable(superClass=WTDocument.class,
 properties={
 @GeneratedProperty(name="sizeC", 
 type=Integer.class, initialValue="3",
 javaDoc="Integer value to represent the size of C.")},
 
 iconProperties=@IconProperties(standardIcon="netmarkets/images/stop.gif", 
 openIcon="netmarkets/images/stop.gif")
)
public class AcmeModeledDoc extends _AcmeModeledDoc {

 static final long serialVersionUID = 1;

 public static AcmeModeledDoc newAcmeModeledDoc()
 throws WTException {
 AcmeModeledDoc instance = new AcmeModeledDoc();
 instance.initialize();
 return instance;
 }
}

Everything works , I can create a document, specify the sizeС.

I tried creating a second subtype with link it to the previous one:

package com.acme;

import wt.doc.WTDocument;
import wt.util.WTException;
import com.ptc.windchill.annotations.metadata.*;

@GenAsPersistable(superClass=WTDocument.class,
properties={
@GeneratedProperty(name="sizeTwo", 
 type=Integer.class, initialValue="3",
 javaDoc="Integer value to represent the size of C."),
// link 
@GeneratedProperty(name="sizeC", type=AcmeModeledDoc.class)},

iconProperties=@IconProperties(standardIcon="netmarkets/images/start.gif", 
 openIcon="netmarkets/images/start.gif")

)

public class AcmeModeledDocTwo extends _AcmeModeledDocTwo {

	 static final long serialVersionUID = 1;

	 public static AcmeModeledDocTwo newAcmeModeledDocTwo()
	 throws WTException {
		 AcmeModeledDocTwo instance = new AcmeModeledDocTwo();
	 instance.initialize();
	 return instance;
	 }
	}

 

But now I can 't create a document


Can you tell me how to set up a connection?