3 Replies Latest reply on Feb 6, 2012 7:12 AM by Bill Robinson

    blcli: How to get the model type of an object as string

    Richard Bayer

      Hi all,

       

      I need to convert the integer of a model type to the representing string. There is a method in the Utlitiy namespace (convertModelType), that does it vice versa, so from a string to the integer value. But I can find anything from int to string.

       

      Any ideas?

       

       

      Regards,

      Richard

        • 1. Re: blcli: How to get the model type of an object as string
          Bill Robinson

          there isn't.  you can build and array of the model type ids and the strings and do a look up that way. 

          why do you need to do this ?

          • 2. Re: blcli: How to get the model type of an object as string
            Richard Bayer

            I would like to go through a depot group and read / update the properties of each object (software package) in there.

             

            I managed to get the content of a depot group, but to read or write the properties, I need the name and type of the depot object. Unfortunately all the commands just return the type as integer. But the command to set the object properties (DepotObject getFullyResolvedPropertyValue) expects the object type as string.

             

             

            So my script to read the depot group looks like this at the moment:

             

            ------------------------------------------------

                blcli_execute DepotGroup groupNameToId "$FOLDERPATH" >/dev/null 2>&1

                blcli_storeenv GROUPID >/dev/null 2>&1

                blcli_execute DepotObject findAllHeadersByGroup "$GROUPID" >/dev/null 2>&1

                blcli_execute Utility storeTargetObject SHEADER >/dev/null 2>&1

             

                # now go through list

                blcli_execute Utility listLength >/dev/null 2>&1

                blcli_storeenv LASTINDEX >/dev/null 2>&1

                INDEX=0

             

                while [ $INDEX -lt $LASTINDEX ]

                do

                    # retrieve target object from list

                    blcli_execute Utility setTargetObject SHEADER >/dev/null 2>&1

                    blcli_execute Utility listItemSelect $INDEX >/dev/null 2>&1

                    blcli_execute Utility setTargetObject >/dev/null 2>&1

             

                    # get object type

                    blcli_execute SDepotObjectHeader getObjectTypeId >/dev/null 2>&1

                    blcli_storeenv MYTYPE >/dev/null 2>&1

             

                    # get object name

                    blcli_execute SDepotObjectHeader getName >/dev/null 2>&1

                    blcli_storeenv MYNAME >/dev/null 2>&1

             

                    # print out debug

                    echo "NEWOBJECT: $MYTYPE;$MYNAME"

                    INDEX=`expr $INDEX + 1`

             

                    # retrieve object property

                     # FIXME

             

                done

            • 3. Re: blcli: How to get the model type of an object as string
              Bill Robinson

              if you look in the unreleased commands at the command to set the property value, you can just step through that sequence and use the object type number.  one of the first things that command sequence does is convert the string to a int...

              1 of 1 people found this helpful