List of Places using Platform SDK - java

Background
My application connects to the Genesys Interaction Server in order to receive events for actions performed on the Interaction Workspace. I am using the Platform SDK 8.5 for Java.
I make the connection to the Interaction Server using the method described in the API reference.
InteractionServerProtocol interactionServerProtocol =
new InteractionServerProtocol(
new Endpoint(
endpointName,
interactionServerHost,
interactionServerPort));
interactionServerProtocol.setClientType(InteractionClient.AgentApplication);
interactionServerProtocol.open();
Next, I need to register a listener for each Place I wish to receive events for.
RequestStartPlaceAgentStateReporting requestStartPlaceAgentStateReporting = RequestStartPlaceAgentStateReporting.create();
requestStartPlaceAgentStateReporting.setPlaceId("PlaceOfGold");
requestStartPlaceAgentStateReporting.setTenantId(101);
isProtocol.send(requestStartPlaceAgentStateReporting);
The way it is now, my application requires the user to manually specify each Place he wishes to observe. This requires him to know the names of all the Places, which he may not necessarily have [easy] access to.
Question
How do I programmatically obtain a list of Places available? Preferably from the Interaction Server to limit the number of connections needed.

There is a method you can use. If you check methods of applicationblocks you will see cfg and query objects. You can use it for get list of all DNs. When building query, try blank DBID,name and number.
there is a .net code similar to java code(actually exatly the same)
List<CfgDN> list = new List<CfgDN>();
List<DN> dnlist = new List<Dn>();
CfgDNQuery query = new CfgDNQuery(m_ConfService);
list = m_ConfService.RetrieveMultipleObjects<CfgDN>(query).ToList();
foreach (CfgDN item in list)
{
foo = (DN) item.DBID;
......
dnlist.Add(foo);
}
Note : DN is my class which contains some property from platform SDK.

KeyValueCollection tenantList = new KeyValueCollection();
tenantList.addString("tenant", "Resources");
RequestStartPlaceAgentStateReportingAll all = RequestStartPlaceAgentStateReportingAll.create(tenantList);
interactionServerProtocol.send(all);

Related

How to rename a container in Azure Cosmos DB with Java SQL API?

It look like that it is not possible to rename a container in the Azure Cosmos DB. It should be copy to the new container via a bulk operation. How can I do this with the Java SDK? Are there any samples for it?
Yes, you are right. Changing container name is currently not possible. As I understand, you want to discard old container (as you wanted to rename initially) and migrate data to new one.
Data Migration tool is a great tool to do so: Tutorial: Use Data migration tool to migrate your data to Azure Cosmos DB
Also, do check out Bulk Executor library for Java, API documentation and samples.
You can use importAll in BulkExecutor class:
ConnectionPolicy connectionPolicy = new ConnectionPolicy();
RetryOptions retryOptions = new RetryOptions();
// Set client's retry options high for initialization
retryOptions.setMaxRetryWaitTimeInSeconds(120);
retryOptions.setMaxRetryAttemptsOnThrottledRequests(100);
connectionPolicy.setRetryOptions(retryOptions);
connectionPolicy.setMaxPoolSize(1000);
DocumentClient client = new DocumentClient(HOST, MASTER_KEY, connectionPolicy, null);
String collectionLink = String.format("/dbs/%s/colls/%s", "mydb", "mycol");
DocumentCollection collection = client.readCollection(collectionLink, null).getResource();
DocumentBulkExecutor executor = DocumentBulkExecutor.builder().from(client, collection,
collection.getPartitionKey(), collectionOfferThroughput).build();
// Set retries to 0 to pass control to bulk executor
client.getConnectionPolicy().getRetryOptions().setMaxRetryWaitTimeInSeconds(0);
client.getConnectionPolicy().getRetryOptions().setMaxRetryAttemptsOnThrottledRequests(0);
for(int i = 0; i < 10; i++) {
List documents = documentSource.getMoreDocuments();
BulkImportResponse bulkImportResponse = executor.importAll(documents, false, true, 40);
// Validate that all documents inserted to ensure no failure.
if (bulkImportResponse.getNumberOfDocumentsImported() < documents.size()) {
for(Exception e: bulkImportResponse.getErrors()) {
// Validate why there were some failures.
e.printStackTrace();
}
break;
}
}
executor.close();
client.close();
I solve the problem by linking instead copying all the data. This simulate an rename of the container. Instead of one container I use two container now. The first contains only the name of the second container.
Now I can build the new version of the container. If I are finish I change the name of the saved container name. Then I drop the old container.
The tricky is to inform all nodes of the app to use the new container name.

