Quantcast
Channel: PTC Community: Message List - Windchill
Viewing all articles
Browse latest Browse all 8876

Re: How to update the Softtype attribute and OOTB attribute of WTDocument

$
0
0

Hi Anurag,

 

Try below code.

 

/**

           * This method will update the IBA value without changing the iteration of

           * the given Persistable object.

           *

           * @param iba

           *            The object of {@link IBAHolder}

           *

           * @param attrName

           *            Name of the IBA

           *

           * @param value

           *            Value of the IBA

           *

           * @exception WTException

           *                throws {@link WTException}

           *

           * @exception WTPropertyVetoException

           *                throws {@link WTPropertyVetoException}

           *

           * @exception RemoteException

           *                throws {@link RemoteException}

           */

          public static void updateValues(IBAHolder iba, String attrName, Object value)

                              throws WTException, WTPropertyVetoException, RemoteException {

                    final IBAHolder ibaHolder = IBAValueHelper.service

                                        .refreshAttributeContainer((IBAHolder) iba, null, null, null);

                    // From part retrieving corresponding IBAHolder

                    final DefaultAttributeContainer defaultattributecontainer = (DefaultAttributeContainer) ibaHolder

                                        .getAttributeContainer();

                    final AttributeDefDefaultView addview = IBADefinitionHelper.service

                                        .getAttributeDefDefaultViewByPath(attrName);

                    final AbstractValueView abstractValueView[] = defaultattributecontainer

                                        .getAttributeValues(addview);

                    final StringDefView sd = (StringDefView) addview;

                    final StringValueDefaultView svdobj = new StringValueDefaultView(sd,

                                        (String) value);

                    // Putting StringValueDefaultView into AbstractValueView

                    defaultattributecontainer

                                        .addAttributeValue(((AbstractValueView) (svdobj)));

                    // Updating the attribute container

                    StandardIBAValueService.theIBAValueDBService.updateAttributeContainer(

                                        ibaHolder, null, null, null);

          }

 

With Regards,

Kaushik


Viewing all articles
Browse latest Browse all 8876

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>