Written by

Question CM Wang · Aug 15, 2017

How to get all the names of the classes which inherits %Persistent

I want to retrieve all the names of classes which are %Persistent in a namespace by COS.

Any suggestion, Thanks.

Comments

Jeffrey Semmens  Aug 15, 2017 to Robert Cemper

Programmatically you can use the SubclassOf() query in the %Dictionary.ClassDefinitionQuery class. Pass in %Persistent and the flag for non-system classes.

0
CM Wang  Aug 15, 2017 to Jeffrey Semmens

It seems like any classes defined in %SYS would also returned by this method.

Any way to filter them out? Thanks.

0
Jeffrey Semmens  Aug 15, 2017 to CM Wang

You could then iterate through the returned classes and check to see which ones are marked "system" by opening up each definition. I seem to vaguely remember a way to do this with a query but I can't find it now.

0
Eduard Lebedyuk  Aug 15, 2017 to Jeffrey Semmens

SQL join or is there something more elaborate?

SELECT cd.name
FROM %Dictionary.ClassDefinition cd
JOIN subclassofquery sq ON sq.Name = cd.Name
WHERE cd.System IS NULL
0
Robert Cemper  Aug 15, 2017 to Eduard Lebedyuk

high comfort  service ! yes

0
Dan Pasco  Aug 15, 2017 to Jeffrey Semmens

SYSTEM is not a valid filter. That keyword allows the class compiler to organize classes into compile 'groups' so that a class that may depend on another class at compile time is guaranteed to have the dependency resolved.

It isn't an indicator that the class originated in %SYS/%CACHELIB.

0
John Murray  Aug 17, 2017 to CM Wang

I have just posted an article here about how to determine whether a class is mapped.

0