Forum Stats

  • 3,769,223 Users
  • 2,252,930 Discussions
  • 7,874,951 Comments

Discussions

Creating iFS Objects Programtically

3004
3004 Member Posts: 204,171
Is there a way to create instances of iFS objects programatically from a client (other than by building XML files on the fly and dropping them on iFS) or from within the database? I'd rather not use the XML approach because it is not transactional across instances (i.e. if I want to create 100 instances I would need 100 XML files and dropping each one on iFS would result in a commit).

Comments

  • 3004
    3004 Member Posts: 204,171
    Absolutely. The general pattern for creating a persistent object is as follows:

    // connect to iFS
    LibrarySession mySession = LibraryService.connect(/* ... */);

    // define the object to be created (replace <ObjectName> with the name of the iFS object you wish to create, such as PublicObject or Folder)
    <ObjectName>Definition def = new <ObjectName>Definition(mySession);
    def.set<attribute>(/*...*/);

    // create the object
    <ObjectName> obj = mySession.create<ObjectName>(def);

    A development kit will be posted shortly; it will include much more information.
  • 3004
    3004 Member Posts: 204,171
    oops -- typed too fast. The last part, where you create the object (create<ObjectName> method on class LibrarySession) should be:

    mySession.createPublicObject(def);

    This is of course limited to subclasses of PublicObject -- the most common type of object you will create.
This discussion has been closed.