Topic
2 replies Latest Post - ‏2009-12-17T15:47:15Z by JavaAdam
JavaAdam
JavaAdam
6 Posts
ACCEPTED ANSWER

Pinned topic Is there a way to find out which attribute is the representive one?

‏2009-12-17T13:33:29Z |
Hello,

the title is my question: Is there a way to find out which property/attribute is the representive one of a class/item type? In P8 the property is marked as isName in CM8 it is the representiveItem...

Greetings
Adam
Updated on 2009-12-17T15:47:15Z at 2009-12-17T15:47:15Z by JavaAdam
  • SystemAdmin
    SystemAdmin
    254 Posts
    ACCEPTED ANSWER

    Re: Is there a way to find out which attribute is the representive one?

    ‏2009-12-17T14:57:48Z  in response to JavaAdam
    Hi Adam,

    Using the Java API if you can iterate across all of the PropertyDescription objects and for each get the IExtendedDataTYpe. There are a set of constants, one of which is means "name".
    My IICE Java is a little rusty, but it's something like this:

    Content theContent = ... retrived somehow ...;

    for (int i=0; i < theContent.getPropertyDescriptionCount(); i++) {
    PropertyDescription pd = theContent.getPropertyDescription(i);
    if (pd.getExtendedDataType() == IExtendedDataType.ITEM_NAME)) {
    // do something...
    }

    }

    Alternatively, if you just wanted to set the name to some value and you didn't care which property that actually is:

    RepositoryProfile repoProfile = repo.getRepositoryProfile();
    if (repoProfile.getCanUpdateName()) {
    theContent.setName("newNameValue");
    }
    Best regards,

    Bobby
    • JavaAdam
      JavaAdam
      6 Posts
      ACCEPTED ANSWER

      Re: Is there a way to find out which attribute is the representive one?

      ‏2009-12-17T15:47:15Z  in response to SystemAdmin
      Hello Bobby,

      thanks for your response, but it does not work in my environment:

      CIEE 8.5.1
      CM8DB2 8.4.1
      II4C 8.4.1

      I have tested the ExtendedDataType() of the PropertyDescription objects, but no one have the "ITEM_NAME" ExtendedDataType(). But some other types are retrievable: USER,REVISION_DATE,UNIQUE_ID,CREATION_DATE.

      Any suggestions? Did you have a similar environment?

      The Checkbox is checked in the item type properly.

      Greetings
      Adam