Platform SDK Java 8.5 API Reference

Package com.genesyslab.platform.json.jackson2

Platform SDK includes the following protocol-specific Jackson modules, that help to serialize protocol messages to or from JSON format:

Configuration protocol: ConfServerModule
Contacts protocol: ContactServerModule
OpenMedia protocols: ExternalServiceModule InteractionServerModule OpenMediaAttributesModule
Outbound protocols: OutboundDesktopModule OutboundServerModule
Management protocols: LocalControlAgentModule MessageServerModule SolutionControlServerModule
Reporting protocol: StatServerModule
Routing protocol: CustomServerModule RoutingServerModule
Voice protocols: TServerModule PreviewInteractionModule
WebMedia protocol: BasicChatModule CallbackModule EmailModule EspEmailModule FlexChatModule

See:
          Description

Interface Summary
MetaDataSupport Specifies which Configuration Server metadata will be used to deserialize Configuration Server messages to/from JSON.
 

Class Summary
PSDKCommonModule The base class for all provided Platform SDK Jackson modules.
PSDKJSONConstants Contains string constants that are used as keys in JSON.
PSDKModule Jackson module that describes how to serialize Platform SDK messages for all protocols to/from JSON.
 

Exception Summary
MetadataInstantiationException Used to prevent a ProtocolException from being thrown during the instantiation of CfgMetadata.
 

Package com.genesyslab.platform.json.jackson2 Description

Platform SDK includes the following protocol-specific Jackson modules, that help to serialize protocol messages to or from JSON format:

Configuration protocol: ConfServerModule
Contacts protocol: ContactServerModule
OpenMedia protocols: ExternalServiceModule InteractionServerModule OpenMediaAttributesModule
Outbound protocols: OutboundDesktopModule OutboundServerModule
Management protocols: LocalControlAgentModule MessageServerModule SolutionControlServerModule
Reporting protocol: StatServerModule
Routing protocol: CustomServerModule RoutingServerModule
Voice protocols: TServerModule PreviewInteractionModule
WebMedia protocol: BasicChatModule CallbackModule EmailModule EspEmailModule FlexChatModule

An example of using the ConfServerModule is provided below. Syntax for other Jackson modules is similar, with differences detailed on the page for that specific module.

 
  // create jackson's JSON converter
  ObjectMapper mapper = new ObjectMapper();
   
  // register our new PSDK module
  mapper.registerModule( new ConfServerModule() );
   
  // create PSDK message
  RequestCreateObject request = RequestCreateObject.create();
  // TODO : fill the request attributes
    
  // serialize message
  String json = mapper.writeValueAsString(request);
  
  // ...
   
  // deserialize message
 RequestCreateObject msg = mapper.readValue(json, RequestCreateObject.class);
 
If you need to work with some specific version of Configuration Server, you can use the server metadata. This approach is useful when it needs connection to newer version of Configuration Server then Platform SDK supports.
  ConfServerProtocol c = new ConfServerProtocol(endpoint);
  c.open();
  
  // to use specific metadata version use following code
  
  // gets server specific version of metadata
  CfgMetaData metadata = ((ConfServerContext)c.connectionContext().serverContext()).getMetadata();
 
  // create jackson's JSON converter
  ObjectMapper mapper = new ObjectMapper();
  
  mapper.registerModule( new ConfServerModule(metadata) );
 
Any Configuration Server message that is deserialized using the latest metadata version contained in Platform SDK can be sent to older versions of Configuration Server, but the unknown (new) attributes for that version of Configuration Server will be ignored while sending the message.

NOTE: The Jackson module changes ObjectMapper features while it is registering (as shown in commented lines below), so if you intend to customize the configuration then only make changes after the module is registered.
     ObjectMapper mapper = new ObjectMapper(); 
     mapper.register( new ConfServerModule() );
     // mapper.setSerializationInclusion(Include.NON_NULL);
     // mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
     // mapper.setDateFormat(new ISO8601DateFormatWithMilliseconds()); 
  


Platform SDK Java 8.5 API Reference

Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 8.5.302.00
Copyright © 2006–2017 Genesys Telecommunications Laboratories, Inc. All rights reserved.