cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get all soft types of WTDocument by using API ?

Highlighted
Granite

How to get all soft types of WTDocument by using API ?

Hi All,

I want to list out all Soft types of WTDocumnet by using Windchill API's.

I have created few soft types from type and attribute manager, now my requirement is to show all the soft types of WTDocumnet in a list by using API.

My soft types from type and attribute manager as shown here,

Soft types.jpg

Kindly let me know the related API for this.

Thanks,

Vivek

Tags (1)
4 REPLIES 4
Highlighted

Re: How to get all soft types of WTDocument by using API ?

I belief it should work like this. I copied different methods to one. So you should get an idea.

try {

    TypeIdentifier localTypeIdentifier = null;

        GetTypeIdentifierCommand localGetTypeIdentifierCommand = new GetTypeIdentifierCommand();

        localGetTypeIdentifierCommand.setTypename(WTDocument.class.getName());

        localGetTypeIdentifierCommand.setLocale(SessionHelper.getLocale());

        localGetTypeIdentifierCommand = (GetTypeIdentifierCommand) localGetTypeIdentifierCommand.execute();

        TypeIdentifier[] typeIdentifiers = localGetTypeIdentifierCommand.getAnswer();

        if ((typeIdentifiers != null) && (typeIdentifiers.length > 0)) {

            localTypeIdentifier = typeIdentifiers[0];

            logger.debug("Found type <" + localTypeIdentifier.getTypename() + "> for class <" + WTDocument.class.getName() + ">");

        } else {

            logger.debug("Didn't find type identifier for class <" + WTDocument.class.getName() + ">");

        }

    if (localTypeIdentifier != null) {

        if (TYPE_MODEL.isInstantiable(localTypeIdentifier)) {

            String sDisplayName = TypedUtilityServiceHelper.service.getLocalizedTypeName(localTypeIdentifier, SessionHelper.getLocale());

            logger.debug("found sybtype <" + localTypeIdentifier.getTypename() + "> - " + sDisplayName + " for type <" + localTypeIdentifier.getTypename() + ">");

        }

        TypeIdentifier[] arrayOfTypeIdentifier = TYPE_MODEL.getInstantiableDescendants(localTypeIdentifier, (TypeInstanceIdentifier) null);

        if ((arrayOfTypeIdentifier != null) && (arrayOfTypeIdentifier.length > 0)) {

            for (TypeIdentifier arrayOfTypeIdentifier1 : arrayOfTypeIdentifier) {

                String sDisplayName = TypedUtilityServiceHelper.service.getLocalizedTypeName(arrayOfTypeIdentifier1, SessionHelper.getLocale());

                logger.debug("found sybtype <" + arrayOfTypeIdentifier1.getTypename() + "> - " + sDisplayName + " for type <" + localTypeIdentifier.getTypename() + ">");

            }

        }

    }

} catch (WTException | RemoteException ex) {

    logger.error(ex);

} catch (WTPropertyVetoException e) {

    e.printStackTrace();

}

Highlighted

Re: How to get all soft types of WTDocument by using API ?

hi bjorn thanks for the reply.

10-10-2016 4-04-18 PM.jpg

in the above image how can we get the "TYPE_MODEL" value?

Highlighted

Re: How to get all soft types of WTDocument by using API ?

static {

        TYPE_MODEL = (TypeModel) DefaultServiceProvider.getService(TypeModel.class, null);

    }

Highlighted

Re: How to get all soft types of WTDocument by using API ?

‌did it work?

Announcements