Input: Retrieves all Form Definitions by logged in user . [CODESPLIT] public List < Form > getAllByLoggedInUser ( boolean includeTableRecordTypesParam ) { Form form = new Form ( ) ; if ( this . serviceTicket != null ) { form . setServiceTicket ( this . serviceTicket ) ; } if ( includeTableRecordTypesParam ) { return new FormListing ( this . postJson ( form , WS . Path . FormDefinition . Version1 . getAllByLoggedInUserIncludeTableTypes ( ) ) ) . getListing ( ) ; } else { return new FormListing ( this . postJson ( form , WS . Path . FormDefinition . Version1 . getAllByLoggedInUser ( ) ) ) . getListing ( ) ; } }


Input: Retrieves all Form Definitions where the logged in user can create a new instance of the { @code Form } . [CODESPLIT] public List < Form > getAllByLoggedInUserWhereCanCreateInstanceOf ( ) { Form form = new Form ( ) ; if ( this . serviceTicket != null ) { form . setServiceTicket ( this . serviceTicket ) ; } return new FormListing ( this . postJson ( form , WS . Path . FormDefinition . Version1 . getAllByLoggedInAndCanCreateInstanceOf ( ) ) ) . getListing ( ) ; }


Input: Deletes the Form Definition provided . Id must be set on the Form Definition . [CODESPLIT] public Form deleteFormDefinition ( Form formDefinitionParam ) { if ( formDefinitionParam != null && this . serviceTicket != null ) { formDefinitionParam . setServiceTicket ( this . serviceTicket ) ; } return new Form ( this . postJson ( formDefinitionParam , WS . Path . FormDefinition . Version1 . formDefinitionDelete ( ) ) ) ; }


