not - HP Software Solutions Community online forum

advertisement
TUF23: TRIM User Forum
2010
Changing the Economics of IM
Rory Kleeman
Software Architect, HP Information Management
TRIM User Forum 2010
TRIM SDK.NET
A new development toolkit
Why TRIM SDK.NET?
– Support .NET developers with a more natural .NET interface
– Improve memory model for .NET development environment
ReleaseCOMObject difficult to use
– More object-oriented hierarchy
– Tidy up a long-standing COM interface
TRIM User Forum 2010
Main Object Hierarchy
TrimPropertySet
TrimObject
TrimObject
TrimChildObject
TrimMainObject
Record
Location
and more ...
TRIM User Forum 2010
TrimPropertySet
– A set of property values, each identified by a PropertyIds value
– Properties
•
•
•
•
•
•
ErrorMessage
Error (derives from TrimException : ApplicationException)
Caption
Database
Icon (new TrimIcon class)
IsModified
– Methods
•
•
•
•
•
•
•
GetProperty (PropertyIds) returns Object
GetPropertyIcon (PropertyIds) returns TrimIcon
SetProperty(PropertyIds, Object)
GetPropertyAsString(PropertyIds, DisplayType)
IsMandatory(PropertyIds)
VerifyProperty(PropertyIds)
CanModifyProperty(PropertyIds)
TRIM User Forum 2010
TrimObject
– Derives from TrimPropertySet, identified by a BaseObjectTypes value
– Properties
•
•
•
•
•
TrimType (each TrimObject is of type BaseObjectTypes)
Uri (64-bit unique identifier)
NameString (eg, Record.RecordNumber )
NameStringExtra (eh, Record.Title)
IsReadOnly
– Methods
•
•
IsMandatory(FieldDefinition)
IsValidFor(Purpose, …)
– Interfaces, used for special capabilities (see Get…Interface methods)
•
•
•
•
•
ITrimNotes
ITrimUserFields
ITrimAccessControl
ITrimActiveDates
ITrimDocument
TRIM User Forum 2010
TrimMainObject
– Derives from TrimObject, designed to be “persisted”
– Properties
•
•
•
•
•
•
Verified
LastUpdatedOn (used for update synchronisation)
Uri (64-bit unique identifier)
NameString (eg, Record.RecordNumber )
NameStringExtra (eh, Record.Title)
IsReadOnly
– Methods
•
•
•
•
•
Verify(…)
Save(), to persist any changes
Delete(), is permanent
MakeReference(RefFileName)
GetChildObjectList(BaseObjectTypes childType)
– Interfaces, used for special capabilities (see Get…Interface methods)
•
•
•
ITrimSecurity
ITrimAccessControlDefault
ITrimLabels
TRIM User Forum 2010
TrimChildObject
– Derives from TrimObject, contained within a TrimChildObjectList
– Properties
•
ParentList, the parent TrimChildObjectList
– Methods
•
Delete()
− removes from parent,
− not permanent until parent object is saved
− care required when calling in a loop
TRIM User Forum 2010
TrimChildObjectList
– Derives from IEnumerable
•
belongs to a TrimMainObject
•
implements a concept of an array of propertySets
– Properties
•
ErrorMessage, Error, Database
•
ParentObject
•
ParentList, the parent TrimChildObjectList
•
TrimType
•
Count
•
Item[index]
– Methods
•
GetEnumerator()
•
FindChildByUri(Uri)
– Supports
•
foreach ( TrimChildObject obj in myChildList )
TRIM User Forum 2010
Searching
– Provided by TrimMainObjectSearch class
– Search consists of a reverse-polish array of TrimSearchStackItem
objects
– A stack item is either a TrimSearchClause or a TrimSearchOperator
– A TrimSearchClause is a method with parameters
– A TrimSearchOperator is one of and, or, not
– Search can also be specified using a “linear” string
assignee:me and (createdOn:this month or updatedOn:this month)
[0]: assignee:me
[1]: createdOn:this month
[2]: updatedOn:this month
[3]: or
[4]: and
TRIM User Forum 2010
TrimMainObjectSearch
– Derives from IEnumerable, allowing foreach iteration
– Properties
•
ErrorMessage, Error, Database
•
TrimType, BaseObjectTypes specified in constructor
•
Icon
•
Title
•
FastCount
•
SearchString
•
SearchAsXML
– Methods
• GetEnumerator(), for foreach support
• GetResultAsUriArray(…), useful for web apps
• SetSearchString(), returns TrimParserException
• ClearSearch()
• AddSearchClause()
• And()
• Or()
• Not()
• GetSearchAsStack()
• SetSearchFromStack()
TRIM User Forum 2010
TrimMainObjectSearch (cont.)
– The main search stack can be “filtered” by specifying more criteria which
are effectively combined with the main search using the and operator
•
•
•
•
•
•
•
FilterString property
SetFilterString()
ClearFilters()
AddFilterClause()
GetFiltersAsArray()
SetFiltersToDefault()
SaveFiltersAsDefault()
– The result set can also be sorted, using a subset of the search methods
that are considered suitable for sorting
•
•
•
•
•
•
•
•
SortString property
SetSortString()
ClearSort()
AddSortItemAscending(…)
AddSortItemDescending(…)
GetSortAsArray()
SetSortToDefault()
SaveSortAsDefault()
TRIM User Forum 2010
TrimMainObjectSearch (cont.)
– A number of “canned” selection methods are also available
•
•
•
•
•
•
•
•
SelectByPrefix
SelectFavorites(…)
SelectByUserLabel(userLabelToSelectBy)
SelectNone()
SelectAll()
SelectByUris(array of uris)
SelectTopLevels(), for hierarchical objects
SelectThoseWithin(parent) , for hierarchical objects
– The selection may also be assisted by specifying the purpose to
which the list will be used, although not always
• SetPurpose(…)
• ClearPurpose()
• IsValidFromPurpose(TrimMainObject)
– Can also do an “in-memory” compare, to see if an object would
match the selection criteria contained in the search
• ItemMatches(TrimMainObjectToMatch)
TRIM User Forum 2010
TrimApplication
– Represents the process which the TRIM SDK.NET is being called from
– A “singleton”, with all properties and methods as static
– Properties
•
•
•
•
•
•
•
•
RuntimeEnvironment(Environments enum value)
SDKVersion
SoftwareVersion
WebServerWorkPath
ServiceType(windows, web, none)
BinaryPath
TemporaryPath
HasUserInterface
– Methods
•
•
•
•
•
•
SetAsService()
SetAsWebService(workPath)
GetMessage(…) for accessing standard TRIM messages
ProcessMessage(…), accessing TRIM substitution strings
SetDefaultLanguage(…)
GetDatabaseIds(servicedByWorkgroup)
TRIM User Forum 2010
Other Helper Classes
– TrimIcon
•
SDK.NET exposes the set of TRIM Icons, useful in certain situations
•
Provides functionality based on the Icons enumeration
•
Can also be constructed to represent the icon embedded within a Windows binary
– TrimAccessControlList
•
Class designed to simplify operations involving the updating and retrieval of access control
information
– TrimSecurityProfile
•
Encapsulates a TrimSecurityLevel and an array of TrimSecurityCaveats
•
Facilities simpler updates to the security profile of TRIM objects
– TrimDateTime
•
Encapsulates a date and time and is class used for all data and time fields in TRIM
•
Extends System::DateTime by handling blank dates, blank times, and business calendar
arithmetic
•
Provides the usual date and time methods and properties
TRIM User Forum 2010
Object Model Helper Classes
– Somewhat akin to “reflection”, there are a number of classes that expose the inherent
behaviour of TRIM SDK elements
– Provide captioning and capability discovery
– ObjectDef
• Describes capabilities of a particular BaseObjectTypes value
– PropertyDef
• Based on a value from the enumeration PropertyIds
– Enum
• Based on a value from the enumeration AllEnumerations
– EnumItem
• Allows you to access items with a particular enum.
– CommandDef
• Based on a value from the enumeration CommandIds
– SearchClauseDef
• Based on a value from the enumeration SearchClauseIds
TRIM User Forum 2010
Differences from COM
– .NET
supports constructors, so we use them
db.GetRecord becomes new Record(db)
– Since enumeration item values need to be qualified in .NET, we no
longer have the two character prefix
ctAuthor becomes ContactTypes.Author
– Many of the “optional” features of objects have been implemented
using an interface
GetNotesInterface() allows for a more generic style of programming
– Implements IDisposible, allowing for more efficient memory
management
COM Interop did not implement IDisposable ...
– No more “obsolete” properties and methods
TRIM User Forum 2010
For more information...
IM Digital Hub:
TRIM Home Page:
Facebook:
www.hp.com/go/imhub
www.hp.com/go/hptrim
http://tinyurl.com/HPTRIM-7-Facebook
Twitter:
www.twitter.com/HPInfoGov
www.twitter.com/thattrimguy
#TUF23
www.hp.com/blogs/information-faster
Twitter HashTag:
Blogs:
HP Software Solutions Community:
www.hp.com/go/swcommunity
TUF23 Post-event Website:
18
© Copyright 2010 Hewlett-Packard Development Company, L.P.
Available April 2010
Download