How to obtain PayloadSize from Genicam reference implementation?

I'm trying to access a GigE camera using the Genicam reference implementation by trying to look at the online resources and existing existing resources (aravis, harvesters) and follow the GenTL standard using the SNFC which every Genicam compatible camera supports. The producer I'm currently using is from Basler since the camera I have here is from them.
/* I wrapped the Genicam classes with my own. Here are the relevant parts */
tl = new GenicamTransportlayer("/opt/pylon/lib/gentlproducer/gtl/ProducerGEV.cti");
if0 = tl.getFirstInterface();
dev0 = if0.getFirstDevice();
ds = dev0.getFirstDataStream();
I'm able to connect to the System, Interface, Device, DataStream, connect the nodemaps and am now trying to set up the buffers for acquisition. To do so I need to get the maximum payload size from the camera. The GenTL standard document standard says, I need to query it from the DataStream module using
boolean definesPayloadSize = ds.getInfoBool8(StreamInfoCommand.STREAM_INFO_DEFINES_PAYLOADSIZE);
which gives me 0 or false. The producer MAY provide a PayloadSize feature which can be queried using
ds.getInfoSizet(StreamInfoCommand.STREAM_INFO_PAYLOAD_SIZE);
which is obviously also 0 and with being a may I cannot rely on it. The standard further tells me if both fail, I need to inquire via the remote devices NodeMap to read the PayloadSize:
long payloadSizeFromRemoteMap = dev0.remoteMap.getIntegerNode("PayloadSize").getValue();
This gives me 0 too. The standard goes on that if the producer does not implement an interface standard (whatever this means?), the required payload size has to be queried via the producer using the StreamInfo Commands which also fails (GenTL maps the constant STREAM_INFO_PAYLOAD_SIZE to 7 which produces a BufferTooSmallException on the System port).
At this point I'm confused on what to do. Most of my nodes are locked (I can overwrite TLParamsLocked but still cannot change parameters, eg, execute a load of the default parameter set) so I cannot set Width/Height/ImageFormat to infer the PayloadSize:
/* Trying to set a default configuration fails */
IEnumeration userSetSelector = dev0.remoteMap.getEnumerationNode("UserSetSelector");
log.debug("Loading Feature set: " + userSetSelector.getEntries().get(0).getName());
// Prints: Loading Feature set: EnumEntry_UserSetSelector_Default
userSetSelector.setValue("Default");
dev0.remoteMap.getCommandNode("UserSetLoad").execute();
// AccessException: Node is not writable. : AccessException thrown in node 'UserSetLoad' while calling 'UserSetLoad.Execute()' - Node is not writable.
Without knowing the size of the buffers I cannot continue. How can I infer the PayloadSize to set them up?

Ebay Finding API

I am making a call from a server that is located in US to FindItemsAdvanced of ebay finding api.
I define ListedIn as "EBAY-ENCA", however, when I make the call - I see that it doesn't return results. I believe that this is because that items are not available to US.
I see that there is a parameter called: AvailableTo - but how can I say "to all countries" ? Writing each iso code in the world could be exhausting..
My code:
ItemFilter marketFilter = new ItemFilter();
marketFilter.setName(ItemFilterType.LISTED_IN);
marketFilter.getValue().add("EBAY-ENCA");
request.getItemFilter().add(marketFilter);
ItemFilter conditionFilter = new ItemFilter();
conditionFilter.setName(ItemFilterType.AVAILABLE_TO);
conditionFilter.getValue().add("UK");
request.getItemFilter().add(conditionFilter);
In general this call should work - regardless from where you call the API. So I assume that you get an error message from the API that prevent items from being returned. Be aware that the FindItemsAdvanced call of the eBay Finding API requires either a given "categoryId" or a "keyword". Do you set any of these?
Here is the XML payload of a working call:
<findItemsAdvancedRequest xmlns="http://www.ebay.com/marketplace/search/v1/services">
<keywords>iPhone6</keywords>
<itemFilter>
<name>ListedIn</name>
<value>EBAY-ENCA</value>
</itemFilter>
</findItemsAdvancedRequest>
I've created an example in our API playground. It uses the XML version of the Finding API. Just execute the call to see the valid response with items included. You can adapt and customize the request parameters to your needs and see how the API responses.
The "AvailableTo" filter can only be used once per request with exactly one value. So it won't be possible to add it multiple times or to add it once with multiple values. But I'm not sure if I get your use case right. Do you really want to get only those items that are available world wide? If yes, then I'm afraid this most probably isn't possible without filtering them locally (eg. by filtering for "Worldwide" in the "shipToLocations").

