This discussion is archived
10 Replies Latest reply: May 24, 2011 4:19 AM by user8726358 RSS

Content DB attributes

user8726358 Newbie
Currently Being Moderated
We have to integrate our software with content DB. We need to upload and store files with a sets of attributes defined in our software and later search for documents using those attributes to get document content. Is there a way to define new attributes in content DB and store files with them?

Please advise.
Thank you.
  • 1. Re: Content DB attributes
    frank.closheim Newbie
    Currently Being Moderated
    Hi,

    sure there is. Custom attributes can be stored with a document as so called "categories". The CDB Developer Kit has examples how to create new categories on the fly and associated them with documents in CDB. You can then immediately search by this attributes for your documents.

    The CDB Dev Kit is available here: http://www.oracle.com/technology/products/contentdb/index.html and contains the API, Javadoc and examples.

    It is also possible to create new categories via the standard WebUI. See here http://download.oracle.com/docs/cd/B32119_01/doc/contentdb.1012/b31265/site.htm#CBAGHFCI for more details.

    Hope that helps.
    Frank
  • 2. Re: Content DB attributes
    user8726358 Newbie
    Currently Being Moderated
    Thank you frank. It is just what I was looking for.
  • 3. Re: Content DB attributes
    user8726358 Newbie
    Currently Being Moderated
    Storing attributes in category works fine but I have a problem when I have to store multiple attributes with the same attribute name but different values. Is there a way to save document with category that have for example two atrributes Test = "first value of test" and Test = "second value of test" ?
  • 4. Re: Content DB attributes
    frank.closheim Newbie
    Currently Being Moderated
    You can store multiple values for one attribute if you specify the attribute as an array. In your case it would be an ATTRIBUTE_TYPE of ATTRIBUTE_TYPE_STRING_ARRAY.

    Hope that helps,
    Frank
  • 5. Re: Content DB attributes
    user8726358 Newbie
    Currently Being Moderated
    Thank You Frank I believe it could be helpfull. Is there any chance that You have example how to store and update such attributes array for document ?
  • 6. Re: Content DB attributes
    user8726358 Newbie
    Currently Being Moderated
    When I add document with table of strings added to value property of some attribute and when I go to GUI console and check the category attributes I see that value of attribute is something like : [Ljava.lang.String;@5d8d512a. I believe I should see values like "Test 1" and "test 2' separeted somehow ?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
  • 7. Re: Content DB attributes
    frank.closheim Newbie
    Currently Being Moderated
    Are you trying to specify a list of possible values for one attribute a user can select from (LOV), or do you want the end users be able to give multiple (free choice) values for one attribute?

    Can you describe the use case behind this requirement for better understanding?
  • 8. Re: Content DB attributes
    user8726358 Newbie
    Currently Being Moderated
    Frank,

    I will try to explain the situation. When user adds document in our application and documents meets some criteria (For example one of it's attributes it is attribute "Test") then our application adds such document to Content DB with category attributes. When user updates any attriubutes in our application for document send to Content DB we have to update category attributes in Content DB for that document as well.

    The problem is that in our application documents can have several attributes with te same name but different values. It is not a predefined list of values. User can set attribute value to any value. For example attribute Test can have values 1 or 11 or 123 or 001 ... ad so on. We can not predict what the value will be and how many attributes with the same name document will have. One document can can have attributes Test ="FirstValue" and Test ="SecondValue" other documents can have even more attributes with the same name but different value.

    When I add attribute for category in GUI I see that there are only two choices "string" or "enumerated string". In enumerated string I have to define values (it is impossible in my case) and when using type of string I can store only one value for an attribute :(

    Please help.

    Edited by: user8726358 on 2011-04-07 05:21
  • 9. Re: Content DB attributes
    frank.closheim Newbie
    Currently Being Moderated
    This feature is not exposed in the WebUI. The WebUI does not expose the full power and flexibility of CDB.

    Here is a simple example of how to create such a Category and how to create a doc with an attribute of type String[]:

    // Category creation
    NamedValue strArrayAttr = newNamedValue(Attributes.ATTRIBUTE_DETAIL,
    newNamedValueArray( new Object[][]
    {
    {Attributes.DISPLAY_NAME, "String Array Attr"},
    {Attributes.ATTRIBUTE_TYPE, new Integer(FdkConstants.ATTRIBUTE_TYPE_STRING_ARRAY)},
    {Attributes.ATTRIBUTE_REQUIRED, Boolean.FALSE},
    {Attributes.ATTRIBUTE_SETTABLE, Boolean.TRUE},
    {Attributes.ATTRIBUTE_UPDATEABLE, Boolean.TRUE},
    {Attributes.ATTRIBUTE_HIDDEN, Boolean.FALSE},
    {Attributes.ATTRIBUTE_PROMPTED, Boolean.TRUE},
    {Attributes.ATTRIBUTE_OVERRIDEABLE, Boolean.TRUE}
    }
    )
    );

    NamedValue[] catdef = newNamedValueArray( new Object[][]
    {
    {Attributes.DISPLAY_NAME, "TestCategory"},
    {Attributes.DESCRIPTION, "This is a test category"},
    {Attributes.SUPERCLASS, null},
    {Attributes.CLASS_ABSTRACT, Boolean.FALSE},
    {Attributes.CLASS_FINAL, Boolean.FALSE},
    {Attributes.CLASS_HIDDEN, Boolean.FALSE},
    {Attributes.CLASS_COPIED, Boolean.TRUE},
    {Attributes.ATTRIBUTE_DETAILS,
    new NamedValue[] { strArrayAttr } }
    }
    );

    AttributeRequest[] catreq = newAttributeRequestArray( new Object[]
    {
    Attributes.DISPLAY_NAME,
    newAttributeRequest(Attributes.METADATA_ATTRIBUTES,
    newAttributeRequestArray( new Object[]
    { Attributes.DISPLAY_NAME
    } )
    )
    }
    );

    sessManager.setSessionMode(FdkConstants.SESSION_MODE_DOMAIN_ADMINISTRATION, null);

    Item categoryClass = catManager.createCategorySubClass(catdef, catreq);

    // Document creation and category assignment

    attrsdef = newNamedValueArray( new Object[][]
    {
    {"String Array Attr", new String[] {"redish-brown","green"} }
    }
    );

    catdef = newNamedValueArray( new Object[][]
    {
    {Options.CATEGORY_CLASS_ID, new Long(categoryClass.getId())},
    {Options.CATEGORY_DEFINITION_ATTRIBUTES, attrsdef}
    }
    );

    docdef = newNamedValueArray( new Object[][]
    {
    {Attributes.NAME, "test4"},
    {Options.DESTFOLDER, new Long(folder.getId())},
    {Options.CATEGORY_DEFINITION, catdef}
    }
    );

    doc = fm.createDocument(docdef, null, null);


    The WebUI will not show this attribute I guess.

    Hope that helps.
    Frank
  • 10. Re: Content DB attributes
    user8726358 Newbie
    Currently Being Moderated
    Thank You for help our client has changed requirements and such functionality is not needed anymore.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points