Cancel
Showing results for 
Search instead for 
Did you mean: 

How to find value of PropertyDescriptor using SOA API ?

Experimenter
Experimenter

Within the field 'SoaType' of a Form there is a subfield 'PropDescs' which contains the names of fields on the form, but not the values.

 

For ex. the field 'owning_group' contains the key 'owning_group' and the value '{Teamcenter.Soa.Internal.Client.Model.PropertyDescriptionImpl}', not the string containing the owning_group's name.

 

Rather the value exposes the PropertyDescription type members, ex. 'enabled, FieldType, InitialValue, Localizable, LovCategory' to name a few, but again, the actual value within the field is not present/or loaded.

 

Running DataManagementService.GetProperties on the WorkspaceObject representing the Form is not loading any additional properties, namely, Object_properties which appears to be the field desired in this case.

 

GetAttachedPropDescs2 documentation wording isn't providing clarity - "Get the attached property descriptor based on input type name and property names structure."

 

Is this meaning it takes an input type, ex. "ItemRevision", and ex. name "object_name", that the output would be "String" or the actual value stored in object_name?

 

Similarly, how does this method know which object to pull the data from?

 

tl;dr - How to load the entered value for a given field on a form and retrieve it?

3 REPLIES

Re: How to find value of PropertyDescriptor using SOA API ?

Experimenter
Experimenter

ModelObject.GetProperty(string propertyName) returns an 'Properpty' object which contains the data in a variety of parameters. 'DisplayValue', 'StringValue', et cetera.

 

Edit: to include an example.

 

Note: this returns custom properties created via the BMIDE as well, at least, for me.

ex: 

// Load the property
Teamcenter.Soa.Client.Model.Property temp = ModelObject.GetProperty("owning_user");

// Data entered into "owning_user" field
string refFormText = temp.StringValue;

Re: How to find value of PropertyDescriptor using SOA API ?

Solution Partner Experimenter Solution Partner Experimenter
Solution Partner Experimenter

Hello,

I'll allow myself to join the thread. My problem is a bit similar. 

In some cases I need to take property as object - I use method getPropertyObject(refName). 

Sometimes I need to us the property which is defined as a RuntimeProperty. SOA provides a specific type for RuntimeProperty objects, but I have found no special way to handle it (to resolve it's value). 

Specific case: having queried PSBomViewRevision, I need a reference to it's ItemRevision (as an Object). I found no way to do it with using SOA (with Java). 

My attempt was like:

 

ModelObject psBomViewRev; //instance of PSBomViewRevision
//...
//property is loaded in other place Property prop = psBomVewRev.getPropertyObject("item_revision"); //runtime property defined on the  ModelObject mo = prop.getModelObjectValue();

Unfortunately, mo is null. I use the similar way in a few cases to resolve refered object (i.e. Item from ItemRevision, Item from BomView etc) and it works just fine, but this is a RuntimeProperty and is not resolved. It also does not return NotLoadedException.

 

Does anybody here know a way to get runtime property using SOA services? I searched through a documentation but found nothing. 

 

Will appreciate every feedback, thank you in advance.

 

Re: How to find value of PropertyDescriptor using SOA API ?

Pioneer
Pioneer

If the MO.GetProperty method isn't what working out as was shown in the accepted response, you can try loading roperties via the policy used on the SessionService (reference as 'service' here). Best of luck.

 

ObjectPropertyPolicy policy = new ObjectPropertyPolicy();

policy.AddType(new PolicyType("WorkspaceObject", new String[] { "object_type", "object_string" }));
policy.AddType(new PolicyType("ImanFile", new String[] { "object_type", "original_file_name" }));
policy.AddType(new PolicyType("ItemRevision", new String[] { "object_type", "revision_list" }));
policy.AddType(new PolicyType("Dataset", new String[] { "object_type", "ref_list" }));
    new String[] { PolicyProperty.WITH_PROPERTIES }));

service.SetObjectPropertyPolicy(policy);