Input: Executes a native SQL query on the remote Fluid instance . [CODESPLIT] public List < SQLResultSet > executeNativeSQLSynchronized ( NativeSQLQuery nativeSQLQueryParam ) { if ( nativeSQLQueryParam == null ) { return null ; } if ( nativeSQLQueryParam . getDatasourceName ( ) == null || nativeSQLQueryParam . getDatasourceName ( ) . isEmpty ( ) ) { throw new FluidClientException ( "No data-source name provided. Not allowed." , FluidClientException . ErrorCode . FIELD_VALIDATE ) ; } //No query to execute... if ( ( nativeSQLQueryParam . getQuery ( ) == null || nativeSQLQueryParam . getQuery ( ) . isEmpty ( ) ) && ( nativeSQLQueryParam . getStoredProcedure ( ) == null || nativeSQLQueryParam . getStoredProcedure ( ) . isEmpty ( ) ) ) { return null ; } //Validate the echo... this . setEchoIfNotSet ( nativeSQLQueryParam ) ; //Start a new request... String uniqueReqId = this . initNewRequest ( ) ; //Send the actual message... this . sendMessage ( nativeSQLQueryParam , uniqueReqId ) ; try { List < SQLResultSet > 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-ExecuteNativeSQL: " + "The connection was closed by the server prior to the response received." , FluidClientException . ErrorCode . IO_ERROR ) ; } return returnValue ; } //Interrupted... catch ( InterruptedException exceptParam ) { throw new FluidClientException ( "SQLUtil-WebSocket-ExecuteNativeSQL: " + 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 ( "SQLUtil-WebSocket-ExecuteNativeSQL: " + cause . getMessage ( ) , cause , FluidClientException . ErrorCode . STATEMENT_EXECUTION_ERROR ) ; } } //Timeout... catch ( TimeoutException eParam ) { throw new FluidClientException ( "SQLUtil-WebSocket-ExecuteNativeSQL: 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 single instance of the { @code SyntaxFactory } . [CODESPLIT] public static SyntaxFactory getInstance ( ) { if ( SyntaxFactory . syntaxFactory == null ) { SyntaxFactory . syntaxFactory = new SyntaxFactory ( ) ; } return SyntaxFactory . syntaxFactory ; }


Input: Returns the { @code ISyntax } from the { @code sqlTypeParam } and { @code aliasParam } . [CODESPLIT] public ISyntax getSyntaxFor ( ABaseSQLUtil . SQLServerType sqlTypeParam , String aliasParam ) { if ( ISyntax . ProcedureMapping . isStoredProcedureMapping ( aliasParam ) ) { return new StoredProcedureSyntax ( aliasParam , ISyntax . ProcedureMapping . getParamCountForAlias ( aliasParam ) ) ; } throw new FluidSQLException ( new SQLException ( "Unable to find Syntax for alias '" + aliasParam + "' and SQL Type '" + sqlTypeParam + "'." ) ) ; }


Input: Returns the { @code ISyntax } from the { @code sqlTypeParam } and { @code formFieldMappingParam } . [CODESPLIT] public ISyntax getFieldValueSyntaxFor ( ABaseSQLUtil . SQLServerType sqlTypeParam , SQLFormFieldUtil . FormFieldMapping formFieldMappingParam ) { Long dataType = formFieldMappingParam . dataType ; if ( dataType == null ) { return null ; } switch ( dataType . intValue ( ) ) { case UtilGlobal . FieldTypeId . _1_TEXT : return this . getSyntaxFor ( sqlTypeParam , ISyntax . ProcedureMapping . Field . GetFormFieldValue_1_Text ) ; case UtilGlobal . FieldTypeId . _2_TRUE_FALSE : return this . getSyntaxFor ( sqlTypeParam , ISyntax . ProcedureMapping . Field . GetFormFieldValue_2_TrueFalse ) ; case UtilGlobal . FieldTypeId . _3_PARAGRAPH_TEXT : return this . getSyntaxFor ( sqlTypeParam , ISyntax . ProcedureMapping . Field . GetFormFieldValue_3_ParagraphText ) ; case UtilGlobal . FieldTypeId . _4_MULTI_CHOICE : if ( this . isPlain ( formFieldMappingParam . metaData ) ) { return this . getSyntaxFor ( sqlTypeParam , ISyntax . ProcedureMapping . Field . GetFormFieldValue_4_MultiChoice ) ; } else if ( this . isSelectMany ( formFieldMappingParam . metaData ) ) { return this . getSyntaxFor ( sqlTypeParam , ISyntax . ProcedureMapping . Field . GetFormFieldMultipleValue_4_MultiChoice ) ; } else { throw new FluidSQLException ( new SQLException ( "Data Type '" + dataType + "' does not support '" + formFieldMappingParam . metaData + "'." ) ) ; } case UtilGlobal . FieldTypeId . _5_DATE_TIME : return this . getSyntaxFor ( sqlTypeParam , ISyntax . ProcedureMapping . Field . GetFormFieldValue_5_DateTime ) ; case UtilGlobal . FieldTypeId . _6_DECIMAL : return this . getSyntaxFor ( sqlTypeParam , ISyntax . ProcedureMapping . Field . GetFormFieldValue_6_Decimal ) ; case UtilGlobal . FieldTypeId . _7_TABLE_FIELD : return this . getSyntaxFor ( sqlTypeParam , ISyntax . ProcedureMapping . Field . GetFormFieldValue_7_TableField ) ; case UtilGlobal . FieldTypeId . _8_TEXT_ENCRYPTED : case UtilGlobal . FieldTypeId . _9_LABEL : return null ; default : throw new FluidSQLException ( new SQLException ( "Data Type '" + dataType + "' is not supported." ) ) ; } }


Input: Checks whether { @code textToCheckParam } is Plain . [CODESPLIT] private boolean isPlain ( String textToCheckParam ) { if ( textToCheckParam == null || textToCheckParam . trim ( ) . isEmpty ( ) ) { return false ; } String toCheckLower = textToCheckParam . toLowerCase ( ) ; return toCheckLower . startsWith ( PLAIN . toLowerCase ( ) ) ; }


Input: Checks whether { @code textToCheckParam } is Select Many . [CODESPLIT] private boolean isSelectMany ( String textToCheckParam ) { if ( textToCheckParam == null || textToCheckParam . trim ( ) . isEmpty ( ) ) { return false ; } String toCheckLower = textToCheckParam . toLowerCase ( ) ; return toCheckLower . startsWith ( SELECT_MANY . toLowerCase ( ) ) ; }


Input: Conversion to { @code JSONObject } from Java Object . [CODESPLIT] @ Override public JSONObject toJsonObject ( ) throws JSONException { JSONObject returnVal = super . toJsonObject ( ) ; //SQL Columns... if ( this . getSqlColumns ( ) != null ) { JSONArray jsonArray = new JSONArray ( ) ; for ( SQLColumn toAdd : this . getSqlColumns ( ) ) { jsonArray . put ( toAdd . toJsonObject ( ) ) ; } returnVal . put ( JSONMapping . SQL_COLUMNS , jsonArray ) ; } return returnVal ; }


Input: Conversion to { @code JSONObject } from Java Object . [CODESPLIT] @ Override public JSONObject toJsonObject ( ) throws JSONException { JSONObject returnVal = super . toJsonObject ( ) ; //Name... if ( this . getName ( ) != null ) { returnVal . put ( JSONMapping . NAME , this . getName ( ) ) ; } //Value... if ( this . getValue ( ) != null ) { returnVal . put ( JSONMapping . VALUE , this . getValue ( ) ) ; } return returnVal ; }


Input: Request a new license based on the license request input . [CODESPLIT] public String requestLicense ( LicenseRequest licenseRequestParam ) { if ( licenseRequestParam != null && this . serviceTicket != null ) { licenseRequestParam . setServiceTicket ( this . serviceTicket ) ; } return this . executeTxtReceiveTxt ( HttpMethod . POST , null , false , ( licenseRequestParam == null ) ? null : licenseRequestParam . toJsonObject ( ) . toString ( ) , ContentType . APPLICATION_JSON , Version1 . licenseRequest ( ) ) ; }


Input: Applies a generated license for the server . [CODESPLIT] public LicenseRequest applyLicense ( String licenseToApplyParam ) { LicenseRequest liceReq = new LicenseRequest ( ) ; liceReq . setLicenseCipherText ( licenseToApplyParam ) ; if ( this . serviceTicket != null ) { liceReq . setServiceTicket ( this . serviceTicket ) ; } return new LicenseRequest ( this . postJson ( liceReq , Version1 . licenseApply ( ) ) ) ; }


Input: Conversion to { @code JSONObject } from Java Object . [CODESPLIT] @ Override public JSONObject toJsonObject ( ) throws JSONException { JSONObject returnVal = super . toJsonObject ( ) ; //Name... if ( this . getName ( ) != null ) { returnVal . put ( JSONMapping . NAME , this . getName ( ) ) ; } //Description... if ( this . getDescription ( ) != null ) { returnVal . put ( JSONMapping . DESCRIPTION , this . getDescription ( ) ) ; } //Inputs... if ( this . getInputs ( ) != null ) { JSONArray jsonArray = new JSONArray ( ) ; for ( Field toAdd : this . getInputs ( ) ) { jsonArray . put ( toAdd . toJsonObject ( ) ) ; } returnVal . put ( JSONMapping . INPUTS , jsonArray ) ; } //Rules... if ( this . getRules ( ) != null ) { JSONArray jsonArray = new JSONArray ( ) ; for ( String toAdd : this . getRules ( ) ) { jsonArray . put ( toAdd ) ; } returnVal . put ( JSONMapping . RULES , jsonArray ) ; } //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 ( ) ) ) ; } return returnVal ; }


Input: Create a new Plain Text field . [CODESPLIT] public Field createFieldTextPlain ( Field routeFieldParam ) { if ( routeFieldParam != null && this . serviceTicket != null ) { routeFieldParam . setServiceTicket ( this . serviceTicket ) ; } if ( routeFieldParam != null ) { routeFieldParam . setTypeAsEnum ( Field . Type . Text ) ; routeFieldParam . setTypeMetaData ( FieldMetaData . Text . PLAIN ) ; } return new Field ( this . putJson ( routeFieldParam , Version1 . routeFieldCreate ( ) ) ) ; }


Input: Create a new True False field . [CODESPLIT] public Field createFieldTrueFalse ( Field routeFieldParam ) { if ( routeFieldParam != null && this . serviceTicket != null ) { routeFieldParam . setServiceTicket ( this . serviceTicket ) ; } if ( routeFieldParam != null ) { routeFieldParam . setTypeAsEnum ( Field . Type . TrueFalse ) ; routeFieldParam . setTypeMetaData ( FieldMetaData . TrueFalse . TRUE_FALSE ) ; } return new Field ( this . putJson ( routeFieldParam , Version1 . routeFieldCreate ( ) ) ) ; }


Input: Create a new Paragraph Text field . [CODESPLIT] public Field createFieldParagraphTextPlain ( Field routeFieldParam ) { if ( routeFieldParam != null && this . serviceTicket != null ) { routeFieldParam . setServiceTicket ( this . serviceTicket ) ; } if ( routeFieldParam != null ) { routeFieldParam . setTypeAsEnum ( Field . Type . ParagraphText ) ; routeFieldParam . setTypeMetaData ( FieldMetaData . ParagraphText . PLAIN ) ; } return new Field ( this . putJson ( routeFieldParam , Version1 . routeFieldCreate ( ) ) ) ; }


Input: Create a new Paragraph HTML field . [CODESPLIT] public Field createFieldParagraphTextHTML ( Field routeFieldParam ) { if ( routeFieldParam != null && this . serviceTicket != null ) { routeFieldParam . setServiceTicket ( this . serviceTicket ) ; } if ( routeFieldParam != null ) { routeFieldParam . setTypeAsEnum ( Field . Type . ParagraphText ) ; routeFieldParam . setTypeMetaData ( FieldMetaData . ParagraphText . HTML ) ; } return new Field ( this . putJson ( routeFieldParam , Version1 . routeFieldCreate ( ) ) ) ; }


Input: Create a new Multi Choice field . [CODESPLIT] public Field createFieldMultiChoicePlain ( Field routeFieldParam , List < String > multiChoiceValuesParam ) { if ( routeFieldParam != null && this . serviceTicket != null ) { routeFieldParam . setServiceTicket ( this . serviceTicket ) ; } if ( multiChoiceValuesParam == null ) { multiChoiceValuesParam = new ArrayList ( ) ; } if ( routeFieldParam != null ) { routeFieldParam . setTypeAsEnum ( Field . Type . MultipleChoice ) ; routeFieldParam . setTypeMetaData ( FieldMetaData . MultiChoice . PLAIN ) ; routeFieldParam . setFieldValue ( new MultiChoice ( multiChoiceValuesParam ) ) ; } return new Field ( this . putJson ( routeFieldParam , Version1 . routeFieldCreate ( ) ) ) ; }


Input: Create a new Multi Choice select Many field . [CODESPLIT] public Field createFieldMultiChoiceSelectMany ( Field routeFieldParam , List < String > multiChoiceValuesParam ) { if ( routeFieldParam != null && this . serviceTicket != null ) { routeFieldParam . setServiceTicket ( this . serviceTicket ) ; } if ( multiChoiceValuesParam == null || multiChoiceValuesParam . isEmpty ( ) ) { throw new FluidClientException ( "No Multi-choice values provided." , FluidClientException . ErrorCode . FIELD_VALIDATE ) ; } if ( routeFieldParam != null ) { routeFieldParam . setTypeAsEnum ( Field . Type . MultipleChoice ) ; routeFieldParam . setTypeMetaData ( FieldMetaData . MultiChoice . SELECT_MANY ) ; routeFieldParam . setFieldValue ( new MultiChoice ( multiChoiceValuesParam ) ) ; } return new Field ( this . putJson ( routeFieldParam , Version1 . routeFieldCreate ( ) ) ) ; }


Input: Create a new Date only field . [CODESPLIT] public Field createFieldDateTimeDate ( Field routeFieldParam ) { if ( routeFieldParam != null && this . serviceTicket != null ) { routeFieldParam . setServiceTicket ( this . serviceTicket ) ; } if ( routeFieldParam != null ) { routeFieldParam . setTypeAsEnum ( Field . Type . DateTime ) ; routeFieldParam . setTypeMetaData ( FieldMetaData . DateTime . DATE ) ; } return new Field ( this . putJson ( routeFieldParam , Version1 . routeFieldCreate ( ) ) ) ; }


Input: Create a new Date and time field . [CODESPLIT] public Field createFieldDateTimeDateAndTime ( Field routeFieldParam ) { if ( routeFieldParam != null && this . serviceTicket != null ) { routeFieldParam . setServiceTicket ( this . serviceTicket ) ; } if ( routeFieldParam != null ) { routeFieldParam . setTypeAsEnum ( Field . Type . DateTime ) ; routeFieldParam . setTypeMetaData ( FieldMetaData . DateTime . DATE_AND_TIME ) ; } return new Field ( this . putJson ( routeFieldParam , Version1 . routeFieldCreate ( ) ) ) ; }


Input: Create a new Decimal field . [CODESPLIT] public Field createFieldDecimalPlain ( Field routeFieldParam ) { if ( routeFieldParam != null && this . serviceTicket != null ) { routeFieldParam . setServiceTicket ( this . serviceTicket ) ; } if ( routeFieldParam != null ) { routeFieldParam . setTypeAsEnum ( Field . Type . Decimal ) ; routeFieldParam . setTypeMetaData ( FieldMetaData . Decimal . PLAIN ) ; } return new Field ( this . putJson ( routeFieldParam , Version1 . routeFieldCreate ( ) ) ) ; }


Input: Update an existing Text field . [CODESPLIT] public Field updateFieldTextPlain ( Field routeFieldParam ) { if ( routeFieldParam != null && this . serviceTicket != null ) { routeFieldParam . setServiceTicket ( this . serviceTicket ) ; } if ( routeFieldParam != null ) { routeFieldParam . setTypeAsEnum ( Field . Type . Text ) ; routeFieldParam . setTypeMetaData ( FieldMetaData . Text . PLAIN ) ; } return new Field ( this . postJson ( routeFieldParam , Version1 . routeFieldUpdate ( ) ) ) ; }


Input: Update an existing True False field . [CODESPLIT] public Field updateFieldTrueFalse ( Field routeFieldParam ) { if ( routeFieldParam != null && this . serviceTicket != null ) { routeFieldParam . setServiceTicket ( this . serviceTicket ) ; } if ( routeFieldParam != null ) { routeFieldParam . setTypeAsEnum ( Field . Type . TrueFalse ) ; routeFieldParam . setTypeMetaData ( FieldMetaData . TrueFalse . TRUE_FALSE ) ; } return new Field ( this . postJson ( routeFieldParam , Version1 . routeFieldUpdate ( ) ) ) ; }


Input: Update an existing Paragraph Text field . [CODESPLIT] public Field updateFieldParagraphTextPlain ( Field routeFieldParam ) { if ( routeFieldParam != null && this . serviceTicket != null ) { routeFieldParam . setServiceTicket ( this . serviceTicket ) ; } if ( routeFieldParam != null ) { routeFieldParam . setTypeAsEnum ( Field . Type . ParagraphText ) ; routeFieldParam . setTypeMetaData ( FieldMetaData . ParagraphText . PLAIN ) ; } return new Field ( this . postJson ( routeFieldParam , Version1 . routeFieldUpdate ( ) ) ) ; }


Input: Update an existing Paragraph HTML field . [CODESPLIT] public Field updateFieldParagraphTextHTML ( Field routeFieldParam ) { if ( routeFieldParam != null && this . serviceTicket != null ) { routeFieldParam . setServiceTicket ( this . serviceTicket ) ; } if ( routeFieldParam != null ) { routeFieldParam . setTypeAsEnum ( Field . Type . ParagraphText ) ; routeFieldParam . setTypeMetaData ( FieldMetaData . ParagraphText . HTML ) ; } return new Field ( this . postJson ( routeFieldParam , Version1 . routeFieldUpdate ( ) ) ) ; }


Input: Update an existing Multi Choice field . [CODESPLIT] public Field updateFieldMultiChoicePlain ( Field routeFieldParam , List < String > multiChoiceValuesParam ) { if ( routeFieldParam != null && this . serviceTicket != null ) { routeFieldParam . setServiceTicket ( this . serviceTicket ) ; } if ( multiChoiceValuesParam == null || multiChoiceValuesParam . isEmpty ( ) ) { throw new FluidClientException ( "No Multi-choice values provided." , FluidClientException . ErrorCode . FIELD_VALIDATE ) ; } if ( routeFieldParam != null ) { routeFieldParam . setTypeAsEnum ( Field . Type . MultipleChoice ) ; routeFieldParam . setTypeMetaData ( FieldMetaData . MultiChoice . PLAIN ) ; routeFieldParam . setFieldValue ( new MultiChoice ( multiChoiceValuesParam ) ) ; } return new Field ( this . postJson ( routeFieldParam , Version1 . routeFieldUpdate ( ) ) ) ; }


Input: Update an existing Date field . [CODESPLIT] public Field updateFieldDateTimeDate ( Field routeFieldParam ) { if ( routeFieldParam != null && this . serviceTicket != null ) { routeFieldParam . setServiceTicket ( this . serviceTicket ) ; } if ( routeFieldParam != null ) { routeFieldParam . setTypeAsEnum ( Field . Type . DateTime ) ; routeFieldParam . setTypeMetaData ( FieldMetaData . DateTime . DATE ) ; } return new Field ( this . postJson ( routeFieldParam , Version1 . routeFieldUpdate ( ) ) ) ; }


Input: Update an existing Date and Time field . [CODESPLIT] public Field updateFieldDateTimeDateAndTime ( Field routeFieldParam ) { if ( routeFieldParam != null && this . serviceTicket != null ) { routeFieldParam . setServiceTicket ( this . serviceTicket ) ; } if ( routeFieldParam != null ) { routeFieldParam . setTypeAsEnum ( Field . Type . DateTime ) ; routeFieldParam . setTypeMetaData ( FieldMetaData . DateTime . DATE_AND_TIME ) ; } return new Field ( this . postJson ( routeFieldParam , Version1 . routeFieldUpdate ( ) ) ) ; }


Input: Update an existing Decimal field . [CODESPLIT] public Field updateFieldDecimalPlain ( Field routeFieldParam ) { if ( routeFieldParam != null && this . serviceTicket != null ) { routeFieldParam . setServiceTicket ( this . serviceTicket ) ; } if ( routeFieldParam != null ) { routeFieldParam . setTypeAsEnum ( Field . Type . Decimal ) ; routeFieldParam . setTypeMetaData ( FieldMetaData . Decimal . PLAIN ) ; } return new Field ( this . postJson ( routeFieldParam , Version1 . routeFieldUpdate ( ) ) ) ; }


Input: Update an existing Route field value . [CODESPLIT] public Field updateFieldValue ( Field routeFieldValueParam ) { if ( routeFieldValueParam != null && this . serviceTicket != null ) { routeFieldValueParam . setServiceTicket ( this . serviceTicket ) ; } return new Field ( this . postJson ( routeFieldValueParam , Version1 . routeFieldUpdateValue ( ) ) ) ; }


Input: Create an new Route field value . [CODESPLIT] public Field createFieldValue ( Field routeFieldValueToCreateParam , FluidItem fluidItemParam ) { if ( routeFieldValueToCreateParam != null && this . serviceTicket != null ) { routeFieldValueToCreateParam . setServiceTicket ( this . serviceTicket ) ; } Long fluidItmId = ( fluidItemParam == null ) ? null : fluidItemParam . getId ( ) ; return new Field ( this . putJson ( routeFieldValueToCreateParam , Version1 . routeFieldCreateValue ( fluidItmId ) ) ) ; }


Input: Retrieves field information by { @code fieldIdParam } . [CODESPLIT] public Field getFieldById ( Long fieldIdParam ) { Field field = new Field ( fieldIdParam ) ; //Set for Payara server... field . setFieldValue ( new MultiChoice ( ) ) ; if ( this . serviceTicket != null ) { field . setServiceTicket ( this . serviceTicket ) ; } return new Field ( this . postJson ( field , Version1 . getById ( ) ) ) ; }


Input: Retrieve the Route field values for { @code fluidItemParam } . [CODESPLIT] public List < Field > getRouteFieldValuesBy ( FluidItem fluidItemParam ) { if ( this . serviceTicket != null && fluidItemParam != null ) { fluidItemParam . setServiceTicket ( this . serviceTicket ) ; } return new RouteFieldListing ( this . postJson ( fluidItemParam , Version1 . getValuesBy ( ) ) ) . getListing ( ) ; }


Input: Deletes a field from Fluid . [CODESPLIT] public Field deleteField ( Field fieldParam ) { if ( fieldParam != null && this . serviceTicket != null ) { fieldParam . setServiceTicket ( this . serviceTicket ) ; } return new Field ( this . postJson ( fieldParam , Version1 . routeFieldDelete ( ) ) ) ; }


Input: Forcefully Deletes a field from Fluid . [CODESPLIT] public Field forceDeleteField ( Field fieldParam ) { if ( fieldParam != null && this . serviceTicket != null ) { fieldParam . setServiceTicket ( this . serviceTicket ) ; } return new Field ( this . postJson ( fieldParam , Version1 . routeFieldDelete ( true ) ) ) ; }


Input: Convert the { @code SQLFormFieldUtil . FormFieldMapping } to { @code Field } . [CODESPLIT] @ XmlTransient public List < Field > convertTo ( List < SQLFormFieldUtil . FormFieldMapping > formFieldMappingsParam ) { if ( formFieldMappingsParam == null ) { return null ; } List < Field > returnVal = new ArrayList ( ) ; for ( SQLFormFieldUtil . FormFieldMapping mappingToConvert : formFieldMappingsParam ) { returnVal . add ( this . convertTo ( mappingToConvert ) ) ; } return returnVal ; }


Input: Utility method to convert from a { @code SQLFormFieldUtil . FormFieldMapping } to a { @code Field } . [CODESPLIT] @ XmlTransient public Field convertTo ( SQLFormFieldUtil . FormFieldMapping formFieldMappingParam ) { switch ( formFieldMappingParam . dataType . intValue ( ) ) { //Text... case UtilGlobal . FieldTypeId . _1_TEXT : return new Field ( formFieldMappingParam . formFieldId , formFieldMappingParam . name , null , Field . Type . Text ) ; //True False... case UtilGlobal . FieldTypeId . _2_TRUE_FALSE : return new Field ( formFieldMappingParam . formFieldId , formFieldMappingParam . name , null , Field . Type . TrueFalse ) ; //Paragraph Text... case UtilGlobal . FieldTypeId . _3_PARAGRAPH_TEXT : return new Field ( formFieldMappingParam . formFieldId , formFieldMappingParam . name , null , Field . Type . ParagraphText ) ; //Multiple Choice... case UtilGlobal . FieldTypeId . _4_MULTI_CHOICE : return new Field ( formFieldMappingParam . formFieldId , formFieldMappingParam . name , null , Field . Type . MultipleChoice ) ; //Date Time... case UtilGlobal . FieldTypeId . _5_DATE_TIME : return new Field ( formFieldMappingParam . formFieldId , formFieldMappingParam . name , null , Field . Type . DateTime ) ; //Decimal... case UtilGlobal . FieldTypeId . _6_DECIMAL : return new Field ( formFieldMappingParam . formFieldId , formFieldMappingParam . name , null , Field . Type . Decimal ) ; //Table Field... case UtilGlobal . FieldTypeId . _7_TABLE_FIELD : return new Field ( formFieldMappingParam . formFieldId , formFieldMappingParam . name , null , Field . Type . Table ) ; //TODO __8__ encrypted field... //Label... case UtilGlobal . FieldTypeId . _9_LABEL : return new Field ( formFieldMappingParam . formFieldId , formFieldMappingParam . name , formFieldMappingParam . description , Field . Type . Label ) ; default : throw new IllegalStateException ( "Unable to map '" + formFieldMappingParam . dataType . intValue ( ) + "', to Form Field value." ) ; } }


Input: Retrieves a Configuration by Key . [CODESPLIT] public Configuration getConfigurationByKey ( String configurationKeyParam ) { Configuration configuration = new Configuration ( ) ; configuration . setKey ( configurationKeyParam ) ; if ( this . serviceTicket != null ) { configuration . setServiceTicket ( this . serviceTicket ) ; } return new Configuration ( this . postJson ( configuration , WS . Path . Configuration . Version1 . getByKey ( ) ) ) ; }


Input: Retrieves all Configurations . [CODESPLIT] public ConfigurationListing getAllConfigurations ( ) { Configuration configuration = new Configuration ( ) ; if ( this . serviceTicket != null ) { configuration . setServiceTicket ( this . serviceTicket ) ; } return new ConfigurationListing ( this . postJson ( configuration , WS . Path . Configuration . Version1 . getAllConfigurations ( ) ) ) ; }


Input: Conversion to { @code JSONObject } from Java Object . [CODESPLIT] @ Override public JSONObject toJsonObject ( ) throws JSONException { JSONObject returnVal = super . toJsonObject ( ) ; //Machine Name... if ( this . getMachineName ( ) != null ) { returnVal . put ( JSONMapping . MACHINE_NAME , this . getMachineName ( ) ) ; } //Cipher Text... if ( this . getLicenseCipherText ( ) != null ) { returnVal . put ( JSONMapping . LICENSE_CIPHER_TEXT , this . getLicenseCipherText ( ) ) ; } //License Type... if ( this . getLicenseType ( ) != null ) { returnVal . put ( JSONMapping . LICENSE_TYPE , this . getLicenseType ( ) ) ; } //User Count... if ( this . getUserCount ( ) != null ) { returnVal . put ( JSONMapping . USER_COUNT , this . getUserCount ( ) ) ; } //Date Valid From... if ( this . getDateValidFrom ( ) != null ) { returnVal . put ( JSONMapping . DATE_VALID_FROM , this . getDateAsLongFromJson ( this . getDateValidFrom ( ) ) ) ; } //Date Valid To... if ( this . getDateValidTo ( ) != null ) { returnVal . put ( JSONMapping . DATE_VALID_TO , this . getDateAsLongFromJson ( this . getDateValidTo ( ) ) ) ; } return returnVal ; }


Input: Creates a new ( Form ) for the { @code formToCreateParam } . [CODESPLIT] public Form createFormContainerSynchronized ( Form formToCreateParam ) { if ( formToCreateParam == null ) { return null ; } //Send all the messages... if ( formToCreateParam . getEcho ( ) == null || formToCreateParam . getEcho ( ) . trim ( ) . isEmpty ( ) ) { formToCreateParam . setEcho ( UUID . randomUUID ( ) . toString ( ) ) ; } //Start a new request... String uniqueReqId = this . initNewRequest ( ) ; //Send the actual message... this . sendMessage ( formToCreateParam , uniqueReqId ) ; try { List < Form > 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-CreateFormContainer: " + "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-CreateFormContainer: " + 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-CreateFormContainer: " + cause . getMessage ( ) , cause , FluidClientException . ErrorCode . STATEMENT_EXECUTION_ERROR ) ; } } //Timeout... catch ( TimeoutException eParam ) { throw new FluidClientException ( "WebSocket-CreateFormContainer: 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 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 ( Client client : this . getIdentities ( ) ) { returnVal . append ( client . getProvider ( ) ) ; returnVal . append ( "," ) ; } String toString = returnVal . toString ( ) ; return toString . substring ( 0 , toString . length ( ) - 1 ) ; }


Input: Uploads a new Attachment . If there is an existing attachment with the same name a new version will be uploaded . [CODESPLIT] public Attachment createAttachment ( Attachment attachmentParam ) { if ( attachmentParam != null && this . serviceTicket != null ) { attachmentParam . setServiceTicket ( this . serviceTicket ) ; } return new Attachment ( this . putJson ( attachmentParam , WS . Path . Attachment . Version1 . attachmentCreate ( ) ) ) ; }


Input: Retrieves a Attachment by Primary Key . [CODESPLIT] public Attachment getAttachmentById ( Long attachmentIdParam , boolean includeAttachmentDataParam ) { Attachment attachment = new Attachment ( attachmentIdParam ) ; if ( this . serviceTicket != null ) { attachment . setServiceTicket ( this . serviceTicket ) ; } return new Attachment ( this . postJson ( attachment , WS . Path . Attachment . Version1 . getById ( includeAttachmentDataParam ) ) ) ; }


Input: Retrieves all the Attachments associated with Form { @code formParam } . [CODESPLIT] public List < Attachment > getAttachmentsByForm ( Form formParam , boolean includeAttachmentDataParam ) { if ( formParam != null && this . serviceTicket != null ) { formParam . setServiceTicket ( this . serviceTicket ) ; } AttachmentListing returnedListing = new AttachmentListing ( postJson ( formParam , WS . Path . Attachment . Version1 . getAllByFormContainer ( includeAttachmentDataParam , false ) ) ) ; return ( returnedListing == null ) ? null : returnedListing . getListing ( ) ; }


Input: Delete an existing Attachment . [CODESPLIT] public Attachment deleteAttachment ( Attachment attachmentParam ) { if ( attachmentParam != null && this . serviceTicket != null ) { attachmentParam . setServiceTicket ( this . serviceTicket ) ; } return new Attachment ( this . postJson ( attachmentParam , WS . Path . Attachment . Version1 . attachmentDelete ( ) ) ) ; }


Input: Forcefully Delete an existing Attachment . [CODESPLIT] public Attachment forceDeleteAttachment ( Attachment attachmentParam ) { if ( attachmentParam != null && this . serviceTicket != null ) { attachmentParam . setServiceTicket ( this . serviceTicket ) ; } return new Attachment ( this . postJson ( attachmentParam , WS . Path . Attachment . Version1 . attachmentDelete ( true ) ) ) ; }


Input: Compares two different objects of this type . [CODESPLIT] public static boolean hasDifferentValue ( XsdStringRestrictions o1 , XsdStringRestrictions o2 ) { if ( o1 == null && o2 == null ) { return false ; } String o1Value = null ; String o2Value ; if ( o1 != null ) { o1Value = o1 . getValue ( ) ; } if ( o2 != null ) { o2Value = o2 . getValue ( ) ; return o2Value . equals ( o1Value ) ; } return false ; }


Input: Tries to match the received { [CODESPLIT] public void replaceUnsolvedAttributes ( NamedConcreteElement element ) { if ( element . getElement ( ) instanceof XsdAttributeGroup ) { attributeGroups . stream ( ) . filter ( attributeGroup -> attributeGroup instanceof UnsolvedReference && ( ( UnsolvedReference ) attributeGroup ) . getRef ( ) . equals ( element . getName ( ) ) ) . findFirst ( ) . ifPresent ( referenceBase -> { attributeGroups . remove ( referenceBase ) ; attributeGroups . add ( element ) ; attributes . addAll ( element . getElement ( ) . getElements ( ) ) ; element . getElement ( ) . setParent ( getOwner ( ) ) ; } ) ; } if ( element . getElement ( ) instanceof XsdAttribute ) { attributes . stream ( ) . filter ( attribute -> attribute instanceof UnsolvedReference && ( ( UnsolvedReference ) attribute ) . getRef ( ) . equals ( element . getName ( ) ) ) . findFirst ( ) . ifPresent ( referenceBase -> { attributes . remove ( referenceBase ) ; attributes . add ( element ) ; element . getElement ( ) . setParent ( getOwner ( ) ) ; } ) ; } }


Input: Replaces possible { [CODESPLIT] @ Override public void replaceUnsolvedElements ( NamedConcreteElement elementWrapper ) { if ( elementWrapper . getElement ( ) instanceof XsdElement ) { super . replaceUnsolvedElements ( elementWrapper ) ; } if ( elementWrapper . getElement ( ) instanceof XsdGroup ) { elements . add ( elementWrapper ) ; this . elements . removeIf ( element -> element instanceof UnsolvedReference && ( ( UnsolvedReference ) element ) . getRef ( ) . equals ( elementWrapper . getName ( ) ) ) ; } }


Input: Parses the XSD file represented by the received InputStream . [CODESPLIT] private void parseJarFile ( InputStream inputStream ) { //https://www.mkyong.com/java/how-to-read-xml-file-in-java-dom-parser/ try { Node schemaNode = getSchemaNode ( inputStream ) ; if ( isXsdSchema ( schemaNode ) ) { XsdSchema . parse ( this , schemaNode ) ; } else { throw new ParsingException ( "The top level element of a XSD file should be the xsd:schema node." ) ; } } catch ( SAXException | IOException | ParserConfigurationException e ) { Logger . getAnonymousLogger ( ) . log ( Level . SEVERE , "Exception while parsing." , e ) ; } }


Input: Creates a new class loader replacing the current one having another path added to the classpath . The new path is the path to the jar received in this class constructor . [CODESPLIT] private void setClassLoader ( String jarPath ) { if ( ! jarPath . endsWith ( ".jar" ) ) { throw new ParsingException ( "The jarPath received doesn't represent a jar file." ) ; } ClassLoader originalCl = Thread . currentThread ( ) . getContextClassLoader ( ) ; URL url = originalCl . getResource ( jarPath ) ; if ( url == null ) { try { url = new URL ( "file:/" + jarPath ) ; } catch ( MalformedURLException e ) { throw new ParsingException ( "Invalid jar name." ) ; } } // Create class loader using given codebase // Use prevCl as parent to maintain current visibility ClassLoader urlCl = URLClassLoader . newInstance ( new URL [ ] { url } , originalCl ) ; Thread . currentThread ( ) . setContextClassLoader ( urlCl ) ; classLoader = urlCl ; }


Input: This method is used to parse { [CODESPLIT] static ReferenceBase xsdAnnotationChildrenParse ( Node node , XsdAnnotationChildren annotationChildren ) { annotationChildren . content = xsdRawContentParse ( node ) ; return ReferenceBase . createFromXsd ( annotationChildren ) ; }


Input: Verifies if a given { [CODESPLIT] boolean isXsdSchema ( Node node ) { String schemaNodeName = node . getNodeName ( ) ; return schemaNodeName . equals ( XsdSchema . XSD_TAG ) || schemaNodeName . equals ( XsdSchema . XS_TAG ) ; }


Input: This method resolves all the remaining { [CODESPLIT] void resolveRefs ( ) { Map < String , List < NamedConcreteElement > > concreteElementsMap = parseElements . stream ( ) . filter ( concreteElement -> concreteElement instanceof NamedConcreteElement ) . map ( concreteElement -> ( NamedConcreteElement ) concreteElement ) . collect ( groupingBy ( NamedConcreteElement :: getName ) ) ; unsolvedElements . forEach ( unsolvedElement -> replaceUnsolvedReference ( concreteElementsMap , unsolvedElement ) ) ; }


Input: Replaces a single { [CODESPLIT] private void replaceUnsolvedReference ( Map < String , List < NamedConcreteElement > > concreteElementsMap , UnsolvedReference unsolvedReference ) { List < NamedConcreteElement > concreteElements = concreteElementsMap . get ( unsolvedReference . getRef ( ) ) ; if ( concreteElements != null ) { Map < String , String > oldElementAttributes = unsolvedReference . getElement ( ) . getAttributesMap ( ) ; for ( NamedConcreteElement concreteElement : concreteElements ) { NamedConcreteElement substitutionElementWrapper ; if ( ! unsolvedReference . isTypeRef ( ) ) { XsdNamedElements substitutionElement = concreteElement . getElement ( ) . clone ( oldElementAttributes ) ; substitutionElementWrapper = ( NamedConcreteElement ) ReferenceBase . createFromXsd ( substitutionElement ) ; } else { substitutionElementWrapper = concreteElement ; } unsolvedReference . getParent ( ) . replaceUnsolvedElements ( substitutionElementWrapper ) ; } } else { storeUnsolvedItem ( unsolvedReference ) ; } }


Input: Saves an occurrence of an element which couldn t be resolved in the { [CODESPLIT] private void storeUnsolvedItem ( UnsolvedReference unsolvedReference ) { if ( parserUnsolvedElementsMap . isEmpty ( ) ) { parserUnsolvedElementsMap . add ( new UnsolvedReferenceItem ( unsolvedReference ) ) ; } else { Optional < UnsolvedReferenceItem > innerEntry = parserUnsolvedElementsMap . stream ( ) . filter ( unsolvedReferenceObj -> unsolvedReferenceObj . getUnsolvedReference ( ) . getRef ( ) . equals ( unsolvedReference . getRef ( ) ) ) . findFirst ( ) ; if ( innerEntry . isPresent ( ) ) { innerEntry . ifPresent ( entry -> entry . getParents ( ) . add ( unsolvedReference . getParent ( ) ) ) ; } else { parserUnsolvedElementsMap . add ( new UnsolvedReferenceItem ( unsolvedReference ) ) ; } } }


Input: Adds a new file to the parsing queue . This new file appears by having xsd : import or xsd : include tags in the original file to parse . [CODESPLIT] public void addFileToParse ( String schemaLocation ) { if ( ! schemaLocations . contains ( schemaLocation ) && schemaLocation . endsWith ( ".xsd" ) ) { schemaLocations . add ( schemaLocation ) ; } }


Input: Asserts if the current object has the name attribute when not being a direct child of the XsdSchema element which is not allowed throwing an exception in that case . [CODESPLIT] private void rule2 ( ) { if ( ! ( parent instanceof XsdSchema ) && name != null ) { throw new ParsingException ( XSD_TAG + " element: The " + NAME_TAG + " should only be used when the parent of the " + XSD_TAG + " is the " + XsdSchema . XSD_TAG + " element." ) ; } }


Input: Asserts if the current has no value for its name attribute while being a direct child of the top level XsdSchema element which is required . Throws an exception if no name is present . [CODESPLIT] private void rule3 ( ) { if ( parent instanceof XsdSchema && name == null ) { throw new ParsingException ( XSD_TAG + " element: The " + NAME_TAG + " should is required the parent of the " + XSD_TAG + " is the " + XsdSchema . XSD_TAG + " element." ) ; } }


Input: Compares two different objects of this type . [CODESPLIT] public static boolean hasDifferentValue ( XsdDoubleRestrictions o1 , XsdDoubleRestrictions o2 ) { if ( o1 == null && o2 == null ) { return false ; } double o1Value = Double . MAX_VALUE ; double o2Value ; if ( o1 != null ) { o1Value = o1 . getValue ( ) ; } if ( o2 != null ) { o2Value = o2 . getValue ( ) ; return o2Value == o1Value ; } return false ; }


Input: This method obtains all the restrictions for the current { [CODESPLIT] public List < XsdRestriction > getAllRestrictions ( ) { Map < String , XsdRestriction > restrictions = new HashMap <> ( ) ; Map < String , String > xsdBuiltinTypes = XsdParserCore . getXsdTypesToJava ( ) ; if ( restriction != null ) { restrictions . put ( xsdBuiltinTypes . get ( restriction . getBase ( ) ) , restriction ) ; } if ( union != null ) { union . getUnionElements ( ) . forEach ( unionMember -> { XsdRestriction unionMemberRestriction = unionMember . getRestriction ( ) ; if ( unionMemberRestriction != null ) { XsdRestriction existingRestriction = restrictions . getOrDefault ( xsdBuiltinTypes . get ( unionMemberRestriction . getBase ( ) ) , null ) ; if ( existingRestriction != null ) { if ( existsRestrictionOverlap ( existingRestriction , unionMemberRestriction ) ) { throw new InvalidParameterException ( "The xsd file is invalid because has contradictory restrictions." ) ; } updateExistingRestriction ( existingRestriction , unionMemberRestriction ) ; } else { restrictions . put ( xsdBuiltinTypes . get ( unionMemberRestriction . getBase ( ) ) , unionMemberRestriction ) ; } } } ) ; } return new ArrayList <> ( restrictions . values ( ) ) ; }


Input: Joins two distinct { [CODESPLIT] private void updateExistingRestriction ( XsdRestriction existing , XsdRestriction newRestriction ) { XsdPattern pattern = newRestriction . getPattern ( ) ; XsdMaxExclusive maxExclusive = newRestriction . getMaxExclusive ( ) ; XsdMaxInclusive maxInclusive = newRestriction . getMaxInclusive ( ) ; XsdMaxLength maxLength = newRestriction . getMaxLength ( ) ; XsdMinExclusive minExclusive = newRestriction . getMinExclusive ( ) ; XsdMinInclusive minInclusive = newRestriction . getMinInclusive ( ) ; XsdMinLength minLength = newRestriction . getMinLength ( ) ; XsdLength length = newRestriction . getLength ( ) ; XsdFractionDigits fractionDigits = newRestriction . getFractionDigits ( ) ; XsdTotalDigits totalDigits = newRestriction . getTotalDigits ( ) ; XsdWhiteSpace whiteSpace = newRestriction . getWhiteSpace ( ) ; if ( pattern != null ) { existing . setPattern ( pattern ) ; } if ( maxExclusive != null ) { existing . setMaxExclusive ( maxExclusive ) ; } if ( maxInclusive != null ) { existing . setMaxInclusive ( maxInclusive ) ; } if ( maxLength != null ) { existing . setMaxLength ( maxLength ) ; } if ( minExclusive != null ) { existing . setMinExclusive ( minExclusive ) ; } if ( minInclusive != null ) { existing . setMinInclusive ( minInclusive ) ; } if ( minLength != null ) { existing . setMinLength ( minLength ) ; } if ( length != null ) { existing . setLength ( length ) ; } if ( fractionDigits != null ) { existing . setFractionDigits ( fractionDigits ) ; } if ( totalDigits != null ) { existing . setTotalDigits ( totalDigits ) ; } if ( whiteSpace != null ) { existing . setWhiteSpace ( whiteSpace ) ; } updateExistingRestrictionEnumerations ( existing , newRestriction ) ; }


Input: Updates the existing { [CODESPLIT] private void updateExistingRestrictionEnumerations ( XsdRestriction existing , XsdRestriction newRestriction ) { List < XsdEnumeration > existingEnumeration = existing . getEnumeration ( ) ; List < XsdEnumeration > newRestrictionEnumeration = newRestriction . getEnumeration ( ) ; if ( existingEnumeration == null ) { existing . setEnumeration ( newRestrictionEnumeration ) ; } else { if ( newRestrictionEnumeration != null ) { for ( XsdEnumeration enumerationElem : newRestrictionEnumeration ) { if ( existingEnumeration . stream ( ) . noneMatch ( existingEnumerationElem -> existingEnumerationElem . getValue ( ) . equals ( enumerationElem . getValue ( ) ) ) ) { existingEnumeration . add ( enumerationElem ) ; } } } } }


Input: Checks for any restriction overlap between two different { [CODESPLIT] private boolean existsRestrictionOverlap ( XsdRestriction existing , XsdRestriction newRestriction ) { return hasDifferentValue ( existing . getPattern ( ) , newRestriction . getPattern ( ) ) || hasDifferentValue ( existing . getWhiteSpace ( ) , newRestriction . getWhiteSpace ( ) ) || hasDifferentValue ( existing . getTotalDigits ( ) , newRestriction . getTotalDigits ( ) ) || hasDifferentValue ( existing . getFractionDigits ( ) , newRestriction . getFractionDigits ( ) ) || hasDifferentValue ( existing . getMaxExclusive ( ) , newRestriction . getMaxExclusive ( ) ) || hasDifferentValue ( existing . getMaxInclusive ( ) , newRestriction . getMaxInclusive ( ) ) || hasDifferentValue ( existing . getMaxLength ( ) , newRestriction . getMaxLength ( ) ) || hasDifferentValue ( existing . getMinExclusive ( ) , newRestriction . getMinExclusive ( ) ) || hasDifferentValue ( existing . getMinInclusive ( ) , newRestriction . getMinInclusive ( ) ) || hasDifferentValue ( existing . getMinLength ( ) , newRestriction . getMinLength ( ) ) || hasDifferentValue ( existing . getLength ( ) , newRestriction . getLength ( ) ) ; }


Input: Asserts if the current object has a ref attribute at the same time as either a simpleType as children a form attribute or a type attribute . Throws an exception in that case . [CODESPLIT] private void rule3 ( ) { if ( attributesMap . containsKey ( REF_TAG ) && ( simpleType != null || form != null || type != null ) ) { throw new ParsingException ( XSD_TAG + " element: If " + REF_TAG + " attribute is present, simpleType element, form attribute and type attribute cannot be present at the same time." ) ; } }


Input: Receives a { [CODESPLIT] @ Override public void replaceUnsolvedElements ( NamedConcreteElement elementWrapper ) { super . replaceUnsolvedElements ( elementWrapper ) ; XsdAbstractElement element = elementWrapper . getElement ( ) ; if ( element instanceof XsdSimpleType && simpleType != null && type . equals ( elementWrapper . getName ( ) ) ) { this . simpleType = elementWrapper ; } }


Input: Parses a XSD file and all its containing XSD elements . This code iterates on the nodes and parses the supported ones . The supported types are all the XSD types that have their tag present in the { [CODESPLIT] private void parseFile ( String filePath ) { //https://www.mkyong.com/java/how-to-read-xml-file-in-java-dom-parser/ try { if ( ! new File ( filePath ) . exists ( ) ) { throw new FileNotFoundException ( ) ; } Node schemaNode = getSchemaNode ( filePath ) ; if ( isXsdSchema ( schemaNode ) ) { XsdSchema . parse ( this , schemaNode ) ; } else { throw new ParsingException ( "The top level element of a XSD file should be the xsd:schema node." ) ; } } catch ( SAXException | IOException | ParserConfigurationException e ) { Logger . getAnonymousLogger ( ) . log ( Level . SEVERE , "Exception while parsing." , e ) ; } }


Input: This function uses DOM to obtain a list of nodes from a XSD file . [CODESPLIT] private Node getSchemaNode ( String filePath ) throws IOException , SAXException , ParserConfigurationException { Document doc = DocumentBuilderFactory . newInstance ( ) . newDocumentBuilder ( ) . parse ( filePath ) ; doc . getDocumentElement ( ) . normalize ( ) ; return doc . getFirstChild ( ) ; }


Input: Asserts if the current object has a form attribute while being a direct child of the top level XsdSchema element which isn t allowed throwing an exception in that case . [CODESPLIT] private void rule7 ( ) { if ( parent instanceof XsdSchema && attributesMap . containsKey ( FORM_TAG ) ) { throw new ParsingException ( XSD_TAG + " element: The " + FORM_TAG + " attribute can only be present when the parent of the " + xsdElementIsXsdSchema ) ; } }


Input: Asserts if the current object has a ref attribute while being a direct child of the top level XsdSchema element which isn t allowed throwing an exception in that case . [CODESPLIT] private void rule3 ( ) { if ( parent instanceof XsdSchema && attributesMap . containsKey ( REF_TAG ) ) { throw new ParsingException ( XSD_TAG + " element: The " + REF_TAG + " attribute cannot be present when the parent of the " + xsdElementIsXsdSchema ) ; } }


Input: This method aims to replace the previously created { [CODESPLIT] @ Override public void replaceUnsolvedElements ( NamedConcreteElement element ) { super . replaceUnsolvedElements ( element ) ; XsdNamedElements elem = element . getElement ( ) ; boolean isComplexOrSimpleType = elem instanceof XsdComplexType || elem instanceof XsdSimpleType ; if ( this . type instanceof UnsolvedReference && isComplexOrSimpleType && ( ( UnsolvedReference ) this . type ) . getRef ( ) . equals ( element . getName ( ) ) ) { this . type = element ; elem . setParent ( this ) ; } if ( this . substitutionGroup instanceof UnsolvedReference && elem instanceof XsdElement && ( ( UnsolvedReference ) this . substitutionGroup ) . getRef ( ) . equals ( element . getName ( ) ) ) { XsdElement xsdElement = ( XsdElement ) elem ; this . type = xsdElement . type ; this . simpleType = xsdElement . simpleType ; this . complexType = xsdElement . complexType ; this . substitutionGroup = element ; elem . setParent ( this ) ; } }


Input: The base code for parsing any { [CODESPLIT] static ReferenceBase xsdParseSkeleton ( Node node , XsdAbstractElement element ) { XsdParserCore parser = element . getParser ( ) ; Node child = node . getFirstChild ( ) ; while ( child != null ) { if ( child . getNodeType ( ) == Node . ELEMENT_NODE ) { String nodeName = child . getNodeName ( ) ; BiFunction < XsdParserCore , Node , ReferenceBase > parserFunction = XsdParserCore . getParseMappers ( ) . get ( nodeName ) ; if ( parserFunction != null ) { XsdAbstractElement childElement = parserFunction . apply ( parser , child ) . getElement ( ) ; childElement . accept ( element . getVisitor ( ) ) ; childElement . validateSchemaRules ( ) ; } } child = child . getNextSibling ( ) ; } ReferenceBase wrappedElement = ReferenceBase . createFromXsd ( element ) ; parser . addParsedElement ( wrappedElement ) ; return wrappedElement ; }


Input: Converts a { [CODESPLIT] protected static Map < String , String > convertNodeMap ( NamedNodeMap nodeMap ) { HashMap < String , String > attributesMapped = new HashMap <> ( ) ; for ( int i = 0 ; i < nodeMap . getLength ( ) ; i ++ ) { Node node = nodeMap . item ( i ) ; attributesMapped . put ( node . getNodeName ( ) , node . getNodeValue ( ) ) ; } return attributesMapped ; }


Input: This method iterates on the current element children and replaces any { [CODESPLIT] public void replaceUnsolvedElements ( NamedConcreteElement element ) { List < ReferenceBase > elements = this . getElements ( ) ; if ( elements != null ) { elements . stream ( ) . filter ( referenceBase -> referenceBase instanceof UnsolvedReference ) . map ( referenceBase -> ( UnsolvedReference ) referenceBase ) . filter ( unsolvedReference -> unsolvedReference . getRef ( ) . equals ( element . getName ( ) ) ) . findFirst ( ) . ifPresent ( oldElement -> elements . set ( elements . indexOf ( oldElement ) , element ) ) ; } }


Input: In special cases such as { [CODESPLIT] static String xsdRawContentParse ( Node node ) { Node child = node . getFirstChild ( ) ; StringBuilder stringBuilder = new StringBuilder ( ) ; while ( child != null ) { if ( child . getNodeType ( ) == Node . TEXT_NODE ) { stringBuilder . append ( child . getTextContent ( ) ) ; } child = child . getNextSibling ( ) ; } return stringBuilder . toString ( ) ; }


Input: Compares two different objects of this type . [CODESPLIT] public static boolean hasDifferentValue ( XsdIntegerRestrictions o1 , XsdIntegerRestrictions o2 ) { if ( o1 == null && o2 == null ) { return false ; } int o1Value = Integer . MAX_VALUE ; int o2Value ; if ( o1 != null ) { o1Value = o1 . getValue ( ) ; } if ( o2 != null ) { o2Value = o2 . getValue ( ) ; return o2Value == o1Value ; } return false ; }


Input: Verifies if a given value is present in a given { [CODESPLIT] public static < T extends XsdEnum > T belongsToEnum ( final XsdEnum < T > instance , final String value ) { if ( value == null ) { return null ; } Optional < T > enumValue = Arrays . stream ( instance . getValues ( ) ) . filter ( enumField -> enumField . getValue ( ) . equals ( value ) ) . findFirst ( ) ; if ( enumValue . isPresent ( ) ) { return enumValue . get ( ) ; } else { StringBuilder possibleValues = new StringBuilder ( ) ; instance . getSupportedValues ( ) . forEach ( supportedValue -> possibleValues . append ( supportedValue ) . append ( ", " ) ) ; String values = possibleValues . toString ( ) ; values = values . substring ( 0 , values . length ( ) - 2 ) ; throw new ParsingException ( "The attribute " + instance . getVariableName ( ) + " doesn't support the value \"" + value + "\".\n" + "The possible values for the " + instance . getVariableName ( ) + " attribute are:\n" + values ) ; } }


Input: Checks if the maxOccurs attribute is unbounded or an { [CODESPLIT] static String maxOccursValidation ( String elementName , String value ) { if ( value . equals ( "unbounded" ) ) { return value ; } validateNonNegativeInteger ( elementName , MAX_OCCURS_TAG , value ) ; return value ; }


Input: Validates if a given String is a non negative { [CODESPLIT] static Integer validateNonNegativeInteger ( String elementName , String attributeName , String value ) { try { int intValue = Integer . parseInt ( value ) ; if ( intValue < 0 ) { throw new ParsingException ( "The " + elementName + " " + attributeName + " attribute should be a non negative integer. (greater or equal than 0)" ) ; } return intValue ; } catch ( NumberFormatException e ) { throw new ParsingException ( "The " + elementName + " " + attributeName + "  attribute should be a non negative integer." ) ; } }


Input: Validates if a given String is a non negative { [CODESPLIT] public static Integer validateRequiredNonNegativeInteger ( String elementName , String attributeName , String value ) { if ( value == null ) throw new ParsingException ( attributeMissingMessage ( elementName , attributeName ) ) ; return validateNonNegativeInteger ( elementName , attributeName , value ) ; }


Input: Validates if a given String is a positive { [CODESPLIT] public static Integer validateRequiredPositiveInteger ( String elementName , String attributeName , String value ) { if ( value == null ) throw new ParsingException ( attributeMissingMessage ( elementName , attributeName ) ) ; return validatePositiveInteger ( elementName , attributeName , value ) ; }


Input: Validates if a given { [CODESPLIT] private static Double validateDouble ( String elementName , String attributeName , String value ) { try { return Double . parseDouble ( value ) ; } catch ( NumberFormatException e ) { throw new ParsingException ( "The " + elementName + " " + attributeName + "  attribute should be a numeric value." ) ; } }


Input: Validates if a given { [CODESPLIT] public static Double validateRequiredDouble ( String elementName , String attributeName , String value ) { if ( value == null ) throw new ParsingException ( attributeMissingMessage ( elementName , attributeName ) ) ; return validateDouble ( elementName , attributeName , value ) ; }


Input: Obtains the default value of the { [CODESPLIT] static String getFormDefaultValue ( XsdAbstractElement parent ) { if ( parent == null ) return null ; if ( parent instanceof XsdSchema ) { return ( ( XsdSchema ) parent ) . getElementFormDefault ( ) ; } return getFormDefaultValue ( parent . getParent ( ) ) ; }


Input: Obtains the default value of the { [CODESPLIT] static String getFinalDefaultValue ( XsdAbstractElement parent ) { if ( parent == null ) return null ; if ( parent instanceof XsdSchema ) { return ( ( XsdSchema ) parent ) . getFinalDefault ( ) ; } return getFinalDefaultValue ( parent . getParent ( ) ) ; }


Input: Obtains the default value of the { [CODESPLIT] static String getBlockDefaultValue ( XsdAbstractElement parent ) { if ( parent == null ) return null ; if ( parent instanceof XsdSchema ) { return ( ( XsdSchema ) parent ) . getBlockDefault ( ) ; } return getBlockDefaultValue ( parent . getParent ( ) ) ; }


Input: This method creates a ReferenceBase object that serves as a wrapper to { [CODESPLIT] public static ReferenceBase createFromXsd ( XsdAbstractElement element ) { String ref = getRef ( element ) ; String name = getName ( element ) ; if ( ! ( element instanceof XsdNamedElements ) ) { return new ConcreteElement ( element ) ; } if ( ref == null ) { if ( name == null ) { return new ConcreteElement ( element ) ; } else { return new NamedConcreteElement ( ( XsdNamedElements ) element , name ) ; } } else { return new UnsolvedReference ( ( XsdNamedElements ) element ) ; } }


Input: This method should always receive two elements one to replace the { [CODESPLIT] @ Override public void replaceUnsolvedElements ( NamedConcreteElement element ) { super . replaceUnsolvedElements ( element ) ; XsdNamedElements elem = element . getElement ( ) ; String elemName = elem . getRawName ( ) ; boolean isComplexOrSimpleType = elem instanceof XsdComplexType || elem instanceof XsdSimpleType ; if ( this . base instanceof UnsolvedReference && isComplexOrSimpleType && ( ( UnsolvedReference ) this . base ) . getRef ( ) . equals ( elemName ) ) { this . base = element ; } if ( this . childElement instanceof UnsolvedReference && elem instanceof XsdGroup && ( ( UnsolvedReference ) this . childElement ) . getRef ( ) . equals ( elemName ) ) { this . childElement = element ; } visitor . replaceUnsolvedAttributes ( element ) ; }


Input: If T is assignable from value then return the value . Otherwise tries to create an instance of this type using the provided argument . [CODESPLIT] @ Override public T convert ( final Object value ) { if ( value == null ) { return null ; } else if ( isIterable ( ) && Iterable . class . isAssignableFrom ( value . getClass ( ) ) ) { return convertIterable ( value ) ; } else if ( reflectedKlass . assignableFromObject ( value ) ) { return ( T ) value ; } else if ( reflectedKlass . canBeUnboxed ( value . getClass ( ) ) ) { return ( T ) value ; } else if ( reflectedKlass . canBeBoxed ( value . getClass ( ) ) ) { return ( T ) value ; } FluentClass < ? > klassToCreate ; if ( reflectedKlass . isPrimitive ( ) ) { klassToCreate = reflectedKlass . boxedType ( ) ; } else { klassToCreate = reflectedKlass ; } return ( T ) convertValueTo ( value , klassToCreate ) ; }


Input: Construct a Cli from an annotated interface definition [CODESPLIT] public static < O > Cli < O > createCli ( final Class < O > klass ) throws InvalidOptionSpecificationException { return new CliInterfaceImpl < O > ( klass ) ; }


Input: Construct a Cli from an annotated class [CODESPLIT] public static < O > Cli < O > createCliUsingInstance ( final O options ) throws InvalidOptionSpecificationException { return new CliInstanceImpl < O > ( options ) ; }


Input: Parse arguments from an annotated interface definition [CODESPLIT] public static < O > O parseArguments ( final Class < O > klass , final String ... arguments ) throws ArgumentValidationException , InvalidOptionSpecificationException { return createCli ( klass ) . parseArguments ( arguments ) ; }


Input: Parse arguments from an annotated class instance [CODESPLIT] public static < O > O parseArgumentsUsingInstance ( final O options , final String ... arguments ) throws ArgumentValidationException , InvalidOptionSpecificationException { return createCliUsingInstance ( options ) . parseArguments ( arguments ) ; }


Input: { [CODESPLIT] @ Override public void parseArguments ( final ParsedArguments parsedArguments , final String ... arguments ) throws ArgumentValidationException { boolean finishedOptions = false ; for ( final String argument : arguments ) { if ( finishedOptions ) { parsedArguments . addValue ( argument ) ; } else { finishedOptions = add ( parsedArguments , argument ) ; } } }


Input: Note : The following methods are used to get a String representation of the different POJO ( while handling null value ) [CODESPLIT] private static String getEventDate ( Date dates ) { return Optional . ofNullable ( dates ) . map ( Date :: getStart ) . map ( Start :: getDateTime ) . map ( dt -> dt . toString ( ) ) . orElse ( "No date" ) ; }


Input: Package protected for testing purposess [CODESPLIT] Builder urlBuilder ( String path ) { Builder builder = baseUrlBuilder ( ) . addPathSegment ( configuration . getApiPackage ( ) ) . addPathSegment ( configuration . getApiVersion ( ) ) . addPathSegment ( path ) ; if ( configuration . getPathModifier ( ) != DiscoveryApiConfiguration . PathModifier . NONE ) { builder . addPathSegment ( configuration . getPathModifier ( ) . getModifier ( ) ) ; } return builder ; }


Input: Add a fixed view to appear at the top of the list . If this method is called more than once the views will appear in the order they were added . Views added using this call can take focus if they want . <p > Note : When first introduced this method could only be called before setting the adapter with { @link #setAdapter ( ListAdapter ) } . Starting with { @link android . os . Build . VERSION_CODES#KITKAT } this method may be called at any time . If the ListView s adapter does not extend { @link FooterViewGridAdapter } it will be wrapped with a supporting instance of { @link android . widget . WrapperListAdapter } . [CODESPLIT] public void addHeaderView ( View v , Object data , boolean isSelectable ) { final FixedViewInfo info = new FixedViewInfo ( ) ; FrameLayout fl = new FullWidthFixedViewLayout ( getContext ( ) ) ; fl . addView ( v ) ; info . view = v ; info . viewContainer = fl ; info . data = data ; info . isSelectable = isSelectable ; mHeaderViewInfos . add ( info ) ; // Wrap the adapter if it wasn't already wrapped. if ( mAdapter != null ) { if ( ! ( mAdapter instanceof FooterViewGridAdapter ) ) { mAdapter = new FooterViewGridAdapter ( mHeaderViewInfos , mFooterViewInfos , mAdapter ) ; } // Do not know if this really helps notifiyChanged ( ) ; } }


Input: Removes a previously - added footer view . [CODESPLIT] public boolean removeFooterView ( View v ) { if ( mFooterViewInfos . size ( ) > 0 ) { boolean result = false ; if ( mAdapter != null && ( ( FooterViewGridAdapter ) mAdapter ) . removeFooter ( v ) ) { notifiyChanged ( ) ; result = true ; } removeFixedViewInfo ( v , mFooterViewInfos ) ; return result ; } return false ; }


Input: Sets the position ( @a x @a y @a z ) of the start of the line segment to choose values along . [CODESPLIT] public void setStartPoint ( double x , double y , double z ) { this . x0 = x ; this . y0 = y ; this . z0 = z ; }


Input: Sets the position ( @a x @a y @a z ) of the end of the line segment to choose values along . [CODESPLIT] public void setEndPoint ( double x , double y , double z ) { this . x1 = x ; this . y1 = y ; this . z1 = z ; }


Input: Returns the output value from the noise module given the one - dimensional coordinate of the specified input value located on the line segment . [CODESPLIT] public double getValue ( double p ) { if ( module == null ) { throw new NoModuleException ( ) ; } double x = ( x1 - x0 ) * p + x0 ; double y = ( y1 - y0 ) * p + y0 ; double z = ( z1 - z0 ) * p + z0 ; double value = module . getValue ( x , y , z ) ; if ( attenuate ) { return p * ( 1.0 - p ) * 4 * value ; } else { return value ; } }


Input: Returns the output value from the noise module given the ( @a x @a z ) coordinates of the specified input value located on the surface of the plane . [CODESPLIT] public double getValue ( double x , double z ) { if ( module == null ) { throw new NoModuleException ( ) ; } return module . getValue ( x , 0 , z ) ; }


Input: Generates a gradient - coherent - noise value from the coordinates of a three - dimensional input value . [CODESPLIT] public static double gradientCoherentNoise3D ( double x , double y , double z , int seed , NoiseQuality quality ) { // Create a unit-length cube aligned along an integer boundary.  This cube // surrounds the input point. int x0 = ( ( x > 0.0 ) ? ( int ) x : ( int ) x - 1 ) ; int x1 = x0 + 1 ; int y0 = ( ( y > 0.0 ) ? ( int ) y : ( int ) y - 1 ) ; int y1 = y0 + 1 ; int z0 = ( ( z > 0.0 ) ? ( int ) z : ( int ) z - 1 ) ; int z1 = z0 + 1 ; // Map the difference between the coordinates of the input value and the // coordinates of the cube's outer-lower-left vertex onto an S-curve. double xs , ys , zs ; if ( quality == NoiseQuality . FAST ) { xs = ( x - ( double ) x0 ) ; ys = ( y - ( double ) y0 ) ; zs = ( z - ( double ) z0 ) ; } else if ( quality == NoiseQuality . STANDARD ) { xs = Utils . sCurve3 ( x - ( double ) x0 ) ; ys = Utils . sCurve3 ( y - ( double ) y0 ) ; zs = Utils . sCurve3 ( z - ( double ) z0 ) ; } else { xs = Utils . sCurve5 ( x - ( double ) x0 ) ; ys = Utils . sCurve5 ( y - ( double ) y0 ) ; zs = Utils . sCurve5 ( z - ( double ) z0 ) ; } // Now calculate the noise values at each vertex of the cube.  To generate // the coherent-noise value at the input point, interpolate these eight // noise values using the S-curve value as the interpolant (trilinear // interpolation.) double n0 , n1 , ix0 , ix1 , iy0 , iy1 ; n0 = gradientNoise3D ( x , y , z , x0 , y0 , z0 , seed ) ; n1 = gradientNoise3D ( x , y , z , x1 , y0 , z0 , seed ) ; ix0 = Utils . linearInterp ( n0 , n1 , xs ) ; n0 = gradientNoise3D ( x , y , z , x0 , y1 , z0 , seed ) ; n1 = gradientNoise3D ( x , y , z , x1 , y1 , z0 , seed ) ; ix1 = Utils . linearInterp ( n0 , n1 , xs ) ; iy0 = Utils . linearInterp ( ix0 , ix1 , ys ) ; n0 = gradientNoise3D ( x , y , z , x0 , y0 , z1 , seed ) ; n1 = gradientNoise3D ( x , y , z , x1 , y0 , z1 , seed ) ; ix0 = Utils . linearInterp ( n0 , n1 , xs ) ; n0 = gradientNoise3D ( x , y , z , x0 , y1 , z1 , seed ) ; n1 = gradientNoise3D ( x , y , z , x1 , y1 , z1 , seed ) ; ix1 = Utils . linearInterp ( n0 , n1 , xs ) ; iy1 = Utils . linearInterp ( ix0 , ix1 , ys ) ; return Utils . linearInterp ( iy0 , iy1 , zs ) ; }


Input: Generates a gradient - noise value from the coordinates of a three - dimensional input value and the integer coordinates of a nearby three - dimensional value . [CODESPLIT] public static double gradientNoise3D ( double fx , double fy , double fz , int ix , int iy , int iz , int seed ) { // Randomly generate a gradient vector given the integer coordinates of the // input value.  This implementation generates a random number and uses it // as an index into a normalized-vector lookup table. int vectorIndex = ( X_NOISE_GEN * ix + Y_NOISE_GEN * iy + Z_NOISE_GEN * iz + SEED_NOISE_GEN * seed ) ; vectorIndex ^= ( vectorIndex >> SHIFT_NOISE_GEN ) ; vectorIndex &= 0xff ; double xvGradient = Utils . RANDOM_VECTORS [ ( vectorIndex << 2 ) ] ; double yvGradient = Utils . RANDOM_VECTORS [ ( vectorIndex << 2 ) + 1 ] ; double zvGradient = Utils . RANDOM_VECTORS [ ( vectorIndex << 2 ) + 2 ] ; // Set up us another vector equal to the distance between the two vectors // passed to this function. double xvPoint = ( fx - ix ) ; double yvPoint = ( fy - iy ) ; double zvPoint = ( fz - iz ) ; // Now compute the dot product of the gradient vector with the distance // vector.  The resulting value is gradient noise.  Apply a scaling and // offset value so that this noise value ranges from 0 to 1. return ( ( xvGradient * xvPoint ) + ( yvGradient * yvPoint ) + ( zvGradient * zvPoint ) ) + 0.5 ; }


Input: Generates an integer - noise value from the coordinates of a three - dimensional input value . [CODESPLIT] public static int intValueNoise3D ( int x , int y , int z , int seed ) { // All constants are primes and must remain prime in order for this noise // function to work correctly. int n = ( X_NOISE_GEN * x + Y_NOISE_GEN * y + Z_NOISE_GEN * z + SEED_NOISE_GEN * seed ) & 0x7fffffff ; n = ( n >> 13 ) ^ n ; return ( n * ( n * n * 60493 + 19990303 ) + 1376312589 ) & 0x7fffffff ; }


Input: Generates a value - noise value from the coordinates of a three - dimensional input value . [CODESPLIT] public static double valueNoise3D ( int x , int y , int z , int seed ) { return intValueNoise3D ( x , y , z , seed ) / 2147483647.0 ; }


Input: Returns the output value from the noise module given the ( angle height ) coordinates of the specified input value located on the surface of the cylinder . [CODESPLIT] public double getValue ( double angle , double height ) { if ( module == null ) { throw new NoModuleException ( ) ; } double x , y , z ; x = Math . cos ( Math . toRadians ( angle ) ) ; y = height ; z = Math . sin ( Math . toRadians ( angle ) ) ; return module . getValue ( x , y , z ) ; }


Input: Returns the output value from the noise module given the ( latitude longitude ) coordinates of the specified input value located on the surface of the sphere . [CODESPLIT] public double getValue ( double lat , double lon ) { if ( module == null ) { throw new NoModuleException ( ) ; } double [ ] vec = Utils . latLonToXYZ ( lat , lon ) ; return module . getValue ( vec [ 0 ] , vec [ 1 ] , vec [ 2 ] ) ; }


Input: Performs cubic interpolation between two values bound between two other values [CODESPLIT] public static double cubicInterp ( double n0 , double n1 , double n2 , double n3 , double a ) { double p = ( n3 - n2 ) - ( n0 - n1 ) ; double q = ( n0 - n1 ) - p ; double r = n2 - n0 ; return p * a * a * a + q * a * a + r * a + n1 ; }


Input: maps a value onto a quitnic S - Curve [CODESPLIT] public static double sCurve5 ( double a ) { double a3 = a * a * a ; double a4 = a3 * a ; double a5 = a4 * a ; return ( 6.0 * a5 ) - ( 15.0 * a4 ) + ( 10.0 * a3 ) ; }


Input: / * Calculate the scale and biased to be a applied during Range#getValue ( int x int y int z ) Should be called when the bounds are modified [CODESPLIT] private void recalculateScaleBias ( ) { scale = ( getNewUpperBound ( ) - getNewLowerBound ( ) ) / ( getCurrentUpperBound ( ) - getCurrentLowerBound ( ) ) ; bias = getNewLowerBound ( ) - getCurrentLowerBound ( ) * scale ; }


Input: Configure bounds for range module [CODESPLIT] public void setBounds ( double currentLower , double currentUpper , double newLower , double newUpper ) { if ( currentLower == currentUpper ) { throw new IllegalArgumentException ( "currentLower must not equal currentUpper. Both are " + currentUpper ) ; } if ( newLower == newUpper ) { throw new IllegalArgumentException ( "newLowerBound must not equal newUpperBound. Both are " + newUpper ) ; } currentLowerBound = currentLower ; currentUpperBound = currentUpper ; newLowerBound = newLower ; newUpperBound = newUpper ; recalculateScaleBias ( ) ; }


Input: Processes an single event by looping available plugins . [CODESPLIT] protected void doProcess ( final CloudTrailEvent event ) { for ( final FullstopPlugin plugin : getPluginsForEvent ( event ) ) { doProcess ( event , plugin ) ; } }


Input: Processes a specific event on specified plugin . [CODESPLIT] protected void doProcess ( final CloudTrailEvent event , final FullstopPlugin plugin ) { try { plugin . processEvent ( event ) ; } catch ( HystrixRuntimeException | HttpServerErrorException e ) { log . warn ( e . getMessage ( ) , e ) ; } catch ( final Exception e ) { log . error ( e . getMessage ( ) , e ) ; } }


Input: Extracts list of instanceIds from { [CODESPLIT] public static List < String > getInstanceIds ( final CloudTrailEvent event ) { final CloudTrailEventData eventData = getEventData ( event ) ; final String responseElements = eventData . getResponseElements ( ) ; if ( isNullOrEmpty ( responseElements ) ) { return newArrayList ( ) ; } return read ( responseElements , INSTANCE_ID_JSON_PATH ) ; }


Input: Extracts the accountId . [CODESPLIT] public static String getAccountId ( final CloudTrailEvent event ) { final CloudTrailEventData eventData = getEventData ( event ) ; final UserIdentity userIdentity = checkNotNull ( eventData . getUserIdentity ( ) , USER_IDENTITY_SHOULD_NEVER_BE_NULL ) ; final String value = ofNullable ( userIdentity . getAccountId ( ) ) . orElse ( eventData . getRecipientAccountId ( ) ) ; return checkNotNull ( value , ACCOUNT_ID_OR_RECIPIENT_SHOULD_NEVER_BE_NULL ) ; }


Input: Reads the given responseElements and extracts information based on given pattern . <br / > If responseElements is null or empty you can handle the { [CODESPLIT] public static List < String > read ( final String responseElements , final String pattern , final boolean emptyListOnNullOrEmptyResponse ) { if ( isNullOrEmpty ( responseElements ) && emptyListOnNullOrEmptyResponse ) { return emptyList ( ) ; } try { return JsonPath . read ( responseElements , pattern ) ; } catch ( final PathNotFoundException e ) { if ( emptyListOnNullOrEmptyResponse ) { return emptyList ( ) ; } else { throw e ; } } }


Input: Reads the given responseElements and extracts information based on given pattern . <br / > If responseElements is null or empty raises { [CODESPLIT] public static List < String > read ( final String responseElements , final String pattern ) { return read ( responseElements , pattern , false ) ; }


Input: true if rule matches a violation and should be whitelisted . [CODESPLIT] @ Override public Boolean apply ( final RuleEntity ruleEntity , final ViolationEntity violationEntity ) { final List < Predicate < ViolationEntity > > predicates = newArrayList ( ) ; trimOptional ( ruleEntity . getAccountId ( ) ) . map ( WhitelistRulesEvaluator :: accountIsEqual ) . ifPresent ( predicates :: add ) ; trimOptional ( ruleEntity . getRegion ( ) ) . map ( WhitelistRulesEvaluator :: regionIsEqual ) . ifPresent ( predicates :: add ) ; trimOptional ( ruleEntity . getViolationTypeEntityId ( ) ) . map ( WhitelistRulesEvaluator :: violationTypeIdIsEqual ) . ifPresent ( predicates :: add ) ; trimOptional ( ruleEntity . getImageName ( ) ) . map ( WhitelistRulesEvaluator :: imageNameMatches ) . ifPresent ( predicates :: add ) ; trimOptional ( ruleEntity . getImageOwner ( ) ) . map ( WhitelistRulesEvaluator :: imageOwnerIsEqual ) . ifPresent ( predicates :: add ) ; trimOptional ( ruleEntity . getApplicationId ( ) ) . map ( WhitelistRulesEvaluator :: applicationIdIsEqual ) . ifPresent ( predicates :: add ) ; trimOptional ( ruleEntity . getApplicationVersion ( ) ) . map ( WhitelistRulesEvaluator :: applicationVersionIsEqual ) . ifPresent ( predicates :: add ) ; trimOptional ( ruleEntity . getMetaInfoJsonPath ( ) ) . map ( this :: metaInfoJsonPathExists ) . ifPresent ( predicates :: add ) ; final Optional < Predicate < ViolationEntity > > whiteListTest = predicates . stream ( ) . reduce ( Predicate :: and ) ; return whiteListTest . isPresent ( ) && whiteListTest . get ( ) . test ( violationEntity ) ; }


Input: Builds the prefix that will be prepended to the bucketname <br / > Something like 123456789 / eu - west - 1 / 2015 / 06 / 12 / [CODESPLIT] static String build ( final String accountId , final String region , final DateTime instanceLaunchTime ) { return Paths . get ( accountId , region , instanceLaunchTime . toString ( "YYYY" ) , instanceLaunchTime . toString ( "MM" ) , instanceLaunchTime . toString ( "dd" ) ) . toString ( ) + "/" ; }


Input: Get the EventSerializer based on user s configuration . [CODESPLIT] private EventSerializer getEventSerializer ( final GZIPInputStream inputStream , final CloudTrailLog ctLog ) throws IOException { final EventSerializer serializer ; if ( isEnableRawEventInfo ) { final String logFileContent = new String ( LibraryUtils . toByteArray ( inputStream ) , StandardCharsets . UTF_8 ) ; final JsonParser jsonParser = this . mapper . getFactory ( ) . createParser ( logFileContent ) ; serializer = new RawLogDeliveryEventSerializer ( logFileContent , ctLog , jsonParser ) ; } else { final JsonParser jsonParser = this . mapper . getFactory ( ) . createParser ( inputStream ) ; serializer = new DefaultEventSerializer ( ctLog , jsonParser ) ; } return serializer ; }


Input: { [CODESPLIT] @ Override public void validate ( ) { LibraryUtils . checkArgumentNotNull ( this . getAwsCredentialsProvider ( ) , ERROR_CREDENTIALS_PROVIDER_NULL ) ; LibraryUtils . checkArgumentNotNull ( this . getSqsUrl ( ) , "SQS URL is null." ) ; LibraryUtils . checkArgumentNotNull ( this . getSqsRegion ( ) , "SQS Region is null." ) ; LibraryUtils . checkArgumentNotNull ( this . getVisibilityTimeout ( ) , "Visibility Timeout is null." ) ; LibraryUtils . checkArgumentNotNull ( this . getS3Region ( ) , "S3 Region is null." ) ; LibraryUtils . checkArgumentNotNull ( this . getThreadCount ( ) , "Thread Count is null." ) ; LibraryUtils . checkArgumentNotNull ( this . getThreadTerminationDelaySeconds ( ) , "Thread Termination Delay Seconds is null." ) ; LibraryUtils . checkArgumentNotNull ( this . getMaxEventsPerEmit ( ) , "Maximum Events Per Emit is null." ) ; LibraryUtils . checkArgumentNotNull ( this . isEnableRawEventInfo ( ) , "Is Enable Raw Event Information is null." ) ; }


Input: Configure scopes for specific controller / httpmethods / roles here . [CODESPLIT] @ Override public void configure ( final HttpSecurity http ) throws Exception { http . sessionManagement ( ) . sessionCreationPolicy ( NEVER ) // configure form login . and ( ) . formLogin ( ) . disable ( ) // configure logout . logout ( ) . disable ( ) . authorizeRequests ( ) . antMatchers ( HttpMethod . OPTIONS ) . permitAll ( ) // Allow preflight CORS requests from browsers . antMatchers ( "/" ) . access ( "#oauth2.hasUidScopeAndAnyRealm('/employees', '/services')" ) . antMatchers ( "/api/**" ) . access ( "#oauth2.hasUidScopeAndAnyRealm('/employees', '/services')" ) . antMatchers ( "/s3/**" ) . access ( "#oauth2.hasUidScopeAndAnyRealm('/employees', '/services')" ) . antMatchers ( "/webjars/**" ) . permitAll ( ) . antMatchers ( "/swagger-resources" ) . permitAll ( ) . antMatchers ( "/api-docs" ) . permitAll ( ) ; }


Input: Does this extension support injection for parameters of the type described by the given { @code parameterContext } ? [CODESPLIT] @ Override public boolean supportsParameter ( ParameterContext parameterContext , ExtensionContext extensionContext ) throws ParameterResolutionException { return parameterContext . getParameter ( ) . getAnnotation ( Random . class ) != null ; }


Input: Provides a value for any parameter context which has passed the { @link #supportsParameter ( ParameterContext ExtensionContext ) } gate . [CODESPLIT] @ Override public Object resolveParameter ( ParameterContext parameterContext , ExtensionContext extensionContext ) throws ParameterResolutionException { return resolve ( parameterContext . getParameter ( ) . getType ( ) , parameterContext . getParameter ( ) . getAnnotation ( Random . class ) ) ; }


Input: Maps the random requirements expressed by the given { @code annotation } to invocations on { @link #random } . [CODESPLIT] private Object resolve ( Class < ? > targetType , Random annotation ) { if ( targetType . isAssignableFrom ( List . class ) || targetType . isAssignableFrom ( Collection . class ) ) { return random . objects ( annotation . type ( ) , annotation . size ( ) , annotation . excludes ( ) ) . collect ( Collectors . toList ( ) ) ; } else if ( targetType . isAssignableFrom ( Set . class ) ) { return random . objects ( annotation . type ( ) , annotation . size ( ) , annotation . excludes ( ) ) . collect ( Collectors . toSet ( ) ) ; } else if ( targetType . isAssignableFrom ( Stream . class ) ) { return random . objects ( annotation . type ( ) , annotation . size ( ) , annotation . excludes ( ) ) ; } else { return random . nextObject ( targetType , annotation . excludes ( ) ) ; } }


Input: Create a file within the temporary folder root . [CODESPLIT] public File createFile ( String fileName ) throws IOException { Path path = Paths . get ( rootFolder . getPath ( ) , fileName ) ; return Files . createFile ( path ) . toFile ( ) ; }


Input: Create a directory within the temporary folder root . [CODESPLIT] public File createDirectory ( String directoryName ) { Path path = Paths . get ( rootFolder . getPath ( ) , directoryName ) ; try { return Files . createDirectory ( path ) . toFile ( ) ; } catch ( IOException ex ) { throw new TemporaryFolderException ( String . format ( "Failed to create directory: '%s'" , path . toString ( ) ) , ex ) ; } }


Input: Deletes the { @link #rootFolder } and all of its contents . This is package protected because a { @link TemporaryFolder } s lifecycle is expected to be controlled by its associated extension . [CODESPLIT] void destroy ( ) throws IOException { if ( rootFolder . exists ( ) ) { // walk the contents deleting each Files . walkFileTree ( rootFolder . toPath ( ) , new SimpleFileVisitor < Path > ( ) { @ Override public FileVisitResult visitFile ( Path file , BasicFileAttributes attributes ) throws IOException { return delete ( file ) ; } @ Override public FileVisitResult postVisitDirectory ( Path directory , IOException exception ) throws IOException { return delete ( directory ) ; } @ SuppressWarnings ( "SameReturnValue" ) private FileVisitResult delete ( Path file ) throws IOException { Files . delete ( file ) ; return CONTINUE ; } } ) ; if ( rootFolder . exists ( ) ) { // delete the parent, if it still exists Files . delete ( rootFolder . toPath ( ) ) ; } } }


Input: Does this extension support injection for parameters of the type described by the given { @code parameterContext } ? [CODESPLIT] @ Override public boolean supportsParameter ( ParameterContext parameterContext , ExtensionContext extensionContext ) throws ParameterResolutionException { return appliesTo ( parameterContext . getParameter ( ) . getType ( ) ) ; }


Input: Provides a value for any parameter context which has passed the { @link #supportsParameter ( ParameterContext ExtensionContext ) } gate . [CODESPLIT] @ Override public Object resolveParameter ( ParameterContext parameterContext , ExtensionContext extensionContext ) throws ParameterResolutionException { return extensionContext . getStore ( NAMESPACE ) . getOrComputeIfAbsent ( parameterContext , key -> new TemporaryFolder ( ) , TemporaryFolder . class ) ; }


Input: Maps the expectations expressed in the given { @code annotation } to a { @link Predicate } . [CODESPLIT] private Predicate < String > getPredicate ( ExpectedException annotation ) { if ( has ( annotation . messageStartsWith ( ) ) ) { return s -> s . startsWith ( annotation . messageStartsWith ( ) ) ; } else if ( has ( annotation . messageContains ( ) ) ) { return s -> s . contains ( annotation . messageContains ( ) ) ; } else if ( has ( annotation . messageIs ( ) ) ) { return s -> s . equals ( annotation . messageIs ( ) ) ; } else { // the default return s -> true ; } }


Input: Creates a { @link ExtensionContext . Store } for a given { @code extensionContext } . A { @link ExtensionContext . Store } is bound to an { @link ExtensionContext } so different test invocations do not share the same store . For example a test invocation on { @code ClassA . testMethodA } will have a different { @link ExtensionContext . Store } instance to that associated with a test invocation on { @code ClassA . testMethodB } or test invocation on { @code ClassC . testMethodC } . [CODESPLIT] public static ExtensionContext . Store getStore ( ExtensionContext extensionContext , Class clazz ) { return extensionContext . getStore ( namespace ( extensionContext , clazz ) ) ; }


Input: Creates a { @link ExtensionContext . Namespace } in which extension state is stored on creation for post execution destruction . Storing data in a custom namespace prevents accidental cross pollination of data between extensions and between different invocations within the lifecycle of a single extension . [CODESPLIT] private static ExtensionContext . Namespace namespace ( ExtensionContext extensionContext , Class clazz ) { return ExtensionContext . Namespace . create ( clazz , extensionContext ) ; }


Input: If the current test class has a system property annotation ( s ) then create a { @link RestoreContext } representing the annotation ( s ) . This causes the requested system properties to be set and retains a copy of pre - set values for reinstatement after test execution . [CODESPLIT] @ Override public void beforeAll ( ExtensionContext extensionContext ) throws Exception { List < SystemProperty > systemProperties = getSystemProperties ( extensionContext . getRequiredTestClass ( ) ) ; if ( ! systemProperties . isEmpty ( ) ) { RestoreContext . Builder builder = RestoreContext . createBuilder ( ) ; for ( SystemProperty systemProperty : systemProperties ) { builder . addPropertyName ( systemProperty . name ( ) ) ; if ( System . getProperty ( systemProperty . name ( ) ) != null ) { builder . addRestoreProperty ( systemProperty . name ( ) , System . getProperty ( systemProperty . name ( ) ) ) ; } set ( systemProperty ) ; } writeRestoreContext ( extensionContext , builder . build ( ) ) ; } }


Input: If a { @link RestoreContext } exists for the given { @code extensionContext } then restore it i . e . unset any system properties which were set in { @link #beforeAll ( ExtensionContext ) } for this { @code extensionContext } and reinstate original value if applicable . [CODESPLIT] @ Override public void afterAll ( ExtensionContext extensionContext ) throws Exception { RestoreContext restoreContext = readRestoreContext ( extensionContext ) ; if ( restoreContext != null ) { restoreContext . restore ( ) ; } }


Input: Get a collection of { @link SystemProperty } for the given { @code annotatedElement } . If the given { @code annotatedElement } has no such annotations then an empty list is returned if the given { @code annotatedElement } is annotated with { @link SystemProperty } then a list with one element is returned if the given { @code annotatedElement } is annotated with { @link SystemProperties } then a list with one element for each of the repeated { @link SystemProperty } values is returned . [CODESPLIT] private List < SystemProperty > getSystemProperties ( AnnotatedElement annotatedElement ) { List < SystemProperty > systemProperties = new ArrayList <> ( ) ; if ( isAnnotated ( annotatedElement , SystemProperties . class ) ) { // gather the repeating system property values systemProperties . addAll ( Arrays . asList ( annotatedElement . getAnnotation ( SystemProperties . class ) . value ( ) ) ) ; } if ( isAnnotated ( annotatedElement , SystemProperty . class ) ) { // add the single system property value systemProperties . add ( annotatedElement . getAnnotation ( SystemProperty . class ) ) ; } return systemProperties ; }


Input: Reverse the system property sets performed on behalf of this restore context . [CODESPLIT] public void restore ( ) { for ( String propertyName : propertyNames ) { if ( restoreProperties . containsKey ( propertyName ) ) { // reinstate the original value System . setProperty ( propertyName , restoreProperties . get ( propertyName ) ) ; } else { // remove the (previously unset) property System . clearProperty ( propertyName ) ; } } }


Input: } [CODESPLIT] public static Stream < JarEntry > asStream ( final JarInputStream pInputStream ) { return StreamSupport . stream ( Spliterators . spliteratorUnknownSize ( new Iterator < JarEntry > ( ) { JarEntry entry = null ; public boolean hasNext ( ) { try { if ( entry == null ) { entry = pInputStream . getNextJarEntry ( ) ; } return entry != null ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } public JarEntry next ( ) { try { JarEntry result = entry != null ? entry : pInputStream . getNextJarEntry ( ) ; entry = null ; return result ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } } , Spliterator . IMMUTABLE ) , false ) ; }


Input: / * public static Set<String > getDependenciesOfJar ( final InputStream pInputStream ) throws IOException { [CODESPLIT] public static Set < String > getDependenciesOfClass ( final InputStream pInputStream ) throws IOException { final DependenciesClassAdapter v = new DependenciesClassAdapter ( ) ; new ClassReader ( pInputStream ) . accept ( v , ClassReader . EXPAND_FRAMES ) ; final Set < String > depNames = v . getDependencies ( ) ; return depNames ; }


Input: __ / __ / __ / __ / __ / __ / __ / __ / __ / __ / [CODESPLIT] public static < T extends AbsListView > RxAction < T , String > setFilterText ( ) { return new RxAction < T , String > ( ) { @ Override public void call ( T view , String filterText ) { if ( TextUtils . isEmpty ( filterText ) ) { view . clearTextFilter ( ) ; } else { view . setFilterText ( filterText ) ; } } } ; }


Input: __ / __ / __ / __ / __ / __ / __ / __ / __ / __ / [CODESPLIT] public static < T extends ImageView > RxAction < T , Integer > setImageLevel ( ) { return new RxAction < T , Integer > ( ) { @ Override public void call ( T view , Integer level ) { view . setImageLevel ( level ) ; } } ; }


Input: __ / __ / __ / __ / __ / __ / __ / __ / __ / __ / [CODESPLIT] public static < T extends TextView > RxAction < T , Float > setTextSize ( ) { return new RxAction < T , Float > ( ) { @ Override public void call ( T view , Float size ) { view . setTextSize ( TypedValue . COMPLEX_UNIT_SP , size ) ; } } ; }


Input: __ / __ / __ / __ / __ / __ / __ / __ / __ / __ / [CODESPLIT] public static < T extends View > RxAction < T , Integer > setBackgroundColor ( ) { return new RxAction < T , Integer > ( ) { @ Override public void call ( T view , Integer color ) { view . setBackgroundColor ( color ) ; } } ; }


Input: Create the map implementation [CODESPLIT] private Map < K , V > createImplementation ( ) { if ( delegate instanceof HashMap == false ) return new HashMap < K , V > ( delegate ) ; return delegate ; }


Input: Add an object to the collection . [CODESPLIT] public boolean add ( final Object obj ) { maintain ( ) ; SoftObject soft = SoftObject . create ( obj , queue ) ; return collection . add ( soft ) ; }


Input: Create a <tt > SoftObject< / tt > for the given object . [CODESPLIT] public static SoftObject create ( final Object obj , final ReferenceQueue queue ) { if ( obj == null ) return null ; else return new SoftObject ( obj , queue ) ; }


Input: Set a property [CODESPLIT] public static String set ( String name , String value ) { return PropertyManager . setProperty ( name , value ) ; }


Input: Get a property [CODESPLIT] public static String get ( String name , String defaultValue ) { return PropertyManager . getProperty ( name , defaultValue ) ; }


Input: Get an array style property [CODESPLIT] public static String [ ] getArray ( String base , String [ ] defaultValues ) { return PropertyManager . getArrayProperty ( base , defaultValues ) ; }


Input: Transition to the next state given the name of a valid transition . [CODESPLIT] public State nextState ( String actionName ) throws IllegalTransitionException { Transition t = currentState . getTransition ( actionName ) ; if ( t == null ) { String msg = "No transition for action: '" + actionName + "' from state: '" + currentState . getName ( ) + "'" ; throw new IllegalTransitionException ( msg ) ; } State nextState = t . getTarget ( ) ; log . trace ( "nextState(" + actionName + ") = " + nextState ) ; currentState = nextState ; return currentState ; }


Input: Iterate through the gcqueue for for any cleared reference remove the associated value from the underlying set . [CODESPLIT] private void processQueue ( ) { ComparableSoftReference cr ; while ( ( cr = ( ComparableSoftReference ) gcqueue . poll ( ) ) != null ) { map . remove ( cr . getKey ( ) ) ; } }


Input: Get the information for a type [CODESPLIT] @ SuppressWarnings ( { "unchecked" , "cast" } ) public T get ( Type type ) { if ( type == null ) throw new IllegalArgumentException ( "Null type" ) ; if ( type instanceof ParameterizedType ) return getParameterizedType ( ( ParameterizedType ) type ) ; else if ( type instanceof Class ) return getClass ( ( Class < ? > ) type ) ; else if ( type instanceof TypeVariable ) // TODO Figure out why we need this cast with the Sun compiler?  return ( T ) getTypeVariable ( ( TypeVariable ) type ) ; else if ( type instanceof GenericArrayType ) return getGenericArrayType ( ( GenericArrayType ) type ) ; else if ( type instanceof WildcardType ) return getWildcardType ( ( WildcardType ) type ) ; else throw new UnsupportedOperationException ( "Unknown type: " + type + " class=" + type . getClass ( ) ) ; }


Input: Get the information for a class [CODESPLIT] public T get ( String name , ClassLoader cl ) throws ClassNotFoundException { if ( name == null ) throw new IllegalArgumentException ( "Null name" ) ; if ( cl == null ) throw new IllegalArgumentException ( "Null classloader" ) ; Class < ? > clazz = cl . loadClass ( name ) ; return get ( clazz ) ; }


Input: Get the information for a parameterized type [CODESPLIT] protected T getParameterizedType ( ParameterizedType type ) { // First check if we already have it T result = peek ( type ) ; if ( result != null ) return result ; // Instantiate result = instantiate ( type ) ; // Put the perlimanary result into the cache put ( type , result ) ; // Generate the details generate ( type , result ) ; return result ; }


Input: Get the information for a type variable [CODESPLIT] protected < D extends GenericDeclaration > T getTypeVariable ( TypeVariable < D > type ) { // TODO JBMICROCONT-131 improve this return get ( type . getBounds ( ) [ 0 ] ) ; }


Input: Peek into the cache [CODESPLIT] protected T peek ( ParameterizedType type ) { Class < ? > rawType = ( Class < ? > ) type . getRawType ( ) ; ClassLoader cl = SecurityActions . getClassLoader ( rawType ) ; Map < String , T > classLoaderCache = getClassLoaderCache ( cl ) ; synchronized ( classLoaderCache ) { return classLoaderCache . get ( type . toString ( ) ) ; } }


Input: Put a result into the cache [CODESPLIT] protected void put ( ParameterizedType type , T result ) { Class < ? > rawType = ( Class < ? > ) type . getRawType ( ) ; ClassLoader cl = SecurityActions . getClassLoader ( rawType ) ; Map < String , T > classLoaderCache = getClassLoaderCache ( cl ) ; synchronized ( classLoaderCache ) { // TODO JBMICROCONT-131 something better than toString()? classLoaderCache . put ( type . toString ( ) , result ) ; } }


Input: Get the information for a class [CODESPLIT] protected T getClass ( Class < ? > clazz ) { // First check if we already have it T result = peek ( clazz ) ; if ( result != null ) return result ; // Instantiate result = instantiate ( clazz ) ; // Put the preliminary result into the cache put ( clazz , result ) ; // Generate the details generate ( clazz , result ) ; return result ; }


Input: Peek into the cache [CODESPLIT] protected T peek ( Class < ? > clazz ) { ClassLoader cl = SecurityActions . getClassLoader ( clazz ) ; Map < String , T > classLoaderCache = getClassLoaderCache ( cl ) ; synchronized ( classLoaderCache ) { return classLoaderCache . get ( clazz . getName ( ) ) ; } }


Input: Put a result into the cache [CODESPLIT] protected void put ( Class < ? > clazz , T result ) { ClassLoader cl = SecurityActions . getClassLoader ( clazz ) ; Map < String , T > classLoaderCache = getClassLoaderCache ( cl ) ; synchronized ( classLoaderCache ) { classLoaderCache . put ( clazz . getName ( ) , result ) ; } }


Input: Get the cache for the classloader [CODESPLIT] protected Map < String , T > getClassLoaderCache ( ClassLoader cl ) { synchronized ( cache ) { Map < String , T > result = cache . get ( cl ) ; if ( result == null ) { result = new WeakValueHashMap < String , T > ( ) ; cache . put ( cl , result ) ; } return result ; } }


Input: Prints the composite message and the embedded stack trace to the specified print stream . [CODESPLIT] public void printStackTrace ( final PrintStream stream ) { if ( nested == null || NestedThrowable . PARENT_TRACE_ENABLED ) { super . printStackTrace ( stream ) ; } NestedThrowable . Util . print ( nested , stream ) ; }


Input: Prints the composite message and the embedded stack trace to the specified print writer . [CODESPLIT] public void printStackTrace ( final PrintWriter writer ) { if ( nested == null || NestedThrowable . PARENT_TRACE_ENABLED ) { super . printStackTrace ( writer ) ; } NestedThrowable . Util . print ( nested , writer ) ; }


Input: Build a Class [] from a comma / whitespace seperated list of classes [CODESPLIT] public void setAsText ( final String text ) throws IllegalArgumentException { ClassLoader loader = Thread . currentThread ( ) . getContextClassLoader ( ) ; StringTokenizer tokenizer = new StringTokenizer ( text , ", \t\r\n" ) ; ArrayList < Class < ? > > classes = new ArrayList < Class < ? > > ( ) ; while ( tokenizer . hasMoreTokens ( ) == true ) { String name = tokenizer . nextToken ( ) ; try { Class < ? > c = loader . loadClass ( name ) ; classes . add ( c ) ; } catch ( ClassNotFoundException e ) { throw new IllegalArgumentException ( "Failed to find class: " + name ) ; } } Class < ? > [ ] theValue = new Class [ classes . size ( ) ] ; classes . toArray ( theValue ) ; setValue ( theValue ) ; }


Input: Override replaceObject to check for Remote objects that are not RemoteStubs . [CODESPLIT] protected Object replaceObject ( Object obj ) throws IOException { if ( ( obj instanceof Remote ) && ! ( obj instanceof RemoteStub ) ) { Remote remote = ( Remote ) obj ; try { obj = RemoteObject . toStub ( remote ) ; } catch ( IOException ignore ) { // Let the Serialization layer try with the orignal obj } } return obj ; }


Input: Called by the thread pool executor [CODESPLIT] public void run ( ) { // Get the execution thread this . runThread = Thread . currentThread ( ) ; // Check for a start timeout long runTime = getElapsedTime ( ) ; if ( startTimeout > 0l && runTime >= startTimeout ) { taskRejected ( new StartTimeoutException ( "Start Timeout exceeded for task " + taskString ) ) ; return ; } // We are about to start, check for a stop boolean stopped = false ; synchronized ( stateLock ) { if ( state == TASK_STOPPED ) { stopped = true ; } else { state = TASK_STARTED ; taskStarted ( ) ; if ( waitType == Task . WAIT_FOR_START ) stateLock . notifyAll ( ) ; } } if ( stopped ) { taskRejected ( new TaskStoppedException ( "Task stopped for task " + taskString ) ) ; return ; } // Run the task Throwable throwable = null ; try { task . execute ( ) ; } catch ( Throwable t ) { throwable = t ; } // It is complete taskCompleted ( throwable ) ; // We are completed synchronized ( stateLock ) { state = TASK_COMPLETED ; if ( waitType == Task . WAIT_FOR_COMPLETE ) stateLock . notifyAll ( ) ; } }


Input: Set thetask for this wrapper [CODESPLIT] protected void setTask ( Task task ) { if ( task == null ) throw new IllegalArgumentException ( "Null task" ) ; this . task = task ; this . taskString = task . toString ( ) ; this . startTime = System . currentTimeMillis ( ) ; this . waitType = task . getWaitType ( ) ; this . priority = task . getPriority ( ) ; this . startTimeout = task . getStartTimeout ( ) ; this . completionTimeout = task . getCompletionTimeout ( ) ; }


Input: Notify the task it has been accepted [CODESPLIT] protected boolean taskAccepted ( ) { try { task . accepted ( getElapsedTime ( ) ) ; return true ; } catch ( Throwable t ) { log . warn ( "Unexpected error during 'accepted' for task: " + taskString , t ) ; return false ; } }


Input: Notify the task it has been rejected [CODESPLIT] protected boolean taskRejected ( RuntimeException e ) { try { task . rejected ( getElapsedTime ( ) , e ) ; return true ; } catch ( Throwable t ) { log . warn ( "Unexpected error during 'rejected' for task: " + taskString , t ) ; if ( e != null ) log . warn ( "Original reason for rejection of task: " + taskString , e ) ; return false ; } }


Input: Notify the task it has started [CODESPLIT] protected boolean taskStarted ( ) { try { task . started ( getElapsedTime ( ) ) ; return true ; } catch ( Throwable t ) { log . warn ( "Unexpected error during 'started' for task: " + taskString , t ) ; return false ; } }


Input: Notify the task it has completed [CODESPLIT] protected boolean taskCompleted ( Throwable throwable ) { try { task . completed ( getElapsedTime ( ) , throwable ) ; return true ; } catch ( Throwable t ) { log . warn ( "Unexpected error during 'completed' for task: " + taskString , t ) ; if ( throwable != null ) log . warn ( "Original error during 'run' for task: " + taskString , throwable ) ; return false ; } }


Input: Stop the task [CODESPLIT] protected boolean taskStop ( ) { try { task . stop ( ) ; return true ; } catch ( Throwable t ) { log . warn ( "Unexpected error during 'stop' for task: " + taskString , t ) ; return false ; } }