Api to get NonConformance Review
how to get the NonConformance Review through the NonConformance object.
how to get the NonConformance Review through the NonConformance object.
try below :
package ext;
import com.ptc.qualitymanagement.nc.Nonconformance;
import com.ptc.qualitymanagement.nc.review.NCReview;
import wt.query.OrderBy;
import wt.query.QueryException;
import wt.query.QuerySpec;
import wt.query.SearchCondition;
import wt.fc.QueryResult;
import wt.util.WTException;
import wt.pds.StatementSpec;
import wt.fc.PersistenceHelper;
public class NCService{
public static NCReview getNCReview(Nonconformance NC) throws WTException {
NCReview review = null;
try {
QuerySpec qs = new QuerySpec(NCReview.class);
qs.appendWhere(new SearchCondition(NCReview.class,
NCReview.NONCONFORMANCE_REFERENCE + ".key.id",
SearchCondition.EQUAL,
NC.getPersistInfo().getObjectIdentifier().getId()),
new int[]{0});
QueryResult results = PersistenceHelper.manager.find((StatementSpec)qs);
if(results.hasMoreElements()) {
Object obj = results.nextElement();
if(obj instanceof NCReview) {
review = (NCReview) obj;
}
}
return review;
}catch(WTException e){
System.err.println("Exception" +e);
}
return review;
}
}
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.