idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
7,800
public void setFile ( File file ) throws IOException { if ( ! file . isFile ( ) ) throw new IllegalArgumentException ( file + " must be a file." ) ; else { if ( file . getName ( ) . endsWith ( "gz" ) ) initGzReader ( file ) ; else initReader ( file ) ; } }
Read from a specified file . Also supports gzipped files .
7,801
public void setFileFromAJar ( String fileName ) { InputStream is = this . getClass ( ) . getResourceAsStream ( fileName ) ; if ( is != null ) { this . fileName = fileName ; reader = new InputStreamReader ( is ) ; } }
Read a file resouce located in a jar
7,802
private TypeInfo getTypeInfo ( Map < String , TypeInfo > typeMaps , String path , Class < ? > superType ) { TypeInfo typeInfo = typeMaps . get ( path ) ; if ( typeInfo == null ) { typeInfo = new TypeInfo ( superType ) ; typeMaps . put ( path , typeInfo ) ; } return typeInfo ; }
Get the TypeInfo object from specified path or return the new one if it does not exist .
7,803
protected void successfulAuthentication ( PortletRequest request , PortletResponse response , Authentication authResult ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Authentication success: " + authResult ) ; } SecurityContextHolder . getContext ( ) . setAuthentication ( authResult ) ; if ( this . eventPublisher != null ) { eventPublisher . publishEvent ( new InteractiveAuthenticationSuccessEvent ( authResult , this . getClass ( ) ) ) ; } }
Puts the Authentication instance returned by the authentication manager into the secure context .
7,804
public ApiResponse < Templates > deleteTemplatesWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = deleteTemplatesValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < Templates > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Delete Templates . deleteTemplates
7,805
public ApiResponse < ApiEndpointsSuccess > getApiEndpointsWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getApiEndpointsValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < ApiEndpointsSuccess > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get apiEndpoints . Get api - endpoints
7,806
public ApiResponse < Templates > getTemplatesWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getTemplatesValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < Templates > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get Templates . getTemplates
7,807
public ApiResponse < ApiPostEndpointsSuccess > postApiEndpointsWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = postApiEndpointsValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < ApiPostEndpointsSuccess > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Post apiEndpoints . Post api - endpoints
7,808
public ApiResponse < Templates > postTemplatesWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = postTemplatesValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < Templates > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Post Templates . postTemplates
7,809
public ApiResponse < Templates > putTemplatesWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = putTemplatesValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < Templates > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Put Templates . putTemplates
7,810
public ApiResponse < GetLogout > getLogoutWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getLogoutValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetLogout > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Logout user Logout the user by deleting the session and removing the associated cookie .
7,811
public ApiResponse < ApiSuccessResponse > initProvisioningWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = initProvisioningValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < ApiSuccessResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Init Session The GET operation will init user session .
7,812
public static < T > T dtoFromScratch ( T entity , DTO dtoTemplate ) throws HyalineException { return dtoFromScratch ( entity , dtoTemplate , "Hyaline$Proxy$" + System . currentTimeMillis ( ) ) ; }
It lets you create a new DTO from scratch . This means that any annotation from JAXB Jackson or whatever serialization framework you are using on your entity T will be ignored . The only annotation - based configuration that will be used is the one you are defining in this invocation .
7,813
public static < T > T dtoFromScratch ( T entity , DTO dtoTemplate , String proxyClassName ) throws HyalineException { try { return createDTO ( entity , dtoTemplate , true , proxyClassName ) ; } catch ( CannotInstantiateProxyException | DTODefinitionException e ) { e . printStackTrace ( ) ; throw new HyalineException ( ) ; } }
It lets you create a new DTO from scratch . This means that any annotation for JAXB Jackson or whatever serialization framework you are using on your entity T will be ignored . The only annotation - based configuration that will be used is the one you are defining in this invocation .
7,814
public ApiResponse < GetEnabledResponse > getEnabledWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getEnabledValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetEnabledResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get SAML state . Returns SAML current state .
7,815
public ApiResponse < GetLocationResponse > getLocationsWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getLocationsValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetLocationResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get exist locations . Returns exist locations .
7,816
public ApiResponse < PostLocationResponse > postLocationWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = postLocationValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < PostLocationResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Set main settings . Change global settings .
7,817
public ApiResponse < GetSubResponse > checkMigrateConflictsWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = checkMigrateConflictsValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetSubResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get migrate check for conflicts . Get migrate check for conflicts
7,818
public ApiResponse < CheckPostMigrateStatistic > checkPostMigrateStatisticWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = checkPostMigrateStatisticValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < CheckPostMigrateStatistic > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Post statistic migrate . Post statistic migrate
7,819
public ApiResponse < GetExportStatisticDefinitions > getExportStatisticDefinitionsWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getExportStatisticDefinitionsValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetExportStatisticDefinitions > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get export statistic definitions . Get export statistic definitions
7,820
public ApiResponse < GetStatisticDefinitionsResponse > getStatisticDefinitionsWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getStatisticDefinitionsValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetStatisticDefinitionsResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get statistic definitions . Returns statistic definitions records .
7,821
public ApiResponse < PostImportStatisticDefinitions > postImportStatisticDefinitionsWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = postImportStatisticDefinitionsValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < PostImportStatisticDefinitions > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Post import statistic definitions . Post import statistic definitions
7,822
public ApiResponse < GetStatisticDefinitionsResponse > postStatisticDefinitionsWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = postStatisticDefinitionsValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetStatisticDefinitionsResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Post statistic definitions . Returns statistic definitions records .
7,823
public static QueueConfiguration customGame ( boolean force , String gameId , int team ) { return new CustomGameQueueConfiguration ( force , gameId , team ) ; }
Joins custom game .
7,824
public static PortletApplicationContext getPortletApplicationContext ( PortletRequest request , PortletContext portletContext ) throws IllegalStateException { PortletApplicationContext portletApplicationContext = ( PortletApplicationContext ) request . getAttribute ( ContribDispatcherPortlet . PORTLET_APPLICATION_CONTEXT_ATTRIBUTE ) ; if ( portletApplicationContext == null ) { if ( portletContext == null ) { throw new IllegalStateException ( "No PortletApplicationContext found: not in a DispatcherPortlet request?" ) ; } portletApplicationContext = PortletApplicationContextUtils2 . getRequiredPortletApplicationContext ( portletContext ) ; } return portletApplicationContext ; }
Look for the PortletApplicationContext associated with the DispatcherPortlet that has initiated request processing and for the global context if none was found associated with the current request . This method is useful to allow components outside the framework such as JSP tag handlers to access the most specific application context available .
7,825
public static ApplicationContext getWebApplicationContext ( PortletRequest request , PortletContext portletContext ) throws IllegalStateException { PortletApplicationContext portletApplicationContext = ( PortletApplicationContext ) request . getAttribute ( ContribDispatcherPortlet . PORTLET_APPLICATION_CONTEXT_ATTRIBUTE ) ; if ( portletApplicationContext != null ) { return portletApplicationContext ; } if ( portletContext == null ) { throw new IllegalStateException ( "No PortletApplicationContext found: not in a DispatcherPortlet request?" ) ; } portletApplicationContext = PortletApplicationContextUtils2 . getPortletApplicationContext ( portletContext ) ; if ( portletApplicationContext != null ) { return portletApplicationContext ; } return PortletApplicationContextUtils . getRequiredWebApplicationContext ( portletContext ) ; }
Look for the PortletApplicationContext associated with the DispatcherPortlet that has initiated request processing for the global portlet context if none was found associated with the current request and for the global context if no global portlet context was found . This method is useful to allow components outside the framework such as JSP tag handlers to access the most specific application context available .
7,826
public void initializeWithCode ( String authCode , String redirectUri ) throws ProvisioningApiException { initialize ( null , authCode , redirectUri ) ; }
Initialize the API with an code from the auth service .
7,827
public UpdatableGameState update ( GameUpdateApiResponse gameUpdateData ) { return new UpdatableGameState ( gameUpdateData . getTurn ( ) , startData , MapPatcher . patch ( gameUpdateData . getMapDiff ( ) , rawMapArray ) , MapPatcher . patch ( gameUpdateData . getCitiesDiff ( ) , rawCitiesArray ) , gameUpdateData . getGenerals ( ) , createPlayersInfo ( startData , gameUpdateData ) , gameUpdateData . getAttackIndex ( ) ) ; }
Updates game state from previous turn with new information received from server . The method only works fine if updates are applied in sequence as server is only sending map differences in update messages .
7,828
public ApiResponse < GetMOHFilesResponse > getMOHFilesWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getMOHFilesValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetMOHFilesResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get WAV files for MOH . Returns exist WAV files .
7,829
public ApiResponse < GetMOHSettings > getMOHSettingsWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getMOHSettingsValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetMOHSettings > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get exist setting . Returns exist setting from MOH .
7,830
public ApiResponse < PostCheckInactivity > checkInactivityWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = checkInactivityValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < PostCheckInactivity > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Inactivity . Inactivity .
7,831
public ApiResponse < GetSubResponse > getSubWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getSubValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetSubResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get sub . Sub
7,832
public ApiResponse < PostImportResponse > postImportWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = postImportValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < PostImportResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
PostImport . postImport
7,833
public ApiResponse < PostUsers > postUsersWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = postUsersValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < PostUsers > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Post users . postUsers
7,834
public ApiResponse < PostValidateImportResponse > postValidateImportWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = postValidateImportValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < PostValidateImportResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Post Validate Import . post validate import
7,835
public ApiResponse < PutUsers > putUsersWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = putUsersValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < PutUsers > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Put users . putUsers
7,836
protected Class < ? > determineContextClass ( PortletContext portletContext ) { String contextClassName = portletContext . getInitParameter ( CONTEXT_CLASS_PARAM ) ; if ( contextClassName != null ) { try { return ClassUtils . forName ( contextClassName , ClassUtils . getDefaultClassLoader ( ) ) ; } catch ( ClassNotFoundException ex ) { throw new ApplicationContextException ( "Failed to load custom context class [" + contextClassName + "]" , ex ) ; } } else { contextClassName = defaultStrategies . getProperty ( PortletApplicationContext . class . getName ( ) ) ; try { return ClassUtils . forName ( contextClassName , PortletContextLoader . class . getClassLoader ( ) ) ; } catch ( ClassNotFoundException ex ) { throw new ApplicationContextException ( "Failed to load default context class [" + contextClassName + "]" , ex ) ; } } }
Return the PortletApplicationContext implementation class to use either the default XmlPortletApplicationContext or a custom context class if specified .
7,837
public ApiResponse < GetArgsResponse > argsWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = argsValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetArgsResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get provisioning arguments . Returns some of provisioning variables .
7,838
public ApiResponse < DynconfigGetConfigResponse > dynconfigGetConfigWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = dynconfigGetConfigValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < DynconfigGetConfigResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get config . json file . Returns config . json file .
7,839
public ApiResponse < GetConfigResponse > getConfigWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getConfigValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetConfigResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get analytics config . Returns exist config .
7,840
public void deleteUser ( String userDBID , Boolean keepPlaces ) throws ProvisioningApiException { try { ApiSuccessResponse resp = usersApi . deleteUser ( userDBID , keepPlaces ) ; if ( ! resp . getStatus ( ) . getCode ( ) . equals ( 0 ) ) { throw new ProvisioningApiException ( "Error deleting user. Code: " + resp . getStatus ( ) . getCode ( ) ) ; } } catch ( ApiException e ) { throw new ProvisioningApiException ( "Error deleting user" , e ) ; } }
Deletes a user with the given DBID .
7,841
public void updateUser ( String userDBID , User user ) throws ProvisioningApiException { try { ApiSuccessResponse resp = usersApi . updateUser ( userDBID , new UpdateUserData ( ) . data ( Converters . convertUserToUpdateUserDataData ( user ) ) ) ; if ( ! resp . getStatus ( ) . getCode ( ) . equals ( 0 ) ) { throw new ProvisioningApiException ( "Error updating user. Code: " + resp . getStatus ( ) . getCode ( ) ) ; } } catch ( ApiException e ) { throw new ProvisioningApiException ( "Error updating user" , e ) ; } }
Updates the attributes of a user with the given DBID .
7,842
public Results < DnGroup > searchDnGroups ( SearchParams searchParams ) throws ProvisioningApiException { return searchDnGroups ( searchParams . getLimit ( ) , searchParams . getOffset ( ) , searchParams . getSearchTerm ( ) , searchParams . getSearchKey ( ) , searchParams . getMatchMethod ( ) , searchParams . getSortKey ( ) , searchParams . getSortAscending ( ) , searchParams . getSortMethod ( ) ) ; }
Get Dn groups . Get Dn groups from Configuration Server with the specified filters .
7,843
public ApiResponse < GetInboundResponse > getInboundSettingsWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getInboundSettingsValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetInboundResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get inbound settings . Returns inbound settings .
7,844
public ApiResponse < GetOutboundResponse > getOutboundSettingsWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getOutboundSettingsValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetOutboundResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get outbound settings . Returns outbound settings .
7,845
private static Element lookupId ( List < Element > fields ) { Element objectIdField = null ; Element uuidField = null ; Element _idField = null ; Element idField = null ; for ( Element field : fields ) { if ( field . getAnnotation ( Id . class ) != null ) { return field ; } if ( isObjectId ( field ) ) { objectIdField = field ; } else if ( isUUID ( field ) ) { uuidField = field ; } else if ( field . getSimpleName ( ) . contentEquals ( ID_FIELD_NAME ) ) { _idField = field ; } else if ( field . getSimpleName ( ) . contentEquals ( "id" ) ) { idField = field ; } } if ( objectIdField != null ) { return objectIdField ; } if ( uuidField != null ) { return uuidField ; } if ( _idField != null ) { return _idField ; } if ( idField != null ) { return idField ; } return null ; }
Find a field with the
7,846
public User getUser ( String fieldName , String fieldValue ) { Select q = new Select ( ) . from ( User . class ) ; String nameColumn = ModelReflector . instance ( User . class ) . getColumnDescriptor ( fieldName ) . getName ( ) ; q . where ( new Expression ( q . getPool ( ) , nameColumn , Operator . EQ , new BindVariable ( q . getPool ( ) , fieldValue ) ) ) ; List < ? extends User > users = q . execute ( User . class ) ; if ( users . size ( ) == 1 ) { return users . get ( 0 ) ; } return null ; }
Can be cast to any user model class as the proxy implements all the user classes .
7,847
public Response intercept ( Chain chain ) throws IOException { Request request = chain . request ( ) ; request = request . newBuilder ( ) . addHeader ( TRACEID_HEADER , makeUniqueId ( ) ) . addHeader ( SPANID_HEADER , makeUniqueId ( ) ) . build ( ) ; return chain . proceed ( request ) ; }
64 - bit ids
7,848
public ApiResponse < GetAuditResponse > getAuditWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getAuditValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetAuditResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get audit records . Returns audit records .
7,849
public Options getOptions ( String personDBID , String agentGroupDBID ) throws ProvisioningApiException { try { OptionsGetResponseSuccess resp = optionsApi . optionsGet ( personDBID , agentGroupDBID ) ; if ( ! resp . getStatus ( ) . getCode ( ) . equals ( 0 ) ) { throw new ProvisioningApiException ( "Error getting options. Code: " + resp . getStatus ( ) . getCode ( ) ) ; } Options out = new Options ( ) ; out . setOptions ( ( Map < String , Object > ) resp . getData ( ) . getOptions ( ) ) ; out . setCmeAppName ( resp . getData ( ) . getCmeAppName ( ) ) ; out . setCmeAppDBID ( resp . getData ( ) . getCmeAppDBID ( ) ) ; return out ; } catch ( ApiException e ) { throw new ProvisioningApiException ( "Error getting options" , e ) ; } }
Get options . Get options for a specified application and merge them with the person and agent group annexes .
7,850
public void modifyOptions ( Map < String , Object > options ) throws ProvisioningApiException { try { OptionsPostResponseStatusSuccess resp = optionsApi . optionsPost ( new OptionsPost ( ) . data ( new OptionsPostData ( ) . options ( options ) ) ) ; if ( ! resp . getStatus ( ) . getCode ( ) . equals ( 0 ) ) { throw new ProvisioningApiException ( "Error modifying options. Code: " + resp . getStatus ( ) . getCode ( ) ) ; } } catch ( ApiException e ) { throw new ProvisioningApiException ( "Error modifying options" , e ) ; } }
Modify options . Replace the existing application options with the specified new values .
7,851
public void updateOptions ( Map < String , Object > newOptions , Map < String , Object > changedOptions , Map < String , Object > deletedOptions ) throws ProvisioningApiException { try { OptionsPutResponseStatusSuccess resp = optionsApi . optionsPut ( new OptionsPut ( ) . data ( new OptionsPutData ( ) . newOptions ( newOptions ) . changedOptions ( changedOptions ) . deletedOptions ( deletedOptions ) ) ) ; if ( ! resp . getStatus ( ) . getCode ( ) . equals ( 0 ) ) { throw new ProvisioningApiException ( "Error updating options. Code: " + resp . getStatus ( ) . getCode ( ) ) ; } } catch ( ApiException e ) { throw new ProvisioningApiException ( "Error updating options" , e ) ; } }
Add edit or delete options values . Add edit or delete option values for the specified application .
7,852
private final EvalResult doDefine ( List < SExpression > subexpressions , Environment environment , ParametricBfgBuilder builder , EvalContext context ) { int nameToBind = subexpressions . get ( 1 ) . getConstantIndex ( ) ; if ( subexpressions . size ( ) == 3 ) { Object valueToBind = eval ( subexpressions . get ( 2 ) , environment , builder , context ) . getValue ( ) ; environment . bindName ( nameToBind , valueToBind ) ; } else if ( subexpressions . size ( ) >= 4 ) { AmbLambdaValue lambdaValue = makeLambda ( subexpressions . get ( 2 ) , subexpressions . subList ( 3 , subexpressions . size ( ) ) , environment ) ; environment . bindName ( nameToBind , lambdaValue ) ; } return new EvalResult ( ConstantValue . UNDEFINED ) ; }
Evaluates the define special form .
7,853
public static String password ( int length ) { StringBuilder result = new StringBuilder ( ) ; byte [ ] values = byteArray ( length ) ; int index = 0 ; for ( int i = 0 ; i < length ; i ++ ) { index += ( values [ i ] & 0xff ) ; index = index % passwordCharacters . length ( ) ; result . append ( passwordCharacters . charAt ( index ) ) ; } return result . toString ( ) ; }
Generates a random password .
7,854
public CcgSyntaxTree getSyntacticParse ( ) { HeadedSyntacticCategory originalSyntax = null ; if ( unaryRule != null ) { originalSyntax = unaryRule . getUnaryRule ( ) . getInputSyntacticCategory ( ) . getCanonicalForm ( ) ; } else { originalSyntax = syntax ; } if ( isTerminal ( ) ) { return CcgSyntaxTree . createTerminal ( syntax . getSyntax ( ) , originalSyntax . getSyntax ( ) , spanStart , spanEnd , words , posTags , originalSyntax ) ; } else { CcgSyntaxTree leftTree = left . getSyntacticParse ( ) ; CcgSyntaxTree rightTree = right . getSyntacticParse ( ) ; return CcgSyntaxTree . createNonterminal ( syntax . getSyntax ( ) , originalSyntax . getSyntax ( ) , leftTree , rightTree ) ; } }
Gets a representation of the syntactic structure of this parse omitting all semantic information .
7,855
public Expression2 getLogicalForm ( ) { Expression2 preUnaryLogicalForm = getPreUnaryLogicalForm ( ) ; if ( unaryRule == null ) { return preUnaryLogicalForm ; } else if ( preUnaryLogicalForm == null || unaryRule . getUnaryRule ( ) . getLogicalForm ( ) == null ) { return null ; } else { return Expression2 . nested ( unaryRule . getUnaryRule ( ) . getLogicalForm ( ) , preUnaryLogicalForm ) ; } }
Gets the logical form for this CCG parse .
7,856
public SpannedExpression getLogicalFormForSpan ( int spanStart , int spanEnd ) { CcgParse spanningParse = getParseForSpan ( spanStart , spanEnd ) ; Expression2 lf = spanningParse . getPreUnaryLogicalForm ( ) ; if ( lf != null ) { return new SpannedExpression ( spanningParse . getHeadedSyntacticCategory ( ) , spanningParse . getLogicalForm ( ) , spanningParse . getSpanStart ( ) , spanningParse . getSpanEnd ( ) ) ; } else { return null ; } }
Returns the logical form for the smallest subtree of the parse which completely contains the given span .
7,857
public List < SpannedExpression > getSpannedLogicalForms ( ) { List < SpannedExpression > spannedExpressions = Lists . newArrayList ( ) ; getSpannedLogicalFormsHelper ( spannedExpressions ) ; return spannedExpressions ; }
Gets the logical forms for every subspan of this parse tree . Many of the returned logical forms combine with each other during the parse of the sentence .
7,858
public List < String > getSpannedWords ( ) { if ( isTerminal ( ) ) { return words ; } else { List < String > words = Lists . newArrayList ( ) ; words . addAll ( left . getSpannedWords ( ) ) ; words . addAll ( right . getSpannedWords ( ) ) ; return words ; } }
Gets all of the words spanned by this node of the parse tree in sentence order .
7,859
public List < String > getSpannedPosTags ( ) { if ( isTerminal ( ) ) { return posTags ; } else { List < String > tags = Lists . newArrayList ( ) ; tags . addAll ( left . getSpannedPosTags ( ) ) ; tags . addAll ( right . getSpannedPosTags ( ) ) ; return tags ; } }
Gets all of the part - of - speech tags spanned by this node of the parse tree in sentence order .
7,860
public List < LexiconEntryInfo > getSpannedLexiconEntries ( ) { if ( isTerminal ( ) ) { return Arrays . asList ( lexiconEntry ) ; } else { List < LexiconEntryInfo > lexiconEntries = Lists . newArrayList ( ) ; lexiconEntries . addAll ( left . getSpannedLexiconEntries ( ) ) ; lexiconEntries . addAll ( right . getSpannedLexiconEntries ( ) ) ; return lexiconEntries ; } }
Gets the lexicon entries for all terminal children of this parse tree node in left - to - right order .
7,861
public List < DependencyStructure > getAllDependencies ( ) { List < DependencyStructure > deps = Lists . newArrayList ( ) ; if ( ! isTerminal ( ) ) { deps . addAll ( left . getAllDependencies ( ) ) ; deps . addAll ( right . getAllDependencies ( ) ) ; } deps . addAll ( dependencies ) ; return deps ; }
Gets all dependency structures populated during parsing .
7,862
public Multimap < Integer , DependencyStructure > getAllDependenciesIndexedByHeadWordIndex ( ) { Multimap < Integer , DependencyStructure > map = HashMultimap . create ( ) ; for ( DependencyStructure dep : getAllDependencies ( ) ) { map . put ( dep . getHeadWordIndex ( ) , dep ) ; } return map ; }
Gets all dependency structures populated during parsing indexed by the word that projects the dependency .
7,863
public void load ( UnitDaoFactory unitDaoFactory ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( fileInputStream ) ) ; BufferedReaderIterator iterator = new BufferedReaderIterator ( reader ) ; StringBuilder currentQuery = new StringBuilder ( ) ; while ( iterator . hasNext ( ) ) { String line = iterator . next ( ) . trim ( ) ; if ( ! isCommentOrEmptyLine ( line ) ) { currentQuery . append ( line ) . append ( " " ) ; } if ( isEndOfQuery ( line ) ) { unitDaoFactory . getUnitDao ( ) . execute ( currentQuery . toString ( ) ) ; currentQuery = new StringBuilder ( ) ; } } }
Execute the SQL file s content .
7,864
private static ParserInfo createParser ( LexiconInductionCcgParserFactory factory , SufficientStatistics currentParameters , Collection < LexiconEntry > currentLexicon ) { ParametricCcgParser family = factory . getParametricCcgParser ( currentLexicon ) ; SufficientStatistics newParameters = family . getNewSufficientStatistics ( ) ; if ( currentParameters != null ) { newParameters . transferParameters ( currentParameters ) ; } return new ParserInfo ( currentLexicon , family , newParameters , family . getModelFromParameters ( newParameters ) ) ; }
Creates a CCG parser given parameters and a lexicon .
7,865
private double getPartitionFunction ( List < CcgParse > parses ) { double partitionFunction = 0.0 ; for ( CcgParse parse : parses ) { partitionFunction += parse . getSubtreeProbability ( ) ; } return partitionFunction ; }
Gets the sum total probability assigned to all parses .
7,866
public static ParametricFactorGraph buildSequenceModel ( Iterable < String > emissionFeatureLines , String featureDelimiter ) { List < String > words = StringUtils . readColumnFromDelimitedLines ( emissionFeatureLines , 0 , featureDelimiter ) ; List < String > labels = StringUtils . readColumnFromDelimitedLines ( emissionFeatureLines , 1 , featureDelimiter ) ; List < String > emissionFeatures = StringUtils . readColumnFromDelimitedLines ( emissionFeatureLines , 2 , featureDelimiter ) ; DiscreteVariable wordType = new DiscreteVariable ( "word" , words ) ; DiscreteVariable labelType = new DiscreteVariable ( "label" , labels ) ; DiscreteVariable emissionFeatureType = new DiscreteVariable ( "emissionFeature" , emissionFeatures ) ; ParametricFactorGraphBuilder builder = new ParametricFactorGraphBuilder ( ) ; builder . addPlate ( PLATE_NAME , new VariableNumMap ( Ints . asList ( 1 , 2 ) , Arrays . asList ( INPUT_NAME , OUTPUT_NAME ) , Arrays . asList ( wordType , labelType ) ) , 10000 ) ; String inputPattern = PLATE_NAME + "/?(0)/" + INPUT_NAME ; String outputPattern = PLATE_NAME + "/?(0)/" + OUTPUT_NAME ; String nextOutputPattern = PLATE_NAME + "/?(1)/" + OUTPUT_NAME ; VariableNumMap plateVars = new VariableNumMap ( Ints . asList ( 1 , 2 ) , Arrays . asList ( inputPattern , outputPattern ) , Arrays . asList ( wordType , labelType ) ) ; VariableNumMap x = plateVars . getVariablesByName ( inputPattern ) ; VariableNumMap y = plateVars . getVariablesByName ( outputPattern ) ; VariableNumMap emissionFeatureVar = VariableNumMap . singleton ( 0 , "emissionFeature" , emissionFeatureType ) ; TableFactor emissionFeatureFactor = TableFactor . fromDelimitedFile ( Arrays . asList ( x , y , emissionFeatureVar ) , emissionFeatureLines , featureDelimiter , false , SparseTensorBuilder . getFactory ( ) ) . cacheWeightPermutations ( ) ; System . out . println ( emissionFeatureFactor . getVars ( ) ) ; DiscreteLogLinearFactor emissionFactor = new DiscreteLogLinearFactor ( x . union ( y ) , emissionFeatureVar , emissionFeatureFactor ) ; builder . addFactor ( WORD_LABEL_FACTOR , emissionFactor , VariableNamePattern . fromTemplateVariables ( plateVars , VariableNumMap . EMPTY ) ) ; VariableNumMap adjacentVars = new VariableNumMap ( Ints . asList ( 0 , 1 ) , Arrays . asList ( outputPattern , nextOutputPattern ) , Arrays . asList ( labelType , labelType ) ) ; builder . addFactor ( TRANSITION_FACTOR , DiscreteLogLinearFactor . createIndicatorFactor ( adjacentVars ) , VariableNamePattern . fromTemplateVariables ( adjacentVars , VariableNumMap . EMPTY ) ) ; return builder . build ( ) ; }
Constructs a sequence model from the lines of a file containing features of the emission distribution .
7,867
public void addConstantFactor ( String factorName , PlateFactor factor ) { constantFactors . add ( factor ) ; constantFactorNames . add ( factorName ) ; }
Adds an unparameterized dynamically - instantiated factor to the model under construction .
7,868
public void addFactor ( String factorName , T factor , VariablePattern factorPattern ) { parametricFactors . add ( factor ) ; factorPatterns . add ( factorPattern ) ; parametricFactorNames . add ( factorName ) ; }
Adds a parameterized factor to the log linear model being constructed .
7,869
public void load ( UnitDaoFactory unitDaoFactory ) { for ( String query : queries ) { unitDaoFactory . getUnitDao ( ) . execute ( query ) ; } }
Execute the SQL queries .
7,870
private static final boolean longMultisetsEqual ( long [ ] firstDeps , long [ ] secondDeps ) { if ( firstDeps . length != secondDeps . length ) { return false ; } Arrays . sort ( firstDeps ) ; Arrays . sort ( secondDeps ) ; for ( int i = 0 ; i < firstDeps . length ; i ++ ) { if ( firstDeps [ i ] != secondDeps [ i ] ) { return false ; } } return true ; }
Checks if two multisets of long numbers contain the same keys with the same frequency
7,871
public int add ( T item ) { if ( itemIndex . containsKey ( item ) ) { return itemIndex . get ( item ) ; } int index = items . size ( ) ; itemIndex . put ( item , index ) ; items . add ( item ) ; return index ; }
Add a new element to this set . Note that there can only be a single copy of any given item in the list . Returns the index of the added item .
7,872
public int getIndex ( Object item ) { if ( ! itemIndex . containsKey ( item ) ) { throw new NoSuchElementException ( "No such item: " + item ) ; } return itemIndex . get ( item ) ; }
Get the index in the list of the specified item .
7,873
public T get ( int index ) { if ( index >= items . size ( ) || index < 0 ) { throw new IndexOutOfBoundsException ( "size: " + items . size ( ) + " index: " + index ) ; } return items . get ( index ) ; }
Get the item with the specified index .
7,874
public int getParentExpressionIndex ( int index ) { if ( index == 0 ) { return - 1 ; } else { int [ ] parts = findSubexpression ( index ) ; int parentIndex = subexpressions . get ( parts [ 0 ] ) . getParentExpressionIndex ( parts [ 1 ] ) ; if ( parentIndex == - 1 ) { return 0 ; } else { return parentIndex + parts [ 2 ] ; } } }
Get the index of the parent expression that contains the given index . Returns - 1 if the indexed expression has no parent .
7,875
public void nextState ( IncEvalState prev , IncEvalState next , Object continuation , Environment env , Object denotation , Object diagram , Object otherArgs , LogFunction log ) { next . set ( continuation , env , denotation , diagram , prev . getProb ( ) , null ) ; }
Override this method in subclasses to implement scoring of search states and accumulating features .
7,876
public static Object convert ( String dataType , Object record ) { if ( record == null ) { return null ; } if ( dataType . equals ( UUID ) ) { return java . util . UUID . fromString ( record . toString ( ) ) ; } else { return record ; } }
Based on the generic data type convert record to an appropriate Java Data type
7,877
public ModelDef [ ] correct ( ) { for ( ModelDef m : modelList ) { this . model = m ; correct1to1Detail ( ) ; } for ( ModelDef m : modelList ) { this . model = m ; removeUnnecessaryHasOneToSelf ( ) ; } for ( ModelDef m : modelList ) { this . model = m ; removeUnnecessaryHasManyToSelf ( ) ; } for ( ModelDef m : modelList ) { this . model = m ; crossOutLinkerTables ( ) ; } for ( ModelDef m : modelList ) { this . model = m ; removeHasOneToBothPrimaryAndForeignKey ( ) ; } return modelList ; }
Run each one at a time for all models in such a way that it won t disturb the other
7,878
private void removeHasOneToBothPrimaryAndForeignKey ( ) { String [ ] primaryKeys = model . getPrimaryAttributes ( ) ; String [ ] hasOne = model . getHasOne ( ) ; String [ ] hasOneLocal = model . getHasOneLocalColumn ( ) ; String [ ] hasOneReferenced = model . getHasOneReferencedColumn ( ) ; for ( String pk : primaryKeys ) { int pkIndex = CStringUtils . indexOf ( hasOneLocal , pk ) ; if ( pkIndex >= 0 ) { System . out . println ( "\n" + pk + " is a primary key of [" + model . getTableName ( ) + "] (" + hasOneLocal [ pkIndex ] + ")" + "and foreign key to [" + hasOne [ pkIndex ] + "](" + hasOneReferenced [ pkIndex ] + ")" ) ; System . out . println ( "removing [" + hasOne [ pkIndex ] + "] from [" + model . getTableName ( ) + "]" ) ; model = removeFromHasOne ( model , hasOne [ pkIndex ] ) ; } } }
user_info . user_id is the primary key while it is refering to users . user_id user_info . User will create a cyclic recursive mapping to users and user_info and back . Remove that hasOne which is both primary and foreign to prevent that .
7,879
private void correct1to1Detail ( ) { String [ ] hasManyTables = model . getHasMany ( ) ; for ( String hasMany : hasManyTables ) { if ( shouldBeMoved ( model , hasMany ) ) { model = moveFromHasManyToHasOne ( model , hasMany ) ; } } }
If the localColum of that hasMany table is the primary attributes AND it refer to the primary column of this table
7,880
private void crossOutLinkerTables ( ) { String [ ] primaryKeys = model . getPrimaryAttributes ( ) ; if ( primaryKeys != null && primaryKeys . length == 2 ) { String [ ] hasOne = model . getHasOne ( ) ; String [ ] hasOneLocalColum = model . getHasOneLocalColumn ( ) ; String [ ] hasOneReferencedColumn = model . getHasOneReferencedColumn ( ) ; int indexP1 = CStringUtils . indexOf ( hasOneLocalColum , primaryKeys [ 0 ] ) ; int indexP2 = CStringUtils . indexOf ( hasOneLocalColum , primaryKeys [ 1 ] ) ; if ( indexP1 >= 0 && indexP2 >= 0 ) { String t1 = hasOne [ indexP1 ] ; String t2 = hasOne [ indexP2 ] ; String ref1 = hasOneReferencedColumn [ indexP1 ] ; String ref2 = hasOneReferencedColumn [ indexP2 ] ; ModelDef m1 = getModel ( t1 ) ; boolean isRef1Primary = CStringUtils . inArray ( m1 . getPrimaryAttributes ( ) , ref1 ) ; ModelDef m2 = getModel ( t2 ) ; boolean isRef2Primary = CStringUtils . inArray ( m2 . getPrimaryAttributes ( ) , ref2 ) ; if ( model != m1 && model != m2 && isRef1Primary && isRef2Primary ) { removeFromHasMany ( m1 , model . getTableName ( ) ) ; removeFromHasMany ( m2 , model . getTableName ( ) ) ; addToHasMany ( m1 , m2 . getTableName ( ) , ref2 , null ) ; addToHasMany ( m2 , m1 . getTableName ( ) , ref1 , null ) ; } } } }
Remove a linker table present in the hasMany then short circuit right away to the linked table
7,881
public Map < U , Double > getActiveFeatures ( Tensor featureVector ) { Preconditions . checkArgument ( featureVector . getDimensionSizes ( ) . length == 1 && featureVector . getDimensionSizes ( ) [ 0 ] == getNumberOfFeatures ( ) ) ; Map < U , Double > features = Maps . newHashMap ( ) ; Iterator < KeyValue > keyValueIter = featureVector . keyValueIterator ( ) ; while ( keyValueIter . hasNext ( ) ) { KeyValue featureKeyValue = keyValueIter . next ( ) ; features . put ( featureIndexes . get ( featureKeyValue . getKey ( ) [ 0 ] ) , featureKeyValue . getValue ( ) ) ; } return features ; }
Given a feature vector get the features which were active for it . This method inverts the mapping from feature sets to feature vectors performed by this class .
7,882
public void sendAdvertisement ( final BasicTrustGraphAdvertisement message , final TrustGraphNodeId sender , final TrustGraphNodeId toNeighbor , final int ttl ) { final BasicTrustGraphAdvertisement outboundMessage = message . copyWith ( sender , ttl ) ; final TrustGraphNode toNode = nodes . get ( toNeighbor ) ; toNode . handleAdvertisement ( outboundMessage ) ; }
send a local advertisement to the node specified with the given ttl .
7,883
public LocalTrustGraphNode addNode ( final TrustGraphNodeId nodeId ) { final LocalTrustGraphNode node = createNode ( nodeId ) ; addNode ( node ) ; return node ; }
Create and add a new trust graph node with the given id .
7,884
public void addDirectedRoute ( final LocalTrustGraphNode from , final LocalTrustGraphNode to ) { from . getRoutingTable ( ) . addNeighbor ( to . getId ( ) ) ; }
Add a directed trust graph link between two nodes .
7,885
public void addDirectedRoute ( final TrustGraphNodeId from , final TrustGraphNodeId to ) { final TrustGraphNode fromNode = nodes . get ( from ) ; fromNode . getRoutingTable ( ) . addNeighbor ( to ) ; }
create a directed trust link between two nodes . The node with id from will trust the node with id to .
7,886
public void addRoute ( final TrustGraphNodeId a , final TrustGraphNodeId b ) { addDirectedRoute ( a , b ) ; addDirectedRoute ( b , a ) ; }
create a bidirectional trust link between the nodes with ids a and b
7,887
public void addRoute ( final LocalTrustGraphNode a , final LocalTrustGraphNode b ) { addDirectedRoute ( a , b ) ; addDirectedRoute ( b , a ) ; }
add bidirectioanl trust graph links between two nodes .
7,888
public static Status valueOf ( int code ) { Status result = null ; switch ( code ) { case 100 : result = INFO_CONTINUE ; break ; case 101 : result = INFO_SWITCHING_PROTOCOL ; break ; case 102 : result = INFO_PROCESSING ; break ; case 200 : result = SUCCESS_OK ; break ; case 201 : result = SUCCESS_CREATED ; break ; case 202 : result = SUCCESS_ACCEPTED ; break ; case 203 : result = SUCCESS_NON_AUTHORITATIVE ; break ; case 204 : result = SUCCESS_NO_CONTENT ; break ; case 205 : result = SUCCESS_RESET_CONTENT ; break ; case 206 : result = SUCCESS_PARTIAL_CONTENT ; break ; case 207 : result = SUCCESS_MULTI_STATUS ; break ; case 300 : result = REDIRECTION_MULTIPLE_CHOICES ; break ; case 301 : result = REDIRECTION_PERMANENT ; break ; case 302 : result = REDIRECTION_FOUND ; break ; case 303 : result = REDIRECTION_SEE_OTHER ; break ; case 304 : result = REDIRECTION_NOT_MODIFIED ; break ; case 305 : result = REDIRECTION_USE_PROXY ; break ; case 307 : result = REDIRECTION_TEMPORARY ; break ; case 400 : result = CLIENT_ERROR_BAD_REQUEST ; break ; case 401 : result = CLIENT_ERROR_UNAUTHORIZED ; break ; case 402 : result = CLIENT_ERROR_PAYMENT_REQUIRED ; break ; case 403 : result = CLIENT_ERROR_FORBIDDEN ; break ; case 404 : result = CLIENT_ERROR_NOT_FOUND ; break ; case 405 : result = CLIENT_ERROR_METHOD_NOT_ALLOWED ; break ; case 406 : result = CLIENT_ERROR_NOT_ACCEPTABLE ; break ; case 407 : result = CLIENT_ERROR_PROXY_AUTHENTIFICATION_REQUIRED ; break ; case 408 : result = CLIENT_ERROR_REQUEST_TIMEOUT ; break ; case 409 : result = CLIENT_ERROR_CONFLICT ; break ; case 410 : result = CLIENT_ERROR_GONE ; break ; case 411 : result = CLIENT_ERROR_LENGTH_REQUIRED ; break ; case 412 : result = CLIENT_ERROR_PRECONDITION_FAILED ; break ; case 413 : result = CLIENT_ERROR_REQUEST_ENTITY_TOO_LARGE ; break ; case 414 : result = CLIENT_ERROR_REQUEST_URI_TOO_LONG ; break ; case 415 : result = CLIENT_ERROR_UNSUPPORTED_MEDIA_TYPE ; break ; case 416 : result = CLIENT_ERROR_REQUESTED_RANGE_NOT_SATISFIABLE ; break ; case 417 : result = CLIENT_ERROR_EXPECTATION_FAILED ; break ; case 422 : result = CLIENT_ERROR_UNPROCESSABLE_ENTITY ; break ; case 423 : result = CLIENT_ERROR_LOCKED ; break ; case 424 : result = CLIENT_ERROR_FAILED_DEPENDENCY ; break ; case 500 : result = SERVER_ERROR_INTERNAL ; break ; case 501 : result = SERVER_ERROR_NOT_IMPLEMENTED ; break ; case 502 : result = SERVER_ERROR_BAD_GATEWAY ; break ; case 503 : result = SERVER_ERROR_SERVICE_UNAVAILABLE ; break ; case 504 : result = SERVER_ERROR_GATEWAY_TIMEOUT ; break ; case 505 : result = SERVER_ERROR_VERSION_NOT_SUPPORTED ; break ; case 507 : result = SERVER_ERROR_INSUFFICIENT_STORAGE ; break ; case 1000 : result = CONNECTOR_ERROR_CONNECTION ; break ; case 1001 : result = CONNECTOR_ERROR_COMMUNICATION ; break ; case 1002 : result = CONNECTOR_ERROR_INTERNAL ; break ; } return result ; }
Returns the status associated to a code . If an existing constant exists then it is returned otherwise a new instance is created .
7,889
private < T > T populateEntity ( final T t , final Map < Field , Long > enumeratesMap , final Set < Field > nullableFields , final int currentEmbeddedDepth ) { final Map < Field , GenContainer > genContainers = this . populateScanner . scan ( t . getClass ( ) ) ; for ( final Map . Entry < Field , GenContainer > annotatedField : genContainers . entrySet ( ) ) { final Field field = annotatedField . getKey ( ) ; if ( nullableFields . contains ( field ) ) continue ; try { field . setAccessible ( true ) ; final Object objValue = generateObject ( field , annotatedField . getValue ( ) , enumeratesMap , nullableFields , currentEmbeddedDepth ) ; field . set ( t , objValue ) ; } catch ( ClassCastException e ) { logger . warning ( e . getMessage ( ) + " | field TYPE and GENERATE TYPE are not compatible" ) ; nullableFields . add ( field ) ; throw e ; } catch ( IllegalAccessException e ) { logger . warning ( e . getMessage ( ) + " | have NO ACCESS to field: " + field . getName ( ) ) ; nullableFields . add ( field ) ; } catch ( Exception e ) { logger . warning ( e . getMessage ( ) ) ; nullableFields . add ( field ) ; } finally { annotatedField . getKey ( ) . setAccessible ( false ) ; } } return t ; }
Populate single entity
7,890
private Object generateObject ( final Field field , final GenContainer container , final Map < Field , Long > enumerateMap , final Set < Field > nullableFields , final int currentEmbeddedDepth ) { final IGenerator generator = genStorage . getGenInstance ( container . getGeneratorClass ( ) ) ; final Annotation annotation = container . getMarker ( ) ; Object generated ; if ( EmbeddedGenerator . class . equals ( container . getGeneratorClass ( ) ) ) { generated = generateEmbeddedObject ( annotation , field , nullableFields , currentEmbeddedDepth ) ; } else if ( enumerateMap . containsKey ( field ) ) { generated = generateEnumerateObject ( field , enumerateMap ) ; } else if ( container . isComplex ( ) ) { generated = ( ( IComplexGenerator ) generator ) . generate ( annotation , field , genStorage , currentEmbeddedDepth ) ; } else { generated = generator . generate ( ) ; } final Object casted = castObject ( generated , field . getType ( ) ) ; if ( casted == null ) nullableFields . add ( field ) ; return casted ; }
Generate populate field value
7,891
private Object generateEmbeddedObject ( final Annotation annotation , final Field field , final Set < Field > nullableFields , final int currentEmbeddedDepth ) { final int fieldDepth = getDepth ( annotation ) ; if ( fieldDepth < currentEmbeddedDepth ) return null ; final Object embedded = instantiate ( field . getType ( ) ) ; if ( embedded == null ) { nullableFields . add ( field ) ; return null ; } return populateEntity ( embedded , buildEnumerateMap ( field . getType ( ) ) , buildNullableSet ( ) , currentEmbeddedDepth + 1 ) ; }
Generate embedded field value
7,892
private Object generateEnumerateObject ( final Field field , final Map < Field , Long > enumerateMap ) { final Long currentEnumerateValue = enumerateMap . get ( field ) ; Object objValue = BasicCastUtils . castToNumber ( currentEnumerateValue , field . getType ( ) ) ; enumerateMap . computeIfPresent ( field , ( k , v ) -> v + 1 ) ; return objValue ; }
Generate enumerate field next value
7,893
private Map < Field , Long > buildEnumerateMap ( final Class t ) { return this . enumerateScanner . scan ( t ) . entrySet ( ) . stream ( ) . collect ( Collectors . toMap ( Map . Entry :: getKey , e -> ( ( GenEnumerate ) e . getValue ( ) . get ( 0 ) ) . from ( ) ) ) ; }
Setup map for enumerate fields
7,894
public Factor getRootFactor ( ExpressionTree tree , VariableNumMap expressionVar ) { List < Assignment > roots = Lists . newArrayList ( ) ; if ( tree . getSubstitutions ( ) . size ( ) == 0 ) { roots . add ( expressionVar . outcomeArrayToAssignment ( tree . getExpressionNode ( ) ) ) ; } else { for ( ExpressionTree substitution : tree . getSubstitutions ( ) ) { roots . add ( expressionVar . outcomeArrayToAssignment ( substitution . getExpressionNode ( ) ) ) ; } } return TableFactor . pointDistribution ( expressionVar , roots . toArray ( new Assignment [ 0 ] ) ) ; }
This method is a hack that enables the use of the substitutions field of ExpressionTree at the root of the CFG parse . In the future these substitutions should be handled using unary rules in the CFG parser .
7,895
public synchronized void clearDisappearedJob ( ) { getCron4jJobList ( ) . stream ( ) . filter ( job -> job . isDisappeared ( ) ) . forEach ( job -> { final LaJobKey jobKey = job . getJobKey ( ) ; jobKeyJobMap . remove ( jobKey ) ; jobOrderedList . remove ( job ) ; job . getJobUnique ( ) . ifPresent ( jobUnique -> jobUniqueJobMap . remove ( jobUnique ) ) ; cron4jTaskJobMap . remove ( job . getCron4jTask ( ) ) ; } ) ; }
Clear disappeared jobs from job list if it exists .
7,896
public void addUnreplicatedFactor ( String factorName , Factor factor , VariableNumMap vars ) { plateFactors . add ( new ReplicatedFactor ( factor , new WrapperVariablePattern ( vars ) ) ) ; plateFactorNames . add ( factorName ) ; }
Adds an unreplicated factor to the model being constructed . The factor will match only the variables which it is defined over .
7,897
private boolean isComplex ( final Field field ) { final Class < ? > declaringClass = field . getType ( ) ; return ( declaringClass . equals ( List . class ) || declaringClass . equals ( Set . class ) || declaringClass . equals ( Map . class ) ) || declaringClass . getTypeName ( ) . endsWith ( "[][]" ) || declaringClass . getTypeName ( ) . endsWith ( "[]" ) ; }
Check if the field have complex suitable generator
7,898
private GenContainer findGenAnnotation ( final Field field ) { for ( Annotation annotation : field . getDeclaredAnnotations ( ) ) { for ( Annotation inline : annotation . annotationType ( ) . getDeclaredAnnotations ( ) ) { if ( isGen . test ( inline ) ) { return GenContainer . asGen ( inline , annotation ) ; } } } return null ; }
Found only first found gen annotation on field
7,899
private static void markEntityVars ( HeadedSyntacticCategory cat , int [ ] uniqueVars , boolean [ ] isEntityVar ) { if ( cat . isAtomic ( ) ) { for ( int var : cat . getUniqueVariables ( ) ) { int index = Ints . indexOf ( uniqueVars , var ) ; isEntityVar [ index ] = true ; } } else { markEntityVars ( cat . getArgumentType ( ) , uniqueVars , isEntityVar ) ; markEntityVars ( cat . getReturnType ( ) , uniqueVars , isEntityVar ) ; } }
Marks all unique variables in a syntactic category associated with atomic syntactic categories .