Getting SpooleFileList of a user in java with all the operations which we can do in as400(like view,change..etc)

I want output in the following format, which we get in as400 when WRKSPLF is executed
I am using the following code for retrieving the information from as400
try
{
AS400 as400System = new AS400();
String strSpooledFileName;
SpooledFileList splfList = new SpooledFileList(as400System);
splfList.openAsynchronously();
splfList.waitForListToComplete();
Enumeration enume= splfList.getObjects();
ArrayList<SpoolVO> list = new ArrayList<SpoolVO>();
while( enume.hasMoreElements() )
{
SpoolVO splVO = new SpoolVO();
SpooledFile splf = (SpooledFile)enume.nextElement();
if (splf != null)
{
// output this spooled file's name
splVO.setFileName(splf.getStringAttribute(SpooledFile.ATTR_SPOOLFILE));
splVO.setUserName(splf.getStringAttribute(SpooledFile.ATTR_JOBUSER));
splVO.setUserData(splf.getStringAttribute(SpooledFile.ATTR_USERDATA));
splVO.setDevice(splf.getStringAttribute(SpooledFile.ATTR_OUTPUT_QUEUE));
splVO.setTotalPages(splf.getIntegerAttribute(SpooledFile.ATTR_PAGES));
splVO.setCurrentPage(splf.getIntegerAttribute(SpooledFile.ATTR_CURPAGE));
splVO.setCopy(splf.getIntegerAttribute(SpooledFile.ATTR_COPIES));
list.add(splVO);
}
}
splfList.close();
Now by using the above code I am able to get all the fields except the Options(Opt). I want Options field in java which enables me to do all the operations like send, change, hold, etc. as specified in screenshot.
Is this possible doing with java??
Thanks in advance.
Guessing that you are using JT400 you would use SpooledFileList and SpooledFile to get the details you want. Edit your question to explain the specific details you want to retrieve. Post the code you tried.
Edit:
The Options field is not an attribute of a spooled file; you can't retrieve it from anywhere. It is a field on the display panel that lets the user request an action to be performed by the WRKSPLF command. You will need to provide that functionality within your Java program. For example, if your end user types a 3, you would issue the HLDSPLF command. If she types a 6, you would issue the RLSSPLF command.

How do we add custom properties to a VMWare VM using the vCloud Java API?

I am using the vCloud Java API provided by VMWare to automate the creation of VMs in their enterprise cloud solution. I have been able to do this just fine. However I am not able to figur out to set custom properties on the VM. I have checked out the VMWare API reference and I cannot find anything which intuitively suggests how to do this. Any insight may be helpful?
Here is the code I have written till now to configure the VM and I want to add the custom property configuration to it.
private static SourcedCompositionItemParamType addVAppTemplateItem(String vAppNetwork, MsgType networkInfo, String vmHref, String ipAddress, String vmName) {
SourcedCompositionItemParamType vappTemplateItem = new SourcedCompositionItemParamType();
ReferenceType vappTemplateVMRef = new ReferenceType();
vappTemplateVMRef.setHref(vmHref);
vappTemplateVMRef.setName(vmName);
vappTemplateItem.setSource(vappTemplateVMRef);
NetworkConnectionSectionType networkConnectionSectionType = new NetworkConnectionSectionType();
networkConnectionSectionType.setInfo(networkInfo);
NetworkConnectionType networkConnectionType = new NetworkConnectionType();
networkConnectionType.setNetwork(vAppNetwork);
networkConnectionType.setIpAddressAllocationMode(IpAddressAllocationModeType.MANUAL.value());
networkConnectionType.setIpAddress(ipAddress);
networkConnectionType.setIsConnected(true);
networkConnectionSectionType.getNetworkConnection().add(networkConnectionType);
InstantiationParamsType vmInstantiationParamsType = new InstantiationParamsType();
List<JAXBElement<? extends SectionType>> vmSections = vmInstantiationParamsType.getSection();
vmSections.add(new ObjectFactory().createNetworkConnectionSection(networkConnectionSectionType));
vappTemplateItem.setInstantiationParams(vmInstantiationParamsType);
return vappTemplateItem;
}
After going through the REST API documentation I realized that you put Custom Properties into the ProductSection. Unfortunately I could not figure out a way to add a ProductSection when creating a VApp so added the ProductSection after creating the VApp by retrieving the VM and calling updateProductSections on it.
Response from VMWare community forum

Categories