idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
121,300 | private void marshallPrimitive ( Object value , PrimitiveType primitiveType ) throws XMLStreamException { LOG . trace ( "Primitive value: {} of type: {}" , value , primitiveType ) ; if ( value != null ) { xmlWriter . writeCharacters ( value . toString ( ) ) ; } } | Marshall a primitive value . |
121,301 | public void endDocument ( ) throws ODataRenderException { try { xmlWriter . writeEndDocument ( ) ; xmlWriter . flush ( ) ; } catch ( XMLStreamException e ) { LOG . error ( "Not possible to end stream XML" ) ; throw new ODataRenderException ( "Not possible to end stream XML: " , e ) ; } } | End the XML stream document . |
121,302 | public void writeMetadataDocument ( ) throws ODataRenderException { try { xmlWriter . writeStartElement ( EDMX_NS , EDMX ) ; xmlWriter . writeNamespace ( EDMX_PREFIX , EDMX_NS ) ; xmlWriter . writeAttribute ( VERSION , ODATA_VERSION ) ; xmlWriter . writeStartElement ( EDMX_NS , EDMX_DATA_SERVICES ) ; boolean entityCont... | Write the Metadata Document . |
121,303 | public static Type getAndCheckType ( EntityDataModel entityDataModel , Class < ? > javaType ) { Type type = entityDataModel . getType ( javaType ) ; if ( type == null ) { throw new ODataSystemException ( "No type found in the entity data model for Java type: " + javaType . getName ( ) ) ; } return type ; } | Gets the OData type for a Java type and throws an exception if there is no OData type for the Java type . |
121,304 | public static PrimitiveType checkIsPrimitiveType ( Type type ) { if ( ! isPrimitiveType ( type ) ) { throw new ODataSystemException ( "A primitive type is required, but '" + type . getFullyQualifiedName ( ) + "' is not a primitive type: " + type . getMetaType ( ) ) ; } return ( PrimitiveType ) type ; } | Checks if the specified OData type is a primitive type and throws an exception if it is not . |
121,305 | public static PrimitiveType getAndCheckPrimitiveType ( EntityDataModel entityDataModel , String typeName ) { return checkIsPrimitiveType ( getAndCheckType ( entityDataModel , typeName ) ) ; } | Gets the OData type with a specified name and checks if the OData type is a primitive type ; throws an exception if the OData type is not a primitive type . |
121,306 | public static StructuredType checkIsStructuredType ( Type type ) { if ( ! isStructuredType ( type ) ) { throw new ODataSystemException ( "A structured type is required, but '" + type . getFullyQualifiedName ( ) + "' is not a structured type: " + type . getMetaType ( ) ) ; } return ( StructuredType ) type ; } | Checks if the specified OData type is a structured type and throws an exception if it is not . |
121,307 | public static StructuredType getAndCheckStructuredType ( EntityDataModel entityDataModel , String typeName ) { return checkIsStructuredType ( getAndCheckType ( entityDataModel , typeName ) ) ; } | Gets the OData type with a specified name and checks if the OData type is a structured type ; throws an exception if the OData type is not a structured type . |
121,308 | public static StructuredType getAndCheckStructuredType ( EntityDataModel entityDataModel , Class < ? > javaType ) { return checkIsStructuredType ( getAndCheckType ( entityDataModel , javaType ) ) ; } | Gets the OData type for a Java type and checks if the OData type is a structured type ; throws an exception if the OData type is not a structured type . |
121,309 | public static EntityType checkIsEntityType ( Type type ) { if ( ! isEntityType ( type ) ) { throw new ODataSystemException ( "An entity type is required, but '" + type . getFullyQualifiedName ( ) + "' is not an entity type: " + type . getMetaType ( ) ) ; } return ( EntityType ) type ; } | Checks if the specified OData type is an entity type and throws an exception if it is not . |
121,310 | public static EntityType getAndCheckEntityType ( EntityDataModel entityDataModel , String typeName ) { return checkIsEntityType ( getAndCheckType ( entityDataModel , typeName ) ) ; } | Gets the OData type with a specified name and checks if the OData type is an entity type ; throws an exception if the OData type is not an entity type . |
121,311 | public static EntityType getAndCheckEntityType ( EntityDataModel entityDataModel , Class < ? > javaType ) { return checkIsEntityType ( getAndCheckType ( entityDataModel , javaType ) ) ; } | Gets the OData type for a Java type and checks if the OData type is an entity type ; throws an exception if the OData type is not an entity type . |
121,312 | public static ComplexType checkIsComplexType ( Type type ) { if ( ! isComplexType ( type ) ) { throw new ODataSystemException ( "A complex type is required, but '" + type . getFullyQualifiedName ( ) + "' is not a complex type: " + type . getMetaType ( ) ) ; } return ( ComplexType ) type ; } | Checks if the specified OData type is a complex type and throws an exception if it is not . |
121,313 | public static ComplexType getAndCheckComplexType ( EntityDataModel entityDataModel , Class < ? > javaType ) { return checkIsComplexType ( getAndCheckType ( entityDataModel , javaType ) ) ; } | Gets the OData type for a Java type and checks if the OData type is a complex type ; throws an exception if the OData type is not a complex type . |
121,314 | public static String getPropertyTypeName ( StructuralProperty property ) { return property . isCollection ( ) ? property . getElementTypeName ( ) : property . getTypeName ( ) ; } | Gets the OData type name of the property ; if the property is a collection gets the OData type name of the elements of the collection . |
121,315 | public static Type getPropertyType ( EntityDataModel entityDataModel , StructuralProperty property ) { return getAndCheckType ( entityDataModel , getPropertyTypeName ( property ) ) ; } | Gets the OData type of the property ; if the property is a collection gets the OData type of the elements of the collection . |
121,316 | public static StructuralProperty getStructuralProperty ( EntityDataModel entityDataModel , StructuredType structuredType , String propertyName ) { StructuralProperty structuralProperty = structuredType . getStructuralProperty ( propertyName ) ; if ( structuralProperty != null ) { return structuralProperty ; } else { St... | Get the Structural Property from the given Entity Data Model and Structured Type looking up all the base types recursively . |
121,317 | public static Set < String > getKeyPropertyNames ( EntityType entityType ) { Set < String > keyPropertyNames = entityType . getKey ( ) . getPropertyRefs ( ) . stream ( ) . map ( PropertyRef :: getPath ) . collect ( Collectors . toSet ( ) ) ; return keyPropertyNames ; } | Gets the names of the properties that are part of the key of an entity type . |
121,318 | public static Map < String , Object > getKeyPropertyValues ( EntityType entityType , Object entity ) { Map < String , Object > keyPropertyValues = new HashMap < > ( ) ; for ( PropertyRef propertyRef : entityType . getKey ( ) . getPropertyRefs ( ) ) { String propertyName = propertyRef . getPath ( ) ; Object propertyValu... | Gets the values of the properties that part of the key of an entity type . |
121,319 | public static EntitySet getAndCheckEntitySet ( EntityDataModel entityDataModel , String entitySetName ) { EntitySet entitySet = entityDataModel . getEntityContainer ( ) . getEntitySet ( entitySetName ) ; if ( entitySet == null ) { throw new ODataSystemException ( "Entity set not found in the entity data model: " + enti... | Gets the entity set with the specified name throws an exception if no entity set with the specified name exists . |
121,320 | public static EntitySet getEntitySetByEntityTypeName ( EntityDataModel entityDataModel , String entityTypeName ) throws ODataEdmException { for ( EntitySet entitySet : entityDataModel . getEntityContainer ( ) . getEntitySets ( ) ) { if ( entitySet . getTypeName ( ) . equals ( entityTypeName ) ) { return entitySet ; } }... | Get the Entity Set for a given Entity Type name through the Entity Data Model . |
121,321 | public static String getEntityNameByEntityTypeName ( EntityDataModel entityDataModel , String entityTypeName ) throws ODataEdmException { for ( EntitySet entitySet : entityDataModel . getEntityContainer ( ) . getEntitySets ( ) ) { if ( entitySet . getTypeName ( ) . equals ( entityTypeName ) ) { return entitySet . getNa... | Get the Entity Name for a given Entity Type name through the Entity Data Model . This looks for entity in both EntitySets and Singletons in the container |
121,322 | public static EntitySet getEntitySetByEntity ( EntityDataModel entityDataModel , Object entity ) throws ODataEdmException { return getEntitySetByEntityTypeName ( entityDataModel , getAndCheckEntityType ( entityDataModel , entity . getClass ( ) ) . getFullyQualifiedName ( ) ) ; } | Get the Entity Set of a given entity through the Entity Data Model . |
121,323 | public static boolean isSingletonEntity ( EntityDataModel entityDataModel , Object entity ) throws ODataEdmException { EntityType entityType = getAndCheckEntityType ( entityDataModel , entity . getClass ( ) ) ; boolean isSingletonEntity = false ; for ( Singleton singleton : entityDataModel . getEntityContainer ( ) . ge... | Check if the given entity is a Singleton entity . |
121,324 | public static String getEntityName ( EntityDataModel entityDataModel , Object entity ) throws ODataEdmException { EntityType entityType = getAndCheckEntityType ( entityDataModel , entity . getClass ( ) ) ; String entityName = null ; for ( EntitySet entitySet : entityDataModel . getEntityContainer ( ) . getEntitySets ( ... | Get the entity name in the entity data model for the given entity . |
121,325 | public static Singleton getAndCheckSingleton ( EntityDataModel entityDataModel , String singletonName ) { Singleton singleton = entityDataModel . getEntityContainer ( ) . getSingleton ( singletonName ) ; if ( singleton == null ) { throw new ODataSystemException ( "Singleton not found in the entity data model: " + singl... | Gets the singleton with the specified name throws an exception if no singleton with the specified name exists . |
121,326 | public static FunctionImport getAndCheckFunctionImport ( EntityDataModel entityDataModel , String functionImportName ) { FunctionImport functionImport = entityDataModel . getEntityContainer ( ) . getFunctionImport ( functionImportName ) ; if ( functionImport == null ) { throw new ODataSystemException ( "Function import... | Gets the function import by the specified name throw an exception if no function import with the specified name exists . |
121,327 | public static ActionImport getAndCheckActionImport ( EntityDataModel entityDataModel , String actionImportName ) { ActionImport actionImport = entityDataModel . getEntityContainer ( ) . getActionImport ( actionImportName ) ; if ( actionImport == null ) { throw new ODataSystemException ( "Action import not found in the ... | Gets the action import by the specified name throw an exception if no action import with the specified name exists . |
121,328 | public static Action getAndCheckAction ( EntityDataModel entityDataModel , String actionName ) { int namespaceLastIndex = actionName . lastIndexOf ( '.' ) ; String namespace = actionName . substring ( 0 , namespaceLastIndex ) ; String simpleActionName = actionName . substring ( namespaceLastIndex + 1 ) ; Schema schema ... | Gets the action by the specified name throw an exception if no action with the specified name exists . |
121,329 | public static boolean isCollection ( EntityDataModel entityDataModel , String typeName ) { EntitySet entitySet = entityDataModel . getEntityContainer ( ) . getEntitySet ( typeName ) ; if ( entitySet != null ) { return true ; } try { if ( Collection . class . isAssignableFrom ( Class . forName ( typeName ) ) || COLLECTI... | Checks if the specified typeName is a collection . |
121,330 | public static String formatEntityKey ( EntityDataModel entityDataModel , Object entity ) throws ODataEdmException { Key entityKey = getAndCheckEntityType ( entityDataModel , entity . getClass ( ) ) . getKey ( ) ; List < PropertyRef > keyPropertyRefs = entityKey . getPropertyRefs ( ) ; try { if ( keyPropertyRefs . size ... | Get the entity key for a given entity by inspecting the Entity Data Model . |
121,331 | public static String pluralize ( String word ) { if ( word == null ) { throw new IllegalArgumentException ( ) ; } final String lowerCaseWord = word . toLowerCase ( ) ; if ( endsWithAny ( lowerCaseWord , "s" , "sh" , "o" ) ) { return word + "es" ; } if ( lowerCaseWord . endsWith ( "y" ) && ! lowerCaseWord . endsWith ( "... | Get the plural for the given English word . |
121,332 | protected int scoreServiceDocument ( ODataRequestContext requestContext , MediaType requiredMediaType ) { if ( isServiceDocument ( requestContext . getUri ( ) ) ) { int scoreByFormat = scoreByFormat ( getFormatOption ( requestContext . getUri ( ) ) , requiredMediaType ) ; int scoreByMediaType = scoreByMediaType ( reque... | Calculate a score for a Service Document Renderer based on a given OData request context and required media type . |
121,333 | public void initialize ( ) throws ODataUnmarshallingException { LOG . info ( "Parser is initializing" ) ; try { JsonParser jsonParser = JSON_FACTORY . createParser ( inputJson ) ; while ( jsonParser . nextToken ( ) != JsonToken . END_OBJECT ) { String token = jsonParser . getCurrentName ( ) ; if ( token != null ) { if ... | Initialize processor automatically scanning the input JSON . |
121,334 | private void process ( JsonParser jsonParser ) throws IOException , ODataUnmarshallingException { if ( jsonParser . getCurrentToken ( ) == JsonToken . FIELD_NAME ) { LOG . info ( "Starting to parse {} token" , jsonParser . getCurrentName ( ) ) ; String key = jsonParser . getCurrentName ( ) ; jsonParser . nextToken ( ) ... | Process all things that do not contain special ODataTags . |
121,335 | private List < Object > getCollectionValue ( JsonParser jsonParser ) throws IOException { LOG . info ( "Start parsing {} array" , jsonParser . getCurrentName ( ) ) ; List < Object > list = new ArrayList < > ( ) ; while ( jsonParser . nextToken ( ) != JsonToken . END_ARRAY ) { if ( jsonParser . getCurrentToken ( ) == Js... | Parse the complex values . |
121,336 | private Object getEmbeddedObject ( JsonParser jsonParser ) throws IOException { LOG . info ( "Start parsing an embedded object." ) ; Map < String , Object > embeddedMap = new HashMap < > ( ) ; while ( jsonParser . nextToken ( ) != JsonToken . END_OBJECT ) { String key = jsonParser . getText ( ) ; jsonParser . nextToken... | Process an embedded object . |
121,337 | private void processLinks ( JsonParser jsonParser ) throws IOException { LOG . info ( "@odata.bind tag found - start parsing" ) ; final String fullLinkFieldName = jsonParser . getText ( ) ; final String key = fullLinkFieldName . substring ( 0 , fullLinkFieldName . indexOf ( ODATA_BIND ) ) ; JsonToken token = jsonParser... | Process OData links . |
121,338 | private String processLink ( JsonParser jsonParser ) throws IOException { final String link = jsonParser . getText ( ) ; if ( link . contains ( SVC_EXTENSION ) ) { return link . substring ( link . indexOf ( SVC_EXTENSION ) + SVC_EXTENSION . length ( ) ) ; } return link ; } | Process OData link . |
121,339 | public void fillUpdatedObjectProperty ( Object entity , Object currentNode , StructuralProperty property , Field field , String node , Map < String , Object > map ) throws ODataException { for ( Map . Entry < String , Object > entry : ( ( Map < String , Object > ) currentNode ) . entrySet ( ) ) { if ( findAppropriateEl... | Populates the embedded object property with the relevant field values . |
121,340 | public void fillUpdatedCollectionProperty ( Object entity , Object currentNode , StructuralProperty property , Field field , String node , Map < String , Object > map ) throws ODataException { Collection < Object > valueSet ; if ( field . getType ( ) . isAssignableFrom ( Set . class ) ) { valueSet = new HashSet < > ( )... | Populates the collection property with the relevant field values . |
121,341 | public void fillPrimitiveProperty ( Object entity , Set < String > keySet , StructuralProperty property , Field field , String node , Map < String , Object > map ) throws ODataException { for ( String target : keySet ) { if ( node . equalsIgnoreCase ( target ) ) { Object value = getFieldValueByType ( property . getType... | Populates the primitive property of the entity with the relevant field value . |
121,342 | public void fillCollectionProperty ( Object entity , Set < String > keySet , StructuralProperty property , Field field , String node , Map < String , Object > map ) throws ODataException { for ( String target : keySet ) { if ( node . equalsIgnoreCase ( target ) ) { Iterable subValues = ( Iterable ) map . get ( target )... | Populates the collection property of the entity with field values . |
121,343 | protected Object getFieldValueByType ( String typeName , Object targetNode , Map < String , Object > map , boolean isExtracted ) throws ODataException { Object fieldValue = null ; LOG . debug ( "Type is {}" , typeName ) ; Type type = entityDataModel . getType ( typeName ) ; if ( type == null ) { throw new ODataUnmarsha... | Gets the field value for the property type . |
121,344 | private Object unmarshallEntityByName ( String entityName , Map < String , Object > map , Object currentNode ) throws ODataException { LOG . debug ( "Entity '{}' created." , entityName ) ; if ( ! isNullOrEmpty ( entityName ) ) { Object entity = loadEntity ( entityName ) ; setEntityProperties ( entity , JsonParserUtils ... | Unmarsall a named entity . |
121,345 | public Object loadEntity ( String entityName ) throws ODataUnmarshallingException { Object entity = null ; if ( entityName != null ) { try { StructuredType entityType = JsonParserUtils . getStructuredType ( entityName , entityDataModel ) ; if ( entityType != null ) { entity = entityType . getJavaType ( ) . newInstance ... | Creates the an entity based on its name . |
121,346 | public void setEntityProperties ( Object entity , StructuredType entityType , Map < String , Object > map , Object currentNode ) throws ODataException { Set < String > keySet = map . keySet ( ) ; for ( StructuralProperty property : getAllProperties ( entityType , entityDataModel ) ) { Field field = property . getJavaFi... | Sets the given entity with structural properties from the fields . |
121,347 | public ProcessorResult handleWrite ( Object entity ) throws ODataException { if ( ODataUriUtil . isRefPathUri ( getoDataUri ( ) ) ) { return processLink ( ( ODataLink ) entity ) ; } else { if ( entity != null ) { throw new ODataBadRequestException ( "The body of a DELETE request must be empty." ) ; } return processEnti... | This method delete entity . |
121,348 | private ProcessorResult processEntity ( ) throws ODataException { TargetType targetType = getTargetType ( ) ; if ( ! targetType . isCollection ( ) ) { Option < String > singletonName = ODataUriUtil . getSingletonName ( getoDataUri ( ) ) ; if ( singletonName . isDefined ( ) ) { throw new ODataBadRequestException ( "The ... | This method finds correct data source based on target type and executes delete operation on data source . |
121,349 | public String writeRawJson ( final String json , final String contextUrl ) throws ODataRenderException { this . contextURL = checkNotNull ( contextUrl ) ; try { final ByteArrayOutputStream stream = new ByteArrayOutputStream ( ) ; jsonGenerator = JSON_FACTORY . createGenerator ( stream , JsonEncoding . UTF8 ) ; jsonGene... | Writes raw json to the JSON stream . |
121,350 | private String writeJson ( Object data , Map < String , Object > meta ) throws IOException , NoSuchFieldException , IllegalAccessException , ODataEdmException , ODataRenderException { ByteArrayOutputStream stream = new ByteArrayOutputStream ( ) ; jsonGenerator = JSON_FACTORY . createGenerator ( stream , JsonEncoding . ... | Write the given data to the JSON stream . The data to write will be either a single entity or a feed depending on whether it is a single object or list . |
121,351 | public Action build ( Class < ? > cls ) { EdmAction edmAction = cls . getAnnotation ( EdmAction . class ) ; EdmReturnType edmReturnType = cls . getAnnotation ( EdmReturnType . class ) ; Set < Parameter > parameters = new HashSet < > ( ) ; for ( Field field : cls . getDeclaredFields ( ) ) { EdmParameter parameterAnnotat... | Builds an action instance from given class . |
121,352 | protected boolean isEntityQuery ( ODataUri uri , EntityDataModel entityDataModel ) { return getTargetType ( uri , entityDataModel ) . map ( t -> t . getMetaType ( ) == MetaType . ENTITY ) . orElse ( false ) ; } | Check if the parsed OData URI is a query and it results in an entity or a collection of entities . |
121,353 | protected String buildContextURL ( ODataRequestContext requestContext , Object data ) throws ODataRenderException { ODataUri oDataUri = requestContext . getUri ( ) ; if ( ODataUriUtil . isActionCallUri ( oDataUri ) || ODataUriUtil . isFunctionCallUri ( oDataUri ) ) { return buildContextUrlFromOperationCall ( oDataUri ,... | Build the Context URL from a given OData request context . |
121,354 | protected void checkContextURL ( ODataRequestContext requestContext , Option < String > contextURL ) throws ODataRenderException { if ( ! contextURL . isDefined ( ) ) { throw new ODataRenderException ( String . format ( "Not possible to create context URL for request %s" , requestContext ) ) ; } } | Check whether the given Context URL is defined . |
121,355 | public ProcessorResult handleWrite ( Object action ) throws ODataException { Operation operation ; if ( action instanceof Operation ) { operation = ( Operation ) action ; Object data = operation . doOperation ( getODataRequestContext ( ) , getDataSourceFactory ( ) ) ; if ( data == null ) { return new ProcessorResult ( ... | Handles action call and returns result in case when action returns it . |
121,356 | public String getPropertyAsString ( Object data ) throws ODataException { LOG . trace ( "GetPropertyAsString invoked with {}" , data ) ; if ( data != null ) { return makePropertyString ( data ) ; } else { return generateNullPropertyString ( ) ; } } | This is main method to get property as string . |
121,357 | public String buildServiceDocument ( ) throws ODataRenderException { LOG . info ( "Building service(root) document" ) ; try ( ByteArrayOutputStream outputStream = new ByteArrayOutputStream ( BUFFER_SIZE ) ) { XMLStreamWriter writer = startServiceDocument ( outputStream ) ; writeEntitySets ( writer ) ; writeSingleton ( ... | This is main method which generates service document . |
121,358 | private void writeEntitySets ( XMLStreamWriter writer ) throws XMLStreamException , ODataRenderException { List < EntitySet > entitySets = getEntityContainer ( ) . getEntitySets ( ) ; LOG . debug ( "Number of entity sets to be written in service document are {}" , entitySets . size ( ) ) ; for ( EntitySet entitySet : e... | This writes all entity sets in entity data model as collection of elements . |
121,359 | private XMLStreamWriter startServiceDocument ( ByteArrayOutputStream outputStream ) throws XMLStreamException , ODataRenderException { XMLStreamWriter writer = XMLWriterUtil . startDocument ( outputStream , null , SERVICE , ODATA_SERVICE_NS ) ; writer . writeNamespace ( ATOM , ATOM_NS ) ; writer . writeNamespace ( META... | Starts service document with correct attributes and also writes workspace title elements . |
121,360 | private EntityContainer getEntityContainer ( ) throws ODataRenderException { EntityContainer entityContainer = entityDataModel . getEntityContainer ( ) ; if ( entityContainer == null ) { String message = "EntityContainer should not be null" ; LOG . error ( message ) ; throw new ODataRenderException ( message ) ; } retu... | Returns entity container if it exists in entity data model otherwise throws ODataRenderException . |
121,361 | public void ensureCollection ( StructuredType entityType ) throws ODataException { List < String > missingCollectionPropertyName = new ArrayList < > ( ) ; entityType . getStructuralProperties ( ) . stream ( ) . filter ( property -> ( property . isCollection ( ) ) && ! ( property instanceof NavigationProperty ) && ! pro... | Ensure that non nullable collection are present . |
121,362 | public void ensureNavigationProperties ( StructuredType entityType ) throws ODataException { List < String > missingNavigationPropertyNames = new ArrayList < > ( ) ; entityType . getStructuralProperties ( ) . stream ( ) . filter ( property -> ( property instanceof NavigationProperty ) && ! property . isNullable ( ) ) .... | Ensure that non nullable navigation properties are present . |
121,363 | public URLConnectionRequestPropertiesBuilder withCookie ( String cookieName , String cookieValue ) { if ( requestProperties . containsKey ( "Cookie" ) ) { final String cookies = requestProperties . get ( "Cookie" ) ; requestProperties . put ( "Cookie" , cookies + COOKIES_SEPARATOR + buildCookie ( cookieName , cookieVal... | Add provided cookie to Cookie request property . |
121,364 | public static < T > Class < T > wrap ( Class < T > type ) { if ( type == null ) { throw new IllegalArgumentException ( ) ; } Class < T > wrapped = ( Class < T > ) PRIMITIVE_TO_WRAP . get ( type ) ; return ( wrapped == null ) ? type : wrapped ; } | Guava wrap alternative . |
121,365 | public static < T > Class < T > unwrap ( Class < T > type ) { if ( type == null ) { throw new IllegalArgumentException ( ) ; } Class < T > unwrapped = ( Class < T > ) WRAP_TO_PRIMITIVE . get ( type ) ; return ( unwrapped == null ) ? type : unwrapped ; } | Guava unwrap alternative . |
121,366 | public static EndpointCaller initializeEndpointCaller ( Properties properties ) { EndpointCaller ec ; try { LOG . debug ( "Initializing endpoint caller. Checking whether '{}' is in classpath." , TRACING_ENDPOINT_CALLER_CLASSNAME ) ; Class < ? > tracingEndpointCallerClass = Class . forName ( TRACING_ENDPOINT_CALLER_CLAS... | If the TracingEndpointCaller class is in a classpath - use it otherwise use BasicEndpointCaller . |
121,367 | public void addFunctionImport ( Class < ? > cls ) { EdmFunctionImport functionImportAnnotation = cls . getAnnotation ( EdmFunctionImport . class ) ; FunctionImportImpl . Builder functionImportBuilder = new FunctionImportImpl . Builder ( ) . setEntitySetName ( functionImportAnnotation . entitySet ( ) ) . setFunctionName... | Add function import to builder of this factory by specified class . |
121,368 | public Iterable < FunctionImport > build ( FactoryLookup lookup ) { List < FunctionImport > builder = new ArrayList < > ( ) ; for ( FunctionImportImpl . Builder functionImportBuilder : functionImportBuilders ) { EntitySet entitySet = lookup . getEntitySet ( functionImportBuilder . getEntitySetName ( ) ) ; Function func... | Returns built function imports using passed lookup for searching entity sets and functions for appropriate function import . |
121,369 | public static String getFullyQualifiedFunctionImportName ( EdmFunctionImport functionImportAnnotation , Class < ? > functionImportClass ) { String name = getTypeName ( functionImportAnnotation , functionImportClass ) ; String namespace = getNamespace ( functionImportAnnotation , functionImportClass ) ; return namespace... | Returns fully qualified function import name by function import annotation and class . |
121,370 | protected void validateProperties ( final Object entity , final EntityDataModel edm ) throws ODataException { final Type type = edm . getType ( entity . getClass ( ) ) ; if ( ! ( type instanceof StructuredType ) ) { return ; } visitProperties ( edm , ( StructuredType ) type , property -> { Object value = getPropertyVal... | Checks if all non - nullable properties of an entity are non - empty . |
121,371 | public String buildJson ( ) throws ODataRenderException { LOG . debug ( "Start building Json service root document" ) ; try ( ByteArrayOutputStream stream = new ByteArrayOutputStream ( ) ) { JsonGenerator jsonGenerator = JSON_FACTORY . createGenerator ( stream , JsonEncoding . UTF8 ) ; jsonGenerator . writeStartObject ... | The main method for Writer . It builds the service root document according to spec . |
121,372 | private void writeName ( JsonGenerator jsonGenerator , Object entity ) throws IOException { jsonGenerator . writeFieldName ( NAME ) ; if ( entity instanceof EntitySet ) { jsonGenerator . writeObject ( ( ( EntitySet ) entity ) . getName ( ) ) ; } else { jsonGenerator . writeObject ( ( ( Singleton ) entity ) . getName ( ... | Writes the name of the entity It is a MUST element . |
121,373 | private void writeKind ( JsonGenerator jsonGenerator , Object entity ) throws IOException { jsonGenerator . writeFieldName ( KIND ) ; if ( entity instanceof EntitySet ) { jsonGenerator . writeObject ( ENTITY_SET ) ; } else { jsonGenerator . writeObject ( SINGLETON ) ; } } | Writes the kind of the entity . |
121,374 | private void writeURL ( JsonGenerator jsonGenerator , Object entity ) throws IOException { jsonGenerator . writeFieldName ( URL ) ; if ( entity instanceof EntitySet ) { jsonGenerator . writeObject ( ( ( EntitySet ) entity ) . getName ( ) ) ; } else { jsonGenerator . writeObject ( ( ( Singleton ) entity ) . getName ( ) ... | Writes the url of the entity It is a MUST element . |
121,375 | public static String buildContextUrlFromOperationCall ( ODataUri oDataUri , EntityDataModel entityDataModel , boolean isPrimitive ) { String serviceRoot = oDataUri . serviceRoot ( ) ; String returnType = ODataUriUtil . getOperationReturnType ( oDataUri , entityDataModel ) ; return serviceRoot + "/" + METADATA + "#" + r... | Builds the Context URL when the request is an action or function call . |
121,376 | public static < T > T checkNotNull ( T reference , String message , Object ... args ) { if ( reference == null ) { throw new IllegalArgumentException ( String . format ( message , args ) ) ; } return reference ; } | Check if the reference is not null . This differs from Guava that throws Illegal Argument Exception + message . |
121,377 | public static boolean isForceExpandParamSet ( ODataUri oDataUri ) { if ( isFunctionCallUri ( oDataUri ) ) { Option < scala . collection . immutable . Map < String , String > > params = getFunctionCallParameters ( oDataUri ) ; if ( params . isDefined ( ) && ! params . get ( ) . isEmpty ( ) ) { Map < String , String > pa... | Checks if we are trying to force expand all Nav properties for function calls by looking at expand parameter . |
121,378 | public static < T extends Annotation > T checkAnnotationPresent ( AnnotatedElement annotatedType , Class < T > annotationClass ) { return getAnnotation ( annotatedType , annotationClass ) ; } | Check if the annotation is present and if not throws an exception this is just an overload for more clear naming . |
121,379 | public int score ( ODataRequestContext requestContext , QueryResult data ) { if ( data . getType ( ) == QueryResult . ResultType . NOTHING || data . getType ( ) != QueryResult . ResultType . EXCEPTION ) { return DEFAULT_SCORE ; } if ( data . getData ( ) instanceof ODataBatchException ) { return MAXIMUM_FORMAT_SCORE ; }... | Batch score mechanism exists not only for simple rendering but also for computing batch error scores . |
121,380 | public List < ProcessorResult > handleWrite ( ) throws ODataException { LOG . info ( "Handling transactional operations per each odata request." ) ; List < ProcessorResult > resultList = new ArrayList < > ( ) ; try { for ( ChangeSetEntity changeSetEntity : changeSetEntities ) { ODataRequestContext odataRequestContext =... | Handles transactional operations for each parsed odata request . |
121,381 | private Type getRequestType ( ODataRequest oDataRequest , ODataUri oDataUri ) throws ODataTargetTypeException { TargetType targetType = WriteMethodUtil . getTargetType ( oDataRequest , entityDataModel , oDataUri ) ; return entityDataModel . getType ( targetType . typeName ( ) ) ; } | Returns request type for the given odata uri . |
121,382 | private TransactionalDataSource getTransactionalDataSource ( ODataRequestContext odataRequestContext , Type type ) throws ODataException { DataSource dataSource = dataSourceFactory . getDataSource ( odataRequestContext , type . getFullyQualifiedName ( ) ) ; String dataSourceKey = dataSource . getClass ( ) . toString ( ... | If it s the first batch request call - start transaction . |
121,383 | public static Integer getIntegerProperty ( Properties properties , String key ) { String property = getStringProperty ( properties , key ) ; if ( property == null ) { return null ; } Integer value ; try { value = Integer . parseInt ( property ) ; } catch ( RuntimeException e ) { throw new ODataClientRuntimeException ( ... | Get an integer property from the properties . |
121,384 | public static String getStringProperty ( Properties properties , String key ) { String property = properties . getProperty ( key ) ; return property != null && property . trim ( ) . isEmpty ( ) ? null : property ; } | Get a string property from the properties . |
121,385 | public static Long getLongProperty ( String property ) { if ( property == null ) { return null ; } Long propertyLong = null ; try { propertyLong = Long . valueOf ( property ) ; } catch ( NumberFormatException e ) { LOG . warn ( "Cannot convert string value into number" , e ) ; } return propertyLong ; } | Get a long property from properties . |
121,386 | public static XMLStreamWriter startDocument ( ByteArrayOutputStream outputStream , String prefix , String documentRootName , String nameSpaceURI ) throws XMLStreamException { XMLStreamWriter writer = XML_OUTPUT_FACTORY . createXMLStreamWriter ( outputStream , UTF_8 . name ( ) ) ; if ( isNullOrEmpty ( prefix ) ) { write... | Creates document root with given name . |
121,387 | public static void writePrimitiveValue ( Object primitiveValue , JsonGenerator jsonGenerator ) throws IOException { Class < ? > primitiveClass = PrimitiveUtil . wrap ( primitiveValue . getClass ( ) ) ; if ( String . class . isAssignableFrom ( primitiveClass ) ) { jsonGenerator . writeString ( String . valueOf ( primiti... | Write the given primitive value to the JSON stream by using the given JSON generator . |
121,388 | public Function build ( Class < ? > cls ) { EdmFunction edmFunction = cls . getAnnotation ( EdmFunction . class ) ; EdmReturnType edmReturnType = cls . getAnnotation ( EdmReturnType . class ) ; if ( edmReturnType == null ) { throw new IllegalArgumentException ( "The class must have EdmReturnType: " + cls . getName ( ) ... | Method to build Function implementation with parameters by class . |
121,389 | public static String getFullyQualifiedFunctionName ( EdmFunction functionAnnotation , Class < ? > functionClass ) { String name = getTypeName ( functionAnnotation , functionClass ) ; String namespace = getNamespace ( functionAnnotation , functionClass ) ; return namespace + "." + name ; } | Returned fully qualified function name using function annotation and class . |
121,390 | protected boolean isRightMethodForUnmarshall ( ODataRequest request ) { ODataRequest . Method method = request . getMethod ( ) ; return isPostMethod ( method ) || isPatchMethod ( method ) || isPutMethod ( method ) ; } | This method checks request method is PUT or POST or PATCH . |
121,391 | protected int score ( MediaType contentTypeFromRequest , MediaType ... expectedTypes ) { if ( contentTypeFromRequest == null ) { return DEFAULT_SCORE ; } for ( MediaType expected : expectedTypes ) { if ( contentTypeFromRequest . matches ( expected ) ) { return MAXIMUM_FORMAT_SCORE ; } } return DEFAULT_SCORE ; } | Calculates score based on given media type . |
121,392 | public Result index ( ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "access granted to index" ) ; } DemoUser user = ( DemoUser ) ctx ( ) . args . get ( SecureSocial . USER_KEY ) ; return ok ( index . render ( user , SecureSocial . env ( ) ) ) ; } | This action only gets called if the user is logged in . |
121,393 | public Future < Option < BasicProfile > > find ( String providerId , String userId ) { return toScala ( doFind ( providerId , userId ) . thenApply ( Scala :: Option ) ) ; } | Finds an Identity that maches the specified id |
121,394 | public Future < Option < BasicProfile > > findByEmailAndProvider ( String email , String providerId ) { return toScala ( doFindByEmailAndProvider ( email , providerId ) . thenApply ( Scala :: Option ) ) ; } | Finds an Identity by email and provider id . |
121,395 | public Future < U > save ( BasicProfile user , SaveMode mode ) { return toScala ( doSave ( user , mode ) ) ; } | Saves the Identity . This method gets called when a user logs in . This is your chance to save the user information in your backing store . |
121,396 | public Future < U > link ( U current , BasicProfile to ) { return toScala ( doLink ( current , to ) ) ; } | Links the current user Identity to another |
121,397 | public Future < MailToken > saveToken ( MailToken mailToken ) { return toScala ( doSaveToken ( Token . fromScala ( mailToken ) ) . thenApply ( Token :: toScala ) ) ; } | Saves a token . This is needed for users that are creating an account in the system instead of using one in a 3rd party system . |
121,398 | public Future < Option < MailToken > > findToken ( String tokenId ) { return toScala ( doFindToken ( tokenId ) . thenApply ( this :: toMailToken ) ) ; } | Finds a token |
121,399 | public Future < scala . Option < MailToken > > deleteToken ( String tokenId ) { return toScala ( doDeleteToken ( tokenId ) . thenApply ( this :: toMailToken ) ) ; } | Deletes a token |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.