idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
26,100 | public ServiceCall < AudioResources > listAudio ( ListAudioOptions listAudioOptions ) { Validator . notNull ( listAudioOptions , "listAudioOptions cannot be null" ) ; String [ ] pathSegments = { "v1/acoustic_customizations" , "audio" } ; String [ ] pathParameters = { listAudioOptions . customizationId ( ) } ; RequestBuilder builder = RequestBuilder . get ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "speech_to_text" , "v1" , "listAudio" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( AudioResources . class ) ) ; } | List audio resources . | 235 | 4 |
26,101 | public ServiceCall < MessageResponse > message ( MessageOptions messageOptions ) { Validator . notNull ( messageOptions , "messageOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "message" } ; String [ ] pathParameters = { messageOptions . workspaceId ( ) } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "message" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( messageOptions . nodesVisitedDetails ( ) != null ) { builder . query ( "nodes_visited_details" , String . valueOf ( messageOptions . nodesVisitedDetails ( ) ) ) ; } final JsonObject contentJson = new JsonObject ( ) ; if ( messageOptions . input ( ) != null ) { contentJson . add ( "input" , GsonSingleton . getGson ( ) . toJsonTree ( messageOptions . input ( ) ) ) ; } if ( messageOptions . intents ( ) != null ) { contentJson . add ( "intents" , GsonSingleton . getGson ( ) . toJsonTree ( messageOptions . intents ( ) ) ) ; } if ( messageOptions . entities ( ) != null ) { contentJson . add ( "entities" , GsonSingleton . getGson ( ) . toJsonTree ( messageOptions . entities ( ) ) ) ; } if ( messageOptions . alternateIntents ( ) != null ) { contentJson . addProperty ( "alternate_intents" , messageOptions . alternateIntents ( ) ) ; } if ( messageOptions . context ( ) != null ) { contentJson . add ( "context" , GsonSingleton . getGson ( ) . toJsonTree ( messageOptions . context ( ) ) ) ; } if ( messageOptions . output ( ) != null ) { contentJson . add ( "output" , GsonSingleton . getGson ( ) . toJsonTree ( messageOptions . output ( ) ) ) ; } builder . bodyJson ( contentJson ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( MessageResponse . class ) ) ; } | Get response to user input . | 592 | 6 |
26,102 | public ServiceCall < Workspace > createWorkspace ( CreateWorkspaceOptions createWorkspaceOptions ) { String [ ] pathSegments = { "v1/workspaces" } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "createWorkspace" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( createWorkspaceOptions != null ) { final JsonObject contentJson = new JsonObject ( ) ; if ( createWorkspaceOptions . name ( ) != null ) { contentJson . addProperty ( "name" , createWorkspaceOptions . name ( ) ) ; } if ( createWorkspaceOptions . description ( ) != null ) { contentJson . addProperty ( "description" , createWorkspaceOptions . description ( ) ) ; } if ( createWorkspaceOptions . language ( ) != null ) { contentJson . addProperty ( "language" , createWorkspaceOptions . language ( ) ) ; } if ( createWorkspaceOptions . metadata ( ) != null ) { contentJson . add ( "metadata" , GsonSingleton . getGson ( ) . toJsonTree ( createWorkspaceOptions . metadata ( ) ) ) ; } if ( createWorkspaceOptions . learningOptOut ( ) != null ) { contentJson . addProperty ( "learning_opt_out" , createWorkspaceOptions . learningOptOut ( ) ) ; } if ( createWorkspaceOptions . systemSettings ( ) != null ) { contentJson . add ( "system_settings" , GsonSingleton . getGson ( ) . toJsonTree ( createWorkspaceOptions . systemSettings ( ) ) ) ; } if ( createWorkspaceOptions . intents ( ) != null ) { contentJson . add ( "intents" , GsonSingleton . getGson ( ) . toJsonTree ( createWorkspaceOptions . intents ( ) ) ) ; } if ( createWorkspaceOptions . entities ( ) != null ) { contentJson . add ( "entities" , GsonSingleton . getGson ( ) . toJsonTree ( createWorkspaceOptions . entities ( ) ) ) ; } if ( createWorkspaceOptions . dialogNodes ( ) != null ) { contentJson . add ( "dialog_nodes" , GsonSingleton . getGson ( ) . toJsonTree ( createWorkspaceOptions . dialogNodes ( ) ) ) ; } if ( createWorkspaceOptions . counterexamples ( ) != null ) { contentJson . add ( "counterexamples" , GsonSingleton . getGson ( ) . toJsonTree ( createWorkspaceOptions . counterexamples ( ) ) ) ; } builder . bodyJson ( contentJson ) ; } return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( Workspace . class ) ) ; } | Create workspace . | 728 | 3 |
26,103 | public ServiceCall < Workspace > getWorkspace ( GetWorkspaceOptions getWorkspaceOptions ) { Validator . notNull ( getWorkspaceOptions , "getWorkspaceOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" } ; String [ ] pathParameters = { getWorkspaceOptions . workspaceId ( ) } ; RequestBuilder builder = RequestBuilder . get ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "getWorkspace" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( getWorkspaceOptions . export ( ) != null ) { builder . query ( "export" , String . valueOf ( getWorkspaceOptions . export ( ) ) ) ; } if ( getWorkspaceOptions . includeAudit ( ) != null ) { builder . query ( "include_audit" , String . valueOf ( getWorkspaceOptions . includeAudit ( ) ) ) ; } if ( getWorkspaceOptions . sort ( ) != null ) { builder . query ( "sort" , getWorkspaceOptions . sort ( ) ) ; } return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( Workspace . class ) ) ; } | Get information about a workspace . | 363 | 6 |
26,104 | public ServiceCall < WorkspaceCollection > listWorkspaces ( ListWorkspacesOptions listWorkspacesOptions ) { String [ ] pathSegments = { "v1/workspaces" } ; RequestBuilder builder = RequestBuilder . get ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "listWorkspaces" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( listWorkspacesOptions != null ) { if ( listWorkspacesOptions . pageLimit ( ) != null ) { builder . query ( "page_limit" , String . valueOf ( listWorkspacesOptions . pageLimit ( ) ) ) ; } if ( listWorkspacesOptions . includeCount ( ) != null ) { builder . query ( "include_count" , String . valueOf ( listWorkspacesOptions . includeCount ( ) ) ) ; } if ( listWorkspacesOptions . sort ( ) != null ) { builder . query ( "sort" , listWorkspacesOptions . sort ( ) ) ; } if ( listWorkspacesOptions . cursor ( ) != null ) { builder . query ( "cursor" , listWorkspacesOptions . cursor ( ) ) ; } if ( listWorkspacesOptions . includeAudit ( ) != null ) { builder . query ( "include_audit" , String . valueOf ( listWorkspacesOptions . includeAudit ( ) ) ) ; } } return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( WorkspaceCollection . class ) ) ; } | List workspaces . | 414 | 4 |
26,105 | public ServiceCall < Workspace > updateWorkspace ( UpdateWorkspaceOptions updateWorkspaceOptions ) { Validator . notNull ( updateWorkspaceOptions , "updateWorkspaceOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" } ; String [ ] pathParameters = { updateWorkspaceOptions . workspaceId ( ) } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "updateWorkspace" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( updateWorkspaceOptions . append ( ) != null ) { builder . query ( "append" , String . valueOf ( updateWorkspaceOptions . append ( ) ) ) ; } final JsonObject contentJson = new JsonObject ( ) ; if ( updateWorkspaceOptions . name ( ) != null ) { contentJson . addProperty ( "name" , updateWorkspaceOptions . name ( ) ) ; } if ( updateWorkspaceOptions . description ( ) != null ) { contentJson . addProperty ( "description" , updateWorkspaceOptions . description ( ) ) ; } if ( updateWorkspaceOptions . language ( ) != null ) { contentJson . addProperty ( "language" , updateWorkspaceOptions . language ( ) ) ; } if ( updateWorkspaceOptions . metadata ( ) != null ) { contentJson . add ( "metadata" , GsonSingleton . getGson ( ) . toJsonTree ( updateWorkspaceOptions . metadata ( ) ) ) ; } if ( updateWorkspaceOptions . learningOptOut ( ) != null ) { contentJson . addProperty ( "learning_opt_out" , updateWorkspaceOptions . learningOptOut ( ) ) ; } if ( updateWorkspaceOptions . systemSettings ( ) != null ) { contentJson . add ( "system_settings" , GsonSingleton . getGson ( ) . toJsonTree ( updateWorkspaceOptions . systemSettings ( ) ) ) ; } if ( updateWorkspaceOptions . intents ( ) != null ) { contentJson . add ( "intents" , GsonSingleton . getGson ( ) . toJsonTree ( updateWorkspaceOptions . intents ( ) ) ) ; } if ( updateWorkspaceOptions . entities ( ) != null ) { contentJson . add ( "entities" , GsonSingleton . getGson ( ) . toJsonTree ( updateWorkspaceOptions . entities ( ) ) ) ; } if ( updateWorkspaceOptions . dialogNodes ( ) != null ) { contentJson . add ( "dialog_nodes" , GsonSingleton . getGson ( ) . toJsonTree ( updateWorkspaceOptions . dialogNodes ( ) ) ) ; } if ( updateWorkspaceOptions . counterexamples ( ) != null ) { contentJson . add ( "counterexamples" , GsonSingleton . getGson ( ) . toJsonTree ( updateWorkspaceOptions . counterexamples ( ) ) ) ; } builder . bodyJson ( contentJson ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( Workspace . class ) ) ; } | Update workspace . | 799 | 3 |
26,106 | public ServiceCall < Intent > createIntent ( CreateIntentOptions createIntentOptions ) { Validator . notNull ( createIntentOptions , "createIntentOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "intents" } ; String [ ] pathParameters = { createIntentOptions . workspaceId ( ) } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "createIntent" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; final JsonObject contentJson = new JsonObject ( ) ; contentJson . addProperty ( "intent" , createIntentOptions . intent ( ) ) ; if ( createIntentOptions . description ( ) != null ) { contentJson . addProperty ( "description" , createIntentOptions . description ( ) ) ; } if ( createIntentOptions . examples ( ) != null ) { contentJson . add ( "examples" , GsonSingleton . getGson ( ) . toJsonTree ( createIntentOptions . examples ( ) ) ) ; } builder . bodyJson ( contentJson ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( Intent . class ) ) ; } | Create intent . | 384 | 3 |
26,107 | public ServiceCall < Intent > getIntent ( GetIntentOptions getIntentOptions ) { Validator . notNull ( getIntentOptions , "getIntentOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "intents" } ; String [ ] pathParameters = { getIntentOptions . workspaceId ( ) , getIntentOptions . intent ( ) } ; RequestBuilder builder = RequestBuilder . get ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "getIntent" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( getIntentOptions . export ( ) != null ) { builder . query ( "export" , String . valueOf ( getIntentOptions . export ( ) ) ) ; } if ( getIntentOptions . includeAudit ( ) != null ) { builder . query ( "include_audit" , String . valueOf ( getIntentOptions . includeAudit ( ) ) ) ; } return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( Intent . class ) ) ; } | Get intent . | 342 | 3 |
26,108 | public ServiceCall < IntentCollection > listIntents ( ListIntentsOptions listIntentsOptions ) { Validator . notNull ( listIntentsOptions , "listIntentsOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "intents" } ; String [ ] pathParameters = { listIntentsOptions . workspaceId ( ) } ; RequestBuilder builder = RequestBuilder . get ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "listIntents" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( listIntentsOptions . export ( ) != null ) { builder . query ( "export" , String . valueOf ( listIntentsOptions . export ( ) ) ) ; } if ( listIntentsOptions . pageLimit ( ) != null ) { builder . query ( "page_limit" , String . valueOf ( listIntentsOptions . pageLimit ( ) ) ) ; } if ( listIntentsOptions . includeCount ( ) != null ) { builder . query ( "include_count" , String . valueOf ( listIntentsOptions . includeCount ( ) ) ) ; } if ( listIntentsOptions . sort ( ) != null ) { builder . query ( "sort" , listIntentsOptions . sort ( ) ) ; } if ( listIntentsOptions . cursor ( ) != null ) { builder . query ( "cursor" , listIntentsOptions . cursor ( ) ) ; } if ( listIntentsOptions . includeAudit ( ) != null ) { builder . query ( "include_audit" , String . valueOf ( listIntentsOptions . includeAudit ( ) ) ) ; } return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( IntentCollection . class ) ) ; } | List intents . | 488 | 4 |
26,109 | public ServiceCall < Intent > updateIntent ( UpdateIntentOptions updateIntentOptions ) { Validator . notNull ( updateIntentOptions , "updateIntentOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "intents" } ; String [ ] pathParameters = { updateIntentOptions . workspaceId ( ) , updateIntentOptions . intent ( ) } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "updateIntent" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; final JsonObject contentJson = new JsonObject ( ) ; if ( updateIntentOptions . newIntent ( ) != null ) { contentJson . addProperty ( "intent" , updateIntentOptions . newIntent ( ) ) ; } if ( updateIntentOptions . newDescription ( ) != null ) { contentJson . addProperty ( "description" , updateIntentOptions . newDescription ( ) ) ; } if ( updateIntentOptions . newExamples ( ) != null ) { contentJson . add ( "examples" , GsonSingleton . getGson ( ) . toJsonTree ( updateIntentOptions . newExamples ( ) ) ) ; } builder . bodyJson ( contentJson ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( Intent . class ) ) ; } | Update intent . | 416 | 3 |
26,110 | public ServiceCall < Example > createExample ( CreateExampleOptions createExampleOptions ) { Validator . notNull ( createExampleOptions , "createExampleOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "intents" , "examples" } ; String [ ] pathParameters = { createExampleOptions . workspaceId ( ) , createExampleOptions . intent ( ) } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "createExample" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; final JsonObject contentJson = new JsonObject ( ) ; contentJson . addProperty ( "text" , createExampleOptions . text ( ) ) ; if ( createExampleOptions . mentions ( ) != null ) { contentJson . add ( "mentions" , GsonSingleton . getGson ( ) . toJsonTree ( createExampleOptions . mentions ( ) ) ) ; } builder . bodyJson ( contentJson ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( Example . class ) ) ; } | Create user input example . | 351 | 5 |
26,111 | public ServiceCall < Example > getExample ( GetExampleOptions getExampleOptions ) { Validator . notNull ( getExampleOptions , "getExampleOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "intents" , "examples" } ; String [ ] pathParameters = { getExampleOptions . workspaceId ( ) , getExampleOptions . intent ( ) , getExampleOptions . text ( ) } ; RequestBuilder builder = RequestBuilder . get ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "getExample" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( getExampleOptions . includeAudit ( ) != null ) { builder . query ( "include_audit" , String . valueOf ( getExampleOptions . includeAudit ( ) ) ) ; } return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( Example . class ) ) ; } | Get user input example . | 306 | 5 |
26,112 | public ServiceCall < ExampleCollection > listExamples ( ListExamplesOptions listExamplesOptions ) { Validator . notNull ( listExamplesOptions , "listExamplesOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "intents" , "examples" } ; String [ ] pathParameters = { listExamplesOptions . workspaceId ( ) , listExamplesOptions . intent ( ) } ; RequestBuilder builder = RequestBuilder . get ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "listExamples" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( listExamplesOptions . pageLimit ( ) != null ) { builder . query ( "page_limit" , String . valueOf ( listExamplesOptions . pageLimit ( ) ) ) ; } if ( listExamplesOptions . includeCount ( ) != null ) { builder . query ( "include_count" , String . valueOf ( listExamplesOptions . includeCount ( ) ) ) ; } if ( listExamplesOptions . sort ( ) != null ) { builder . query ( "sort" , listExamplesOptions . sort ( ) ) ; } if ( listExamplesOptions . cursor ( ) != null ) { builder . query ( "cursor" , listExamplesOptions . cursor ( ) ) ; } if ( listExamplesOptions . includeAudit ( ) != null ) { builder . query ( "include_audit" , String . valueOf ( listExamplesOptions . includeAudit ( ) ) ) ; } return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( ExampleCollection . class ) ) ; } | List user input examples . | 445 | 5 |
26,113 | public ServiceCall < Counterexample > getCounterexample ( GetCounterexampleOptions getCounterexampleOptions ) { Validator . notNull ( getCounterexampleOptions , "getCounterexampleOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "counterexamples" } ; String [ ] pathParameters = { getCounterexampleOptions . workspaceId ( ) , getCounterexampleOptions . text ( ) } ; RequestBuilder builder = RequestBuilder . get ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "getCounterexample" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( getCounterexampleOptions . includeAudit ( ) != null ) { builder . query ( "include_audit" , String . valueOf ( getCounterexampleOptions . includeAudit ( ) ) ) ; } return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( Counterexample . class ) ) ; } | Get counterexample . | 331 | 6 |
26,114 | public ServiceCall < CounterexampleCollection > listCounterexamples ( ListCounterexamplesOptions listCounterexamplesOptions ) { Validator . notNull ( listCounterexamplesOptions , "listCounterexamplesOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "counterexamples" } ; String [ ] pathParameters = { listCounterexamplesOptions . workspaceId ( ) } ; RequestBuilder builder = RequestBuilder . get ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "listCounterexamples" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( listCounterexamplesOptions . pageLimit ( ) != null ) { builder . query ( "page_limit" , String . valueOf ( listCounterexamplesOptions . pageLimit ( ) ) ) ; } if ( listCounterexamplesOptions . includeCount ( ) != null ) { builder . query ( "include_count" , String . valueOf ( listCounterexamplesOptions . includeCount ( ) ) ) ; } if ( listCounterexamplesOptions . sort ( ) != null ) { builder . query ( "sort" , listCounterexamplesOptions . sort ( ) ) ; } if ( listCounterexamplesOptions . cursor ( ) != null ) { builder . query ( "cursor" , listCounterexamplesOptions . cursor ( ) ) ; } if ( listCounterexamplesOptions . includeAudit ( ) != null ) { builder . query ( "include_audit" , String . valueOf ( listCounterexamplesOptions . includeAudit ( ) ) ) ; } return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( CounterexampleCollection . class ) ) ; } | List counterexamples . | 491 | 6 |
26,115 | public ServiceCall < Counterexample > updateCounterexample ( UpdateCounterexampleOptions updateCounterexampleOptions ) { Validator . notNull ( updateCounterexampleOptions , "updateCounterexampleOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "counterexamples" } ; String [ ] pathParameters = { updateCounterexampleOptions . workspaceId ( ) , updateCounterexampleOptions . text ( ) } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "updateCounterexample" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; final JsonObject contentJson = new JsonObject ( ) ; if ( updateCounterexampleOptions . newText ( ) != null ) { contentJson . addProperty ( "text" , updateCounterexampleOptions . newText ( ) ) ; } builder . bodyJson ( contentJson ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( Counterexample . class ) ) ; } | Update counterexample . | 349 | 6 |
26,116 | public ServiceCall < Entity > createEntity ( CreateEntityOptions createEntityOptions ) { Validator . notNull ( createEntityOptions , "createEntityOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "entities" } ; String [ ] pathParameters = { createEntityOptions . workspaceId ( ) } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "createEntity" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; final JsonObject contentJson = new JsonObject ( ) ; contentJson . addProperty ( "entity" , createEntityOptions . entity ( ) ) ; if ( createEntityOptions . description ( ) != null ) { contentJson . addProperty ( "description" , createEntityOptions . description ( ) ) ; } if ( createEntityOptions . metadata ( ) != null ) { contentJson . add ( "metadata" , GsonSingleton . getGson ( ) . toJsonTree ( createEntityOptions . metadata ( ) ) ) ; } if ( createEntityOptions . fuzzyMatch ( ) != null ) { contentJson . addProperty ( "fuzzy_match" , createEntityOptions . fuzzyMatch ( ) ) ; } if ( createEntityOptions . values ( ) != null ) { contentJson . add ( "values" , GsonSingleton . getGson ( ) . toJsonTree ( createEntityOptions . values ( ) ) ) ; } builder . bodyJson ( contentJson ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( Entity . class ) ) ; } | Create entity . | 461 | 3 |
26,117 | public ServiceCall < Entity > getEntity ( GetEntityOptions getEntityOptions ) { Validator . notNull ( getEntityOptions , "getEntityOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "entities" } ; String [ ] pathParameters = { getEntityOptions . workspaceId ( ) , getEntityOptions . entity ( ) } ; RequestBuilder builder = RequestBuilder . get ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "getEntity" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( getEntityOptions . export ( ) != null ) { builder . query ( "export" , String . valueOf ( getEntityOptions . export ( ) ) ) ; } if ( getEntityOptions . includeAudit ( ) != null ) { builder . query ( "include_audit" , String . valueOf ( getEntityOptions . includeAudit ( ) ) ) ; } return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( Entity . class ) ) ; } | Get entity . | 330 | 3 |
26,118 | public ServiceCall < EntityCollection > listEntities ( ListEntitiesOptions listEntitiesOptions ) { Validator . notNull ( listEntitiesOptions , "listEntitiesOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "entities" } ; String [ ] pathParameters = { listEntitiesOptions . workspaceId ( ) } ; RequestBuilder builder = RequestBuilder . get ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "listEntities" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( listEntitiesOptions . export ( ) != null ) { builder . query ( "export" , String . valueOf ( listEntitiesOptions . export ( ) ) ) ; } if ( listEntitiesOptions . pageLimit ( ) != null ) { builder . query ( "page_limit" , String . valueOf ( listEntitiesOptions . pageLimit ( ) ) ) ; } if ( listEntitiesOptions . includeCount ( ) != null ) { builder . query ( "include_count" , String . valueOf ( listEntitiesOptions . includeCount ( ) ) ) ; } if ( listEntitiesOptions . sort ( ) != null ) { builder . query ( "sort" , listEntitiesOptions . sort ( ) ) ; } if ( listEntitiesOptions . cursor ( ) != null ) { builder . query ( "cursor" , listEntitiesOptions . cursor ( ) ) ; } if ( listEntitiesOptions . includeAudit ( ) != null ) { builder . query ( "include_audit" , String . valueOf ( listEntitiesOptions . includeAudit ( ) ) ) ; } return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( EntityCollection . class ) ) ; } | List entities . | 488 | 3 |
26,119 | public ServiceCall < Entity > updateEntity ( UpdateEntityOptions updateEntityOptions ) { Validator . notNull ( updateEntityOptions , "updateEntityOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "entities" } ; String [ ] pathParameters = { updateEntityOptions . workspaceId ( ) , updateEntityOptions . entity ( ) } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "updateEntity" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; final JsonObject contentJson = new JsonObject ( ) ; if ( updateEntityOptions . newEntity ( ) != null ) { contentJson . addProperty ( "entity" , updateEntityOptions . newEntity ( ) ) ; } if ( updateEntityOptions . newDescription ( ) != null ) { contentJson . addProperty ( "description" , updateEntityOptions . newDescription ( ) ) ; } if ( updateEntityOptions . newMetadata ( ) != null ) { contentJson . add ( "metadata" , GsonSingleton . getGson ( ) . toJsonTree ( updateEntityOptions . newMetadata ( ) ) ) ; } if ( updateEntityOptions . newFuzzyMatch ( ) != null ) { contentJson . addProperty ( "fuzzy_match" , updateEntityOptions . newFuzzyMatch ( ) ) ; } if ( updateEntityOptions . newValues ( ) != null ) { contentJson . add ( "values" , GsonSingleton . getGson ( ) . toJsonTree ( updateEntityOptions . newValues ( ) ) ) ; } builder . bodyJson ( contentJson ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( Entity . class ) ) ; } | Update entity . | 499 | 3 |
26,120 | public ServiceCall < Value > createValue ( CreateValueOptions createValueOptions ) { Validator . notNull ( createValueOptions , "createValueOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "entities" , "values" } ; String [ ] pathParameters = { createValueOptions . workspaceId ( ) , createValueOptions . entity ( ) } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "createValue" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; final JsonObject contentJson = new JsonObject ( ) ; contentJson . addProperty ( "value" , createValueOptions . value ( ) ) ; if ( createValueOptions . metadata ( ) != null ) { contentJson . add ( "metadata" , GsonSingleton . getGson ( ) . toJsonTree ( createValueOptions . metadata ( ) ) ) ; } if ( createValueOptions . valueType ( ) != null ) { contentJson . addProperty ( "type" , createValueOptions . valueType ( ) ) ; } if ( createValueOptions . synonyms ( ) != null ) { contentJson . add ( "synonyms" , GsonSingleton . getGson ( ) . toJsonTree ( createValueOptions . synonyms ( ) ) ) ; } if ( createValueOptions . patterns ( ) != null ) { contentJson . add ( "patterns" , GsonSingleton . getGson ( ) . toJsonTree ( createValueOptions . patterns ( ) ) ) ; } builder . bodyJson ( contentJson ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( Value . class ) ) ; } | Create entity value . | 489 | 4 |
26,121 | public ServiceCall < Void > deleteValue ( DeleteValueOptions deleteValueOptions ) { Validator . notNull ( deleteValueOptions , "deleteValueOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "entities" , "values" } ; String [ ] pathParameters = { deleteValueOptions . workspaceId ( ) , deleteValueOptions . entity ( ) , deleteValueOptions . value ( ) } ; RequestBuilder builder = RequestBuilder . delete ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "deleteValue" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getVoid ( ) ) ; } | Delete entity value . | 259 | 4 |
26,122 | public ServiceCall < Value > getValue ( GetValueOptions getValueOptions ) { Validator . notNull ( getValueOptions , "getValueOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "entities" , "values" } ; String [ ] pathParameters = { getValueOptions . workspaceId ( ) , getValueOptions . entity ( ) , getValueOptions . value ( ) } ; RequestBuilder builder = RequestBuilder . get ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "getValue" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( getValueOptions . export ( ) != null ) { builder . query ( "export" , String . valueOf ( getValueOptions . export ( ) ) ) ; } if ( getValueOptions . includeAudit ( ) != null ) { builder . query ( "include_audit" , String . valueOf ( getValueOptions . includeAudit ( ) ) ) ; } return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( Value . class ) ) ; } | Get entity value . | 342 | 4 |
26,123 | public ServiceCall < ValueCollection > listValues ( ListValuesOptions listValuesOptions ) { Validator . notNull ( listValuesOptions , "listValuesOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "entities" , "values" } ; String [ ] pathParameters = { listValuesOptions . workspaceId ( ) , listValuesOptions . entity ( ) } ; RequestBuilder builder = RequestBuilder . get ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "listValues" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( listValuesOptions . export ( ) != null ) { builder . query ( "export" , String . valueOf ( listValuesOptions . export ( ) ) ) ; } if ( listValuesOptions . pageLimit ( ) != null ) { builder . query ( "page_limit" , String . valueOf ( listValuesOptions . pageLimit ( ) ) ) ; } if ( listValuesOptions . includeCount ( ) != null ) { builder . query ( "include_count" , String . valueOf ( listValuesOptions . includeCount ( ) ) ) ; } if ( listValuesOptions . sort ( ) != null ) { builder . query ( "sort" , listValuesOptions . sort ( ) ) ; } if ( listValuesOptions . cursor ( ) != null ) { builder . query ( "cursor" , listValuesOptions . cursor ( ) ) ; } if ( listValuesOptions . includeAudit ( ) != null ) { builder . query ( "include_audit" , String . valueOf ( listValuesOptions . includeAudit ( ) ) ) ; } return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( ValueCollection . class ) ) ; } | List entity values . | 481 | 4 |
26,124 | public ServiceCall < Value > updateValue ( UpdateValueOptions updateValueOptions ) { Validator . notNull ( updateValueOptions , "updateValueOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "entities" , "values" } ; String [ ] pathParameters = { updateValueOptions . workspaceId ( ) , updateValueOptions . entity ( ) , updateValueOptions . value ( ) } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "updateValue" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; final JsonObject contentJson = new JsonObject ( ) ; if ( updateValueOptions . newValue ( ) != null ) { contentJson . addProperty ( "value" , updateValueOptions . newValue ( ) ) ; } if ( updateValueOptions . newMetadata ( ) != null ) { contentJson . add ( "metadata" , GsonSingleton . getGson ( ) . toJsonTree ( updateValueOptions . newMetadata ( ) ) ) ; } if ( updateValueOptions . valueType ( ) != null ) { contentJson . addProperty ( "type" , updateValueOptions . valueType ( ) ) ; } if ( updateValueOptions . newSynonyms ( ) != null ) { contentJson . add ( "synonyms" , GsonSingleton . getGson ( ) . toJsonTree ( updateValueOptions . newSynonyms ( ) ) ) ; } if ( updateValueOptions . newPatterns ( ) != null ) { contentJson . add ( "patterns" , GsonSingleton . getGson ( ) . toJsonTree ( updateValueOptions . newPatterns ( ) ) ) ; } builder . bodyJson ( contentJson ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( Value . class ) ) ; } | Update entity value . | 523 | 4 |
26,125 | public ServiceCall < Synonym > getSynonym ( GetSynonymOptions getSynonymOptions ) { Validator . notNull ( getSynonymOptions , "getSynonymOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "entities" , "values" , "synonyms" } ; String [ ] pathParameters = { getSynonymOptions . workspaceId ( ) , getSynonymOptions . entity ( ) , getSynonymOptions . value ( ) , getSynonymOptions . synonym ( ) } ; RequestBuilder builder = RequestBuilder . get ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "getSynonym" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( getSynonymOptions . includeAudit ( ) != null ) { builder . query ( "include_audit" , String . valueOf ( getSynonymOptions . includeAudit ( ) ) ) ; } return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( Synonym . class ) ) ; } | Get entity value synonym . | 333 | 6 |
26,126 | public ServiceCall < SynonymCollection > listSynonyms ( ListSynonymsOptions listSynonymsOptions ) { Validator . notNull ( listSynonymsOptions , "listSynonymsOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "entities" , "values" , "synonyms" } ; String [ ] pathParameters = { listSynonymsOptions . workspaceId ( ) , listSynonymsOptions . entity ( ) , listSynonymsOptions . value ( ) } ; RequestBuilder builder = RequestBuilder . get ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "listSynonyms" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( listSynonymsOptions . pageLimit ( ) != null ) { builder . query ( "page_limit" , String . valueOf ( listSynonymsOptions . pageLimit ( ) ) ) ; } if ( listSynonymsOptions . includeCount ( ) != null ) { builder . query ( "include_count" , String . valueOf ( listSynonymsOptions . includeCount ( ) ) ) ; } if ( listSynonymsOptions . sort ( ) != null ) { builder . query ( "sort" , listSynonymsOptions . sort ( ) ) ; } if ( listSynonymsOptions . cursor ( ) != null ) { builder . query ( "cursor" , listSynonymsOptions . cursor ( ) ) ; } if ( listSynonymsOptions . includeAudit ( ) != null ) { builder . query ( "include_audit" , String . valueOf ( listSynonymsOptions . includeAudit ( ) ) ) ; } return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( SynonymCollection . class ) ) ; } | List entity value synonyms . | 478 | 6 |
26,127 | public ServiceCall < Synonym > updateSynonym ( UpdateSynonymOptions updateSynonymOptions ) { Validator . notNull ( updateSynonymOptions , "updateSynonymOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "entities" , "values" , "synonyms" } ; String [ ] pathParameters = { updateSynonymOptions . workspaceId ( ) , updateSynonymOptions . entity ( ) , updateSynonymOptions . value ( ) , updateSynonymOptions . synonym ( ) } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "updateSynonym" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; final JsonObject contentJson = new JsonObject ( ) ; if ( updateSynonymOptions . newSynonym ( ) != null ) { contentJson . addProperty ( "synonym" , updateSynonymOptions . newSynonym ( ) ) ; } builder . bodyJson ( contentJson ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( Synonym . class ) ) ; } | Update entity value synonym . | 354 | 6 |
26,128 | public ServiceCall < DialogNode > getDialogNode ( GetDialogNodeOptions getDialogNodeOptions ) { Validator . notNull ( getDialogNodeOptions , "getDialogNodeOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "dialog_nodes" } ; String [ ] pathParameters = { getDialogNodeOptions . workspaceId ( ) , getDialogNodeOptions . dialogNode ( ) } ; RequestBuilder builder = RequestBuilder . get ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "getDialogNode" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( getDialogNodeOptions . includeAudit ( ) != null ) { builder . query ( "include_audit" , String . valueOf ( getDialogNodeOptions . includeAudit ( ) ) ) ; } return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( DialogNode . class ) ) ; } | Get dialog node . | 311 | 4 |
26,129 | public ServiceCall < DialogNodeCollection > listDialogNodes ( ListDialogNodesOptions listDialogNodesOptions ) { Validator . notNull ( listDialogNodesOptions , "listDialogNodesOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "dialog_nodes" } ; String [ ] pathParameters = { listDialogNodesOptions . workspaceId ( ) } ; RequestBuilder builder = RequestBuilder . get ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "listDialogNodes" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( listDialogNodesOptions . pageLimit ( ) != null ) { builder . query ( "page_limit" , String . valueOf ( listDialogNodesOptions . pageLimit ( ) ) ) ; } if ( listDialogNodesOptions . includeCount ( ) != null ) { builder . query ( "include_count" , String . valueOf ( listDialogNodesOptions . includeCount ( ) ) ) ; } if ( listDialogNodesOptions . sort ( ) != null ) { builder . query ( "sort" , listDialogNodesOptions . sort ( ) ) ; } if ( listDialogNodesOptions . cursor ( ) != null ) { builder . query ( "cursor" , listDialogNodesOptions . cursor ( ) ) ; } if ( listDialogNodesOptions . includeAudit ( ) != null ) { builder . query ( "include_audit" , String . valueOf ( listDialogNodesOptions . includeAudit ( ) ) ) ; } return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( DialogNodeCollection . class ) ) ; } | List dialog nodes . | 473 | 4 |
26,130 | public ServiceCall < LogCollection > listAllLogs ( ListAllLogsOptions listAllLogsOptions ) { Validator . notNull ( listAllLogsOptions , "listAllLogsOptions cannot be null" ) ; String [ ] pathSegments = { "v1/logs" } ; RequestBuilder builder = RequestBuilder . get ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "listAllLogs" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; builder . query ( "filter" , listAllLogsOptions . filter ( ) ) ; if ( listAllLogsOptions . sort ( ) != null ) { builder . query ( "sort" , listAllLogsOptions . sort ( ) ) ; } if ( listAllLogsOptions . pageLimit ( ) != null ) { builder . query ( "page_limit" , String . valueOf ( listAllLogsOptions . pageLimit ( ) ) ) ; } if ( listAllLogsOptions . cursor ( ) != null ) { builder . query ( "cursor" , listAllLogsOptions . cursor ( ) ) ; } return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( LogCollection . class ) ) ; } | List log events in all workspaces . | 365 | 8 |
26,131 | public ServiceCall < LogCollection > listLogs ( ListLogsOptions listLogsOptions ) { Validator . notNull ( listLogsOptions , "listLogsOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "logs" } ; String [ ] pathParameters = { listLogsOptions . workspaceId ( ) } ; RequestBuilder builder = RequestBuilder . get ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "listLogs" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( listLogsOptions . sort ( ) != null ) { builder . query ( "sort" , listLogsOptions . sort ( ) ) ; } if ( listLogsOptions . filter ( ) != null ) { builder . query ( "filter" , listLogsOptions . filter ( ) ) ; } if ( listLogsOptions . pageLimit ( ) != null ) { builder . query ( "page_limit" , String . valueOf ( listLogsOptions . pageLimit ( ) ) ) ; } if ( listLogsOptions . cursor ( ) != null ) { builder . query ( "cursor" , listLogsOptions . cursor ( ) ) ; } return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( LogCollection . class ) ) ; } | List log events in a workspace . | 393 | 7 |
26,132 | public ServiceCall < ToneAnalysis > tone ( ToneOptions toneOptions ) { Validator . notNull ( toneOptions , "toneOptions cannot be null" ) ; String [ ] pathSegments = { "v3/tone" } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "tone_analyzer" , "v3" , "tone" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( toneOptions . contentLanguage ( ) != null ) { builder . header ( "Content-Language" , toneOptions . contentLanguage ( ) ) ; } if ( toneOptions . acceptLanguage ( ) != null ) { builder . header ( "Accept-Language" , toneOptions . acceptLanguage ( ) ) ; } if ( toneOptions . contentType ( ) != null ) { builder . header ( "Content-Type" , toneOptions . contentType ( ) ) ; } if ( toneOptions . sentences ( ) != null ) { builder . query ( "sentences" , String . valueOf ( toneOptions . sentences ( ) ) ) ; } if ( toneOptions . tones ( ) != null ) { builder . query ( "tones" , RequestUtils . join ( toneOptions . tones ( ) , "," ) ) ; } builder . bodyContent ( toneOptions . contentType ( ) , toneOptions . toneInput ( ) , null , toneOptions . body ( ) ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( ToneAnalysis . class ) ) ; } | Analyze general tone . | 417 | 5 |
26,133 | public ServiceCall < UtteranceAnalyses > toneChat ( ToneChatOptions toneChatOptions ) { Validator . notNull ( toneChatOptions , "toneChatOptions cannot be null" ) ; String [ ] pathSegments = { "v3/tone_chat" } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "tone_analyzer" , "v3" , "toneChat" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( toneChatOptions . contentLanguage ( ) != null ) { builder . header ( "Content-Language" , toneChatOptions . contentLanguage ( ) ) ; } if ( toneChatOptions . acceptLanguage ( ) != null ) { builder . header ( "Accept-Language" , toneChatOptions . acceptLanguage ( ) ) ; } final JsonObject contentJson = new JsonObject ( ) ; contentJson . add ( "utterances" , GsonSingleton . getGson ( ) . toJsonTree ( toneChatOptions . utterances ( ) ) ) ; builder . bodyJson ( contentJson ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( UtteranceAnalyses . class ) ) ; } | Analyze customer engagement tone . | 360 | 6 |
26,134 | public String getName ( String oldName ) { if ( oldName != null && this . existing . containsKey ( oldName ) ) { return this . existing . get ( oldName ) ; } final String name = this . prefix + this . counter ; this . counter ++ ; if ( oldName != null ) { this . existing . put ( oldName , name ) ; } return name ; } | Gets the new name for the given old name where if no old name is given a new name will be generated . | 83 | 24 |
26,135 | static boolean isNode ( Object v ) { // Note: A value is a subject if all of these hold true: // 1. It is an Object. // 2. It is not a @value, @set, or @list. // 3. It has more than 1 key OR any existing key is not @id. if ( v instanceof Map && ! ( ( ( Map ) v ) . containsKey ( "@value" ) || ( ( Map ) v ) . containsKey ( "@set" ) || ( ( Map ) v ) . containsKey ( "@list" ) ) ) { return ( ( Map < String , Object > ) v ) . size ( ) > 1 || ! ( ( Map ) v ) . containsKey ( "@id" ) ; } return false ; } | Returns true if the given value is a subject with properties . | 163 | 12 |
26,136 | static boolean isNodeReference ( Object v ) { // Note: A value is a subject reference if all of these hold true: // 1. It is an Object. // 2. It has a single key: @id. return ( v instanceof Map && ( ( Map < String , Object > ) v ) . size ( ) == 1 && ( ( Map < String , Object > ) v ) . containsKey ( "@id" ) ) ; } | Returns true if the given value is a subject reference . | 93 | 11 |
26,137 | static void fillNodesToPrune ( Object input , final Map < String , Object > toPrune ) { // recurse through arrays if ( isArray ( input ) ) { for ( final Object i : ( List < Object > ) input ) { fillNodesToPrune ( i , toPrune ) ; } } else if ( isObject ( input ) ) { // skip @values if ( isValue ( input ) ) { return ; } // recurse through @lists if ( isList ( input ) ) { fillNodesToPrune ( ( ( Map < String , Object > ) input ) . get ( "@list" ) , toPrune ) ; return ; } // recurse through properties for ( final String prop : new LinkedHashSet <> ( ( ( Map < String , Object > ) input ) . keySet ( ) ) ) { if ( prop . equals ( JsonLdConsts . ID ) ) { final String id = ( String ) ( ( Map < String , Object > ) input ) . get ( JsonLdConsts . ID ) ; if ( id . startsWith ( "_:" ) ) { // if toPrune contains the id already, it was already // present somewhere else, // so we just null the value if ( toPrune . containsKey ( id ) ) { toPrune . put ( id , null ) ; } else { // else we add the object as the value toPrune . put ( id , input ) ; } } } else { fillNodesToPrune ( ( ( Map < String , Object > ) input ) . get ( prop ) , toPrune ) ; } } } else if ( input instanceof String ) { // this is an id, as non-id values will have been discarded by the // isValue() above final String p = ( String ) input ; if ( p . startsWith ( "_:" ) ) { // the id is outside of the context of an @id property, if we're // in that case, // then we're referencing a blank node id so this id should not // be removed toPrune . put ( p , null ) ; } } } | Gets the objects on which we ll prune the blank node ID | 456 | 14 |
26,138 | static boolean isBlankNode ( Object v ) { // Note: A value is a blank node if all of these hold true: // 1. It is an Object. // 2. If it has an @id key its value begins with '_:'. // 3. It has no keys OR is not a @value, @set, or @list. if ( v instanceof Map ) { final Map < String , Object > map = ( Map < String , Object > ) v ; if ( map . containsKey ( "@id" ) ) { return ( ( String ) map . get ( "@id" ) ) . startsWith ( "_:" ) ; } else { return map . isEmpty ( ) || ! map . containsKey ( "@value" ) || map . containsKey ( "@set" ) || map . containsKey ( "@list" ) ; } } return false ; } | Returns true if the given value is a blank node . | 184 | 11 |
26,139 | static Boolean isList ( Object v ) { return ( v instanceof Map && ( ( Map < String , Object > ) v ) . containsKey ( "@list" ) ) ; } | Returns true if the given value is a JSON - LD List | 38 | 12 |
26,140 | static Boolean isValue ( Object v ) { return ( v instanceof Map && ( ( Map < String , Object > ) v ) . containsKey ( "@value" ) ) ; } | Returns true if the given value is a JSON - LD value | 38 | 12 |
26,141 | public static String removeDotSegments ( String path , boolean hasAuthority ) { String rval = "" ; if ( path . indexOf ( "/" ) == 0 ) { rval = "/" ; } // RFC 3986 5.2.4 (reworked) final List < String > input = new ArrayList < String > ( Arrays . asList ( path . split ( "/" ) ) ) ; if ( path . endsWith ( "/" ) ) { // javascript .split includes a blank entry if the string ends with // the delimiter, java .split does not so we need to add it manually input . add ( "" ) ; } final List < String > output = new ArrayList < String > ( ) ; for ( int i = 0 ; i < input . size ( ) ; i ++ ) { if ( "." . equals ( input . get ( i ) ) || ( "" . equals ( input . get ( i ) ) && input . size ( ) - i > 1 ) ) { // input.remove(0); continue ; } if ( ".." . equals ( input . get ( i ) ) ) { // input.remove(0); if ( hasAuthority || ( output . size ( ) > 0 && ! ".." . equals ( output . get ( output . size ( ) - 1 ) ) ) ) { // [].pop() doesn't fail, to replicate this we need to check // that there is something to remove if ( output . size ( ) > 0 ) { output . remove ( output . size ( ) - 1 ) ; } } else { output . add ( ".." ) ; } continue ; } output . add ( input . get ( i ) ) ; // input.remove(0); } if ( output . size ( ) > 0 ) { rval += output . get ( 0 ) ; for ( int i = 1 ; i < output . size ( ) ; i ++ ) { rval += "/" + output . get ( i ) ; } } return rval ; } | Removes dot segments from a JsonLdUrl path . | 430 | 13 |
26,142 | private static void parseAuthority ( JsonLdUrl parsed ) { // parse authority for unparsed relative network-path reference if ( parsed . href . indexOf ( ":" ) == - 1 && parsed . href . indexOf ( "//" ) == 0 && "" . equals ( parsed . host ) ) { // must parse authority from pathname parsed . pathname = parsed . pathname . substring ( 2 ) ; final int idx = parsed . pathname . indexOf ( "/" ) ; if ( idx == - 1 ) { parsed . authority = parsed . pathname ; parsed . pathname = "" ; } else { parsed . authority = parsed . pathname . substring ( 0 , idx ) ; parsed . pathname = parsed . pathname . substring ( idx ) ; } } else { // construct authority parsed . authority = parsed . host ; if ( ! "" . equals ( parsed . auth ) ) { parsed . authority = parsed . auth + "@" + parsed . authority ; } } } | Parses the authority for the pre - parsed given JsonLdUrl . | 216 | 17 |
26,143 | public static void escape ( String str , StringBuilder rval ) { for ( int i = 0 ; i < str . length ( ) ; i ++ ) { final char hi = str . charAt ( i ) ; if ( hi <= 0x8 || hi == 0xB || hi == 0xC || ( hi >= 0xE && hi <= 0x1F ) || ( hi >= 0x7F && hi <= 0xA0 ) || // 0xA0 is end of // non-printable latin-1 // supplement // characters ( ( hi >= 0x24F // 0x24F is the end of latin extensions && ! Character . isHighSurrogate ( hi ) ) // TODO: there's probably a lot of other characters that // shouldn't be escaped that // fall outside these ranges, this is one example from the // json-ld tests ) ) { rval . append ( String . format ( "\\u%04x" , ( int ) hi ) ) ; } else if ( Character . isHighSurrogate ( hi ) ) { final char lo = str . charAt ( ++ i ) ; final int c = ( hi << 10 ) + lo + ( 0x10000 - ( 0xD800 << 10 ) - 0xDC00 ) ; rval . append ( String . format ( "\\U%08x" , c ) ) ; } else { switch ( hi ) { case ' ' : rval . append ( "\\b" ) ; break ; case ' ' : rval . append ( "\\n" ) ; break ; case ' ' : rval . append ( "\\t" ) ; break ; case ' ' : rval . append ( "\\f" ) ; break ; case ' ' : rval . append ( "\\r" ) ; break ; // case '\'': // rval += "\\'"; // break; case ' ' : rval . append ( "\\\"" ) ; // rval += "\\u0022"; break ; case ' ' : rval . append ( "\\\\" ) ; break ; default : // just put the char as is rval . append ( hi ) ; break ; } } } // return rval; } | Escapes the given string according to the N - Quads escape rules | 476 | 14 |
26,144 | public Map < String , Object > getContext ( ) { final Map < String , Object > rval = newMap ( ) ; rval . putAll ( context ) ; // replace "" with "@vocab" if ( rval . containsKey ( "" ) ) { rval . put ( "@vocab" , rval . remove ( "" ) ) ; } return rval ; } | Returns a valid context containing any namespaces set | 81 | 9 |
26,145 | public void parseContext ( Object contextLike ) throws JsonLdError { Context context ; if ( api != null ) { context = new Context ( api . opts ) ; } else { context = new Context ( ) ; } // Context will do our recursive parsing and initial IRI resolution context = context . parse ( contextLike ) ; // And then leak to us the potential 'prefixes' final Map < String , String > prefixes = context . getPrefixes ( true ) ; for ( final String key : prefixes . keySet ( ) ) { final String val = prefixes . get ( key ) ; if ( "@vocab" . equals ( key ) ) { if ( val == null || isString ( val ) ) { setNamespace ( "" , val ) ; } else { } } else if ( ! isKeyword ( key ) ) { setNamespace ( key , val ) ; // TODO: should we make sure val is a valid URI prefix (i.e. it // ends with /# or ?) // or is it ok that full URIs for terms are used? } } } | parses a context object and sets any namespaces found within it | 234 | 14 |
26,146 | public void addTriple ( final String subject , final String predicate , final String object ) { addQuad ( subject , predicate , object , "@default" ) ; } | Adds a triple to the default graph of this dataset | 35 | 10 |
26,147 | private Node objectToRDF ( Object item ) { // convert value object to RDF if ( isValue ( item ) ) { final Object value = ( ( Map < String , Object > ) item ) . get ( "@value" ) ; final Object datatype = ( ( Map < String , Object > ) item ) . get ( "@type" ) ; // convert to XSD datatypes as appropriate if ( value instanceof Boolean || value instanceof Number ) { // convert to XSD datatype if ( value instanceof Boolean ) { return new Literal ( value . toString ( ) , datatype == null ? XSD_BOOLEAN : ( String ) datatype , null ) ; } else if ( value instanceof Double || value instanceof Float || XSD_DOUBLE . equals ( datatype ) ) { if ( value instanceof Double && ! Double . isFinite ( ( double ) value ) ) { return new Literal ( Double . toString ( ( double ) value ) , datatype == null ? XSD_DOUBLE : ( String ) datatype , null ) ; } else if ( value instanceof Float && ! Float . isFinite ( ( float ) value ) ) { return new Literal ( Float . toString ( ( float ) value ) , datatype == null ? XSD_DOUBLE : ( String ) datatype , null ) ; } else { // canonical double representation final DecimalFormat df = new DecimalFormat ( "0.0###############E0" ) ; df . setDecimalFormatSymbols ( DecimalFormatSymbols . getInstance ( Locale . US ) ) ; return new Literal ( df . format ( value ) , datatype == null ? XSD_DOUBLE : ( String ) datatype , null ) ; } } else { final DecimalFormat df = new DecimalFormat ( "0" ) ; return new Literal ( df . format ( value ) , datatype == null ? XSD_INTEGER : ( String ) datatype , null ) ; } } else if ( ( ( Map < String , Object > ) item ) . containsKey ( "@language" ) ) { return new Literal ( ( String ) value , datatype == null ? RDF_LANGSTRING : ( String ) datatype , ( String ) ( ( Map < String , Object > ) item ) . get ( "@language" ) ) ; } else { return new Literal ( ( String ) value , datatype == null ? XSD_STRING : ( String ) datatype , null ) ; } } // convert string/node object to RDF else { final String id ; if ( isObject ( item ) ) { id = ( String ) ( ( Map < String , Object > ) item ) . get ( "@id" ) ; if ( JsonLdUtils . isRelativeIri ( id ) ) { return null ; } } else { id = ( String ) item ; } if ( id . indexOf ( "_:" ) == 0 ) { // NOTE: once again no need to rename existing blank nodes return new BlankNode ( id ) ; } else { return new IRI ( id ) ; } } } | Converts a JSON - LD value object to an RDF literal or a JSON - LD string or node object to an RDF resource . | 695 | 28 |
26,148 | public DocumentLoader addInjectedDoc ( String url , String doc ) throws JsonLdError { try { m_injectedDocs . put ( url , JsonUtils . fromString ( doc ) ) ; return this ; } catch ( final Exception e ) { throw new JsonLdError ( JsonLdError . Error . LOADING_INJECTED_CONTEXT_FAILED , url , e ) ; } } | Avoid resolving a document by instead using the given serialised representation . | 95 | 13 |
26,149 | public RemoteDocument loadDocument ( String url ) throws JsonLdError { if ( m_injectedDocs . containsKey ( url ) ) { try { return new RemoteDocument ( url , m_injectedDocs . get ( url ) ) ; } catch ( final Exception e ) { throw new JsonLdError ( JsonLdError . Error . LOADING_INJECTED_CONTEXT_FAILED , url , e ) ; } } else { final String disallowRemote = System . getProperty ( DocumentLoader . DISALLOW_REMOTE_CONTEXT_LOADING ) ; if ( "true" . equalsIgnoreCase ( disallowRemote ) ) { throw new JsonLdError ( JsonLdError . Error . LOADING_REMOTE_CONTEXT_FAILED , "Remote context loading has been disallowed (url was " + url + ")" ) ; } try { return new RemoteDocument ( url , JsonUtils . fromURL ( new URL ( url ) , getHttpClient ( ) ) ) ; } catch ( final Exception e ) { throw new JsonLdError ( JsonLdError . Error . LOADING_REMOTE_CONTEXT_FAILED , url , e ) ; } } } | Loads the URL if possible returning it as a RemoteDocument . | 274 | 13 |
26,150 | public static String toPrettyString ( Object jsonObject ) throws JsonGenerationException , IOException { final StringWriter sw = new StringWriter ( ) ; writePrettyPrint ( sw , jsonObject ) ; return sw . toString ( ) ; } | Writes the given JSON - LD Object out to a String using indentation and new lines to improve readability . | 51 | 23 |
26,151 | public static void write ( Writer writer , Object jsonObject ) throws JsonGenerationException , IOException { final JsonGenerator jw = JSON_FACTORY . createGenerator ( writer ) ; jw . writeObject ( jsonObject ) ; } | Writes the given JSON - LD Object out to the given Writer . | 54 | 14 |
26,152 | public static void writePrettyPrint ( Writer writer , Object jsonObject ) throws JsonGenerationException , IOException { final JsonGenerator jw = JSON_FACTORY . createGenerator ( writer ) ; jw . useDefaultPrettyPrinter ( ) ; jw . writeObject ( jsonObject ) ; } | Writes the given JSON - LD Object out to the given Writer using indentation and new lines to improve readability . | 67 | 24 |
26,153 | public static Map < String , Object > newMap ( String key , Object value ) { final Map < String , Object > result = newMap ( ) ; result . put ( key , value ) ; return result ; } | Helper function for creating maps and tuning them as necessary . | 45 | 11 |
26,154 | public static Object fromRDF ( Object dataset , JsonLdOptions options ) throws JsonLdError { // handle non specified serializer case RDFParser parser = null ; if ( options . format == null && dataset instanceof String ) { // attempt to parse the input as nquads options . format = JsonLdConsts . APPLICATION_NQUADS ; } if ( rdfParsers . containsKey ( options . format ) ) { parser = rdfParsers . get ( options . format ) ; } else { throw new JsonLdError ( JsonLdError . Error . UNKNOWN_FORMAT , options . format ) ; } // convert from RDF return fromRDF ( dataset , options , parser ) ; } | Converts an RDF dataset to JSON - LD . | 162 | 11 |
26,155 | public static Object normalize ( Object input , JsonLdOptions options ) throws JsonLdError { final JsonLdOptions opts = options . copy ( ) ; opts . format = null ; final RDFDataset dataset = ( RDFDataset ) toRDF ( input , opts ) ; return new JsonLdApi ( options ) . normalize ( dataset ) ; } | Performs RDF dataset normalization on the given JSON - LD input . The output is an RDF dataset unless the format option is used . | 89 | 29 |
26,156 | public Object compactValue ( String activeProperty , Map < String , Object > value ) { // 1) int numberMembers = value . size ( ) ; // 2) if ( value . containsKey ( JsonLdConsts . INDEX ) && JsonLdConsts . INDEX . equals ( this . getContainer ( activeProperty ) ) ) { numberMembers -- ; } // 3) if ( numberMembers > 2 ) { return value ; } // 4) final String typeMapping = getTypeMapping ( activeProperty ) ; final String languageMapping = getLanguageMapping ( activeProperty ) ; if ( value . containsKey ( JsonLdConsts . ID ) ) { // 4.1) if ( numberMembers == 1 && JsonLdConsts . ID . equals ( typeMapping ) ) { return compactIri ( ( String ) value . get ( JsonLdConsts . ID ) ) ; } // 4.2) if ( numberMembers == 1 && JsonLdConsts . VOCAB . equals ( typeMapping ) ) { return compactIri ( ( String ) value . get ( JsonLdConsts . ID ) , true ) ; } // 4.3) return value ; } final Object valueValue = value . get ( JsonLdConsts . VALUE ) ; // 5) if ( value . containsKey ( JsonLdConsts . TYPE ) && Obj . equals ( value . get ( JsonLdConsts . TYPE ) , typeMapping ) ) { return valueValue ; } // 6) if ( value . containsKey ( JsonLdConsts . LANGUAGE ) ) { // TODO: SPEC: doesn't specify to check default language as well if ( Obj . equals ( value . get ( JsonLdConsts . LANGUAGE ) , languageMapping ) || Obj . equals ( value . get ( JsonLdConsts . LANGUAGE ) , this . get ( JsonLdConsts . LANGUAGE ) ) ) { return valueValue ; } } // 7) if ( numberMembers == 1 && ( ! ( valueValue instanceof String ) || ! this . containsKey ( JsonLdConsts . LANGUAGE ) || ( termDefinitions . containsKey ( activeProperty ) && getTermDefinition ( activeProperty ) . containsKey ( JsonLdConsts . LANGUAGE ) && languageMapping == null ) ) ) { return valueValue ; } // 8) return value ; } | Value Compaction Algorithm | 543 | 5 |
26,157 | @ SuppressWarnings ( "unchecked" ) public Context parse ( Object localContext , List < String > remoteContexts ) throws JsonLdError { return parse ( localContext , remoteContexts , false ) ; } | Context Processing Algorithm | 49 | 4 |
26,158 | String expandIri ( String value , boolean relative , boolean vocab , Map < String , Object > context , Map < String , Boolean > defined ) throws JsonLdError { // 1) if ( value == null || JsonLdUtils . isKeyword ( value ) ) { return value ; } // 2) if ( context != null && context . containsKey ( value ) && ! Boolean . TRUE . equals ( defined . get ( value ) ) ) { this . createTermDefinition ( context , value , defined ) ; } // 3) if ( vocab && this . termDefinitions . containsKey ( value ) ) { final Map < String , Object > td = ( Map < String , Object > ) this . termDefinitions . get ( value ) ; if ( td != null ) { return ( String ) td . get ( JsonLdConsts . ID ) ; } else { return null ; } } // 4) final int colIndex = value . indexOf ( ":" ) ; if ( colIndex >= 0 ) { // 4.1) final String prefix = value . substring ( 0 , colIndex ) ; final String suffix = value . substring ( colIndex + 1 ) ; // 4.2) if ( "_" . equals ( prefix ) || suffix . startsWith ( "//" ) ) { return value ; } // 4.3) if ( context != null && context . containsKey ( prefix ) && ( ! defined . containsKey ( prefix ) || defined . get ( prefix ) == false ) ) { this . createTermDefinition ( context , prefix , defined ) ; } // 4.4) if ( this . termDefinitions . containsKey ( prefix ) ) { return ( String ) ( ( Map < String , Object > ) this . termDefinitions . get ( prefix ) ) . get ( JsonLdConsts . ID ) + suffix ; } // 4.5) return value ; } // 5) if ( vocab && this . containsKey ( JsonLdConsts . VOCAB ) ) { return this . get ( JsonLdConsts . VOCAB ) + value ; } // 6) else if ( relative ) { return JsonLdUrl . resolve ( ( String ) this . get ( JsonLdConsts . BASE ) , value ) ; } else if ( context != null && JsonLdUtils . isRelativeIri ( value ) ) { throw new JsonLdError ( Error . INVALID_IRI_MAPPING , "not an absolute IRI: " + value ) ; } // 7) return value ; } | IRI Expansion Algorithm | 558 | 5 |
26,159 | public String getContainer ( String property ) { if ( property == null ) { return null ; } if ( JsonLdConsts . GRAPH . equals ( property ) ) { return JsonLdConsts . SET ; } if ( ! property . equals ( JsonLdConsts . TYPE ) && JsonLdUtils . isKeyword ( property ) ) { return property ; } final Map < String , Object > td = ( Map < String , Object > ) termDefinitions . get ( property ) ; if ( td == null ) { return null ; } return ( String ) td . get ( JsonLdConsts . CONTAINER ) ; } | Retrieve container mapping . | 143 | 5 |
26,160 | private static String hashQuads ( String id , Map < String , Object > bnodes , UniqueNamer namer ) { // return cached hash if ( ( ( Map < String , Object > ) bnodes . get ( id ) ) . containsKey ( "hash" ) ) { return ( String ) ( ( Map < String , Object > ) bnodes . get ( id ) ) . get ( "hash" ) ; } // serialize all of bnode's quads final List < Map < String , Object > > quads = ( List < Map < String , Object > > ) ( ( Map < String , Object > ) bnodes . get ( id ) ) . get ( "quads" ) ; final List < String > nquads = new ArrayList < String > ( ) ; for ( int i = 0 ; i < quads . size ( ) ; ++ i ) { nquads . add ( toNQuad ( ( RDFDataset . Quad ) quads . get ( i ) , quads . get ( i ) . get ( "name" ) != null ? ( String ) ( ( Map < String , Object > ) quads . get ( i ) . get ( "name" ) ) . get ( "value" ) : null , id ) ) ; } // sort serialized quads Collections . sort ( nquads ) ; // return hashed quads final String hash = sha1hash ( nquads ) ; ( ( Map < String , Object > ) bnodes . get ( id ) ) . put ( "hash" , hash ) ; return hash ; } | Hashes all of the quads about a blank node . | 345 | 12 |
26,161 | private static String sha1hash ( Collection < String > nquads ) { try { // create SHA-1 digest final MessageDigest md = MessageDigest . getInstance ( "SHA-1" ) ; for ( final String nquad : nquads ) { md . update ( nquad . getBytes ( "UTF-8" ) ) ; } return encodeHex ( md . digest ( ) ) ; } catch ( final NoSuchAlgorithmException e ) { throw new RuntimeException ( e ) ; } catch ( final UnsupportedEncodingException e ) { throw new RuntimeException ( e ) ; } } | A helper class to sha1 hash all the strings in a collection | 130 | 14 |
26,162 | public JsonLdOptions copy ( ) { final JsonLdOptions copy = new JsonLdOptions ( base ) ; copy . setCompactArrays ( compactArrays ) ; copy . setExpandContext ( expandContext ) ; copy . setProcessingMode ( processingMode ) ; copy . setDocumentLoader ( documentLoader ) ; copy . setEmbed ( embed ) ; copy . setExplicit ( explicit ) ; copy . setOmitDefault ( omitDefault ) ; copy . setOmitGraph ( omitGraph ) ; copy . setFrameExpansion ( frameExpansion ) ; copy . setPruneBlankNodeIdentifiers ( pruneBlankNodeIdentifiers ) ; copy . setRequireAll ( requireAll ) ; copy . setAllowContainerSetOnType ( allowContainerSetOnType ) ; copy . setUseRdfType ( useRdfType ) ; copy . setUseNativeTypes ( useNativeTypes ) ; copy . setProduceGeneralizedRdf ( produceGeneralizedRdf ) ; copy . format = format ; copy . useNamespaces = useNamespaces ; copy . outputForm = outputForm ; return copy ; } | Creates a shallow copy of this JsonLdOptions object . | 243 | 14 |
26,163 | private static void removeEmbed ( FramingContext state , String id ) { // get existing embed final Map < String , EmbedNode > links = state . uniqueEmbeds ; final EmbedNode embed = links . get ( id ) ; final Object parent = embed . parent ; final String property = embed . property ; // create reference to replace embed final Map < String , Object > node = newMap ( JsonLdConsts . ID , id ) ; // remove existing embed if ( JsonLdUtils . isNode ( parent ) ) { // replace subject with reference final List < Object > newvals = new ArrayList < Object > ( ) ; final List < Object > oldvals = ( List < Object > ) ( ( Map < String , Object > ) parent ) . get ( property ) ; for ( final Object v : oldvals ) { if ( v instanceof Map && Obj . equals ( ( ( Map < String , Object > ) v ) . get ( JsonLdConsts . ID ) , id ) ) { newvals . add ( node ) ; } else { newvals . add ( v ) ; } } ( ( Map < String , Object > ) parent ) . put ( property , newvals ) ; } // recursively remove dependent dangling embeds removeDependents ( links , id ) ; } | Removes an existing embed . | 280 | 6 |
26,164 | private static void addFrameOutput ( FramingContext state , Object parent , String property , Object output ) { if ( parent instanceof Map ) { List < Object > prop = ( List < Object > ) ( ( Map < String , Object > ) parent ) . get ( property ) ; if ( prop == null ) { prop = new ArrayList < Object > ( ) ; ( ( Map < String , Object > ) parent ) . put ( property , prop ) ; } prop . add ( output ) ; } else { ( ( List ) parent ) . add ( output ) ; } } | Adds framing output to the given parent . | 121 | 8 |
26,165 | public RDFDataset toRDF ( ) throws JsonLdError { // TODO: make the default generateNodeMap call (i.e. without a // graphName) create and return the nodeMap final Map < String , Object > nodeMap = newMap ( ) ; nodeMap . put ( JsonLdConsts . DEFAULT , newMap ( ) ) ; generateNodeMap ( this . value , nodeMap ) ; final RDFDataset dataset = new RDFDataset ( this ) ; for ( final String graphName : nodeMap . keySet ( ) ) { // 4.1) if ( JsonLdUtils . isRelativeIri ( graphName ) ) { continue ; } final Map < String , Object > graph = ( Map < String , Object > ) nodeMap . get ( graphName ) ; dataset . graphToRDF ( graphName , graph ) ; } return dataset ; } | Adds RDF triples for each graph in the current node map to an RDF dataset . | 200 | 19 |
26,166 | public Object normalize ( Map < String , Object > dataset ) throws JsonLdError { // create quads and map bnodes to their associated quads final List < Object > quads = new ArrayList < Object > ( ) ; final Map < String , Object > bnodes = newMap ( ) ; for ( String graphName : dataset . keySet ( ) ) { final List < Map < String , Object > > triples = ( List < Map < String , Object > > ) dataset . get ( graphName ) ; if ( JsonLdConsts . DEFAULT . equals ( graphName ) ) { graphName = null ; } for ( final Map < String , Object > quad : triples ) { if ( graphName != null ) { if ( graphName . indexOf ( "_:" ) == 0 ) { final Map < String , Object > tmp = newMap ( ) ; tmp . put ( "type" , "blank node" ) ; tmp . put ( "value" , graphName ) ; quad . put ( "name" , tmp ) ; } else { final Map < String , Object > tmp = newMap ( ) ; tmp . put ( "type" , "IRI" ) ; tmp . put ( "value" , graphName ) ; quad . put ( "name" , tmp ) ; } } quads . add ( quad ) ; final String [ ] attrs = new String [ ] { "subject" , "object" , "name" } ; for ( final String attr : attrs ) { if ( quad . containsKey ( attr ) && "blank node" . equals ( ( ( Map < String , Object > ) quad . get ( attr ) ) . get ( "type" ) ) ) { final String id = ( String ) ( ( Map < String , Object > ) quad . get ( attr ) ) . get ( "value" ) ; if ( ! bnodes . containsKey ( id ) ) { bnodes . put ( id , new LinkedHashMap < String , List < Object > > ( ) { { put ( "quads" , new ArrayList < Object > ( ) ) ; } } ) ; } ( ( List < Object > ) ( ( Map < String , Object > ) bnodes . get ( id ) ) . get ( "quads" ) ) . add ( quad ) ; } } } } // mapping complete, start canonical naming final NormalizeUtils normalizeUtils = new NormalizeUtils ( quads , bnodes , new UniqueNamer ( "_:c14n" ) , opts ) ; return normalizeUtils . hashBlankNodes ( bnodes . keySet ( ) ) ; } | Performs RDF normalization on the given JSON - LD input . | 579 | 14 |
26,167 | public static CallStackElement create ( CallStackElement parent , String signature , long startTimestamp ) { CallStackElement cse ; if ( useObjectPooling ) { cse = objectPool . poll ( ) ; if ( cse == null ) { cse = new CallStackElement ( ) ; } } else { cse = new CallStackElement ( ) ; } cse . executionTime = startTimestamp ; cse . signature = signature ; if ( parent != null ) { cse . parent = parent ; parent . children . add ( cse ) ; } return cse ; } | This static factory method also sets the parent - child relationships . | 125 | 12 |
26,168 | public void beforeTransformation ( TypeDescription typeDescription , ClassLoader classLoader ) { if ( isPreventDuplicateTransformation ( ) ) { Dispatcher . put ( getClassAlreadyTransformedKey ( typeDescription , classLoader ) , Boolean . TRUE ) ; } if ( DEBUG_INSTRUMENTATION && logger . isDebugEnabled ( ) ) { logger . debug ( "TRANSFORM {} ({})" , typeDescription . getName ( ) , getClass ( ) . getSimpleName ( ) ) ; } } | This method is called before the transformation . You can stop the transformation from happening by returning false from this method . | 111 | 22 |
26,169 | public static String getCallerSignature ( ) { if ( Stagemonitor . getPlugin ( CorePlugin . class ) . getIncludePackages ( ) . isEmpty ( ) ) { return null ; } if ( javaLangAccessObject != null ) { return getCallerSignatureSharedSecrets ( ) ; } else { return getCallerSignatureGetStackTrace ( ) ; } } | Returns the signature of the method inside the monitored codebase which was last executed . | 87 | 16 |
26,170 | @ Deprecated public static void reset ( MeasurementSession measurementSession ) { started = false ; disabled = false ; if ( configuration == null ) { reloadPluginsAndConfiguration ( ) ; } if ( measurementSession == null ) { CorePlugin corePlugin = getPlugin ( CorePlugin . class ) ; measurementSession = new MeasurementSession ( corePlugin . getApplicationName ( ) , corePlugin . getHostName ( ) , corePlugin . getInstanceName ( ) ) ; } onShutdownActions . add ( AgentAttacher . performRuntimeAttachment ( ) ) ; startMonitoring ( measurementSession ) ; healthCheckRegistry . register ( "Startup" , new HealthCheck ( ) { @ Override protected Result check ( ) throws Exception { if ( started ) { return Result . healthy ( ) ; } else { return Result . unhealthy ( "stagemonitor is not started" ) ; } } } ) ; logStatus ( ) ; new ConfigurationLogger ( ) . logConfiguration ( configuration ) ; } | Should only be used outside of this class by the internal unit tests | 210 | 13 |
26,171 | public boolean isPasswordCorrect ( String password ) { final String actualPassword = configurationRegistry . getString ( updateConfigPasswordKey ) ; return "" . equals ( actualPassword ) || actualPassword != null && actualPassword . equals ( password ) ; } | Validates a password . | 51 | 5 |
26,172 | @ Override public T convert ( String name ) throws IllegalArgumentException { if ( name == null ) { throw new IllegalArgumentException ( "Cant convert 'null' to " + enumClass . getSimpleName ( ) ) ; } try { return Enum . valueOf ( enumClass , name ) ; } catch ( IllegalArgumentException e ) { // ignore } try { return Enum . valueOf ( enumClass , name . toUpperCase ( ) ) ; } catch ( IllegalArgumentException e ) { // ignore } try { return Enum . valueOf ( enumClass , name . toUpperCase ( ) . replace ( "-" , "_" ) ) ; } catch ( IllegalArgumentException e ) { // ignore } throw new IllegalArgumentException ( "Can't convert " + name + " to " + enumClass . getSimpleName ( ) ) ; } | Converts a String into an Enum . | 188 | 9 |
26,173 | @ Override protected void doGet ( HttpServletRequest req , HttpServletResponse resp ) throws ServletException , IOException { if ( alertingPlugin . getAlertSender ( ) != null ) { JsonUtils . writeJsonToOutputStream ( alertingPlugin . getAlertSender ( ) . getAvailableAlerters ( ) , resp . getOutputStream ( ) ) ; } else { JsonUtils . writeJsonToOutputStream ( Collections . emptyList ( ) , resp . getOutputStream ( ) ) ; } } | Returns all available alerters | 119 | 6 |
26,174 | private void addRemotePropertiesConfigurationSources ( ConfigurationRegistry configuration , CorePlugin corePlugin ) { final List < URL > configurationUrls = corePlugin . getRemotePropertiesConfigUrls ( ) ; if ( corePlugin . isDeactivateStagemonitorIfRemotePropertyServerIsDown ( ) ) { assertRemotePropertiesServerIsAvailable ( configurationUrls . get ( 0 ) ) ; } logger . debug ( "Loading RemotePropertiesConfigurationSources with: configurationUrls = " + configurationUrls ) ; final HttpClient sharedHttpClient = new HttpClient ( ) ; for ( URL configUrl : configurationUrls ) { final RemotePropertiesConfigurationSource source = new RemotePropertiesConfigurationSource ( sharedHttpClient , configUrl ) ; configuration . addConfigurationSourceAfter ( source , SimpleSource . class ) ; } configuration . reloadAllConfigurationOptions ( ) ; } | Creates and registers a RemotePropertiesConfigurationSource for each configuration url | 182 | 14 |
26,175 | private void assertRemotePropertiesServerIsAvailable ( final URL configUrl ) { new HttpClient ( ) . send ( "HEAD" , configUrl . toExternalForm ( ) , new HashMap < String , String > ( ) , null , new HttpClient . ResponseHandler < Void > ( ) { @ Override public Void handleResponse ( HttpRequest < ? > httpRequest , InputStream is , Integer statusCode , IOException e ) throws IOException { if ( e != null || statusCode != 200 ) { throw new IllegalStateException ( "Remote properties are not available at " + configUrl + ", http status code: " + statusCode , e ) ; } return null ; } } ) ; } | Does a simple HEAD request to a configuration endpoint to check if it s reachable . If not an IllegalStateException is thrown | 149 | 25 |
26,176 | private CounterMetricFamily fromCounter ( List < Map . Entry < MetricName , Counter > > countersWithSameName ) { final Map . Entry < MetricName , Counter > first = countersWithSameName . get ( 0 ) ; final MetricName firstName = first . getKey ( ) ; final CounterMetricFamily metricFamily = new CounterMetricFamily ( firstName . getName ( ) , getHelpMessage ( firstName , first . getValue ( ) ) , firstName . getTagKeys ( ) ) ; for ( Map . Entry < MetricName , Counter > entry : countersWithSameName ) { metricFamily . addMetric ( entry . getKey ( ) . getTagValues ( ) , entry . getValue ( ) . getCount ( ) ) ; } return metricFamily ; } | Export counter as prometheus counter . | 170 | 7 |
26,177 | private MetricFamilySamples fromTimer ( List < Map . Entry < MetricName , Timer > > histogramsWithSameName ) { final SummaryMetricFamily summaryMetricFamily = getSummaryMetricFamily ( histogramsWithSameName , "_seconds" ) ; for ( Map . Entry < MetricName , Timer > entry : histogramsWithSameName ) { addSummaryMetric ( summaryMetricFamily , entry . getKey ( ) , entry . getValue ( ) . getSnapshot ( ) , SECONDS_IN_NANOS , entry . getValue ( ) . getCount ( ) ) ; } return summaryMetricFamily ; } | Export dropwizard Timer as a histogram . Use TIME_UNIT as time unit . | 140 | 20 |
26,178 | @ SuppressWarnings ( "unchecked" ) public static < T > T get ( String key , Class < T > valueClass ) { return ( T ) values . get ( key ) ; } | Gets a shared value by it s key | 43 | 9 |
26,179 | public static synchronized Runnable performRuntimeAttachment ( ) { if ( runtimeAttached || ! corePlugin . isStagemonitorActive ( ) || ! corePlugin . isAttachAgentAtRuntime ( ) ) { return NOOP_ON_SHUTDOWN_ACTION ; } runtimeAttached = true ; final List < ClassFileTransformer > classFileTransformers = new ArrayList < ClassFileTransformer > ( ) ; final AutoEvictingCachingBinaryLocator binaryLocator = new AutoEvictingCachingBinaryLocator ( ) ; if ( assertNoDifferentStagemonitorVersionIsDeployedOnSameJvm ( ) && initInstrumentation ( ) ) { final long start = System . currentTimeMillis ( ) ; classFileTransformers . add ( initByteBuddyClassFileTransformer ( binaryLocator ) ) ; if ( corePlugin . isDebugInstrumentation ( ) ) { logger . info ( "Attached agents in {} ms" , System . currentTimeMillis ( ) - start ) ; } TimedElementMatcherDecorator . logMetrics ( ) ; } return new Runnable ( ) { public void run ( ) { for ( ClassFileTransformer classFileTransformer : classFileTransformers ) { instrumentation . removeTransformer ( classFileTransformer ) ; } // This ClassLoader is shutting down so don't try to retransform classes of it in the future hashCodesOfClassLoadersToIgnore . add ( ClassUtils . getIdentityString ( AgentAttacher . class . getClassLoader ( ) ) ) ; binaryLocator . close ( ) ; } } ; } | Attaches the profiler and other instrumenters at runtime so that it is not necessary to add the - javaagent command line argument . | 351 | 27 |
26,180 | public static void registerMBean ( final ObjectInstance objectInstance , final String mBeanAttributeName , MetricName metricName , Metric2Registry metricRegistry ) { metricRegistry . register ( metricName , new Gauge < Object > ( ) { @ Override public Object getValue ( ) { return getValueFromMBean ( objectInstance , mBeanAttributeName ) ; } } ) ; } | Registers a MBean into the MetricRegistry | 89 | 12 |
26,181 | public void registerAll ( Metric2Set metrics ) throws IllegalArgumentException { for ( Map . Entry < MetricName , Metric > entry : metrics . getMetrics ( ) . entrySet ( ) ) { register ( entry . getKey ( ) , entry . getValue ( ) ) ; } } | Given a metric set registers them . | 65 | 7 |
26,182 | public void registerAny ( Metric2Set metrics ) { for ( Map . Entry < MetricName , Metric > entry : metrics . getMetrics ( ) . entrySet ( ) ) { registerNewMetrics ( entry . getKey ( ) , entry . getValue ( ) ) ; } } | Given a metric set registers the ones not already registered . This method prevents IllegalArgumentException | 63 | 18 |
26,183 | public void registerNewMetrics ( MetricName name , Metric metric ) { final Set < MetricName > registeredNames = getNames ( ) ; if ( ! registeredNames . contains ( name ) ) { try { register ( name , metric ) ; } catch ( IllegalArgumentException e ) { /* exception due to race condition*/ } } } | Only registers the metric if it is not already registered | 73 | 10 |
26,184 | public MimeMessage createMimeMessage ( Session session ) throws MessagingException { if ( isEmpty ( htmlPart ) && isEmpty ( textPart ) ) { throw new IllegalArgumentException ( "Missing email content" ) ; } final MimeMessage msg = new MimeMessage ( session ) ; msg . setSubject ( subject ) ; msg . setFrom ( new InternetAddress ( from ) ) ; msg . setContent ( createMultiPart ( ) ) ; msg . setRecipients ( Message . RecipientType . TO , InternetAddress . parse ( recipients , false ) ) ; return msg ; } | Creates a MimeMessage containing given Multipart . Subject sender and content and session will be set . | 126 | 22 |
26,185 | private Multipart createMultiPart ( ) throws MessagingException { Multipart multipart = new MimeMultipart ( "alternative" ) ; if ( textPart != null ) { // add text first, to give priority to html multipart . addBodyPart ( ( BodyPart ) createTextMimePart ( ) ) ; } if ( htmlPart != null ) { multipart . addBodyPart ( ( BodyPart ) createHtmlMimePart ( ) ) ; } return multipart ; } | Creates a Multipart from present parts . | 107 | 10 |
26,186 | private MimePart createHtmlMimePart ( ) throws MessagingException { MimePart bodyPart = new MimeBodyPart ( ) ; bodyPart . setContent ( htmlPart , "text/html; charset=utf-8" ) ; return bodyPart ; } | Creates a MimePart from HTML part . | 59 | 10 |
26,187 | private MimePart createTextMimePart ( ) throws MessagingException { MimePart bodyPart = new MimeBodyPart ( ) ; bodyPart . setText ( textPart ) ; return bodyPart ; } | Creates a MimePart from text part . | 45 | 10 |
26,188 | public PreExecutionInterceptorContext mustCollectCallTree ( String reason ) { logger . debug ( "Must collect call tree because {}" , reason ) ; mustCollectCallTree = true ; collectCallTree = true ; return this ; } | Makes sure that a call tree is collected for the current request . In other words profiles this request . | 49 | 21 |
26,189 | public PreExecutionInterceptorContext shouldNotCollectCallTree ( String reason ) { if ( ! mustCollectCallTree ) { logger . debug ( "Should not collect call tree because {}" , reason ) ; collectCallTree = false ; } return this ; } | Requests that this request should not be profiled | 54 | 10 |
26,190 | public List < CheckResult > check ( MetricName actualTarget , Map < String , Number > currentValuesByMetric ) { SortedMap < CheckResult . Status , List < Threshold > > sortedThresholds = new TreeMap < CheckResult . Status , List < Threshold > > ( thresholds ) ; for ( Map . Entry < CheckResult . Status , List < Threshold > > entry : sortedThresholds . entrySet ( ) ) { List < CheckResult > results = checkThresholds ( entry . getValue ( ) , entry . getKey ( ) , actualTarget , currentValuesByMetric ) ; if ( ! results . isEmpty ( ) ) { return results ; } } return Collections . emptyList ( ) ; } | Performs threshold checks for the whole check group | 157 | 9 |
26,191 | public Map < String , Boolean > getNamesOfConfigurationSources ( ) { final Map < String , Boolean > result = new LinkedHashMap < String , Boolean > ( ) ; for ( ConfigurationSource configurationSource : configurationSources ) { result . put ( configurationSource . getName ( ) , configurationSource . isSavingPossible ( ) ) ; } return result ; } | Returns a map with the names of all configuration sources as key and a boolean indicating whether the configuration source supports saving as value | 77 | 24 |
26,192 | public void reload ( String key ) { if ( configurationOptionsByKey . containsKey ( key ) ) { configurationOptionsByKey . get ( key ) . reload ( false ) ; } } | Reloads a specific dynamic configuration option . | 39 | 9 |
26,193 | public String getString ( String key ) { if ( key == null || key . isEmpty ( ) ) { return null ; } String property = null ; for ( ConfigurationSource configurationSource : configurationSources ) { property = configurationSource . getValue ( key ) ; if ( property != null ) { break ; } } return property ; } | Gets the value of a configuration key as string | 69 | 10 |
26,194 | public URL getElasticsearchUrl ( ) { final List < URL > urls = elasticsearchUrls . getValue ( ) ; if ( urls . isEmpty ( ) ) { return null ; } final int index = accessesToElasticsearchUrl . getAndIncrement ( ) % urls . size ( ) ; URL elasticsearchURL = urls . get ( index ) ; final String defaultUsernameValue = elasticsearchDefaultUsername . getValue ( ) ; final String defaultPasswordValue = elasticsearchDefaultPassword . getValue ( ) ; if ( elasticsearchURL . getUserInfo ( ) == null && ! defaultUsernameValue . isEmpty ( ) && ! defaultPasswordValue . isEmpty ( ) ) { try { String username = URLEncoder . encode ( defaultUsernameValue , "UTF-8" ) ; String password = URLEncoder . encode ( defaultPasswordValue , "UTF-8" ) ; StringBuilder stringBuilder = new StringBuilder ( ) ; stringBuilder . append ( elasticsearchURL . getProtocol ( ) ) . append ( "://" ) . append ( username ) . append ( ":" ) . append ( password ) . append ( "@" ) . append ( elasticsearchURL . getHost ( ) ) . append ( ":" ) . append ( elasticsearchURL . getPort ( ) ) . append ( elasticsearchURL . getPath ( ) ) ; return new URL ( stringBuilder . toString ( ) ) ; } catch ( Exception e ) { logger . error ( e . getMessage ( ) , e ) ; } } return elasticsearchURL ; } | Cycles through all provided Elasticsearch URLs and returns one | 337 | 11 |
26,195 | public void update ( T newValue , String configurationSourceName ) throws IOException { final String newValueAsString = valueConverter . toString ( newValue ) ; configuration . save ( key , newValueAsString , configurationSourceName ) ; } | Updates the existing value with a new one | 53 | 9 |
26,196 | public boolean isDefault ( ) { return ( valueAsString != null && valueAsString . equals ( defaultValueAsString ) ) || ( valueAsString == null && defaultValueAsString == null ) ; } | Returns true if the current value is equal to the default value | 44 | 12 |
26,197 | public String toGraphiteName ( ) { StringBuilder sb = new StringBuilder ( GraphiteSanitizer . sanitizeGraphiteMetricSegment ( name ) ) ; for ( String value : tags . values ( ) ) { sb . append ( ' ' ) . append ( GraphiteSanitizer . sanitizeGraphiteMetricSegment ( value ) ) ; } return sb . toString ( ) ; } | Converts a metrics 2 . 0 name into a graphite compliant name by appending all tag values to the metric name | 92 | 24 |
26,198 | @ NonNull public final List < Router > getChildRouters ( ) { List < Router > routers = new ArrayList <> ( childRouters . size ( ) ) ; routers . addAll ( childRouters ) ; return routers ; } | Returns all of this Controller s child Routers | 54 | 9 |
26,199 | public boolean handleBack ( ) { List < RouterTransaction > childTransactions = new ArrayList <> ( ) ; for ( ControllerHostedRouter childRouter : childRouters ) { childTransactions . addAll ( childRouter . getBackstack ( ) ) ; } Collections . sort ( childTransactions , new Comparator < RouterTransaction > ( ) { @ Override public int compare ( RouterTransaction o1 , RouterTransaction o2 ) { return o2 . transactionIndex - o1 . transactionIndex ; } } ) ; for ( RouterTransaction transaction : childTransactions ) { Controller childController = transaction . controller ; if ( childController . isAttached ( ) && childController . getRouter ( ) . handleBack ( ) ) { return true ; } } return false ; } | Should be overridden if this Controller needs to handle the back button being pressed . | 167 | 16 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.