Input: Retrieves the { @code CachedFieldValue } value stored under the params . [CODESPLIT] public CachedFieldValue getCachedFieldValueFrom ( Long formDefIdParam , Long formContIdParam , Long formFieldIdParam ) { if ( ( formDefIdParam == null || formContIdParam == null ) || formFieldIdParam == null ) { return null ; } String storageKey = this . getStorageKeyFrom ( formDefIdParam , formContIdParam , formFieldIdParam ) ; Object objWithKey ; try { objWithKey = this . memcachedClient . get ( storageKey ) ; } //Changed for Java 1.6 compatibility... catch ( MemcachedException e ) { throw new FluidCacheException ( "Unable to get Field value for '" + storageKey + "'." + "Contact administrator. " + e . getMessage ( ) , e ) ; } catch ( TimeoutException e ) { throw new FluidCacheException ( "Unable to get Field value for '" + storageKey + "'." + "Contact administrator. " + e . getMessage ( ) , e ) ; } catch ( InterruptedException e ) { throw new FluidCacheException ( "Unable to get Field value for '" + storageKey + "'." + "Contact administrator. " + e . getMessage ( ) , e ) ; } return this . getCacheFieldValueFromObject ( objWithKey ) ; }


Input: Converts the { @code objWithKeyParam } Object to { @code CachedFieldValue } . [CODESPLIT] @ SuppressWarnings ( "unchecked" ) private CachedFieldValue getCacheFieldValueFromObject ( Object objWithKeyParam ) { if ( objWithKeyParam == null ) { return null ; } //Get Word... Method methodGetWord = CacheUtil . getMethod ( objWithKeyParam . getClass ( ) , CustomCode . IWord . METHOD_getWord ) ; //Get Value... Method methodGetValue = CacheUtil . getMethod ( objWithKeyParam . getClass ( ) , CustomCode . ADataType . METHOD_getValue ) ; //Word... Object getWordObj = CacheUtil . invoke ( methodGetWord , objWithKeyParam ) ; String getWordVal = null ; if ( getWordObj instanceof String ) { getWordVal = ( String ) getWordObj ; } //Value... Object getValueObj ; if ( FlowJobType . MULTIPLE_CHOICE . equals ( getWordVal ) ) { MultiChoice multiChoice = new MultiChoice ( ) ; //Available Choices... Method methodAvailableChoices = getMethod ( objWithKeyParam . getClass ( ) , CustomCode . MultipleChoice . METHOD_getAvailableChoices ) ; Object availChoicesObj = CacheUtil . invoke ( methodAvailableChoices , objWithKeyParam ) ; if ( availChoicesObj instanceof List ) { multiChoice . setAvailableMultiChoices ( ( List ) availChoicesObj ) ; } //Selected... Method methodSelectedChoices = getMethod ( objWithKeyParam . getClass ( ) , CustomCode . MultipleChoice . METHOD_getSelectedChoices ) ; Object selectedChoicesObj = invoke ( methodSelectedChoices , objWithKeyParam ) ; if ( selectedChoicesObj instanceof List ) { multiChoice . setSelectedMultiChoices ( ( List ) selectedChoicesObj ) ; } getValueObj = multiChoice ; } else { getValueObj = CacheUtil . invoke ( methodGetValue , objWithKeyParam ) ; } if ( getValueObj == null ) { return null ; } if ( getWordVal == null ) { throw new FluidCacheException ( "Get Word value is 'null'. Not allowed." ) ; } CachedFieldValue returnVal = new CachedFieldValue ( ) ; returnVal . dataType = getWordVal ; returnVal . cachedFieldValue = getValueObj ; return returnVal ; }


Input: Retrieves the java method from class { @code clazzParam } . [CODESPLIT] @ SuppressWarnings ( "unchecked" ) private static Method getMethod ( Class clazzParam , String nameParam ) { try { if ( clazzParam == null || nameParam == null ) { return null ; } Method returnVal = clazzParam . getDeclaredMethod ( nameParam ) ; returnVal . setAccessible ( true ) ; return returnVal ; } // catch ( NoSuchMethodException e ) { throw new FluidCacheException ( "Unable to get method '" + nameParam + "'. " + e . getMessage ( ) , e ) ; } }


Input: Invokes the { @code methodParam } method on { @code objParam } . [CODESPLIT] private static Object invoke ( Method methodParam , Object objParam ) { try { return methodParam . invoke ( objParam ) ; } //Changed for Java 1.6 compatibility... catch ( InvocationTargetException e ) { throw new FluidCacheException ( "Unable to invoke method '" + methodParam . getName ( ) + "'. " + e . getMessage ( ) , e ) ; } catch ( IllegalAccessException e ) { throw new FluidCacheException ( "Unable to invoke method '" + methodParam . getName ( ) + "'. " + e . getMessage ( ) , e ) ; } catch ( IllegalArgumentException e ) { throw new FluidCacheException ( "Unable to invoke method '" + methodParam . getName ( ) + "'. " + e . getMessage ( ) , e ) ; } }


Input: Generates the storage key the provided parameters . [CODESPLIT] private String getStorageKeyFrom ( Long formDefIdParam , Long formContIdParam , Long formFieldIdParam ) { StringBuilder stringBuff = new StringBuilder ( ) ; //Form Definition... if ( formDefIdParam == null ) { stringBuff . append ( NULL ) ; } else { stringBuff . append ( formDefIdParam . toString ( ) ) ; } stringBuff . append ( DASH ) ; //Form Container... if ( formContIdParam == null ) { stringBuff . append ( NULL ) ; } else { stringBuff . append ( formContIdParam . toString ( ) ) ; } stringBuff . append ( DASH ) ; //Form Field... if ( formFieldIdParam == null ) { stringBuff . append ( NULL ) ; } else { stringBuff . append ( formFieldIdParam . toString ( ) ) ; } return stringBuff . toString ( ) ; }


Input: Creates an instance of MemcachedClient . [CODESPLIT] private MemcachedClient initXMemcachedClient ( ) { if ( this . memcachedClient != null && ! this . memcachedClient . isShutdown ( ) ) { return this . memcachedClient ; } try { this . memcachedClient = new XMemcachedClient ( this . cacheHost , this . cachePort ) ; return this . memcachedClient ; } //Unable to create client with connection. catch ( IOException e ) { throw new FluidCacheException ( "Unable to create MemCache client. " + e . getMessage ( ) , e ) ; } }


Input: Closes the Memcached client connection . [CODESPLIT] public void shutdown ( ) { if ( this . memcachedClient != null && ! this . memcachedClient . isShutdown ( ) ) { try { this . memcachedClient . shutdown ( ) ; } // catch ( IOException eParam ) { throw new FluidCacheException ( "Unable to create shutdown MemCache client. " + eParam . getMessage ( ) , eParam ) ; } } }


Input: Conversion to { @code JSONObject } from Java Object . [CODESPLIT] @ Override public JSONObject toJsonObject ( ) throws JSONException { JSONObject returnVal = super . toJsonObject ( ) ; //Order... if ( this . getOrder ( ) != null ) { returnVal . put ( JSONMapping . ORDER , this . getOrder ( ) ) ; } //Rule... if ( this . getRule ( ) != null ) { returnVal . put ( JSONMapping . RULE , this . getRule ( ) ) ; } //Current Typed Syntax... if ( this . getCurrentTypedSyntax ( ) != null ) { returnVal . put ( JSONMapping . CURRENT_TYPED_SYNTAX , this . getCurrentTypedSyntax ( ) ) ; } //Flow... if ( this . getFlow ( ) != null ) { returnVal . put ( JSONMapping . FLOW , this . getFlow ( ) . toJsonObject ( ) ) ; } //Flow Step... if ( this . getFlowStep ( ) != null ) { returnVal . put ( JSONMapping . FLOW_STEP , this . getFlowStep ( ) . toJsonObject ( ) ) ; } //Next Valid Syntax Words... if ( this . getNextValidSyntaxWords ( ) != null && ! this . getNextValidSyntaxWords ( ) . isEmpty ( ) ) { JSONArray jsonArrayOfValidWords = new JSONArray ( ) ; for ( String validWord : this . getNextValidSyntaxWords ( ) ) { jsonArrayOfValidWords . put ( validWord ) ; } returnVal . put ( JSONMapping . NEXT_VALID_SYNTAX_WORDS , jsonArrayOfValidWords ) ; } return returnVal ; }


Input: Retrieves all the Descendants ( Forms ) for the { @code formToGetTableFormsForParam } . [CODESPLIT] public List < FormListing > getDescendantsSynchronized ( Form ... formToGetDescendantsForParam ) { if ( formToGetDescendantsForParam == null || formToGetDescendantsForParam . length == 0 ) { return null ; } //Start a new request... String uniqueReqId = this . initNewRequest ( ) ; //Mass data fetch... int numberOfSentForms = 0 ; if ( this . massFetch ) { FormListing listingToSend = new FormListing ( ) ; List < Form > listOfValidForms = new ArrayList ( ) ; for ( Form formToSend : formToGetDescendantsForParam ) { if ( formToSend == null ) { throw new FluidClientException ( "Cannot provide 'null' for Form." , FluidClientException . ErrorCode . ILLEGAL_STATE_ERROR ) ; } listOfValidForms . add ( new Form ( formToSend . getId ( ) ) ) ; } listingToSend . setEcho ( UUID . randomUUID ( ) . toString ( ) ) ; listingToSend . setListing ( listOfValidForms ) ; //Send the actual message... this . sendMessage ( listingToSend , uniqueReqId ) ; numberOfSentForms ++ ; } else { //Single... //Send all the messages... for ( Form formToSend : formToGetDescendantsForParam ) { this . setEchoIfNotSet ( formToSend ) ; //Send the actual message... this . sendMessage ( formToSend , uniqueReqId ) ; numberOfSentForms ++ ; } } try { List < FormListing > returnValue = this . getHandler ( uniqueReqId ) . getCF ( ) . get ( this . getTimeoutInMillis ( ) , TimeUnit . MILLISECONDS ) ; //Connection was closed.. this is a problem.... if ( this . getHandler ( uniqueReqId ) . isConnectionClosed ( ) ) { throw new FluidClientException ( "SQLUtil-WebSocket-GetDescendants: " + "The connection was closed by the server prior to the response received." , FluidClientException . ErrorCode . IO_ERROR ) ; } return returnValue ; } catch ( InterruptedException exceptParam ) { //Interrupted... throw new FluidClientException ( "SQLUtil-WebSocket-Interrupted-GetDescendants: " + exceptParam . getMessage ( ) , exceptParam , FluidClientException . ErrorCode . STATEMENT_EXECUTION_ERROR ) ; } catch ( ExecutionException executeProblem ) { //Error on the web-socket... Throwable cause = executeProblem . getCause ( ) ; //Fluid client exception... if ( cause instanceof FluidClientException ) { throw ( FluidClientException ) cause ; } else { throw new FluidClientException ( "SQLUtil-WebSocket-GetDescendants: " + cause . getMessage ( ) , cause , FluidClientException . ErrorCode . STATEMENT_EXECUTION_ERROR ) ; } } catch ( TimeoutException eParam ) { //Timeout... String errMessage = this . getExceptionMessageVerbose ( "SQLUtil-WebSocket-GetDescendants" , uniqueReqId , numberOfSentForms ) ; throw new FluidClientException ( errMessage , FluidClientException . ErrorCode . IO_ERROR ) ; } finally { this . removeHandler ( uniqueReqId ) ; } }


Input: Retrieves a property and returns the value as { @code java . lang . String } . [CODESPLIT] protected static String getStringPropertyFromProperties ( Properties propertiesParam , String propertyKeyParam ) { if ( propertiesParam == null || propertiesParam . isEmpty ( ) ) { return null ; } return propertiesParam . getProperty ( propertyKeyParam ) ; }


Input: Retrieves a property and returns the value as { @code int } . [CODESPLIT] protected static int getIntPropertyFromProperties ( Properties propertiesParam , String propertyKeyParam ) { String strProp = getStringPropertyFromProperties ( propertiesParam , propertyKeyParam ) ; if ( strProp == null || strProp . trim ( ) . isEmpty ( ) ) { return - 1 ; } try { return Integer . parseInt ( strProp ) ; } catch ( NumberFormatException nfe ) { return - 1 ; } }


Input: Returns - 1 if there is a problem with conversion . [CODESPLIT] protected long toLongSafe ( String toParseParam ) { if ( toParseParam == null || toParseParam . trim ( ) . isEmpty ( ) ) { return - 1 ; } try { return Long . parseLong ( toParseParam . trim ( ) ) ; } catch ( NumberFormatException e ) { return - 1 ; } }


Input: Conversion to { @code JSONObject } from Java Object . [CODESPLIT] @ Override public JSONObject toJsonObject ( ) throws JSONException { JSONObject returnVal = super . toJsonObject ( ) ; //Flow... if ( this . getFlow ( ) != null ) { returnVal . put ( JSONMapping . FLOW , this . getFlow ( ) ) ; } //Form... if ( this . getForm ( ) != null ) { returnVal . put ( JSONMapping . FORM , this . getForm ( ) . toJsonObject ( ) ) ; } //User Fields... if ( this . getUserFields ( ) != null && ! this . getUserFields ( ) . isEmpty ( ) ) { JSONArray fieldsArr = new JSONArray ( ) ; for ( Field toAdd : this . getUserFields ( ) ) { fieldsArr . put ( toAdd . toJsonObject ( ) ) ; } returnVal . put ( JSONMapping . USER_FIELDS , fieldsArr ) ; } //Route Fields... if ( this . getRouteFields ( ) != null && ! this . getRouteFields ( ) . isEmpty ( ) ) { JSONArray fieldsArr = new JSONArray ( ) ; for ( Field toAdd : this . getRouteFields ( ) ) { fieldsArr . put ( toAdd . toJsonObject ( ) ) ; } returnVal . put ( JSONMapping . ROUTE_FIELDS , fieldsArr ) ; } //Global Fields... if ( this . getGlobalFields ( ) != null && ! this . getGlobalFields ( ) . isEmpty ( ) ) { JSONArray fieldsArr = new JSONArray ( ) ; for ( Field toAdd : this . getGlobalFields ( ) ) { fieldsArr . put ( toAdd . toJsonObject ( ) ) ; } returnVal . put ( JSONMapping . GLOBAL_FIELDS , fieldsArr ) ; } //Attachments... if ( this . getAttachments ( ) != null ) { JSONArray jsonArray = new JSONArray ( ) ; for ( Attachment toAdd : this . getAttachments ( ) ) { jsonArray . put ( toAdd . toJsonObject ( ) ) ; } returnVal . put ( JSONMapping . ATTACHMENTS , jsonArray ) ; } //Flow State... if ( this . getFlowState ( ) != null ) { returnVal . put ( JSONMapping . FLOW_STATE , this . getFlowState ( ) . toString ( ) ) ; } return returnVal ; }


Input: Serialize { @code this } object into a JSONObject . [CODESPLIT] @ XmlTransient public JSONObject convertToFlatJSONObject ( ) { JSONObject returnVal = new JSONObject ( ) ; //Id... returnVal . put ( FlatFormJSONMapping . FLUID_ITEM_ID , this . getId ( ) == null ? JSONObject . NULL : this . getId ( ) ) ; //Flow State... returnVal . put ( FlatFormJSONMapping . FLOW_STATE , ( this . getFlowState ( ) == null ) ? JSONObject . NULL : this . getFlowState ( ) . name ( ) ) ; //Populate the Form... JSONObject formJSONObjFlat = ( this . getForm ( ) == null ) ? null : this . getForm ( ) . convertToFlatJSONObject ( ) ; if ( formJSONObjFlat != null ) { formJSONObjFlat . keySet ( ) . forEach ( ( toAdd ) - > { returnVal . put ( toAdd , formJSONObjFlat . get ( toAdd ) )  ; } ) ; }


Input: Conversion to { @code JSONObject } from Java Object . [CODESPLIT] @ Override public JSONObject toJsonObject ( ) throws JSONException { JSONObject returnVal = super . toJsonObject ( ) ; //Can Create... if ( this . isCanCreate ( ) != null ) { returnVal . put ( JSONMapping . CAN_CREATE , this . isCanCreate ( ) . booleanValue ( ) ) ; } //Form Definition... if ( this . getFormDefinition ( ) != null ) { returnVal . put ( JSONMapping . FORM_DEFINITION , this . getFormDefinition ( ) . toJsonObject ( ) ) ; } return returnVal ; }


Input: Gets a comma seperated list of providers from { @code Identity } s . [CODESPLIT] public String getListOfProvidersFromIdentities ( ) { if ( this . getIdentities ( ) == null || this . getIdentities ( ) . isEmpty ( ) ) { return "" ; } StringBuilder returnVal = new StringBuilder ( ) ; for ( Identity identity : this . getIdentities ( ) ) { returnVal . append ( identity . getProvider ( ) ) ; returnVal . append ( "," ) ; } String toString = returnVal . toString ( ) ; return toString . substring ( 0 , toString . length ( ) - 1 ) ; }


Input: Conversion to { @code JSONObject } from Java Object . [CODESPLIT] @ Override public JSONObject toJsonObject ( ) throws JSONException { JSONObject returnVal = super . toJsonObject ( ) ; //User Id... if ( this . getUserId ( ) != null ) { returnVal . put ( JSONMapping . USER_ID , this . getUserId ( ) ) ; } //Name... if ( this . getName ( ) != null ) { returnVal . put ( JSONMapping . NAME , this . getName ( ) ) ; } //Email... if ( this . getEmail ( ) != null ) { returnVal . put ( JSONMapping . EMAIL , this . getEmail ( ) ) ; } //Email Verified... returnVal . put ( JSONMapping . EMAIL_VERIFIED , this . isEmailVerified ( ) ) ; //Nickname... if ( this . getNickname ( ) != null ) { returnVal . put ( JSONMapping . NICKNAME , this . getNickname ( ) ) ; } //Picture... if ( this . getPicture ( ) != null ) { returnVal . put ( JSONMapping . PICTURE , this . getPicture ( ) ) ; } //Given Name... if ( this . getGivenName ( ) != null ) { returnVal . put ( JSONMapping . GIVEN_NAME , this . getGivenName ( ) ) ; } //Family Name... if ( this . getFamilyName ( ) != null ) { returnVal . put ( JSONMapping . FAMILY_NAME , this . getFamilyName ( ) ) ; } //Locale... if ( this . getLocale ( ) != null ) { returnVal . put ( JSONMapping . LOCALE , this . getLocale ( ) ) ; } //Identities... if ( this . getIdentities ( ) != null && ! this . getIdentities ( ) . isEmpty ( ) ) { JSONArray identitiesArr = new JSONArray ( ) ; for ( Identity toAdd : this . getIdentities ( ) ) { identitiesArr . put ( toAdd . toJsonObject ( ) ) ; } returnVal . put ( JSONMapping . IDENTITIES , identitiesArr ) ; } return returnVal ; }


Input: Makes use of the Fluid Core to convert a document into a PDF file . [CODESPLIT] public File convertDocumentToPDF ( File inputDocumentParam ) { if ( inputDocumentParam == null || ! inputDocumentParam . exists ( ) ) { throw new UtilException ( "Input document to convert not provided or does not exist." , UtilException . ErrorCode . COMMAND ) ; } if ( ! inputDocumentParam . isFile ( ) ) { throw new UtilException ( "Input document '' is not a file." , UtilException . ErrorCode . COMMAND ) ; } File parentFolder = inputDocumentParam . getParentFile ( ) ; String inputFilenameWithoutExt = inputDocumentParam . getName ( ) ; int indexOfDot = - 1 ; if ( ( indexOfDot = inputFilenameWithoutExt . indexOf ( ' ' ) ) > - 1 ) { inputFilenameWithoutExt = inputFilenameWithoutExt . substring ( 0 , indexOfDot ) ; } File generatedPdfFileOut = new File ( parentFolder . getAbsolutePath ( ) . concat ( File . separator ) . concat ( inputFilenameWithoutExt ) . concat ( ".pdf" ) ) ; String completeOutputPath = generatedPdfFileOut . getAbsolutePath ( ) ; try { CommandUtil . CommandResult commandResult = this . commandUtil . executeCommand ( CommandUtil . FLUID_CLI , COMMAND_CONVERT_DOC_TO_PDF , "-i" , inputDocumentParam . getAbsolutePath ( ) , "-o" , completeOutputPath ) ; //There is a problem... if ( commandResult . getExitCode ( ) != 0 ) { throw new UtilException ( "Unable to convert '" + inputDocumentParam . getName ( ) + "' to PDF. " + commandResult . toString ( ) , UtilException . ErrorCode . COMMAND ) ; } File returnVal = new File ( completeOutputPath ) ; if ( ! returnVal . exists ( ) ) { throw new UtilException ( "Command executed, but no output file. Expected PDF at '" + completeOutputPath + "'." , UtilException . ErrorCode . GENERAL ) ; } return returnVal ; } // catch ( IOException eParam ) { throw new UtilException ( "Problem executing command. " + eParam . getMessage ( ) , eParam , UtilException . ErrorCode . GENERAL ) ; } }


Input: Retrieves the Ancestor for the { @code formToGetAncestorForParam } . [CODESPLIT] public Form getAncestor ( Form formToGetAncestorForParam , boolean includeFieldDataParam , boolean includeTableFieldsParam ) { if ( DISABLE_WS ) { this . mode = Mode . RESTfulActive ; } //ANCESTOR... try { //When mode is null or [WebSocketActive]... if ( this . getAncestorClient == null && Mode . RESTfulActive != this . mode ) { this . getAncestorClient = new SQLUtilWebSocketGetAncestorClient ( this . baseURL , null , this . loggedInUser . getServiceTicketAsHexUpper ( ) , this . timeoutMillis , includeFieldDataParam , includeTableFieldsParam , COMPRESS_RSP , COMPRESS_RSP_CHARSET ) ; this . mode = Mode . WebSocketActive ; } } catch ( FluidClientException clientExcept ) { if ( clientExcept . getErrorCode ( ) != FluidClientException . ErrorCode . WEB_SOCKET_DEPLOY_ERROR ) { throw clientExcept ; } this . mode = Mode . RESTfulActive ; } Form formToUse = ( formToGetAncestorForParam == null ) ? null : new Form ( formToGetAncestorForParam . getId ( ) ) ; return ( this . getAncestorClient == null ) ? this . sqlUtilClient . getAncestor ( formToUse , includeFieldDataParam , includeTableFieldsParam ) : this . getAncestorClient . getAncestorSynchronized ( formToUse ) ; }


Input: Retrieves all the Descendants ( Forms ) for the { @code formsToGetDescForParam } . [CODESPLIT] public List < FormListing > getDescendants ( boolean includeFieldDataParam , boolean includeTableFieldsParam , boolean includeTableFieldFormRecordInfoParam , boolean massFetchParam , Form ... formsToGetDescForParam ) { if ( DISABLE_WS ) { this . mode = Mode . RESTfulActive ; } //DESCENDANTS... try { //When mode is null or [WebSocketActive]... if ( this . getDescendantsClient == null && Mode . RESTfulActive != this . mode ) { this . getDescendantsClient = new SQLUtilWebSocketGetDescendantsClient ( this . baseURL , null , this . loggedInUser . getServiceTicketAsHexUpper ( ) , this . timeoutMillis , includeFieldDataParam , includeTableFieldsParam , includeTableFieldFormRecordInfoParam , massFetchParam , COMPRESS_RSP , COMPRESS_RSP_CHARSET ) ; this . mode = Mode . WebSocketActive ; } } catch ( FluidClientException clientExcept ) { if ( clientExcept . getErrorCode ( ) != FluidClientException . ErrorCode . WEB_SOCKET_DEPLOY_ERROR ) { throw clientExcept ; } this . mode = Mode . RESTfulActive ; } if ( formsToGetDescForParam == null || formsToGetDescForParam . length < 1 ) { return null ; } Form [ ] formsToFetchFor = new Form [ formsToGetDescForParam . length ] ; for ( int index = 0 ; index < formsToFetchFor . length ; index ++ ) { formsToFetchFor [ index ] = new Form ( formsToGetDescForParam [ index ] . getId ( ) ) ; } if ( this . getDescendantsClient != null ) { return this . getDescendantsClient . getDescendantsSynchronized ( formsToFetchFor ) ; } else { List < FormListing > returnVal = new ArrayList <> ( ) ; for ( Form formToFetchFor : formsToFetchFor ) { List < Form > listOfForms = this . sqlUtilClient . getDescendants ( formToFetchFor , includeFieldDataParam , includeTableFieldsParam , includeTableFieldFormRecordInfoParam ) ; FormListing toAdd = new FormListing ( ) ; toAdd . setListing ( listOfForms ) ; toAdd . setListingCount ( ( listOfForms == null ) ? 0 : listOfForms . size ( ) ) ; returnVal . add ( toAdd ) ; } return returnVal ; } }


Input: Retrieves all the Table ( Forms ) for the { @code formsToGetDescForParam } . [CODESPLIT] public List < FormListing > getTableForms ( boolean includeFieldDataParam , Form ... formsToGetTableFormsForParam ) { if ( DISABLE_WS ) { this . mode = Mode . RESTfulActive ; } //DESCENDANTS... try { //When mode is null or [WebSocketActive]... if ( this . getTableFormsClient == null && Mode . RESTfulActive != this . mode ) { this . getTableFormsClient = new SQLUtilWebSocketGetTableFormsClient ( this . baseURL , null , this . loggedInUser . getServiceTicketAsHexUpper ( ) , this . timeoutMillis , includeFieldDataParam , COMPRESS_RSP , COMPRESS_RSP_CHARSET ) ; this . mode = Mode . WebSocketActive ; } } catch ( FluidClientException clientExcept ) { if ( clientExcept . getErrorCode ( ) != FluidClientException . ErrorCode . WEB_SOCKET_DEPLOY_ERROR ) { throw clientExcept ; } this . mode = Mode . RESTfulActive ; } if ( formsToGetTableFormsForParam == null || formsToGetTableFormsForParam . length < 1 ) { return null ; } Form [ ] formsToFetchFor = new Form [ formsToGetTableFormsForParam . length ] ; for ( int index = 0 ; index < formsToFetchFor . length ; index ++ ) { formsToFetchFor [ index ] = new Form ( formsToGetTableFormsForParam [ index ] . getId ( ) ) ; } if ( this . getTableFormsClient != null ) { return this . getTableFormsClient . getTableFormsSynchronized ( formsToFetchFor ) ; } else { List < FormListing > returnVal = new ArrayList <> ( ) ; for ( Form formToFetchFor : formsToFetchFor ) { List < Form > listOfForms = this . sqlUtilClient . getTableForms ( formToFetchFor , includeFieldDataParam ) ; FormListing toAdd = new FormListing ( ) ; toAdd . setListing ( listOfForms ) ; toAdd . setListingCount ( ( listOfForms == null ) ? 0 : listOfForms . size ( ) ) ; returnVal . add ( toAdd ) ; } return returnVal ; } }


Input: Retrieves all the ( Fields ) for the { @code formsToGetDescForParam } . [CODESPLIT] public List < FormFieldListing > getFormFields ( boolean includeFieldDataParam , Form ... formsToGetFieldsForParam ) { if ( DISABLE_WS ) { this . mode = Mode . RESTfulActive ; } //FORM FIELDS... try { //When mode is null or [WebSocketActive]... if ( this . getFormFieldsClient == null && Mode . RESTfulActive != this . mode ) { this . getFormFieldsClient = new SQLUtilWebSocketGetFormFieldsClient ( this . baseURL , null , this . loggedInUser . getServiceTicketAsHexUpper ( ) , this . timeoutMillis , includeFieldDataParam , COMPRESS_RSP , COMPRESS_RSP_CHARSET ) ; this . mode = Mode . WebSocketActive ; } } catch ( FluidClientException clientExcept ) { if ( clientExcept . getErrorCode ( ) != FluidClientException . ErrorCode . WEB_SOCKET_DEPLOY_ERROR ) { throw clientExcept ; } this . mode = Mode . RESTfulActive ; } if ( formsToGetFieldsForParam == null || formsToGetFieldsForParam . length < 1 ) { return null ; } Form [ ] formsToFetchFor = new Form [ formsToGetFieldsForParam . length ] ; for ( int index = 0 ; index < formsToFetchFor . length ; index ++ ) { formsToFetchFor [ index ] = new Form ( formsToGetFieldsForParam [ index ] . getId ( ) ) ; } if ( this . getFormFieldsClient != null ) { return this . getFormFieldsClient . getFormFieldsSynchronized ( formsToFetchFor ) ; } else { List < FormFieldListing > returnVal = new ArrayList <> ( ) ; for ( Form formToFetchFor : formsToFetchFor ) { List < Field > listOfFields = this . sqlUtilClient . getFormFields ( formToFetchFor , includeFieldDataParam ) ; FormFieldListing toAdd = new FormFieldListing ( ) ; toAdd . setListing ( listOfFields ) ; toAdd . setListingCount ( ( listOfFields == null ) ? 0 : listOfFields . size ( ) ) ; returnVal . add ( toAdd ) ; } return returnVal ; } }


Input: Retrieves all the ( Fields ) for the { @code formsToGetDescForParam } . [CODESPLIT] public void massPopulateFormFields ( boolean includeFieldDataParam , Form ... formsToPopulateFormFieldsForParam ) { if ( DISABLE_WS ) { this . mode = Mode . RESTfulActive ; } //FORM FIELDS... try { //When mode is null or [WebSocketActive]... if ( this . getFormFieldsClient == null && Mode . RESTfulActive != this . mode ) { this . getFormFieldsClient = new SQLUtilWebSocketGetFormFieldsClient ( this . baseURL , null , this . loggedInUser . getServiceTicketAsHexUpper ( ) , this . timeoutMillis , includeFieldDataParam , COMPRESS_RSP , COMPRESS_RSP_CHARSET ) ; this . mode = Mode . WebSocketActive ; } } catch ( FluidClientException clientExcept ) { if ( clientExcept . getErrorCode ( ) != FluidClientException . ErrorCode . WEB_SOCKET_DEPLOY_ERROR ) { throw clientExcept ; } this . mode = Mode . RESTfulActive ; } //Nothing to do... if ( formsToPopulateFormFieldsForParam == null || formsToPopulateFormFieldsForParam . length < 1 ) { return ; } //Populate a known echo for all of the local form caches... Form [ ] formsToFetchForLocalCacheArr = new Form [ formsToPopulateFormFieldsForParam . length ] ; for ( int index = 0 ; index < formsToFetchForLocalCacheArr . length ; index ++ ) { formsToFetchForLocalCacheArr [ index ] = new Form ( formsToPopulateFormFieldsForParam [ index ] . getId ( ) ) ; formsToFetchForLocalCacheArr [ index ] . setEcho ( UUID . randomUUID ( ) . toString ( ) ) ; } List < FormFieldListing > listingReturnFieldValsPopulated = new ArrayList <> ( ) ; //Fetch all of the values in a single go... if ( this . getFormFieldsClient != null ) { listingReturnFieldValsPopulated = this . getFormFieldsClient . getFormFieldsSynchronized ( formsToFetchForLocalCacheArr ) ; } else { //Old Rest way of fetching all of the values... for ( Form formToFetchFor : formsToFetchForLocalCacheArr ) { List < Field > listOfFields = this . sqlUtilClient . getFormFields ( formToFetchFor , includeFieldDataParam ) ; FormFieldListing toAdd = new FormFieldListing ( ) ; toAdd . setListing ( listOfFields ) ; toAdd . setListingCount ( ( listOfFields == null ) ? 0 : listOfFields . size ( ) ) ; toAdd . setEcho ( formToFetchFor . getEcho ( ) ) ; listingReturnFieldValsPopulated . add ( toAdd ) ; } } //Populate each of the form from the param... for ( Form formToSetFieldsOn : formsToPopulateFormFieldsForParam ) { formToSetFieldsOn . setFormFields ( this . getFieldValuesForFormFromCache ( formToSetFieldsOn . getId ( ) , listingReturnFieldValsPopulated , formsToFetchForLocalCacheArr ) ) ; } }


Input: Populate the field values from the cache . [CODESPLIT] private List < Field > getFieldValuesForFormFromCache ( Long formIdParam , List < FormFieldListing > listingReturnFieldValsPopulatedParam , Form [ ] formsToFetchForLocalCacheArrParam ) { if ( formIdParam == null || formIdParam . longValue ( ) < 1 ) { return null ; } if ( listingReturnFieldValsPopulatedParam == null || listingReturnFieldValsPopulatedParam . isEmpty ( ) ) { return null ; } if ( formsToFetchForLocalCacheArrParam == null || formsToFetchForLocalCacheArrParam . length == 0 ) { return null ; } for ( Form formIter : formsToFetchForLocalCacheArrParam ) { //Form is a match... if ( formIdParam . equals ( formIter . getId ( ) ) ) { String echoToUse = formIter . getEcho ( ) ; for ( FormFieldListing fieldListing : listingReturnFieldValsPopulatedParam ) { if ( echoToUse . equals ( fieldListing . getEcho ( ) ) ) { return fieldListing . getListing ( ) ; } } } } return null ; }


Input: Close any clients used during lifetime of { [CODESPLIT] public void closeAndClean ( ) { if ( this . sqlUtilClient != null ) { this . sqlUtilClient . closeAndClean ( ) ; } if ( this . getAncestorClient != null ) { this . getAncestorClient . closeAndClean ( ) ; } if ( this . getDescendantsClient != null ) { this . getDescendantsClient . closeAndClean ( ) ; } if ( this . getTableFormsClient != null ) { this . getTableFormsClient . closeAndClean ( ) ; } if ( this . getFormFieldsClient != null ) { this . getFormFieldsClient . closeAndClean ( ) ; } }


Input: Conversion to { @code JSONObject } from Java Object . [CODESPLIT] @ Override public JSONObject toJsonObject ( ) throws JSONException { JSONObject returnVal = super . toJsonObject ( ) ; //Name... if ( this . getColumnName ( ) != null ) { returnVal . put ( JSONMapping . COLUMN_NAME , this . getColumnName ( ) ) ; } //Index... if ( this . getColumnIndex ( ) != null ) { returnVal . put ( JSONMapping . COLUMN_INDEX , this . getColumnIndex ( ) ) ; } //SQL Type... if ( this . getSqlType ( ) != null ) { returnVal . put ( JSONMapping . SQL_TYPE , this . getSqlType ( ) ) ; } //SQL Value... if ( this . getSqlValue ( ) != null ) { returnVal . put ( JSONMapping . SQL_VALUE , this . getSqlValue ( ) ) ; } return returnVal ; }


Input: <p > Base { @code toJsonObject } that creates a { @code JSONObject } with the Id and ServiceTicket set . < / p > [CODESPLIT] @ XmlTransient public JSONObject toJsonObject ( ) throws JSONException { JSONObject returnVal = new JSONObject ( ) ; //Id... if ( this . getId ( ) != null ) { returnVal . put ( JSONMapping . ID , this . getId ( ) ) ; } //Service Ticket... if ( this . getServiceTicket ( ) != null ) { returnVal . put ( JSONMapping . SERVICE_TICKET , this . getServiceTicket ( ) ) ; } //Echo... if ( this . getEcho ( ) != null ) { returnVal . put ( JSONMapping . ECHO , this . getEcho ( ) ) ; } return returnVal ; }


Input: Converts the { @code Long } timestamp into a { @code Date } object . [CODESPLIT] @ XmlTransient private Date getLongAsDateFromJson ( Long longValueParam ) { if ( longValueParam == null ) { return null ; } return new Date ( longValueParam ) ; }


Input: Retrieves the value of field { @code fieldNameParam } as a timestamp . [CODESPLIT] @ XmlTransient public Date getDateFieldValueFromFieldWithName ( String fieldNameParam ) { if ( ( fieldNameParam == null || fieldNameParam . trim ( ) . isEmpty ( ) ) || ( this . jsonObject == null || this . jsonObject . isNull ( fieldNameParam ) ) ) { return null ; } Object objectAtIndex = this . jsonObject . get ( fieldNameParam ) ; if ( objectAtIndex instanceof Number ) { return this . getLongAsDateFromJson ( ( ( Number ) objectAtIndex ) . longValue ( ) ) ; } else if ( objectAtIndex instanceof String ) { Date validDate = null ; for ( SimpleDateFormat format : SUPPORTED_FORMATS ) { try { validDate = format . parse ( ( String ) objectAtIndex ) ; if ( validDate != null ) { break ; } } catch ( ParseException parseExcept ) { validDate = null ; } } return validDate ; } return null ; }


Input: Converts the { @code Date } object into a { @code Long } timestamp . [CODESPLIT] @ XmlTransient public Long getDateAsLongFromJson ( Date dateValueParam ) { if ( dateValueParam == null ) { return null ; } return dateValueParam . getTime ( ) ; }


Input: Create a new Flow Step Entry rule . [CODESPLIT] public FlowStepRule createFlowStepEntryRule ( FlowStepRule flowStepRuleParam ) { if ( flowStepRuleParam != null && this . serviceTicket != null ) { flowStepRuleParam . setServiceTicket ( this . serviceTicket ) ; } return new FlowStepRule ( this . putJson ( flowStepRuleParam , WS . Path . FlowStepRule . Version1 . flowStepRuleEntryCreate ( ) ) ) ; }


Input: Create a new Flow Step Exit rule . [CODESPLIT] public FlowStepRule createFlowStepExitRule ( FlowStepRule flowStepRuleParam ) { if ( flowStepRuleParam != null && this . serviceTicket != null ) { flowStepRuleParam . setServiceTicket ( this . serviceTicket ) ; } return new FlowStepRule ( this . putJson ( flowStepRuleParam , WS . Path . FlowStepRule . Version1 . flowStepRuleExitCreate ( ) ) ) ; }


Input: Create a new Flow Step View rule . [CODESPLIT] public FlowStepRule createFlowStepViewRule ( FlowStepRule flowStepRuleParam ) { if ( flowStepRuleParam != null && this . serviceTicket != null ) { flowStepRuleParam . setServiceTicket ( this . serviceTicket ) ; } return new FlowStepRule ( this . putJson ( flowStepRuleParam , WS . Path . FlowStepRule . Version1 . flowStepRuleViewCreate ( ) ) ) ; }


Input: Update an existing Flow Step Entry rule . [CODESPLIT] public FlowStepRule updateFlowStepEntryRule ( FlowStepRule flowStepRuleParam ) { if ( flowStepRuleParam != null && this . serviceTicket != null ) { flowStepRuleParam . setServiceTicket ( this . serviceTicket ) ; } return new FlowStepRule ( this . postJson ( flowStepRuleParam , WS . Path . FlowStepRule . Version1 . flowStepRuleUpdateEntry ( ) ) ) ; }


Input: Update an existing Flow Step Exit rule . [CODESPLIT] public FlowStepRule updateFlowStepExitRule ( FlowStepRule flowStepRuleParam ) { if ( flowStepRuleParam != null && this . serviceTicket != null ) { flowStepRuleParam . setServiceTicket ( this . serviceTicket ) ; } return new FlowStepRule ( this . postJson ( flowStepRuleParam , WS . Path . FlowStepRule . Version1 . flowStepRuleUpdateExit ( ) ) ) ; }


Input: Update an existing Flow Step View rule . [CODESPLIT] public FlowStepRule updateFlowStepViewRule ( FlowStepRule flowStepRuleParam ) { if ( flowStepRuleParam != null && this . serviceTicket != null ) { flowStepRuleParam . setServiceTicket ( this . serviceTicket ) ; } return new FlowStepRule ( this . postJson ( flowStepRuleParam , WS . Path . FlowStepRule . Version1 . flowStepRuleUpdateView ( ) ) ) ; }


Input: Compiles the { @code viewRuleSyntaxParam } text within the Fluid workflow engine . [CODESPLIT] public FlowStepRule compileFlowStepViewRule ( String viewRuleSyntaxParam ) { FlowStepRule flowStepRule = new FlowStepRule ( ) ; flowStepRule . setRule ( viewRuleSyntaxParam ) ; if ( this . serviceTicket != null ) { flowStepRule . setServiceTicket ( this . serviceTicket ) ; } return new FlowStepRule ( this . postJson ( flowStepRule , WS . Path . FlowStepRule . Version1 . compileViewSyntax ( ) ) ) ; }


Input: Retrieves the exit rules by step { @code flowStepParam } . Name or id can be provided . [CODESPLIT] public FlowStepRuleListing getExitRulesByStep ( FlowStep flowStepParam ) { if ( flowStepParam == null ) { return null ; } if ( this . serviceTicket != null ) { flowStepParam . setServiceTicket ( this . serviceTicket ) ; } return new FlowStepRuleListing ( this . postJson ( flowStepParam , WS . Path . FlowStepRule . Version1 . getExitRulesByStep ( ) ) ) ; }


Input: Compiles and Executes the { @code viewRuleSyntaxParam } text within the Fluid workflow engine . [CODESPLIT] public FlowItemExecuteResult compileFlowStepViewRuleAndExecute ( String viewRuleSyntaxParam , FluidItem fluidItemToExecuteOnParam ) { FlowStepRule flowStepRule = new FlowStepRule ( ) ; flowStepRule . setRule ( viewRuleSyntaxParam ) ; FlowItemExecutePacket toPost = new FlowItemExecutePacket ( ) ; if ( this . serviceTicket != null ) { toPost . setServiceTicket ( this . serviceTicket ) ; } toPost . setFlowStepRule ( flowStepRule ) ; toPost . setFluidItem ( fluidItemToExecuteOnParam ) ; return new FlowItemExecuteResult ( this . postJson ( toPost , WS . Path . FlowStepRule . Version1 . compileViewSyntaxAndExecute ( ) ) ) ; }


Input: Compiles the { @code entryRuleSyntaxParam } text within the Fluid workflow engine . [CODESPLIT] public FlowStepRule compileFlowStepEntryRule ( String entryRuleSyntaxParam ) { FlowStepRule flowStepRule = new FlowStepRule ( ) ; flowStepRule . setRule ( entryRuleSyntaxParam ) ; if ( this . serviceTicket != null ) { flowStepRule . setServiceTicket ( this . serviceTicket ) ; } return new FlowStepRule ( this . postJson ( flowStepRule , WS . Path . FlowStepRule . Version1 . compileEntrySyntax ( ) ) ) ; }


Input: Compiles and Executes the { @code entryRuleSyntaxParam } text within the Fluid workflow engine . [CODESPLIT] public FlowItemExecuteResult compileFlowStepEntryRuleAndExecute ( String entryRuleSyntaxParam , FluidItem fluidItemToExecuteOnParam ) { FlowStepRule flowStepRule = new FlowStepRule ( ) ; flowStepRule . setRule ( entryRuleSyntaxParam ) ; FlowItemExecutePacket toPost = new FlowItemExecutePacket ( ) ; if ( this . serviceTicket != null ) { toPost . setServiceTicket ( this . serviceTicket ) ; } toPost . setFlowStepRule ( flowStepRule ) ; toPost . setFluidItem ( fluidItemToExecuteOnParam ) ; return new FlowItemExecuteResult ( this . postJson ( toPost , WS . Path . FlowStepRule . Version1 . compileEntrySyntaxAndExecute ( ) ) ) ; }


Input: Moves an entry rule order one up from the current location . [CODESPLIT] public FlowStepRule moveFlowStepEntryRuleUp ( FlowStepRule flowStepRuleParam ) { if ( flowStepRuleParam != null && this . serviceTicket != null ) { flowStepRuleParam . setServiceTicket ( this . serviceTicket ) ; } return new FlowStepRule ( this . postJson ( flowStepRuleParam , WS . Path . FlowStepRule . Version1 . flowStepRuleMoveEntryUp ( ) ) ) ; }


Input: Moves an entry rule order one down from the current location . [CODESPLIT] public FlowStepRule moveFlowStepEntryRuleDown ( FlowStepRule flowStepRuleParam ) { if ( flowStepRuleParam != null && this . serviceTicket != null ) { flowStepRuleParam . setServiceTicket ( this . serviceTicket ) ; } return new FlowStepRule ( this . postJson ( flowStepRuleParam , WS . Path . FlowStepRule . Version1 . flowStepRuleMoveEntryDown ( ) ) ) ; }


Input: Deletes an Step Entry rule . [CODESPLIT] public FlowStepRule deleteFlowStepEntryRule ( FlowStepRule flowStepRuleParam ) { if ( flowStepRuleParam != null && this . serviceTicket != null ) { flowStepRuleParam . setServiceTicket ( this . serviceTicket ) ; } return new FlowStepRule ( this . postJson ( flowStepRuleParam , WS . Path . FlowStepRule . Version1 . flowStepRuleDeleteEntry ( ) ) ) ; }


Input: Deletes an Step Exit rule . [CODESPLIT] public FlowStep deleteFlowStepExitRule ( FlowStepRule flowStepRuleParam ) { if ( flowStepRuleParam != null && this . serviceTicket != null ) { flowStepRuleParam . setServiceTicket ( this . serviceTicket ) ; } return new FlowStep ( this . postJson ( flowStepRuleParam , WS . Path . FlowStepRule . Version1 . flowStepRuleDeleteExit ( ) ) ) ; }


Input: Deletes an Step View rule . [CODESPLIT] public FlowStep deleteFlowStepViewRule ( FlowStepRule flowStepRuleParam ) { if ( flowStepRuleParam != null && this . serviceTicket != null ) { flowStepRuleParam . setServiceTicket ( this . serviceTicket ) ; } return new FlowStep ( this . postJson ( flowStepRuleParam , WS . Path . FlowStepRule . Version1 . flowStepRuleDeleteView ( ) ) ) ; }


Input: Retrieves the next valid syntax rules for { @code inputRuleParam } . [CODESPLIT] public List < String > getNextValidSyntaxWordsEntryRule ( String inputRuleParam ) { if ( inputRuleParam == null ) { inputRuleParam = UtilGlobal . EMPTY ; } FlowStepRule flowStepRule = new FlowStepRule ( ) ; flowStepRule . setRule ( inputRuleParam ) ; if ( this . serviceTicket != null ) { flowStepRule . setServiceTicket ( this . serviceTicket ) ; } FlowStepRule returnedObj = new FlowStepRule ( this . postJson ( flowStepRule , WS . Path . FlowStepRule . Version1 . getNextValidEntrySyntax ( ) ) ) ; return returnedObj . getNextValidSyntaxWords ( ) ; }


Input: Performs the necessary login actions against Fluid . [CODESPLIT] public AppRequestToken login ( String usernameParam , String passwordParam ) { //Default login is for 9 hours. return this . login ( usernameParam , passwordParam , TimeUnit . HOURS . toSeconds ( 9 ) ) ; }


Input: Performs the necessary login actions against Fluid . [CODESPLIT] public AppRequestToken login ( String usernameParam , String passwordParam , Long sessionLifespanSecondsParam ) { if ( this . isEmpty ( usernameParam ) || this . isEmpty ( passwordParam ) ) { throw new FluidClientException ( "Username and Password required." , FluidClientException . ErrorCode . FIELD_VALIDATE ) ; } AuthRequest authRequest = new AuthRequest ( ) ; authRequest . setUsername ( usernameParam ) ; authRequest . setLifetime ( sessionLifespanSecondsParam ) ; //Init the session... //Init the session to get the salt... AuthResponse authResponse ; try { authResponse = new AuthResponse ( this . postJson ( true , authRequest , WS . Path . User . Version1 . userInitSession ( ) ) ) ; } //JSON format problem... catch ( JSONException jsonException ) { throw new FluidClientException ( jsonException . getMessage ( ) , jsonException , FluidClientException . ErrorCode . JSON_PARSING ) ; } AuthEncryptedData authEncData = this . initializeSession ( passwordParam , authResponse ) ; //Issue the token... AppRequestToken appReqToken = this . issueAppRequestToken ( authResponse . getServiceTicketBase64 ( ) , usernameParam , authEncData ) ; appReqToken . setRoleString ( authEncData . getRoleListing ( ) ) ; appReqToken . setSalt ( authResponse . getSalt ( ) ) ; return appReqToken ; }


Input: Performs HMAC and encryption to initialize the session . [CODESPLIT] private AuthEncryptedData initializeSession ( String passwordParam , AuthResponse authResponseParam ) { //IV... byte [ ] ivBytes = UtilGlobal . decodeBase64 ( authResponseParam . getIvBase64 ( ) ) ; //Seed... byte [ ] seedBytes = UtilGlobal . decodeBase64 ( authResponseParam . getSeedBase64 ( ) ) ; //Encrypted Data... byte [ ] encryptedData = UtilGlobal . decodeBase64 ( authResponseParam . getEncryptedDataBase64 ( ) ) ; //HMac from Response... byte [ ] hMacFromResponse = UtilGlobal . decodeBase64 ( authResponseParam . getEncryptedDataHmacBase64 ( ) ) ; //Local HMac... byte [ ] localGeneratedHMac = AES256Local . generateLocalHMAC ( encryptedData , passwordParam , authResponseParam . getSalt ( ) , seedBytes ) ; //Password mismatch... if ( ! Arrays . equals ( hMacFromResponse , localGeneratedHMac ) ) { throw new FluidClientException ( "Login attempt failure." , FluidClientException . ErrorCode . LOGIN_FAILURE ) ; } //Decrypted Initialization Data... byte [ ] decryptedEncryptedData = AES256Local . decryptInitPacket ( encryptedData , passwordParam , authResponseParam . getSalt ( ) , ivBytes , seedBytes ) ; try { JSONObject jsonObj = new JSONObject ( new String ( decryptedEncryptedData ) ) ; return new AuthEncryptedData ( jsonObj ) ; } catch ( JSONException jsonExcept ) { throw new FluidClientException ( jsonExcept . getMessage ( ) , FluidClientException . ErrorCode . JSON_PARSING ) ; } }


Input: Issue a new { @code AppRequestToken } from provided params . [CODESPLIT] private AppRequestToken issueAppRequestToken ( String serviceTicketBase64Param , String usernameParam , AuthEncryptedData authEncryptDataParam ) { byte [ ] iv = AES256Local . generateRandom ( AES256Local . IV_SIZE_BYTES ) ; byte [ ] seed = AES256Local . generateRandom ( AES256Local . SEED_SIZE_BYTES ) ; byte [ ] sessionKey = UtilGlobal . decodeBase64 ( authEncryptDataParam . getSessionKeyBase64 ( ) ) ; byte [ ] dataToEncrypt = usernameParam . getBytes ( ) ; byte [ ] encryptedData = AES256Local . encrypt ( sessionKey , dataToEncrypt , iv ) ; byte [ ] encryptedDataHMac = AES256Local . generateLocalHMACForReqToken ( encryptedData , sessionKey , seed ) ; AppRequestToken requestToServer = new AppRequestToken ( ) ; requestToServer . setEncryptedDataBase64 ( UtilGlobal . encodeBase64 ( encryptedData ) ) ; requestToServer . setEncryptedDataHmacBase64 ( UtilGlobal . encodeBase64 ( encryptedDataHMac ) ) ; requestToServer . setIvBase64 ( UtilGlobal . encodeBase64 ( iv ) ) ; requestToServer . setSeedBase64 ( UtilGlobal . encodeBase64 ( seed ) ) ; requestToServer . setServiceTicket ( serviceTicketBase64Param ) ; try { return new AppRequestToken ( this . postJson ( requestToServer , WS . Path . User . Version1 . userIssueToken ( ) ) ) ; } // catch ( JSONException jsonExcept ) { throw new FluidClientException ( jsonExcept . getMessage ( ) , jsonExcept , FluidClientException . ErrorCode . JSON_PARSING ) ; } }


Input: Conversion to { @code JSONObject } from Java Object . [CODESPLIT] @ Override public JSONObject toJsonObject ( ) throws JSONException { JSONObject returnVal = super . toJsonObject ( ) ; //Fluid Item... if ( this . getFluidItem ( ) != null ) { returnVal . put ( JSONMapping . FLUID_ITEM , this . getFluidItem ( ) . toJsonObject ( ) ) ; } //Flow Step Rule... if ( this . getFlowStepRule ( ) != null ) { returnVal . put ( JSONMapping . FLOW_STEP_RULE , this . getFlowStepRule ( ) . toJsonObject ( ) ) ; } //Assignment Rule... if ( this . getAssignmentRuleValue ( ) != null ) { returnVal . put ( JSONMapping . ASSIGNMENT_RULE_VALUE , this . getAssignmentRuleValue ( ) ) ; } //Statement Result as String... if ( this . getStatementResultAsString ( ) != null ) { returnVal . put ( JSONMapping . STATEMENT_RESULT_AS_STRING , this . getStatementResultAsString ( ) ) ; } //Execute per Fluid Item Query... if ( this . getExecutePerFluidItemQuery ( ) != null ) { returnVal . put ( JSONMapping . EXECUTE_PER_FLUID_ITEM_QUERY , this . getExecutePerFluidItemQuery ( ) ) ; } //Fluid Item Query... if ( this . getFluidItemQuery ( ) != null ) { returnVal . put ( JSONMapping . FLUID_ITEM_QUERY , this . getFluidItemQuery ( ) ) ; } //Execution Result... if ( this . getExecutionResult ( ) != null ) { returnVal . put ( JSONMapping . EXECUTION_RESULT , this . getExecutionResult ( ) ) ; } //Progress to next phase... if ( this . getProgressToNextPhase ( ) != null ) { returnVal . put ( JSONMapping . PROGRESS_TO_NEXT_PHASE , this . getProgressToNextPhase ( ) ) ; } //Fluid Items... if ( this . getFluidItems ( ) != null && ! this . getFluidItems ( ) . isEmpty ( ) ) { JSONArray jsonArray = new JSONArray ( ) ; for ( FluidItem item : this . getFluidItems ( ) ) { jsonArray . put ( item . toJsonObject ( ) ) ; } returnVal . put ( JSONMapping . FLUID_ITEMS , jsonArray ) ; } //Execute Users... if ( this . getExecuteUsers ( ) != null && ! this . getExecuteUsers ( ) . isEmpty ( ) ) { JSONArray jsonArray = new JSONArray ( ) ; for ( User item : this . getExecuteUsers ( ) ) { jsonArray . put ( item . toJsonObject ( ) ) ; } returnVal . put ( JSONMapping . EXECUTE_USERS , jsonArray ) ; } //Mail Messages To Send... if ( this . getMailMessagesToSend ( ) != null && ! this . getMailMessagesToSend ( ) . isEmpty ( ) ) { JSONArray jsonArray = new JSONArray ( ) ; for ( MailMessage item : this . getMailMessagesToSend ( ) ) { jsonArray . put ( item . toJsonObject ( ) ) ; } returnVal . put ( JSONMapping . MAIL_MESSAGES_TO_SEND , jsonArray ) ; } return returnVal ; }


Input: Conversion to { @code JSONObject } from Java Object . [CODESPLIT] @ Override public JSONObject toJsonObject ( ) throws JSONException { JSONObject returnVal = super . toJsonObject ( ) ; //Available... if ( this . getAvailableMultiChoices ( ) != null ) { List < String > availChoices = this . getAvailableMultiChoices ( ) ; returnVal . put ( JSONMapping . AVAILABLE_MULTI_CHOICES , new JSONArray ( availChoices . toArray ( ) ) ) ; returnVal . put ( JSONMapping . AVAILABLE_CHOICES , new JSONArray ( availChoices . toArray ( ) ) ) ; returnVal . put ( JSONMapping . AVAILABLE_CHOICES_COMBINED , this . combineStringArrayWith ( availChoices , UtilGlobal . PIPE ) ) ; } //Selected... if ( this . getSelectedMultiChoices ( ) != null ) { List < String > selectChoices = this . getSelectedMultiChoices ( ) ; returnVal . put ( JSONMapping . SELECTED_MULTI_CHOICES , new JSONArray ( selectChoices . toArray ( ) ) ) ; returnVal . put ( JSONMapping . SELECTED_CHOICES , new JSONArray ( selectChoices . toArray ( ) ) ) ; returnVal . put ( JSONMapping . SELECTED_CHOICES_COMBINED , this . combineStringArrayWith ( selectChoices , UtilGlobal . PIPE ) ) ; } return returnVal ; }


Input: Combine { @code listToCombineParam } into a single { @code String } . [CODESPLIT] @ XmlTransient public String combineStringArrayWith ( List < String > listToCombineParam , String separatorCharsParam ) { String returnValue = UtilGlobal . EMPTY ; int lengthOfSepChars = ( separatorCharsParam == null ) ? 0 : separatorCharsParam . length ( ) ; if ( listToCombineParam != null && ! listToCombineParam . isEmpty ( ) ) { StringBuffer concatBuffer = new StringBuffer ( ) ; for ( String toAdd : listToCombineParam ) { concatBuffer . append ( toAdd ) ; concatBuffer . append ( separatorCharsParam ) ; } String concatString = concatBuffer . toString ( ) ; returnValue = concatString . substring ( 0 , concatString . length ( ) - lengthOfSepChars ) ; } return returnValue ; }


Input: Creates a new { @code UserQuery } . [CODESPLIT] public UserQuery createUserQuery ( UserQuery userQueryParam ) { if ( userQueryParam != null && this . serviceTicket != null ) { userQueryParam . setServiceTicket ( this . serviceTicket ) ; } return new UserQuery ( this . putJson ( userQueryParam , WS . Path . UserQuery . Version1 . userQueryCreate ( ) ) ) ; }


Input: Updates an existing { @code UserQuery } . [CODESPLIT] public UserQuery updateUserQuery ( UserQuery userQueryParam ) { if ( userQueryParam != null && this . serviceTicket != null ) { userQueryParam . setServiceTicket ( this . serviceTicket ) ; } return new UserQuery ( this . postJson ( userQueryParam , WS . Path . UserQuery . Version1 . userQueryUpdate ( ) ) ) ; }


Input: Deletes the { @code UserQuery } provided . Id must be set on the { @code UserQuery } . [CODESPLIT] public UserQuery deleteUserQuery ( UserQuery userQueryToDeleteParam ) { if ( userQueryToDeleteParam != null && this . serviceTicket != null ) { userQueryToDeleteParam . setServiceTicket ( this . serviceTicket ) ; } return new UserQuery ( this . postJson ( userQueryToDeleteParam , WS . Path . UserQuery . Version1 . userQueryDelete ( ) ) ) ; }


Input: Retrieves User Query information for the provided { @code userQueryIdParam } . [CODESPLIT] public UserQuery getUserQueryById ( Long userQueryIdParam ) { UserQuery userQueryToGetInfoFor = new UserQuery ( ) ; userQueryToGetInfoFor . setId ( userQueryIdParam ) ; if ( this . serviceTicket != null ) { userQueryToGetInfoFor . setServiceTicket ( this . serviceTicket ) ; } try { return new UserQuery ( this . postJson ( userQueryToGetInfoFor , WS . Path . UserQuery . Version1 . getById ( ) ) ) ; } catch ( JSONException jsonExcept ) { throw new FluidClientException ( jsonExcept . getMessage ( ) , FluidClientException . ErrorCode . JSON_PARSING ) ; } }


Input: Retrieves all user query information . [CODESPLIT] public UserQueryListing getAllUserQueries ( ) { UserQuery userQueryToGetInfoFor = new UserQuery ( ) ; if ( this . serviceTicket != null ) { userQueryToGetInfoFor . setServiceTicket ( this . serviceTicket ) ; } try { return new UserQueryListing ( this . postJson ( userQueryToGetInfoFor , WS . Path . UserQuery . Version1 . getAllUserQueries ( ) ) ) ; } // catch ( JSONException jsonExcept ) { throw new FluidClientException ( jsonExcept . getMessage ( ) , FluidClientException . ErrorCode . JSON_PARSING ) ; } }


Input: Executes the { @code UserQuery } { @code queryToExecuteParam } and returns the result information . [CODESPLIT] public FluidItemListing executeUserQuery ( UserQuery queryToExecuteParam , boolean populateAncestorIdParam , int queryLimitParam , int offsetParam ) { return this . executeUserQuery ( queryToExecuteParam , populateAncestorIdParam , queryLimitParam , offsetParam , false ) ; }


Input: Executes the { @code UserQuery } { @code queryToExecuteParam } and returns the result information . [CODESPLIT] public FluidItemListing executeUserQuery ( UserQuery queryToExecuteParam , boolean populateAncestorIdParam , int queryLimitParam , int offsetParam , boolean forceUseDatabaseParam ) { if ( this . serviceTicket != null && queryToExecuteParam != null ) { queryToExecuteParam . setServiceTicket ( this . serviceTicket ) ; } try { return new FluidItemListing ( this . postJson ( queryToExecuteParam , WS . Path . UserQuery . Version1 . executeUserQuery ( populateAncestorIdParam , forceUseDatabaseParam , queryLimitParam , offsetParam ) ) ) ; } catch ( JSONException jsonExcept ) { //JSON Issue... throw new FluidClientException ( jsonExcept . getMessage ( ) , FluidClientException . ErrorCode . JSON_PARSING ) ; } }


Input: Retrieve the Form Field mappings for Electronic Form { @code electronicFormIdParam } . [CODESPLIT] public List < FormFieldMapping > getFormFieldMappingForForm ( Long electronicFormIdParam ) { List < FormFieldMapping > returnVal = new ArrayList ( ) ; if ( electronicFormIdParam == null ) { return returnVal ; } PreparedStatement preparedStatement = null ; ResultSet resultSet = null ; try { Long formDefinitionId = this . getFormDefinitionId ( electronicFormIdParam ) ; //Local Mapping... //When we have the key by definition, we can just return. if ( this . localDefinitionToFieldsMapping . containsKey ( formDefinitionId ) ) { return this . localDefinitionToFieldsMapping . get ( formDefinitionId ) ; } ISyntax syntax = SyntaxFactory . getInstance ( ) . getSyntaxFor ( this . getSQLTypeFromConnection ( ) , ISyntax . ProcedureMapping . Field . GetFormFieldsForFormContainer ) ; preparedStatement = this . getConnection ( ) . prepareStatement ( syntax . getPreparedStatement ( ) ) ; preparedStatement . setLong ( 1 , electronicFormIdParam ) ; resultSet = preparedStatement . executeQuery ( ) ; //Iterate each of the form containers... while ( resultSet . next ( ) ) { returnVal . add ( this . mapFormFieldMapping ( resultSet ) ) ; } //Cache the mapping... this . localDefinitionToFieldsMapping . put ( formDefinitionId , returnVal ) ; return returnVal ; } catch ( SQLException sqlError ) { throw new FluidSQLException ( sqlError ) ; } finally { this . closeStatement ( preparedStatement , resultSet ) ; } }


Input: Retrieve the Form Field mappings for Form Definition { @code electronicFormDefinitionIdParam } . [CODESPLIT] public List < FormFieldMapping > getFormFieldMappingForFormDefinition ( Long formDefinitionIdParam ) { List < FormFieldMapping > returnVal = new ArrayList ( ) ; if ( formDefinitionIdParam == null || formDefinitionIdParam . longValue ( ) < 1 ) { return returnVal ; } PreparedStatement preparedStatement = null ; ResultSet resultSet = null ; try { //Local Mapping... //When we have the key by definition, we can just return. if ( this . localDefinitionToFieldsMapping . containsKey ( formDefinitionIdParam ) ) { return this . localDefinitionToFieldsMapping . get ( formDefinitionIdParam ) ; } ISyntax syntax = SyntaxFactory . getInstance ( ) . getSyntaxFor ( this . getSQLTypeFromConnection ( ) , ISyntax . ProcedureMapping . Field . GetFormFieldsForFormDefinition ) ; preparedStatement = this . getConnection ( ) . prepareStatement ( syntax . getPreparedStatement ( ) ) ; preparedStatement . setLong ( 1 , formDefinitionIdParam ) ; resultSet = preparedStatement . executeQuery ( ) ; //Iterate each of the form containers... while ( resultSet . next ( ) ) { returnVal . add ( this . mapFormFieldMapping ( resultSet ) ) ; } this . localDefinitionToFieldsMapping . put ( formDefinitionIdParam , returnVal ) ; return returnVal ; } // catch ( SQLException sqlError ) { throw new FluidSQLException ( sqlError ) ; } // finally { this . closeStatement ( preparedStatement , resultSet ) ; } }


Input: Retrieves the Form Definition Id for the Electronic Form with id { @code electronicFormIdParam } . [CODESPLIT] public Long getFormDefinitionId ( Long electronicFormIdParam ) { if ( electronicFormIdParam == null ) { return null ; } PreparedStatement preparedStatement = null ; ResultSet resultSet ; try { ISyntax syntax = SyntaxFactory . getInstance ( ) . getSyntaxFor ( this . getSQLTypeFromConnection ( ) , ISyntax . ProcedureMapping . Field . GetFormDefinitionForFormContainer ) ; preparedStatement = this . getConnection ( ) . prepareStatement ( syntax . getPreparedStatement ( ) ) ; preparedStatement . setLong ( 1 , electronicFormIdParam ) ; resultSet = preparedStatement . executeQuery ( ) ; //Iterate each of the form containers... while ( resultSet . next ( ) ) { return resultSet . getLong ( 1 ) ; } return null ; } catch ( SQLException sqlError ) { throw new FluidSQLException ( sqlError ) ; } finally { this . closeStatement ( preparedStatement ) ; } }


Input: Retrieves the Form Fields { @code VALUES } for the Electronic Form with id { @code electronicFormIdParam } . [CODESPLIT] public List < Field > getFormFields ( Long electronicFormIdParam , boolean includeTableFieldsParam , boolean includeTableFieldFormRecordInfoParam ) { List < Field > returnVal = new ArrayList ( ) ; if ( electronicFormIdParam == null ) { return returnVal ; } List < FormFieldMapping > fieldMappings = this . getFormFieldMappingForForm ( electronicFormIdParam ) ; if ( fieldMappings == null || fieldMappings . isEmpty ( ) ) { return returnVal ; } //Get the values for each of the fields... for ( FormFieldMapping fieldMapping : fieldMappings ) { //Skip if ignore Table Fields... if ( ! includeTableFieldsParam && fieldMapping . dataType == UtilGlobal . FieldTypeId . _7_TABLE_FIELD ) { //Table Field... continue ; } Field fieldToAdd = this . getFormFieldValueFor ( fieldMapping , electronicFormIdParam , includeTableFieldFormRecordInfoParam ) ; if ( fieldToAdd == null ) { continue ; } //When table field... if ( includeTableFieldsParam && ( fieldToAdd . getFieldValue ( ) instanceof TableField ) ) { TableField tableField = ( TableField ) fieldToAdd . getFieldValue ( ) ; if ( tableField . getTableRecords ( ) != null && ! tableField . getTableRecords ( ) . isEmpty ( ) ) { for ( Form tableRecordForm : tableField . getTableRecords ( ) ) { tableRecordForm . setFormFields ( this . getFormFields ( tableRecordForm . getId ( ) , false , false ) ) ; } } } returnVal . add ( fieldToAdd ) ; } return returnVal ; }


Input: Retrieves the Form Field value for Electronic Form { @code formContainerIdParam } . [CODESPLIT] public Field getFormFieldValueFor ( FormFieldMapping formFieldMappingParam , Long formContainerIdParam , boolean includeTableFieldFormRecordInfoParam ) { if ( formFieldMappingParam == null ) { return null ; } //First attempt to fetch from the cache... if ( this . getCacheUtil ( ) != null ) { CacheUtil . CachedFieldValue cachedFieldValue = this . getCacheUtil ( ) . getCachedFieldValueFrom ( formFieldMappingParam . formDefinitionId , formContainerIdParam , formFieldMappingParam . formFieldId ) ; if ( cachedFieldValue != null ) { Field field = cachedFieldValue . getCachedFieldValueAsField ( ) ; if ( field != null ) { field . setFieldName ( formFieldMappingParam . name ) ; return field ; } } } //Now use a database lookup... Field returnVal = null ; PreparedStatement preparedStatement = null , preparedStatementForTblInfo = null ; ResultSet resultSet = null , resultSetForTblInfo = null ; try { ISyntax syntax = SyntaxFactory . getInstance ( ) . getFieldValueSyntaxFor ( this . getSQLTypeFromConnection ( ) , formFieldMappingParam ) ; if ( syntax != null ) { preparedStatement = this . getConnection ( ) . prepareStatement ( syntax . getPreparedStatement ( ) ) ; preparedStatement . setLong ( 1 , formFieldMappingParam . formDefinitionId ) ; preparedStatement . setLong ( 2 , formFieldMappingParam . formFieldId ) ; preparedStatement . setLong ( 3 , formContainerIdParam ) ; resultSet = preparedStatement . executeQuery ( ) ; } switch ( formFieldMappingParam . dataType . intValue ( ) ) { //Text... case UtilGlobal . FieldTypeId . _1_TEXT : if ( resultSet . next ( ) ) { returnVal = new Field ( formFieldMappingParam . name , resultSet . getString ( 1 ) , Field . Type . Text ) ; } break ; //True False... case UtilGlobal . FieldTypeId . _2_TRUE_FALSE : if ( resultSet . next ( ) ) { returnVal = new Field ( formFieldMappingParam . name , resultSet . getBoolean ( 1 ) , Field . Type . TrueFalse ) ; } break ; //Paragraph Text... case UtilGlobal . FieldTypeId . _3_PARAGRAPH_TEXT : if ( resultSet . next ( ) ) { returnVal = new Field ( formFieldMappingParam . name , resultSet . getString ( 1 ) , Field . Type . ParagraphText ) ; } break ; //Multiple Choice... case UtilGlobal . FieldTypeId . _4_MULTI_CHOICE : MultiChoice multiChoice = new MultiChoice ( ) ; List < String > selectedValues = new ArrayList ( ) ; while ( resultSet . next ( ) ) { selectedValues . add ( resultSet . getString ( 1 ) ) ; } multiChoice . setSelectedMultiChoices ( selectedValues ) ; if ( ! selectedValues . isEmpty ( ) ) { returnVal = new Field ( formFieldMappingParam . name , multiChoice ) ; } break ; //Date Time... case UtilGlobal . FieldTypeId . _5_DATE_TIME : if ( resultSet . next ( ) ) { returnVal = new Field ( formFieldMappingParam . name , resultSet . getDate ( 1 ) , Field . Type . DateTime ) ; } break ; //Decimal... case UtilGlobal . FieldTypeId . _6_DECIMAL : if ( resultSet . next ( ) ) { returnVal = new Field ( formFieldMappingParam . name , resultSet . getDouble ( 1 ) , Field . Type . Decimal ) ; } break ; //Table Field... case UtilGlobal . FieldTypeId . _7_TABLE_FIELD : List < Long > formContainerIds = new ArrayList ( ) ; while ( resultSet . next ( ) ) { formContainerIds . add ( resultSet . getLong ( 1 ) ) ; } //Break if empty... if ( formContainerIds . isEmpty ( ) ) { break ; } TableField tableField = new TableField ( ) ; final List < Form > formRecords = new ArrayList ( ) ; //Populate all the ids for forms... formContainerIds . forEach ( formContId -> { formRecords . add ( new Form ( formContId ) ) ; } ) ; //Retrieve the info for the table record... if ( includeTableFieldFormRecordInfoParam ) { ISyntax syntaxForFormContInfo = SyntaxFactory . getInstance ( ) . getSyntaxFor ( this . getSQLTypeFromConnection ( ) , ISyntax . ProcedureMapping . Form . GetFormContainerInfo ) ; preparedStatementForTblInfo = this . getConnection ( ) . prepareStatement ( syntaxForFormContInfo . getPreparedStatement ( ) ) ; for ( Form formRecordToSetInfoOn : formRecords ) { preparedStatementForTblInfo . setLong ( 1 , formRecordToSetInfoOn . getId ( ) ) ; resultSetForTblInfo = preparedStatementForTblInfo . executeQuery ( ) ; if ( resultSetForTblInfo . next ( ) ) { Long formTypeId = resultSetForTblInfo . getLong ( SQLFormUtil . SQLColumnIndex . _02_FORM_TYPE ) ; formRecordToSetInfoOn . setFormTypeId ( formTypeId ) ; formRecordToSetInfoOn . setFormType ( this . sqlFormDefinitionUtil == null ? null : this . sqlFormDefinitionUtil . getFormDefinitionIdAndTitle ( ) . get ( formTypeId ) ) ; formRecordToSetInfoOn . setTitle ( resultSetForTblInfo . getString ( SQLFormUtil . SQLColumnIndex . _03_TITLE ) ) ; Date created = resultSetForTblInfo . getDate ( SQLFormUtil . SQLColumnIndex . _04_CREATED ) ; Date lastUpdated = resultSetForTblInfo . getDate ( SQLFormUtil . SQLColumnIndex . _05_LAST_UPDATED ) ; //Created... if ( created != null ) { formRecordToSetInfoOn . setDateCreated ( new Date ( created . getTime ( ) ) ) ; } //Last Updated... if ( lastUpdated != null ) { formRecordToSetInfoOn . setDateLastUpdated ( new Date ( lastUpdated . getTime ( ) ) ) ; } } } } tableField . setTableRecords ( formRecords ) ; returnVal = new Field ( formFieldMappingParam . name , tableField , Field . Type . Table ) ; //TODO __8__ encrypted field... break ; //Label... case UtilGlobal . FieldTypeId . _9_LABEL : returnVal = new Field ( formFieldMappingParam . name , formFieldMappingParam . description , Field . Type . Label ) ; break ; default : throw new SQLException ( "Unable to map '" + formContainerIdParam . intValue ( ) + "', to Form Field value." ) ; } return returnVal ; } catch ( SQLException sqlError ) { throw new FluidSQLException ( sqlError ) ; } finally { this . closeStatement ( preparedStatement ) ; this . closeStatement ( preparedStatementForTblInfo ) ; } }


Input: Maps a { @code ResultSet } to a new instance of { @code FormFieldMapping } . [CODESPLIT] private FormFieldMapping mapFormFieldMapping ( ResultSet resultSetParam ) throws SQLException { return new FormFieldMapping ( resultSetParam . getLong ( 1 ) , resultSetParam . getLong ( 2 ) , resultSetParam . getLong ( 3 ) , resultSetParam . getString ( 4 ) , resultSetParam . getString ( 5 ) , resultSetParam . getString ( 6 ) ) ; }


Input: Creates a new { @code Role } with the privileges inside the { @code roleParam } . [CODESPLIT] public Role createRole ( Role roleParam ) { if ( roleParam != null && this . serviceTicket != null ) { roleParam . setServiceTicket ( this . serviceTicket ) ; } return new Role ( this . putJson ( roleParam , WS . Path . Role . Version1 . roleCreate ( ) ) ) ; }


Input: Updates an existing { @code Role } with the privileges inside the { @code roleParam } . [CODESPLIT] public Role updateRole ( Role roleParam ) { if ( roleParam != null && this . serviceTicket != null ) { roleParam . setServiceTicket ( this . serviceTicket ) ; } return new Role ( this . postJson ( roleParam , WS . Path . Role . Version1 . roleUpdate ( ) ) ) ; }


Input: Deletes the { @code Role } provided . Id must be set on the { @code Role } . [CODESPLIT] public Role deleteRole ( Role roleToDeleteParam ) { if ( roleToDeleteParam != null && this . serviceTicket != null ) { roleToDeleteParam . setServiceTicket ( this . serviceTicket ) ; } return new Role ( this . postJson ( roleToDeleteParam , WS . Path . Role . Version1 . roleDelete ( ) ) ) ; }


Input: Retrieves role information for the provided { @code roleIdParam } . [CODESPLIT] public Role getRoleById ( Long roleIdParam ) { Role roleToGetInfoFor = new Role ( ) ; roleToGetInfoFor . setId ( roleIdParam ) ; if ( this . serviceTicket != null ) { roleToGetInfoFor . setServiceTicket ( this . serviceTicket ) ; } try { return new Role ( this . postJson ( roleToGetInfoFor , WS . Path . Role . Version1 . getById ( ) ) ) ; } // catch ( JSONException jsonExcept ) { throw new FluidClientException ( jsonExcept . getMessage ( ) , FluidClientException . ErrorCode . JSON_PARSING ) ; } }


Input: Retrieves all role information . [CODESPLIT] public RoleListing getAllRoles ( ) { RoleListing roleToGetInfoFor = new RoleListing ( ) ; if ( this . serviceTicket != null ) { roleToGetInfoFor . setServiceTicket ( this . serviceTicket ) ; } try { return new RoleListing ( this . postJson ( roleToGetInfoFor , WS . Path . Role . Version1 . getAllRoles ( ) ) ) ; } // catch ( JSONException jsonExcept ) { throw new FluidClientException ( jsonExcept . getMessage ( ) , FluidClientException . ErrorCode . JSON_PARSING ) ; } }


Input: Conversion to { @code JSONObject } from Java Object . [CODESPLIT] @ Override public JSONObject toJsonObject ( ) throws JSONException { JSONObject returnVal = super . toJsonObject ( ) ; //Attachment Path... if ( this . getAttachmentPath ( ) != null ) { returnVal . put ( JSONMapping . ATTACHMENT_PATH , this . getAttachmentPath ( ) ) ; } //Attachment Data Base64... if ( this . getAttachmentDataBase64 ( ) != null ) { returnVal . put ( JSONMapping . ATTACHMENT_DATA_BASE64 , this . getAttachmentDataBase64 ( ) ) ; } return returnVal ; }


Input: Executes the { @code commandParams } and returns the result . [CODESPLIT] public CommandResult executeCommand ( String ... commandParams ) throws IOException { if ( commandParams == null || commandParams . length == 0 ) { throw new IOException ( "Unable to execute command. No commands provided." ) ; } List < String > returnedLines = new ArrayList ( ) ; Charset charset = Charset . forName ( ENCODING_UTF_8 ) ; try { Process process = null ; //One param... if ( commandParams . length == 1 ) { process = Runtime . getRuntime ( ) . exec ( commandParams [ 0 ] ) ; } //More params... else { process = Runtime . getRuntime ( ) . exec ( commandParams ) ; } BufferedReader reader = new BufferedReader ( new InputStreamReader ( process . getInputStream ( ) , charset ) ) ; String readLine = null ; while ( ( readLine = reader . readLine ( ) ) != null ) { returnedLines . add ( readLine ) ; } BufferedReader errorReader = new BufferedReader ( new InputStreamReader ( process . getErrorStream ( ) , charset ) ) ; while ( ( readLine = errorReader . readLine ( ) ) != null ) { returnedLines . add ( readLine ) ; } int exitValue = - 1000 ; try { exitValue = process . waitFor ( ) ; } catch ( InterruptedException e ) { String commandString = ( commandParams == null || commandParams . length == 0 ) ? "<unknown>" : commandParams [ 0 ] ; throw new IOException ( "Unable to wait for command [" + commandString + "] to exit. " + e . getMessage ( ) , e ) ; } String [ ] rtnArr = { } ; return new CommandResult ( exitValue , returnedLines . toArray ( rtnArr ) ) ; } catch ( IOException ioExeption ) { //IO Problem... String commandString = ( commandParams == null || commandParams . length == 0 ) ? "<unknown>" : commandParams [ 0 ] ; throw new IOException ( "Unable to execute command/s [" + commandString + "]. " + ioExeption . getMessage ( ) , ioExeption ) ; } }


Input: Executes the { @code objectCommandParam } and returns the result . [CODESPLIT] public CommandResult executeCommand ( String objectCommandParam ) throws Exception { if ( objectCommandParam == null ) { return new CommandResult ( 333 , new String [ ] { "No Object Command provided. 'null' not allowed." } ) ; } return this . executeCommand ( new String [ ] { objectCommandParam } ) ; }


Input: Conversion to { @code JSONObject } from Java Object . [CODESPLIT] @ Override public JSONObject toJsonObject ( ) throws JSONException { JSONObject returnVal = super . toJsonObject ( ) ; //Access Token... if ( this . getAccessToken ( ) != null ) { returnVal . put ( JSONMapping . ACCESS_TOKEN , this . getAccessToken ( ) ) ; } //Id Token... if ( this . getIdToken ( ) != null ) { returnVal . put ( JSONMapping . ID_TOKEN , this . getIdToken ( ) ) ; } //Token Type... if ( this . getTokenType ( ) != null ) { returnVal . put ( JSONMapping . TOKEN_TYPE , this . getTokenType ( ) ) ; } return returnVal ; }


Input: Conversion to { @code JSONObject } from Java Object . [CODESPLIT] @ Override public JSONObject toJsonObject ( ) throws JSONException { JSONObject returnVal = super . toJsonObject ( ) ; //Date... if ( this . getDate ( ) != null ) { returnVal . put ( JSONMapping . DATE , this . getDateAsLongFromJson ( this . getDate ( ) ) ) ; } //Date and Time Field Name... if ( this . getDateAndFieldName ( ) != null ) { returnVal . put ( JSONMapping . DATE_AND_FIELD_NAME , this . getDateAndFieldName ( ) ) ; } //Form Container Field Values JSON... if ( this . getFormContainerFieldValuesJSON ( ) != null ) { returnVal . put ( JSONMapping . FORM_CONTAINER_FIELD_VALUES_JSON , this . getFormContainerFieldValuesJSON ( ) ) ; } //Log Entry Type... if ( this . getLogEntryType ( ) != null ) { returnVal . put ( JSONMapping . LOG_ENTRY_TYPE , this . getLogEntryType ( ) ) ; } //Description... if ( this . getDescription ( ) != null ) { returnVal . put ( JSONMapping . DESCRIPTION , this . getDescription ( ) ) ; } //Historic Entry Type... if ( this . getHistoricEntryType ( ) != null ) { returnVal . put ( JSONMapping . HISTORIC_ENTRY_TYPE , this . getHistoricEntryType ( ) ) ; } //User... if ( this . getUser ( ) != null ) { returnVal . put ( JSONMapping . USER , this . getUser ( ) . toJsonObject ( ) ) ; } //Field... if ( this . getField ( ) != null ) { returnVal . put ( JSONMapping . FIELD , this . getField ( ) . toJsonObject ( ) ) ; } //Different from Previous... if ( this . getIsFieldDifferentFromPrevious ( ) != null ) { returnVal . put ( JSONMapping . IS_FIELD_DIFFERENT_FROM_PREVIOUS , this . getIsFieldDifferentFromPrevious ( ) ) ; } //Field type Signature... if ( this . getIsFieldTypeSignature ( ) != null ) { returnVal . put ( JSONMapping . IS_FIELD_TYPE_SIGNATURE , this . getIsFieldTypeSignature ( ) ) ; } //Escape Text... if ( this . getIsEscapeText ( ) != null ) { returnVal . put ( JSONMapping . IS_ESCAPE_TEXT , this . getIsEscapeText ( ) ) ; } return returnVal ; }


Input: Conversion to { @code JSONObject } from Java Object . [CODESPLIT] @ Override public JSONObject toJsonObject ( ) throws JSONException { JSONObject returnVal = super . toJsonObject ( ) ; //Can Create... if ( this . isCanCreate ( ) != null ) { returnVal . put ( JSONMapping . CAN_CREATE , this . isCanCreate ( ) . booleanValue ( ) ) ; } //Attachment can View... if ( this . isAttachmentsView ( ) != null ) { returnVal . put ( JSONMapping . ATTACHMENTS_VIEW , this . isAttachmentsView ( ) . booleanValue ( ) ) ; } //Attachment can Create or Modify... if ( this . isAttachmentsCreateUpdate ( ) != null ) { returnVal . put ( JSONMapping . ATTACHMENTS_CREATE_UPDATE , this . isAttachmentsCreateUpdate ( ) . booleanValue ( ) ) ; } //Form Definition... if ( this . getFormDefinition ( ) != null ) { returnVal . put ( JSONMapping . FORM_DEFINITION , this . getFormDefinition ( ) . toJsonObject ( ) ) ; } return returnVal ; }


Input: <p > Returns the value of the { @code fieldNameParam } requested . [CODESPLIT] @ XmlTransient public Object getFieldValueForField ( String fieldNameParam ) { Field fieldWithName = this . getField ( fieldNameParam ) ; return ( fieldWithName == null ) ? null : fieldWithName . getFieldValue ( ) ; }


Input: <p > Returns the value of the { @code fieldNameParam } requested . [CODESPLIT] @ XmlTransient public String getFieldValueAsString ( String fieldNameParam ) { Field fieldWithName = this . getField ( fieldNameParam ) ; return ( fieldWithName == null ) ? null : fieldWithName . getFieldValueAsString ( ) ; }


Input: <p > Returns the value of the { @code fieldNameParam } requested . [CODESPLIT] @ XmlTransient public TableField getFieldValueAsTableField ( String fieldNameParam ) { Field fieldWithName = this . getField ( fieldNameParam ) ; return ( fieldWithName == null ) ? null : fieldWithName . getFieldValueAsTableField ( ) ; }


Input: <p > Returns the value of the { @code fieldNameParam } requested . [CODESPLIT] @ XmlTransient public MultiChoice getFieldValueAsMultiChoice ( String fieldNameParam ) { Field fieldWithName = this . getField ( fieldNameParam ) ; return ( fieldWithName == null ) ? null : fieldWithName . getFieldValueAsMultiChoice ( ) ; }


Input: <p > Returns the value of the { @code fieldNameParam } requested . [CODESPLIT] @ XmlTransient public Date getFieldValueAsDate ( String fieldNameParam ) { Field fieldWithName = this . getField ( fieldNameParam ) ; return ( fieldWithName == null ) ? null : fieldWithName . getFieldValueAsDate ( ) ; }


Input: <p > Returns the value of the { @code fieldNameParam } requested . [CODESPLIT] @ XmlTransient public Boolean getFieldValueAsBoolean ( String fieldNameParam ) { Field fieldWithName = this . getField ( fieldNameParam ) ; return ( fieldWithName == null ) ? null : fieldWithName . getFieldValueAsBoolean ( ) ; }


Input: <p > Returns the value of the { @code fieldNameParam } requested . [CODESPLIT] @ XmlTransient public Double getFieldValueAsDouble ( String fieldNameParam ) { Field fieldWithName = this . getField ( fieldNameParam ) ; return ( fieldWithName == null ) ? null : fieldWithName . getFieldValueAsDouble ( ) ; }


Input: <p > Returns the value of the { @code fieldNameParam } requested . [CODESPLIT] @ XmlTransient public Integer getFieldValueAsInt ( String fieldNameParam ) { Field fieldWithName = this . getField ( fieldNameParam ) ; return ( fieldWithName == null ) ? null : fieldWithName . getFieldValueAsInteger ( ) ; }


Input: <p > Returns the value of the { @code fieldNameParam } requested . [CODESPLIT] @ XmlTransient public Long getFieldValueAsLong ( String fieldNameParam ) { Field fieldWithName = this . getField ( fieldNameParam ) ; return ( fieldWithName == null ) ? null : fieldWithName . getFieldValueAsLong ( ) ; }


Input: <p > Returns the value of the { @code fieldNameParam } requested . [CODESPLIT] @ XmlTransient public Number getFieldValueAsNumber ( String fieldNameParam ) { Field fieldWithName = this . getField ( fieldNameParam ) ; return ( fieldWithName == null ) ? null : fieldWithName . getFieldValueAsNumber ( ) ; }


Input: <p > Sets the value of the { @code fieldNameParam } requested . <p > If there is an existing value the value will be override with the value of { @code fieldValueParam } . [CODESPLIT] @ XmlTransient public void setFieldValue ( String fieldNameParam , Object fieldValueParam ) { if ( fieldNameParam == null || fieldNameParam . trim ( ) . length ( ) == 0 ) { return ; } if ( this . getFormFields ( ) == null || this . getFormFields ( ) . isEmpty ( ) ) { this . setFormFields ( new ArrayList ( ) ) ; } String fieldNameParamLower = fieldNameParam . toLowerCase ( ) ; for ( Iterator < Field > fieldIter = this . getFormFields ( ) . iterator ( ) ; fieldIter . hasNext ( ) ; ) { Field field = fieldIter . next ( ) ; if ( field . getFieldName ( ) == null || field . getFieldName ( ) . trim ( ) . length ( ) == 0 ) { continue ; } String fieldNameLower = field . getFieldName ( ) . toLowerCase ( ) ; if ( fieldNameParamLower . equals ( fieldNameLower ) ) { field . setFieldValue ( fieldValueParam ) ; return ; } } //When the Field is not added previously... this . getFormFields ( ) . add ( new Field ( fieldNameParam , fieldValueParam ) ) ; }


Input: <p > Sets the value of the { @code fieldNameParam } requested . [CODESPLIT] @ XmlTransient public void setFieldValue ( String fieldNameParam , Object fieldValueParam , Field . Type typeParam ) { if ( fieldNameParam == null ) { return ; } if ( this . getFormFields ( ) == null || this . getFormFields ( ) . isEmpty ( ) ) { this . setFormFields ( new ArrayList ( ) ) ; } String paramLower = fieldNameParam . toLowerCase ( ) . trim ( ) ; boolean valueFound = false ; //Iterate the Form Fields... int fieldIndex = 0 ; for ( Iterator < Field > fieldIter = this . getFormFields ( ) . iterator ( ) ; fieldIter . hasNext ( ) ; fieldIndex ++ ) { Field field = fieldIter . next ( ) ; String toCheckNameLower = field . getFieldName ( ) ; if ( toCheckNameLower == null || toCheckNameLower . trim ( ) . isEmpty ( ) ) { continue ; } toCheckNameLower = toCheckNameLower . trim ( ) . toLowerCase ( ) ; if ( paramLower . equals ( toCheckNameLower ) ) { valueFound = true ; this . getFormFields ( ) . get ( fieldIndex ) . setFieldValue ( fieldValueParam ) ; this . getFormFields ( ) . get ( fieldIndex ) . setTypeAsEnum ( typeParam ) ; break ; } } //Add the value if it wasn't found by name... if ( ! valueFound ) { this . getFormFields ( ) . add ( new Field ( fieldNameParam , fieldValueParam , typeParam ) ) ; } }


Input: <p > Determine whether the current { @code Form } Type / Definition is of type { @code formTypeParam } [CODESPLIT] @ XmlTransient public boolean isFormType ( String formTypeParam ) { if ( ( formTypeParam == null || formTypeParam . trim ( ) . isEmpty ( ) ) || ( this . getFormType ( ) == null || this . getFormType ( ) . trim ( ) . isEmpty ( ) ) ) { return false ; } return formTypeParam . toLowerCase ( ) . equals ( getFormType ( ) . toLowerCase ( ) ) ; }


Input: Conversion to { @code JSONObject } from Java Object . [CODESPLIT] @ Override @ XmlTransient public JSONObject toJsonObject ( ) throws JSONException { JSONObject returnVal = super . toJsonObject ( ) ; //Form Type... if ( this . getFormType ( ) != null ) { returnVal . put ( JSONMapping . FORM_TYPE , this . getFormType ( ) ) ; } //Form Type Id... if ( this . getFormTypeId ( ) != null ) { returnVal . put ( JSONMapping . FORM_TYPE_ID , this . getFormTypeId ( ) ) ; } //Title... if ( this . getTitle ( ) != null ) { returnVal . put ( JSONMapping . TITLE , this . getTitle ( ) ) ; } //Form Description... if ( this . getFormDescription ( ) != null ) { returnVal . put ( JSONMapping . FORM_DESCRIPTION , this . getFormDescription ( ) ) ; } //Ancestor Label... if ( this . getAncestorLabel ( ) != null ) { returnVal . put ( JSONMapping . ANCESTOR_LABEL , this . getAncestorLabel ( ) ) ; } //Descendant Label... if ( this . getDescendantsLabel ( ) != null ) { returnVal . put ( JSONMapping . DESCENDANTS_LABEL , this . getDescendantsLabel ( ) ) ; } //Number Inputs... if ( this . getNumberInputs ( ) != null ) { returnVal . put ( JSONMapping . NUMBER_INPUTS , this . getNumberInputs ( ) ) ; } //Date Created... if ( this . getDateCreated ( ) != null ) { returnVal . put ( JSONMapping . DATE_CREATED , this . getDateAsLongFromJson ( this . getDateCreated ( ) ) ) ; } //Date Last Updated... if ( this . getDateLastUpdated ( ) != null ) { returnVal . put ( JSONMapping . DATE_LAST_UPDATED , this . getDateAsLongFromJson ( this . getDateLastUpdated ( ) ) ) ; } //Current User... if ( this . getCurrentUser ( ) != null ) { returnVal . put ( JSONMapping . CURRENT_USER , this . getCurrentUser ( ) . toJsonObject ( ) ) ; } //State... if ( this . getState ( ) != null ) { returnVal . put ( JSONMapping . STATE , this . getState ( ) ) ; } //Flow State... if ( this . getFlowState ( ) != null ) { returnVal . put ( JSONMapping . FLOW_STATE , this . getFlowState ( ) ) ; } //Form Fields... if ( this . getFormFields ( ) != null && ! this . getFormFields ( ) . isEmpty ( ) ) { JSONArray formFieldsArr = new JSONArray ( ) ; for ( Field toAdd : this . getFormFields ( ) ) { formFieldsArr . put ( toAdd . toJsonObject ( ) ) ; } returnVal . put ( JSONMapping . FORM_FIELDS , formFieldsArr ) ; } //Associated Flows... if ( this . getAssociatedFlows ( ) != null && ! this . getAssociatedFlows ( ) . isEmpty ( ) ) { JSONArray assoJobsArr = new JSONArray ( ) ; for ( Flow toAdd : this . getAssociatedFlows ( ) ) { assoJobsArr . put ( toAdd . toJsonObject ( ) ) ; } returnVal . put ( JSONMapping . ASSOCIATED_FLOWS , assoJobsArr ) ; } //Ancestor... Long ancestorIdLcl = this . getAncestorId ( ) ; if ( ancestorIdLcl != null ) { returnVal . put ( JSONMapping . ANCESTOR_ID , ancestorIdLcl ) ; } //Table Field Parent Id... if ( this . getTableFieldParentId ( ) != null ) { returnVal . put ( JSONMapping . TABLE_FIELD_PARENT_ID , this . getTableFieldParentId ( ) ) ; } //Descendant Ids... if ( this . getDescendantIds ( ) != null && ! this . getDescendantIds ( ) . isEmpty ( ) ) { JSONArray array = new JSONArray ( ) ; for ( Long formId : this . getDescendantIds ( ) ) { array . put ( formId ) ; } returnVal . put ( JSONMapping . DESCENDANT_IDS , array ) ; } return returnVal ; }


Input: Creates the mapping object required by Elastic Search when making use of enhanced data - types . [CODESPLIT] @ Override @ XmlTransient public JSONObject toJsonMappingForElasticSearch ( ) throws JSONException { JSONObject returnVal = new JSONObject ( ) ; //Id... { JSONObject idJsonObj = new JSONObject ( ) ; idJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . LONG ) ; returnVal . put ( ABaseFluidJSONObject . JSONMapping . ID , idJsonObj ) ; } //Form Type... { JSONObject formTypeJsonObj = new JSONObject ( ) ; formTypeJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . KEYWORD ) ; returnVal . put ( JSONMapping . FORM_TYPE , formTypeJsonObj ) ; } //Form Type Id... { JSONObject formTypeIdJsonObj = new JSONObject ( ) ; formTypeIdJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . LONG ) ; returnVal . put ( JSONMapping . FORM_TYPE_ID , formTypeIdJsonObj ) ; } //Title... { JSONObject titleJsonObj = new JSONObject ( ) ; titleJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . TEXT ) ; returnVal . put ( JSONMapping . TITLE , titleJsonObj ) ; } //Form Description... { JSONObject formDescJsonObj = new JSONObject ( ) ; formDescJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . KEYWORD ) ; returnVal . put ( JSONMapping . FORM_DESCRIPTION , formDescJsonObj ) ; } //State... { JSONObject stateJsonObj = new JSONObject ( ) ; stateJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . KEYWORD ) ; returnVal . put ( JSONMapping . STATE , stateJsonObj ) ; } //Flow State... { JSONObject flowStateJsonObj = new JSONObject ( ) ; flowStateJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . KEYWORD ) ; returnVal . put ( JSONMapping . FLOW_STATE , flowStateJsonObj ) ; } //Current User... { JSONObject currentUserJsonObj = new JSONObject ( ) ; currentUserJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . OBJECT ) ; JSONObject properties = new JSONObject ( ) ; //Current User Id... JSONObject currentUserUserIdJsonObj = new JSONObject ( ) ; currentUserUserIdJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . LONG ) ; properties . put ( User . JSONMapping . Elastic . USER_ID , currentUserUserIdJsonObj ) ; //Current User Id... JSONObject currentUserUsernameJsonObj = new JSONObject ( ) ; currentUserUsernameJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . KEYWORD ) ; properties . put ( User . JSONMapping . USERNAME , currentUserUsernameJsonObj ) ; currentUserJsonObj . put ( ABaseFluidJSONObject . JSONMapping . Elastic . PROPERTIES , properties ) ; returnVal . put ( JSONMapping . CURRENT_USER , currentUserJsonObj ) ; } //Date Created... { JSONObject dateCreatedJsonObj = new JSONObject ( ) ; dateCreatedJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . DATE ) ; returnVal . put ( JSONMapping . DATE_CREATED , dateCreatedJsonObj ) ; } //Date Last Updated... { JSONObject dateLastUpdatedJsonObj = new JSONObject ( ) ; dateLastUpdatedJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . DATE ) ; returnVal . put ( JSONMapping . DATE_LAST_UPDATED , dateLastUpdatedJsonObj ) ; } //Get the listing of form fields... if ( this . getFormFields ( ) != null && ! this . getFormFields ( ) . isEmpty ( ) ) { for ( Field toAdd : this . getFormFields ( ) ) { JSONObject convertedField = toAdd . toJsonMappingForElasticSearch ( ) ; if ( convertedField == null ) { continue ; } String fieldNameAsCamel = toAdd . getFieldNameAsUpperCamel ( ) ; returnVal . put ( fieldNameAsCamel , convertedField ) ; } } //Ancestor Obj... { JSONObject ancestorJsonObj = new JSONObject ( ) ; ancestorJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . LONG ) ; returnVal . put ( JSONMapping . ANCESTOR_ID , ancestorJsonObj ) ; } //Table field parent id... { JSONObject tblFieldParentIdJsonObj = new JSONObject ( ) ; tblFieldParentIdJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . LONG ) ; returnVal . put ( JSONMapping . TABLE_FIELD_PARENT_ID , tblFieldParentIdJsonObj ) ; } return returnVal ; }


Input: Conversion to { @code JSONObject } for storage in ElasticCache for { @code Form } . [CODESPLIT] @ Override @ XmlTransient public JSONObject toJsonForElasticSearch ( ) throws JSONException { JSONObject returnVal = super . toJsonObject ( ) ; //Form Type... if ( this . getFormType ( ) != null ) { returnVal . put ( JSONMapping . FORM_TYPE , this . getFormType ( ) ) ; } //Form Type Id... if ( this . getFormTypeId ( ) != null ) { returnVal . put ( JSONMapping . FORM_TYPE_ID , this . getFormTypeId ( ) ) ; } //Title... if ( this . getTitle ( ) != null ) { returnVal . put ( JSONMapping . TITLE , this . getTitle ( ) ) ; } //Form Description... if ( this . getFormDescription ( ) != null ) { returnVal . put ( JSONMapping . FORM_DESCRIPTION , this . getFormDescription ( ) ) ; } //State... if ( this . getState ( ) != null ) { returnVal . put ( JSONMapping . STATE , this . getState ( ) ) ; } //Flow State... if ( this . getFlowState ( ) != null ) { returnVal . put ( JSONMapping . FLOW_STATE , this . getFlowState ( ) ) ; } //Current User... JSONObject currentUserJsonObj = new JSONObject ( ) ; if ( this . getCurrentUser ( ) == null ) { currentUserJsonObj . put ( User . JSONMapping . Elastic . USER_ID , JSONObject . NULL ) ; currentUserJsonObj . put ( User . JSONMapping . USERNAME , JSONObject . NULL ) ; } else { //Id... if ( this . getCurrentUser ( ) . getId ( ) == null || this . getCurrentUser ( ) . getId ( ) . longValue ( ) < 1 ) { currentUserJsonObj . put ( User . JSONMapping . Elastic . USER_ID , JSONObject . NULL ) ; } else { currentUserJsonObj . put ( User . JSONMapping . Elastic . USER_ID , this . getCurrentUser ( ) . getId ( ) ) ; } //Username... if ( this . getCurrentUser ( ) . getUsername ( ) == null || this . getCurrentUser ( ) . getUsername ( ) . trim ( ) . isEmpty ( ) ) { currentUserJsonObj . put ( User . JSONMapping . USERNAME , JSONObject . NULL ) ; } else { currentUserJsonObj . put ( User . JSONMapping . USERNAME , this . getCurrentUser ( ) . getUsername ( ) ) ; } } returnVal . put ( JSONMapping . CURRENT_USER , currentUserJsonObj ) ; //Date Created... if ( this . getDateCreated ( ) != null ) { returnVal . put ( JSONMapping . DATE_CREATED , this . getDateAsLongFromJson ( this . getDateCreated ( ) ) ) ; } //Date Last Updated... if ( this . getDateLastUpdated ( ) != null ) { returnVal . put ( JSONMapping . DATE_LAST_UPDATED , this . getDateAsLongFromJson ( this . getDateLastUpdated ( ) ) ) ; } //Form Fields... if ( this . getFormFields ( ) != null && ! this . getFormFields ( ) . isEmpty ( ) ) { for ( Field toAdd : this . getFormFields ( ) ) { JSONObject convertedFieldObj = toAdd . toJsonForElasticSearch ( ) ; if ( convertedFieldObj == null ) { continue ; } Iterator < String > iterKeys = convertedFieldObj . keys ( ) ; while ( iterKeys . hasNext ( ) ) { String key = iterKeys . next ( ) ; returnVal . put ( key , convertedFieldObj . get ( key ) ) ; } } } //Ancestor... Long ancestorIdLcl = this . getAncestorId ( ) ; if ( ancestorIdLcl != null ) { returnVal . put ( JSONMapping . ANCESTOR_ID , ancestorIdLcl ) ; } //Table Field Parent Id... if ( this . getTableFieldParentId ( ) != null ) { returnVal . put ( JSONMapping . TABLE_FIELD_PARENT_ID , this . getTableFieldParentId ( ) ) ; } //Descendant Ids... if ( this . getDescendantIds ( ) != null && ! this . getDescendantIds ( ) . isEmpty ( ) ) { JSONArray array = new JSONArray ( ) ; for ( Long formId : this . getDescendantIds ( ) ) { array . put ( formId ) ; } returnVal . put ( JSONMapping . DESCENDANT_IDS , array ) ; } return returnVal ; }


Input: Serialize { @code this } object into a JSONObject . [CODESPLIT] @ XmlTransient public JSONObject convertToFlatJSONObject ( ) { JSONObject returnVal = new JSONObject ( ) ; //Id... returnVal . put ( FlatFormJSONMapping . FORM_ID , this . getId ( ) == null ? JSONObject . NULL : this . getId ( ) ) ; //Title... returnVal . put ( FlatFormJSONMapping . FORM_TITLE , this . getTitle ( ) == null ? JSONObject . NULL : this . getTitle ( ) ) ; //Form Type... returnVal . put ( FlatFormJSONMapping . FORM_TYPE , this . getFormType ( ) == null ? JSONObject . NULL : this . getFormType ( ) ) ; //State... returnVal . put ( FlatFormJSONMapping . FORM_STATE , this . getState ( ) == null ? JSONObject . NULL : this . getState ( ) ) ; //Form Flow State... returnVal . put ( FlatFormJSONMapping . FORM_FLOW_STATE , this . getFlowState ( ) == null ? JSONObject . NULL : this . getFlowState ( ) ) ; //Date Created... returnVal . put ( FlatFormJSONMapping . FORM_DATE_CREATED , ( this . getDateCreated ( ) == null ) ? JSONObject . NULL : this . getDateCreated ( ) . getTime ( ) ) ; //Date Last Updated... returnVal . put ( FlatFormJSONMapping . FORM_DATE_LAST_UPDATED , ( this . getDateLastUpdated ( ) == null ) ? JSONObject . NULL : this . getDateLastUpdated ( ) . getTime ( ) ) ; //Form Fields... if ( this . getFormFields ( ) == null || this . getFormFields ( ) . isEmpty ( ) ) { return returnVal ; } //Set the form fields... UtilGlobal utilGlobal = new UtilGlobal ( ) ; this . getFormFields ( ) . forEach ( ( formFieldItem ) - > { utilGlobal . setFlatFieldOnJSONObj ( FlatFormJSONMapping . FORM_FIELD_PREFIX , FlatFormJSONMapping . FORM_FIELD_ID_PREFIX , formFieldItem , returnVal )  ; }


Input: Conversion to { @code JSONObject } from Java Object . [CODESPLIT] @ Override public JSONObject toJsonObject ( ) throws JSONException { JSONObject returnVal = super . toJsonObject ( ) ; //Mail Template... if ( this . getMailTemplate ( ) != null ) { returnVal . put ( JSONMapping . MAIL_TEMPLATE , this . getMailTemplate ( ) ) ; } //Mail SMTP Server... if ( this . getMailSMTPServer ( ) != null ) { returnVal . put ( JSONMapping . MAIL_SMTP_SERVER , this . getMailSMTPServer ( ) ) ; } //Recipients... if ( this . getRecipients ( ) != null && this . getRecipients ( ) . length > 0 ) { JSONArray jsonArray = new JSONArray ( ) ; for ( String item : this . getRecipients ( ) ) { jsonArray . put ( item ) ; } returnVal . put ( JSONMapping . RECIPIENTS , jsonArray ) ; } //Attachments... if ( this . getAttachments ( ) != null && ! this . getAttachments ( ) . isEmpty ( ) ) { JSONArray jsonArray = new JSONArray ( ) ; for ( MailMessageAttachment item : this . getAttachments ( ) ) { jsonArray . put ( item . toJsonObject ( ) ) ; } returnVal . put ( JSONMapping . ATTACHMENTS , jsonArray ) ; } //Name Values... if ( this . getNameValues ( ) != null && ! this . getNameValues ( ) . isEmpty ( ) ) { JSONArray jsonArray = new JSONArray ( ) ; for ( MailMessageNameValue item : this . getNameValues ( ) ) { jsonArray . put ( item . toJsonObject ( ) ) ; } returnVal . put ( JSONMapping . NAME_VALUES , jsonArray ) ; } return returnVal ; }


Input: Conversion to { @code JSONObject } from Java Object . [CODESPLIT] @ Override public JSONObject toJsonObject ( ) throws JSONException { JSONObject returnVal = new JSONObject ( ) ; returnVal . put ( JSONMapping . CLIENT , this . getPrincipalClient ( ) ) ; returnVal . put ( JSONMapping . SESSION_KEY , this . getSessionKeyBase64 ( ) ) ; returnVal . put ( JSONMapping . TICKET_EXPIRES , this . getTicketExpires ( ) ) ; returnVal . put ( JSONMapping . AUTHORISED_USERNAME , this . getAuthorisedUsername ( ) ) ; return returnVal ; }


Input: Sends the { @code formToSendToFlowParam } to a { @code Flow } in Fluid . The return value is the { @code FluidItem } created as a result . [CODESPLIT] public FluidItem sendToFlowSynchronized ( Form formToSendToFlowParam , String destinationFlowParam ) { if ( formToSendToFlowParam == null ) { return null ; } if ( destinationFlowParam == null || destinationFlowParam . trim ( ) . isEmpty ( ) ) { throw new FluidClientException ( "No destination Flow provided." , FluidClientException . ErrorCode . FIELD_VALIDATE ) ; } FluidItem itemToSend = new FluidItem ( ) ; itemToSend . setFlow ( destinationFlowParam ) ; itemToSend . setForm ( formToSendToFlowParam ) ; //Send all the messages... itemToSend . setEcho ( UUID . randomUUID ( ) . toString ( ) ) ; //Start a new request... String uniqueReqId = this . initNewRequest ( ) ; //Send the actual message... this . sendMessage ( itemToSend , uniqueReqId ) ; try { List < FluidItem > returnValue = this . getHandler ( uniqueReqId ) . getCF ( ) . get ( this . getTimeoutInMillis ( ) , TimeUnit . MILLISECONDS ) ; //Connection was closed.. this is a problem.... if ( this . getHandler ( uniqueReqId ) . isConnectionClosed ( ) ) { throw new FluidClientException ( "WebSocket-SendToFlow: " + "The connection was closed by the server prior to the response received." , FluidClientException . ErrorCode . IO_ERROR ) ; } if ( returnValue == null || returnValue . isEmpty ( ) ) { return null ; } return returnValue . get ( 0 ) ; } //Interrupted... catch ( InterruptedException exceptParam ) { throw new FluidClientException ( "WebSocket-Interrupted-SendToFlow: " + exceptParam . getMessage ( ) , exceptParam , FluidClientException . ErrorCode . STATEMENT_EXECUTION_ERROR ) ; } //Error on the web-socket... catch ( ExecutionException executeProblem ) { Throwable cause = executeProblem . getCause ( ) ; //Fluid client exception... if ( cause instanceof FluidClientException ) { throw ( FluidClientException ) cause ; } else { throw new FluidClientException ( "WebSocket-SendToFlow: " + cause . getMessage ( ) , cause , FluidClientException . ErrorCode . STATEMENT_EXECUTION_ERROR ) ; } } //Timeout... catch ( TimeoutException eParam ) { throw new FluidClientException ( "WebSocket-SendToFlow: Timeout while waiting for all return data. There were '" + this . getHandler ( uniqueReqId ) . getReturnValue ( ) . size ( ) + "' items after a Timeout of " + ( TimeUnit . MILLISECONDS . toSeconds ( this . getTimeoutInMillis ( ) ) ) + " seconds." , FluidClientException . ErrorCode . IO_ERROR ) ; } finally { this . removeHandler ( uniqueReqId ) ; } }


Input: Gets the Service Ticket associated with the Fluid session as HEX . [CODESPLIT] public String getServiceTicketAsHexUpper ( ) { String serviceTicket = this . getServiceTicket ( ) ; if ( serviceTicket == null ) { return null ; } if ( serviceTicket . isEmpty ( ) ) { return serviceTicket ; } byte [ ] base64Bytes = Base64 . getDecoder ( ) . decode ( serviceTicket ) ; return this . bytesToHex ( base64Bytes ) ; }


Input: Convert the byte [] to a HEX string as upper case . [CODESPLIT] private String bytesToHex ( byte [ ] bytesToConvert ) { if ( bytesToConvert == null ) { return null ; } if ( bytesToConvert . length == 0 ) { return UtilGlobal . EMPTY ; } char [ ] hexChars = new char [ bytesToConvert . length * 2 ] ; for ( int index = 0 ; index < bytesToConvert . length ; index ++ ) { int andWith127 = ( bytesToConvert [ index ] & 0xFF ) ; hexChars [ index * 2 ] = HEX_ARRAY [ andWith127 >>> 4 ] ; hexChars [ index * 2 + 1 ] = HEX_ARRAY [ andWith127 & 0x0F ] ; } return new String ( hexChars ) ; }