The SelectProperties command guides the user through the FileNet Workplace Select Properties Java™Server Pages (JSP) pages, to enable the user to select properties associated with a document item or class and then retrieve those values to be embedded in document content. The client application must use the ISelectPropertiesCmd interface to specify the document or document class for which to select the properties using the IObjectStoreItem interface, as well as to customize the page title.
After the SelectProperties command has been executed by calling IAppIntCmd::Invoke, a pointer to the selected item is returned in the SelectProperties response component. Client applications may interact with the response component via the standard IAppIntRsp and custom ISelectPropertiesRsp interfaces. For more information about working with command and response components and their COM interfaces, see Command and Response components.
DLL | FnAppIntSelectPropertiesCmd.dll |
See Also | ShowProperties command |
The SelectProperties command uses the following interfaces:
Interface | Description |
---|---|
ISelectPropertiesCmd |
This is a custom interface used to initialize the data contained in the SelectProperties command component. The client application can use the methods in this interface to customize the JSP page, filter the list of selectable properties by document item or class, specify the number of properties that can be selected and whether system properties should be included, and identify the number of columns and page title to display. |
ISelectPropertiesRsp |
This is a custom interface for the SelectProperties response component that is returned when the SelectProperties command is executed. This interface enables the client application to obtain information about the properties which were selected by the user. |
IAppIntCmd |
This is a standard interface which is automatically used by the SelectProperties command to invoke the SelectProperties command component. The client application executes the SelectProperties command by calling this interface and passing the AppintSession component on which the SelectProperties command component is invoked. Each time the command is executed, an SelectProperties response component is returned. |
IAppIntRsp |
This is a standard interface that is automatically used by the SelectProperties command to determine the success or failure of the command, as well as retrieve any error code or messages. |
In the application's StdAfx.h header file:
#import"C:\Program Files\FileNet\AppInt\FnAppIntCmd.tlb" named_guids no_namespace #import "C:\Program Files\FileNet\AppInt\FnAppIntHttpRequest.dll" named_guids no_namespace #import "C:\Program Files\FileNet\AppInt\FnAppIntBrowserDlg.dll" named_guids no_namespace #import "C:\Program Files\FileNet\AppInt\FnAppIntHttpConnection.dll" named_guids no_namespace #import "C:\Program Files\FileNet\AppInt\FnAppIntResources.dll" named_guids no_namespace #import "C:\Program Files\FileNet\AppInt\FnAppIntClientRecordBase.tlb" named_guids no_namespace #import "C:\Program Files\FileNet\AppInt\FnAppIntClientStore.dll" named_guids no_namespace #import "C:\Program Files\FileNet\AppInt\FnAppIntSession.dll" named_guids no_namespace #import "C:\Program Files\FileNet\AppInt\FnAppIntSessionLogin.dll" named_guids no_namespace #import "C:\Program Files\FileNet\AppInt\FnAppIntCmdComponents.dll" named_guids no_namespace #import "C:\Program Files\FileNet\AppInt\FnAppIntSelectPropertiesCmd.dll" named_guids no_namespace ------------ typedef std::vector< _bstr_t > PropertyList; ... // Instantiate the StdSessionLogin component
IStdSessionLoginPtr spIStdSessionLogin;
HRESULT hResult = spIStdSessionLogin.CreateInstance(__uuidof(StdSessionLogin));
if (FAILED(hResult)) { std::cout << "Could not create the StdSessionLogin component." << std::endl; _ASSERTE(0); } try {
// Initialize the StdSessionLogin component to create // a separate, non-unified login for the client application // by specifying the session / client application name. std::cout << "Initializing the StdSessionLogin component to use NON-unified login..." << std::endl; _bstr_t sessionName(_T("WordPerfect")); spIStdSessionLogin->InitializeViaSessionName(sessionName);
// Instantiate the AppIntSession component
IAppIntSessionPtr spIAppIntSession;
hResult = spIAppIntSession.CreateInstance(__uuidof(AppIntSession)); if (FAILED(hResult)) { std::cout << "Could not create the AppIntSession component." << std::endl; _ASSERTE(0); } // Initialize the AppIntSession component with the StdSessionLogin component
std::cout << "Initializing the AppIntSession component..." << std::endl;
spIAppIntSession->Initialize(spIStdSessionLogin); // * The Client Application may invoke a SessionLogin here; otherwise, // * it will automatically be invoked as needed when commands are executed. std::cout << "Checking Login Status..." << std::endl; VARIANT_BOOL bIsLoggedIn = spIAppIntSession->IsLoggedIn(); if (bIsLoggedIn == VARIANT_TRUE) { std::cout << "User is currently Logged In." << std::endl; } else {
std::cout << "User is NOT currently Logged In." << std::endl;
std::cout << "Attempting Login..." << std::endl;
hResult = spIAppIntSession->Login(); if (FAILED(hResult)) { std::cout << "Login failed." << std::endl; _ASSERTE(0); }
std::cout << "Login succeeded." << std::endl; } // Instantiate the ObjectStoreItem component IObjectStoreItemPtr pIObjectStoreItem; hResult = spIObjectStoreItem.CreateInstance(__uuidof(ObjectStoreItem));
if (FAILED(hResult)) {
std::cout << "Could not create the ObjectStoreItem component.\n"; _ASSERTE(0);
} // Initialize the ObjectStoreItem component with // the items' type, object store name, version series ID and item ID ItemType enItemType = eItemTypeDocument; _bstr_t bstrObjectStoreName = (_T("Alaska")); _bstr_t bstrVersionSeriesID = (_T("{6BC064A2-2D58-4B0A-AEF2-B2F8A1100000}")); _bstr_t bstrItemID = (_T("{DDE54469-36D9-4fe9-8676-445E4994DE1F}")); std::cout << "Initializing the ObjectStoreItem component..." << std::endl;
spIObjectStoreItem->Initialize(enItemType, bstrObjectStoreName, bstrVersionSeriesID, bstrItemID); // Define the XML properties for the item std::cout << "Defining the XML item properties..." << std::endl; _bstr_t bstrPropertiesXml = _T( "" ); bstrPropertiesXml += _T("<properties>");
bstrPropertiesXml += _T("<property>");
bstrPropertiesXml += _T("<symname>DocumentTitle</symname>"); bstrPropertiesXml += _T("<values>");
bstrPropertiesXml += _T("<value>SelectedDocument.doc</value></values>"); bstrPropertiesXml += _T("<selected>false</selected>");
bstrPropertiesXml += _T("</property>");
bstrPropertiesXml += _T("<property>");
bstrPropertiesXml += _T("<symname>CommentReq</symname>"); bstrPropertiesXml += _T("<values>");
bstrPropertiesXml += _T("<value>This document contains the information to be selected.</value></values>"); bstrPropertiesXml += _T("<selected>false</selected>");
bstrPropertiesXml += _T("</property>");
bstrPropertiesXml += _T("<property>");
bstrPropertiesXml += _T("<symname>SVCPStr</symname>"); bstrPropertiesXml += _T("<values>");
bstrPropertiesXml += _T("<value>This is the SVCPStr property</value></values>"); bstrPropertiesXml += _T("<selected>true</selected>");
bstrPropertiesXml += _T("</property>");
bstrPropertiesXml += _T("</properties>");// Instantiate the custom SelectProperties command component ISelectPropertiesCmdPtr spISelectPropertiesCmd;
hResult = spISelectPropertiesCmd.CreateInstance(__uuidof(SelectPropertiesCmd));
if (FAILED(hResult)) {
std::cout << "Could not create the SelectProperties command component.\n"; _ASSERTE(0);
} // Initialize the custom SelectProperties command component with the // page title, two columns, single property selection, and no system properties. _bstr_t bstrPageTitle = (_T("Customized SelectProperties Operation")); ColumnMode enColMode = eColumnsTwo; bool bMultiSelect = false; bool bShowSystemProperties = false; std::cout << "Initializing the SelectProperties command component..." << std::endl; spISelectPropertiesCmd->Initialize(bstrPageTitle, pIObjectStoreItem, bstrPropertiesXml, enColMode, bMultiSelect, bShowSystemProperties); // Execute the SelectProperties command and capture the response component std::cout << "Executing the SelectProperties command..." << std::endl; IAppIntCmdPtr spIAppIntCmd(spISelectPropertiesCmd);
IAppIntRspPtr spIAppIntRsp = spIAppIntCmd->Invoke(spIAppIntSession); // Determine if the command failed, before accessing response component data hResult = spIAppIntRsp->GetHResult(); if (FAILED(hResult)) { std::cout << "The SelectProperties command failed to execute." << std::endl; // Examine the error information provided in the standard response component _bstr_t bstrErrorName = spIAppIntRsp->GetErrorName(); std::cout << "ErrorName=" << ( bstrErrorName.length() ? (LPCSTR) bstrErrorName : _T( "" ) ) << std::endl; _bstr_t bstrErrorMsg = spIAppIntRsp->GetErrorMsg(); std::cout << "ErrorMsg=" << ( bstrErrorMsg.length() ? (LPCSTR) bstrErrorMsg : _T( "" ) ) << std::endl; _bstr_t bstrErrorDetails = spIAppIntRsp->GetErrorDetails(); std::cout << "ErrorDetails=" << ( bstrErrorDetails.length() ? (LPCSTR) bstrErrorDetails : _T( "" ) ) << std::endl; _ASSERTE(0); } else { std::cout << "The SelectProperties command succeeded." << std::endl; // Obtain the response name and description from the standard response component _bstr_t bstrResponseDescription = spIAppIntRsp->GetDescription(); std::cout << "ResponseDescription=" << ( bstrResponseDescription.length() ? (LPCSTR) bstrResponseDescription : _T( "" ) ) << std::endl; _bstr_t bstrResponseName = spIAppIntRsp->GetName(); std::cout << "ResponseName=" << ( bstrResponseName.length() ? (LPCSTR) bstrResponseName : _T( "" ) ) << std::endl; // Obtain the information contained in the custom SelectPropertiesRsp component ISelectPropertiesRspPtr spISelectPropertiesRsp(spIAppIntRsp);
_ASSERTE(spISelectPropertiesRsp != 0); std::cout << "Details for the properties selected by the user:<< std::endl; PropertyList selectedProperties;
selectedProperties.push_back(_bstr_t(_T("/response/objectset/document/properties/property[symname = \"DocumentTitle\"]/value")));
selectedProperties.push_back(_bstr_t(_T("/response/objectset/document/properties/property[symname = \"Name\"]/value")));
for (unsigned int i = 0; i < selectedProperties.size(); i++) {
_bstr_t bstrPropertyName = selectedProperties[i];
_bstr_t bstrProperty = spISelectPropertiesRsp->GetProperty(bstrPropertyName);
std::cout << "property=" << (bstrPropertyName.length() ? (LPCSTR) bstrPropertyName : _T("")) << std::endl;
std::cout << "value=" << (bstrProperty.length() ? (LPCSTR) bstrProperty : _T("")) << std::endl;
}
_bstr_t bstrPropertiesXml = spISelectPropertiesRsp->GetPropertiesXml();
std::cout << "Properties XML=" << (bstrPropertiesXml.length() ? (LPCSTR) bstrPropertiesXml : _T("")) << std::endl; } }