1 / 122

eB SDK Training

eB SDK Training. Integration Methods. Non- API integration External Tools for eB Director Database events triggering stored procedures API-based methods: Stand-alone Applications Stand-alone Web Pages Plug-in Web Pages for eB Web Scripts running in Office Apps

lee-hewitt
Download Presentation

eB SDK Training

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. eB SDK Training

  2. Integration Methods • Non- API integration • External Tools for eB Director • Database events triggering stored procedures • API-based methods: • Stand-alone Applications • Stand-alone Web Pages • Plug-in Web Pages for eB Web • Scripts running in Office Apps • Web Services integration

  3. Register tools for eB Director

  4. External Tool operation

  5. Database events

  6. Structure of the API • Core API • Lets you build your own eB-aware applications • Web API • Lets you access eB objects fromyour own web pages • Web plug-in API • Lets you add functionality to eB Web • Web Services API • Lets you integrate with foreign systems

  7. DLLs and Namespaces • eB.Service.Proxy.dll • eB.Service.Client namespace – implements the Proxy class • eB.Data namespace – implements object classes • eB.Common.dll • eB.Common.Enum namespace – enumerated types used by other classes • eB.Library.Web.dll • eB.Library.Web namespaces • eB.Web.Data.dll • eB.Web.Core namespaces • eB.Web.UI namespaces • eB.Web.Data namespaces

  8. Core API

  9. Proxy class • Proxy – master class that governs interactions with all eB objects • Handles connection, logon, logoff • Creates, modifies, & deletes objects • Gets information for an object • Provides transactions & rollback

  10. eB.Data namespace • Classes for every object • Many helper classes • Used for read operations • Object-oriented layer on Proxy class

  11. Named constants in eB.Common.Enum • Applies meaningful names to lists of values • eB.Common.Enum.ObjectType • Lists the names of all eB object types • 1 = Item 2 = VitualItem 3 = Document • eB.Common.Enum.GetObject • Options for flags used when getting object info • eB.Common.Enum.HasFlags • Tests whether an object has a given relationship

  12. Connecting to the database

  13. Connecting to eB • Connect using eB.Service.Proxy (old way) OR • Connect using eB.Data.Session (new way) • Expensive operation • Preserve the connection while user is logged on

  14. Initializing eBProxy • Create the Proxy object myProxy = new Proxy(); • Connect to the Application server int rtn = myProxy.connect(0, serverName); • Logon int rtn = myProxy.logon(0, dataSource, user, pswd);

  15. Read vs Write access • intrtn = myProxy.connect ( 0, serverName ); Read vs Write access 0 = Proxy.services.both = read/write 1 = Proxy.services.olap = read 2 = Proxy.services.oltp = write Use enumerated values for clarity

  16. Data Source discovery • Get Data Sources from proxy String dataSources = myProxy.get_data_sources(0, ref rtnCode); dataSources string:

  17. eB Sessions • Represents context for a logged-on user • Required for most methods in eB.Data • Contains active and default scopes

  18. Initializing a Session • Create the sessioneB.Data.Session mySession = new eB.Data.Session() • Connect to the servermySession.Connect(SessionTypes.Both, serverName) • Log on to the application servermySession.Logon(SessionTypes.Both, community, username, password)

  19. Converting from eBProxy to Session eBProxy Session ProtoProxy

  20. Code for eBProxy to Session • Log on as ProxyeBProxy.connect(0, “serverName”);eBProxy.logon(0, dataSource, userName, pwd); • Convert to SessioneB.Data.Session session = new eB.Data.Session();Session.AttachProtoProxy(eBProxy.proto_proxy, eBProxy.connect_info);

  21. Cleanup • Logoff-If you don’t logoff and instead just terminate the program, then the license that was being used by the logged-on user is “quarantined” and isn’t freed up for reuse for about 20 minutes. By logging off, you free up that license immediately. • Disconnect-If you don’t Disconnect, I’m not sure what this does. It probably just holds onto some Application server resources until timeout is reached and they are freed up. • Dispose-. It’s the memory clean-up call. In eB, the dispose method also logs the user off and disconnects as well.

  22. Sample Proxy calls • Creating objects int rtnCode = myProxy.add_keyword(keywordName) • Creating object links int rtnCode = myProxy.add_document_location( docId, locationId) • Retrieving object information string fileInfo = myProxy.get_doc_files_list (docId, levels, criteria, ref rtnCode) • Changing objects int rtnCode = myProxy.chg_location( locationId, newDesc, newLocationTypeId )

  23. Error Handling in Proxy calls int rtnCode = myProxy.someMethod (param1, param2) Updating, deleting, linking an objectsuccess = 1 error < 0 Creating an objectsuccess = object ID error < 0

  24. Error Handling in Proxy calls (cont) Retrieving object informationsuccess = 1 error < 0 string info = myProxy.someMethod (param1, param2, ref rtnCode) Return string contains xml data

  25. Getting the error string • myProxy.get_error(rtnCode)

  26. Silent Mode for errors myProxy.silent_mode = true; • Normally false. Error message pops up. • If true, trap the message yourself. • Must be true in web apps or the web server will hang.

  27. Error Handling in eB.Data classes • Use Exception handling to deal with errors

  28. Getting object information

  29. Two approaches to retrieval • Old Method • proxy.get_report – returns multiple objects • proxy.get_object – returns info on one object • New Method using eB.Data namespace • eB.Data.Search – returns multiple objects • eB.Data.class.Retrieve – returns info on one object

  30. Getting object data with eB Proxy • Proxy.get_report() • Gets all objects meeting specified criteria • Proxy.get_object() • Gets all specified data for a single object

  31. Using get_report string xmlStr = proxy.get_report ( string report_name, string criteria, string options, ref int result) Object type to search for Use rules in next slide to build up a query Use a blank string or “IDS_ONLY” Returns 1 for success Returns XML string with info

  32. Rules for criteria in get_report columnName operator value AND/OR columnName operator value ... • These booleans are allowed: • AND • OR • AND NOT • OR NOT You supply the value • Operators are: • like • = (equals) • <> (not equals) • <= (less than or equal to) • >= (greater than or equal to) Column namesdocumented at get_report_syntax Get allowed column names for eachobject from get_report_syntax

  33. Syntax for custom attribute values (char_str_value.<AttrName> = 'finalized') Value to search for Name of the attribute inangle brackets - Required Column name for a string attribute value Use parentheses to avoid ambiguity

  34. Using get_object • Gets only one object per call string xmlStr proxy.get_object ( int pl_object_id, int pl_object_type, long pl_options, ref int pl_result) Internal ID of the object you want Use eB.Common.Enum.ObjectType Bitwise union of options fromeB.Common.Enum.GetObject Returns all requested data for just one object

  35. Sample options for get_object • Use bitwise OR operator to set options long options = (long) GetObject.DocumentOptions.Projects | GetObject.DocumentOptions.Characteristics| GetObject.DocumentOptions.Locations | GetObject.DocumentOptions.Security; long options = (long) GetObject.DocumentOptions.Detail; long options = GetObject.GetAllObjectOptions (objType, true, true);

  36. Checking for relationships: hasFlags • Details option includes ahas_flags element • Convert content to long and test the relationship of interest (bitwise AND) • If 0, no relationship if (hasFlags & GetObject.DocumentOptions.Projects == 0) No Project links

  37. Getting object data with eB.Data • eB.Data.Search() • Gets all objects meeting specified criteria • One object type per search • eB.Data.<classes>.Retrieve • Retrieve method gets specified data for a single object • Class used corresponds to the type of object Data Data

  38. Creating a search for objects • Create the search string (as eQL) • Create the search object • Run the search String eqlStr = @“START WITH Document SELECT Id, Code, Name WHERE Class.Code = ‘DWG’ ”; eB.Data.Search srch = new eB.Data.Search( session, eqlStr); System.Data.DataTable dt = srch.Retrieve<System.Data.DataTable>();

  39. Basics of eQL PrimaryObject Columnsto return Filter Criteria Sorting

  40. eQL syntax Keywords inupper case Commas between columns No comma at end of SELECT Single quotesfor text Dot notationfor related properties Extra spaces& line breaks OK

  41. Generate a list of searchable properties

  42. Getting System Data • eB.Data.SystemData class • Used for eB configuration information • Job types • Keywords • Available Templates • Responsibility Types • Revision rules • Static Lookups • Many others • SystemData.Retrieve(“prop1;prop2;prop3”) retrieves specified properties

  43. Using Retreive for object data • Create the object, using the object ID • Populate the object properties using Retrieve eB.Data.Document doc = new eB.Data.Document(session, id); doc.Retrieve(“Header;Attributes;Files;Securities”);String docName = doc.Name; String docCode = doc.Code; Caution: properties are NULL until retrieved

  44. Available retrieval options • Objects know their own retrieval options

  45. Test Retrieval tool

  46. Document, Copy, File API calls • To add a copy to a document: • add_doc_copy • To add a file to a copy: • add_object_file • To delete a copy object: • del_doc_copy

  47. Document, Copy, File API calls (cont) • To get the file ids of all files in all doc copies: • get_doc_files_list • To get the file (as a stream) knowing the file id: • get_doc_file (file_id, ref stream) • To delete a file from the repository: • del_doc_file (file_id) • To move a file from one doc copy to another: • del_doc_copy_file • add_doc_copy_file

  48. Updating documents • When updating a document, you must supply values for all parameters in the method. • You can supply “no op” values for parameters you don’t want to change: • Text: "%" • Numeric: -1 • Date: "02-JAN-1753" proxy.chg_document (docID, newPrefix, newMiddle, newRevision, newClassID, newTitle); proxy.chg_document (docID, “%", “%", "ver2.0", -1, “%");

  49. Updating document attributes • In the API: Attributes == Characteristics • First get the ID of the object str = proxy.get_report ("documents", “title = ‘mydoc’, “IDS_ONLY”, ref result); • Then get the IDs of its characteristics flag = (long) GetObject.DocumentOptions.Characteristics; str = proxy.get_object (docID, flag, ref result); • Then update result = proxy.chg_char_data (docID, charID, value);

  50. About Templates • Templates aid new object creation • Provide default settings forcommon properties • Ensure object security gets applied • Set up links to Projects, Organizations

More Related