├── jpa-tutorial ├── .gitignore ├── HowToSeeTheModel.txt ├── Sequence │ └── model.di ├── db-model │ └── BuPa.di ├── jpa-model │ └── BuPa.di ├── images │ └── quick-start │ │ ├── start.png │ │ ├── GitClone.png │ │ ├── Project.png │ │ ├── m2-directory.png │ │ ├── MavenNewProject.png │ │ ├── runConfiguration.png │ │ ├── MavenCreateProject.png │ │ ├── MavenSelectArchetype.png │ │ └── MavenSetParameterArchetype.png ├── Tutorials │ ├── Metadata │ │ ├── 1-10-JPAConverter.md │ │ ├── 1-11-Annotations.md │ │ ├── Metadata │ │ │ ├── Mapping1.png │ │ │ ├── Mapping2.png │ │ │ ├── Mapping3.png │ │ │ ├── Mapping4.png │ │ │ ├── Mapping5.png │ │ │ ├── Mapping6.png │ │ │ ├── RunOnServer.png │ │ │ ├── MappingFlagsEnum.png │ │ │ ├── MappingSimpleEnum.png │ │ │ └── MappingSimpleEnumCompany.png │ │ └── 1-9-ChangingGeneratedMetadata.md │ ├── Introduction │ │ ├── Model │ │ │ ├── DBTable.png │ │ │ └── JPAClasses.png │ │ └── CreateProject │ │ │ ├── MaintainPOM.png │ │ │ ├── ConvertJPAProject.png │ │ │ ├── MavenProjectGroupID.png │ │ │ └── MavenProjectArchivetype.png │ ├── ChangeData │ │ ├── Images │ │ │ └── CreateAdminDiv.png │ │ └── 3-0-Overview.md │ ├── SpecialTopics │ │ ├── Images │ │ │ └── ExampleByCountry.JPG │ │ └── 4-0-Overview.md │ └── RetrieveData │ │ └── 2-0-Overview.md ├── .project └── .asciidoctorconfig.adoc ├── jpa ├── odata-jpa-metadata │ ├── src │ │ ├── test │ │ │ ├── resources │ │ │ │ └── annotations │ │ │ │ │ └── empty.xml │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── sap │ │ │ │ └── olingo │ │ │ │ └── jpa │ │ │ │ └── metadata │ │ │ │ └── core │ │ │ │ └── edm │ │ │ │ └── mapper │ │ │ │ ├── testobjects │ │ │ │ ├── ComplexSubTypeOfIgnore.java │ │ │ │ ├── TestActionCollection.java │ │ │ │ ├── TestCollectionInterface.java │ │ │ │ ├── DayOfWeek.java │ │ │ │ ├── EnumWithConverterError.java │ │ │ │ ├── ComplexSubTypeError.java │ │ │ │ ├── WrongMember.java │ │ │ │ ├── WrongType.java │ │ │ │ ├── WrongTypeConverter.java │ │ │ │ ├── FileAccess.java │ │ │ │ ├── ExampleJavaOneAction.java │ │ │ │ ├── ConverterWithConstructorError.java │ │ │ │ └── ExampleJavaOneFunction.java │ │ │ │ ├── testaction │ │ │ │ └── function │ │ │ │ │ └── Function.java │ │ │ │ └── impl │ │ │ │ └── ExampleJavaOneFunction.java │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── sap │ │ │ └── olingo │ │ │ └── jpa │ │ │ └── metadata │ │ │ ├── core │ │ │ └── edm │ │ │ │ └── mapper │ │ │ │ ├── impl │ │ │ │ └── package-info.java │ │ │ │ ├── api │ │ │ │ ├── CardinalityValue.java │ │ │ │ ├── JPASingleton.java │ │ │ │ ├── JPAAction.java │ │ │ │ ├── JPAInheritanceType.java │ │ │ │ ├── JPAJavaFunction.java │ │ │ │ ├── JPAOnConditionItem.java │ │ │ │ ├── JPAOperationResultParameter.java │ │ │ │ ├── JPADataBaseFunction.java │ │ │ │ ├── JPAQueryExtension.java │ │ │ │ ├── JPAEntitySet.java │ │ │ │ ├── JPAParameter.java │ │ │ │ ├── JPAEtagValidator.java │ │ │ │ ├── JPAOperation.java │ │ │ │ ├── JPAAssociationAttribute.java │ │ │ │ ├── JPATopLevelEntity.java │ │ │ │ ├── JPAParameterFacet.java │ │ │ │ ├── JPADescriptionAttribute.java │ │ │ │ ├── JPAElement.java │ │ │ │ ├── Cardinality.java │ │ │ │ └── JPAInheritanceInformation.java │ │ │ │ ├── exception │ │ │ │ ├── ODataJPAMessageKey.java │ │ │ │ ├── ODataJPAModelIgnoreException.java │ │ │ │ ├── ODataJPAMessageBufferRead.java │ │ │ │ └── ODataJPAModelInternalException.java │ │ │ │ ├── extension │ │ │ │ ├── ODataEnumerationType.java │ │ │ │ ├── ODataOperation.java │ │ │ │ ├── IntermediateEntityContainerAccess.java │ │ │ │ ├── IntermediateEntityTypeAccess.java │ │ │ │ ├── IntermediateModelItemAccess.java │ │ │ │ ├── IntermediateEntitySetAccess.java │ │ │ │ └── IntermediateNavigationPropertyAccess.java │ │ │ │ └── cache │ │ │ │ ├── InstanceCache.java │ │ │ │ ├── ListCache.java │ │ │ │ └── MapCache.java │ │ │ └── api │ │ │ ├── JPARequestParameterMap.java │ │ │ ├── JPAHttpHeaderMap.java │ │ │ ├── JPAODataQueryContext.java │ │ │ ├── ODataJPAModelCopyException.java │ │ │ ├── JPAApiVersion.java │ │ │ └── JPAJoinColumn.java │ ├── model │ │ └── .gitignore │ ├── .settings │ │ ├── org.eclipse.wst.validation.prefs │ │ ├── org.eclipse.m2e.core.prefs │ │ ├── org.eclipse.wst.common.project.facet.core.xml │ │ ├── org.eclipse.core.resources.prefs │ │ └── org.eclipse.jdt.core.prefs │ └── .gitignore ├── odata-jpa-processor-parallel │ ├── .gitignore │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── sap │ │ │ └── olingo │ │ │ └── jpa │ │ │ └── processor │ │ │ └── core │ │ │ ├── exception │ │ │ └── ODataJPABatchRuntimeException.java │ │ │ ├── processor │ │ │ └── JPAODataBatchRequestGroup.java │ │ │ └── api │ │ │ └── JPAODataParallelBatchProcessorFactory.java │ └── README.md ├── odata-jpa-vocabularies │ └── src │ │ ├── test │ │ └── resources │ │ │ └── annotations │ │ │ └── empty.xml │ │ └── main │ │ └── java │ │ └── com │ │ └── sap │ │ └── olingo │ │ └── jpa │ │ └── metadata │ │ └── core │ │ └── edm │ │ ├── extension │ │ └── vocabularies │ │ │ ├── AliasAccess.java │ │ │ ├── TermAccess.java │ │ │ ├── PropertyAccess.java │ │ │ ├── ODataPropertyPath.java │ │ │ ├── ODataNavigationPath.java │ │ │ ├── NullAsDefault.java │ │ │ ├── AnnotationProvider.java │ │ │ ├── ReferenceList.java │ │ │ ├── ReferenceAccess.java │ │ │ └── JPAReferences.java │ │ └── mapper │ │ └── vocabularies │ │ ├── Named.java │ │ ├── EdmxDataServices.java │ │ ├── Member.java │ │ └── EdmxReferenceInclude.java ├── .dbeaver │ ├── project-settings.json │ └── credentials-config.json ├── odata-jpa-test │ ├── .settings │ │ ├── org.eclipse.wst.validation.prefs │ │ ├── org.eclipse.m2e.core.prefs │ │ ├── org.eclipse.jpt.core.prefs │ │ ├── org.eclipse.core.resources.prefs │ │ ├── org.eclipse.wst.common.project.facet.core.prefs.xml │ │ └── org.eclipse.wst.common.project.facet.core.xml │ ├── src │ │ ├── main │ │ │ ├── resources │ │ │ │ └── images │ │ │ │ │ └── OlingoOrangeTM.png │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── sap │ │ │ │ └── olingo │ │ │ │ └── jpa │ │ │ │ └── processor │ │ │ │ └── core │ │ │ │ ├── testmodel │ │ │ │ ├── KeyAccess.java │ │ │ │ ├── UserType.java │ │ │ │ ├── ABCClassification.java │ │ │ │ ├── ComplexBaseType.java │ │ │ │ ├── ComplexSubType.java │ │ │ │ ├── JoinRelation.java │ │ │ │ ├── JoinPartnerRoleRelation.java │ │ │ │ ├── DetailSettings.java │ │ │ │ ├── CurrentUserQueryExtension.java │ │ │ │ ├── StringConverter.java │ │ │ │ ├── AccessRights.java │ │ │ │ ├── SalesTeam.java │ │ │ │ ├── ByteConverter.java │ │ │ │ ├── RestrictedEntityUnrestrictedSource.java │ │ │ │ ├── LocaleEnumeration.java │ │ │ │ ├── RestrictedEntityComplex.java │ │ │ │ ├── BooleanConverter.java │ │ │ │ ├── GroupNameCalculator.java │ │ │ │ ├── BestOrganization.java │ │ │ │ ├── LauFilter.java │ │ │ │ ├── Membership.java │ │ │ │ ├── CurrentUser.java │ │ │ │ ├── EmptyQueryExtensionProvider.java │ │ │ │ ├── SupportRelationship.java │ │ │ │ ├── NestedComplexKey.java │ │ │ │ ├── InheritanceByJoinLockedSavingAccount.java │ │ │ │ ├── StreetPropertyCalculator.java │ │ │ │ ├── FullNameCalculator.java │ │ │ │ ├── InheritanceByJoinSavingAccount.java │ │ │ │ ├── DummyEmbeddedToIgnore.java │ │ │ │ ├── JoinComplex.java │ │ │ │ ├── AssociationOneToOneTarget.java │ │ │ │ ├── UUIDToStringConverter.java │ │ │ │ ├── DateConverter.java │ │ │ │ └── JoinTarget.java │ │ │ │ ├── errormodel │ │ │ │ ├── TeamWithTransientEmbeddableKey.java │ │ │ │ ├── ChangeInformation.java │ │ │ │ ├── MissingCardinalityAnnotation.java │ │ │ │ ├── TeamWithTransientError.java │ │ │ │ ├── EmbeddedKeyPartOfGroup.java │ │ │ │ ├── TeamWithTransientCalculatorError.java │ │ │ │ └── TeamWithTransientCalculatorConstructorError.java │ │ │ │ └── util │ │ │ │ └── TestDataConstants.java │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── sap │ │ │ └── olingo │ │ │ └── jpa │ │ │ └── processor │ │ │ └── test │ │ │ ├── UUIDToStringConverterTest.java │ │ │ ├── UUIDToBinaryConverterTest.java │ │ │ ├── LocalDateTimeConverterTest.java │ │ │ ├── TimestampLongConverterTest.java │ │ │ └── AbstractConverterTest.java │ ├── .gitignore │ └── META-INF │ │ └── persistence.xml ├── .settings │ ├── org.eclipse.m2e.core.prefs │ └── org.eclipse.core.resources.prefs ├── eclipse-import.importorder ├── odata-jpa-annotation │ ├── .gitignore │ ├── .settings │ │ ├── org.eclipse.core.resources.prefs │ │ ├── org.eclipse.wst.common.project.facet.core.xml │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── sap │ │ └── olingo │ │ └── jpa │ │ └── metadata │ │ ├── core │ │ └── edm │ │ │ └── annotation │ │ │ ├── EdmFunctionType.java │ │ │ ├── EdmFunctions.java │ │ │ ├── EdmIgnore.java │ │ │ ├── EdmSearchable.java │ │ │ ├── EdmAlias.java │ │ │ ├── ValidatorStrength.java │ │ │ ├── EdmProtections.java │ │ │ └── EdmMediaStream.java │ │ └── odata │ │ └── v4 │ │ └── core │ │ └── annotation │ │ └── Immutable.java ├── odata-jpa-processor-ext │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── sap │ │ └── olingo │ │ └── jpa │ │ └── processor │ │ └── cb │ │ ├── ProcessorSqlPattern.java │ │ ├── ProcessorSubQueryProvider.java │ │ ├── ProcessorSqlOperator.java │ │ ├── ProcessorSqlFunction.java │ │ └── ProcessorSqlParameter.java ├── odata-jpa-processor-cb │ ├── src │ │ ├── test │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── sap │ │ │ │ └── olingo │ │ │ │ └── jpa │ │ │ │ └── processor │ │ │ │ └── cb │ │ │ │ ├── testobjects │ │ │ │ ├── UserType.java │ │ │ │ ├── SubTablePerClass.java │ │ │ │ ├── SubJoined.java │ │ │ │ ├── SuperJoined.java │ │ │ │ └── SuperTablePerClass.java │ │ │ │ ├── joiner │ │ │ │ └── AsSqlAnswer.java │ │ │ │ └── impl │ │ │ │ ├── ClassAnswer.java │ │ │ │ ├── AliasBuilderTest.java │ │ │ │ └── SqlJoinTypeTest.java │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── sap │ │ │ └── olingo │ │ │ └── jpa │ │ │ └── processor │ │ │ └── cb │ │ │ ├── joiner │ │ │ ├── SetExpression.java │ │ │ └── SqlConvertible.java │ │ │ ├── impl │ │ │ ├── SqlDefaultPattern.java │ │ │ ├── SqlSelection.java │ │ │ ├── SqlWindowFunctions.java │ │ │ ├── SqlNullCheck.java │ │ │ ├── SqlSubQuery.java │ │ │ ├── SqlArithmetic.java │ │ │ ├── CompoundPath.java │ │ │ ├── SqlAggregation.java │ │ │ ├── SqlTimeFunctions.java │ │ │ ├── AliasBuilder.java │ │ │ ├── SqlStringFunctions.java │ │ │ └── RootImpl.java │ │ │ └── exceptions │ │ │ ├── NotImplementedException.java │ │ │ ├── SqlParameterException.java │ │ │ └── InternalServerError.java │ └── .gitignore ├── odata-jpa-processor │ ├── src │ │ ├── main │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── sap │ │ │ │ └── olingo │ │ │ │ └── jpa │ │ │ │ └── processor │ │ │ │ └── core │ │ │ │ ├── filter │ │ │ │ ├── JPAFilterAggregationType.java │ │ │ │ ├── JPAPrimitiveTypeOperator.java │ │ │ │ ├── JPAExpressionOperator.java │ │ │ │ ├── JPAOperator.java │ │ │ │ ├── JPAAggregationOperation.java │ │ │ │ ├── JPAExpression.java │ │ │ │ ├── JPABooleanOperator.java │ │ │ │ ├── JPAEnumerationBasedOperator.java │ │ │ │ ├── JPAVisitableExpression.java │ │ │ │ ├── JPAExpressionVisitor.java │ │ │ │ ├── JPAInOperator.java │ │ │ │ ├── JPALambdaAnyOperation.java │ │ │ │ ├── JPAUnaryBooleanOperator.java │ │ │ │ └── JPAComparisonOperator.java │ │ │ │ ├── modify │ │ │ │ └── JPAUpdateResult.java │ │ │ │ ├── properties │ │ │ │ ├── JPACollectionProperty.java │ │ │ │ ├── JPAProcessorCountAttribute.java │ │ │ │ ├── JPAProcessorSimpleAttribute.java │ │ │ │ ├── JPAProcessorNavigationAttribute.java │ │ │ │ └── JPAProcessorDescriptionAttribute.java │ │ │ │ ├── serializer │ │ │ │ ├── JPAPrimitivePropertyInfo.java │ │ │ │ ├── JPAValueSerializerResult.java │ │ │ │ ├── JPAEntityCollectionExtension.java │ │ │ │ ├── JPAEntityCollection.java │ │ │ │ └── JPAOperationSerializer.java │ │ │ │ ├── api │ │ │ │ ├── JPAODataSkipTokenProvider.java │ │ │ │ ├── JPAODataExpandPage.java │ │ │ │ ├── JPAODataCRUDRequestContext.java │ │ │ │ ├── JPAErrorProcessor.java │ │ │ │ ├── JPAODataBatchProcessorFactory.java │ │ │ │ ├── example │ │ │ │ │ └── JPAExampleAuditable.java │ │ │ │ ├── JPAODataQueryDirectivesBuilder.java │ │ │ │ ├── JPAODataPageExpandInfo.java │ │ │ │ ├── JPAODataGroupProvider.java │ │ │ │ ├── JPAODataDatabaseProcessor.java │ │ │ │ ├── JPAODataApiVersionAccess.java │ │ │ │ ├── JPADefaultBatchProcessorFactory.java │ │ │ │ ├── JPAODataPathInformation.java │ │ │ │ └── JPAODataClaimProvider.java │ │ │ │ ├── query │ │ │ │ ├── JPAExpandItemPageable.java │ │ │ │ ├── JPAQuery.java │ │ │ │ ├── JPAExpandQuery.java │ │ │ │ ├── InExpressionValue.java │ │ │ │ ├── JPAQueryPair.java │ │ │ │ ├── ExistsExpressionValue.java │ │ │ │ ├── JPAStandardExtension.java │ │ │ │ ├── JPAExpandCountQuery.java │ │ │ │ ├── JPANoSelectionException.java │ │ │ │ ├── JPAQueryCreationResult.java │ │ │ │ ├── JPANavigationPropertyInfoAccess.java │ │ │ │ ├── EdmBindingTargetInfo.java │ │ │ │ ├── JPACountQuery.java │ │ │ │ └── JPAExtension.java │ │ │ │ ├── uri │ │ │ │ ├── JPAUriInfoResource.java │ │ │ │ ├── JPATopOptionImpl.java │ │ │ │ ├── JPASkipOptionImpl.java │ │ │ │ ├── JPASkipTokenOptionImpl.java │ │ │ │ └── JPALevelsExpandOption.java │ │ │ │ ├── exception │ │ │ │ ├── ODataJPAIllegalAccessException.java │ │ │ │ ├── ODataJPAIllegalArgumentException.java │ │ │ │ ├── ODataJPAKeyPairException.java │ │ │ │ └── ODataJPANotImplementedException.java │ │ │ │ ├── processor │ │ │ │ ├── JPARequestProcessor.java │ │ │ │ ├── JPAETagValidationResult.java │ │ │ │ ├── JPAAbstractGetRequestProcessor.java │ │ │ │ ├── JPAHttpHeaderHashMap.java │ │ │ │ ├── JPARequestParameterHashMap.java │ │ │ │ ├── ODATARequestContext.java │ │ │ │ └── JPARequestLink.java │ │ │ │ └── converter │ │ │ │ ├── JPACollectionResult.java │ │ │ │ └── JPARowConverter.java │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── sap │ │ │ └── olingo │ │ │ └── jpa │ │ │ └── processor │ │ │ └── core │ │ │ ├── testobjects │ │ │ ├── ClassWithIdClassWithoutConstructor.java │ │ │ ├── BusinessPartnerRoleWithoutSetter.java │ │ │ ├── OrganizationWithoutGetter.java │ │ │ ├── FileAccess.java │ │ │ ├── ClassWithOneKeyConstructor.java │ │ │ ├── ClassWithOneKeyAndEmptyConstructor.java │ │ │ ├── ClassWithIdClassConstructor.java │ │ │ └── HeaderParamTransientPropertyConverter.java │ │ │ ├── util │ │ │ ├── matcher │ │ │ │ ├── EntitySerializerOptionsMatcher.java │ │ │ │ ├── ComplexSerializerOptionsMatcher.java │ │ │ │ ├── PrimitiveSerializerOptionsMatcher.java │ │ │ │ └── EntityCollectionSerializerOptionsMatcher.java │ │ │ └── TupleElementDouble.java │ │ │ ├── query │ │ │ ├── JPAExpandItemWrapperTest.java │ │ │ └── TestNotImplemented.java │ │ │ └── api │ │ │ └── JPAODataClaimProviderTest.java │ ├── .gitignore │ └── .settings │ │ ├── org.eclipse.wst.common.project.facet.core.xml │ │ └── org.eclipse.jdt.core.prefs ├── .gitignore ├── odata-jpa-coverage │ └── .project ├── odata-jpa-spring-support │ ├── src │ │ └── main │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── additional-spring-configuration-metadata.json │ └── pom.xml └── odata-jpa-odata-vocabularies │ └── src │ └── main │ └── java │ └── com │ └── sap │ └── olingo │ └── jpa │ └── metadata │ └── odata │ └── v4 │ ├── general │ └── Aliases.java │ ├── core │ └── terms │ │ ├── GenaralProperty.java │ │ ├── GeneralProperty.java │ │ ├── ExampleProperties.java │ │ └── Terms.java │ └── capabilities │ └── terms │ ├── DeepInsertSupportProperties.java │ ├── DeepUpdateSupportProperties.java │ ├── UpdateMethod.java │ ├── ExpandRestrictionsProperties.java │ ├── FilterRestrictionsProperties.java │ ├── CountRestrictionsProperties.java │ ├── SortRestrictionsProperties.java │ └── DeleteRestrictionsProperties.java ├── jpa-archetype ├── odata-jpa-archetype-spring │ ├── src │ │ ├── test │ │ │ └── resources │ │ │ │ └── projects │ │ │ │ └── createWithAllParameter │ │ │ │ ├── goal.txt │ │ │ │ └── archetype.properties │ │ └── main │ │ │ └── resources │ │ │ └── archetype-resources │ │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── SpringApp.java │ │ │ └── resources │ │ │ │ ├── db │ │ │ │ └── migration │ │ │ │ │ └── V1_0__jpa.sql │ │ │ │ ├── application-test.yml │ │ │ │ └── application.yml │ │ │ └── test │ │ │ ├── java │ │ │ └── AppTest.java │ │ │ └── resources │ │ │ └── application-test.yml │ └── .project ├── .project └── pom.xml ├── .project └── .github ├── dependabot.yml └── workflows ├── build.yml ├── build-wo-cb.yml └── archetype.yml /jpa-tutorial/.gitignore: -------------------------------------------------------------------------------- 1 | /*.txt 2 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/test/resources/annotations/empty.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-parallel/.gitignore: -------------------------------------------------------------------------------- 1 | /.sts4-cache/ 2 | -------------------------------------------------------------------------------- /jpa/odata-jpa-vocabularies/src/test/resources/annotations/empty.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /jpa/.dbeaver/project-settings.json: -------------------------------------------------------------------------------- 1 | {"id":"1dc9dc18-395d-49be-a7b8-2ad9bb1a4481"} -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/model/.gitignore: -------------------------------------------------------------------------------- 1 | /model.di 2 | /model.notation 3 | /model.uml 4 | -------------------------------------------------------------------------------- /jpa-archetype/odata-jpa-archetype-spring/src/test/resources/projects/createWithAllParameter/goal.txt: -------------------------------------------------------------------------------- 1 | install -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /jpa-tutorial/HowToSeeTheModel.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/HowToSeeTheModel.txt -------------------------------------------------------------------------------- /jpa/.dbeaver/credentials-config.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa/.dbeaver/credentials-config.json -------------------------------------------------------------------------------- /jpa-tutorial/Sequence/model.di: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /jpa-tutorial/db-model/BuPa.di: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /jpa-tutorial/jpa-model/BuPa.di: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /jpa-tutorial/images/quick-start/start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/images/quick-start/start.png -------------------------------------------------------------------------------- /jpa/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /jpa-tutorial/Tutorials/Metadata/1-10-JPAConverter.md: -------------------------------------------------------------------------------- 1 | # 1.10 JPA Converter 2 | 3 | Next step: [Tutorial 1.11 Annotations](1-11-Annotations.md) 4 | -------------------------------------------------------------------------------- /jpa-tutorial/Tutorials/Metadata/1-11-Annotations.md: -------------------------------------------------------------------------------- 1 | # 1.11 Annotations 2 | 3 | Next step: [Tutorial 1.12 Enumeration Types](1-12-EnumerationTypes.md) -------------------------------------------------------------------------------- /jpa-tutorial/images/quick-start/GitClone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/images/quick-start/GitClone.png -------------------------------------------------------------------------------- /jpa-tutorial/images/quick-start/Project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/images/quick-start/Project.png -------------------------------------------------------------------------------- /jpa/eclipse-import.importorder: -------------------------------------------------------------------------------- 1 | #Organize Import Order 2 | #Sun Jun 09 11:30:55 CEST 2024 3 | 0=java 4 | 1=javax 5 | 2=jakarta 6 | 3=org 7 | 4=com 8 | -------------------------------------------------------------------------------- /jpa-tutorial/images/quick-start/m2-directory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/images/quick-start/m2-directory.png -------------------------------------------------------------------------------- /jpa/odata-jpa-annotation/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | **/target/ 3 | /.pmd 4 | 5 | # JDT-specific (Eclipse Java Development Tools) 6 | .classpath 7 | /.sts4-cache/ 8 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/impl/package-info.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.impl; -------------------------------------------------------------------------------- /jpa/odata-jpa-test/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /jpa-tutorial/images/quick-start/MavenNewProject.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/images/quick-start/MavenNewProject.png -------------------------------------------------------------------------------- /jpa-tutorial/images/quick-start/runConfiguration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/images/quick-start/runConfiguration.png -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /jpa-tutorial/Tutorials/Introduction/Model/DBTable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/Tutorials/Introduction/Model/DBTable.png -------------------------------------------------------------------------------- /jpa-tutorial/Tutorials/Metadata/Metadata/Mapping1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/Tutorials/Metadata/Metadata/Mapping1.png -------------------------------------------------------------------------------- /jpa-tutorial/Tutorials/Metadata/Metadata/Mapping2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/Tutorials/Metadata/Metadata/Mapping2.png -------------------------------------------------------------------------------- /jpa-tutorial/Tutorials/Metadata/Metadata/Mapping3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/Tutorials/Metadata/Metadata/Mapping3.png -------------------------------------------------------------------------------- /jpa-tutorial/Tutorials/Metadata/Metadata/Mapping4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/Tutorials/Metadata/Metadata/Mapping4.png -------------------------------------------------------------------------------- /jpa-tutorial/Tutorials/Metadata/Metadata/Mapping5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/Tutorials/Metadata/Metadata/Mapping5.png -------------------------------------------------------------------------------- /jpa-tutorial/Tutorials/Metadata/Metadata/Mapping6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/Tutorials/Metadata/Metadata/Mapping6.png -------------------------------------------------------------------------------- /jpa-tutorial/images/quick-start/MavenCreateProject.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/images/quick-start/MavenCreateProject.png -------------------------------------------------------------------------------- /jpa-tutorial/Tutorials/Introduction/Model/JPAClasses.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/Tutorials/Introduction/Model/JPAClasses.png -------------------------------------------------------------------------------- /jpa-tutorial/Tutorials/Metadata/1-9-ChangingGeneratedMetadata.md: -------------------------------------------------------------------------------- 1 | # 1.9 Changing Generated Metadata 2 | 3 | Next step: [Tutorial 1.10 JPA Converter](1-10-JPAConverter.md) 4 | -------------------------------------------------------------------------------- /jpa-tutorial/Tutorials/Metadata/Metadata/RunOnServer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/Tutorials/Metadata/Metadata/RunOnServer.png -------------------------------------------------------------------------------- /jpa-tutorial/images/quick-start/MavenSelectArchetype.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/images/quick-start/MavenSelectArchetype.png -------------------------------------------------------------------------------- /jpa-tutorial/Tutorials/ChangeData/Images/CreateAdminDiv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/Tutorials/ChangeData/Images/CreateAdminDiv.png -------------------------------------------------------------------------------- /jpa/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/test/java=UTF-8 4 | encoding/=UTF-8 5 | -------------------------------------------------------------------------------- /jpa-tutorial/Tutorials/Metadata/Metadata/MappingFlagsEnum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/Tutorials/Metadata/Metadata/MappingFlagsEnum.png -------------------------------------------------------------------------------- /jpa-tutorial/Tutorials/Metadata/Metadata/MappingSimpleEnum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/Tutorials/Metadata/Metadata/MappingSimpleEnum.png -------------------------------------------------------------------------------- /jpa-tutorial/images/quick-start/MavenSetParameterArchetype.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/images/quick-start/MavenSetParameterArchetype.png -------------------------------------------------------------------------------- /jpa-tutorial/Tutorials/Introduction/CreateProject/MaintainPOM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/Tutorials/Introduction/CreateProject/MaintainPOM.png -------------------------------------------------------------------------------- /jpa-tutorial/Tutorials/SpecialTopics/Images/ExampleByCountry.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/Tutorials/SpecialTopics/Images/ExampleByCountry.JPG -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/resources/images/OlingoOrangeTM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa/odata-jpa-test/src/main/resources/images/OlingoOrangeTM.png -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/.gitignore: -------------------------------------------------------------------------------- 1 | .settings/ 2 | target/ 3 | **/target/ 4 | /.pmd 5 | /*.log 6 | 7 | # JDT-specific (Eclipse Java Development Tools) 8 | .classpath 9 | /.sts4-cache/ 10 | -------------------------------------------------------------------------------- /jpa-tutorial/Tutorials/Metadata/Metadata/MappingSimpleEnumCompany.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/Tutorials/Metadata/Metadata/MappingSimpleEnumCompany.png -------------------------------------------------------------------------------- /jpa/odata-jpa-annotation/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/test/java=UTF-8 4 | encoding/=UTF-8 5 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-ext/src/main/java/com/sap/olingo/jpa/processor/cb/ProcessorSqlPattern.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb; 2 | 3 | public interface ProcessorSqlPattern { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/.settings/org.eclipse.jpt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jpt.core.platform=eclipselink2_5 3 | org.eclipse.jpt.jpa.core.discoverAnnotatedClasses=true 4 | -------------------------------------------------------------------------------- /jpa-tutorial/Tutorials/Introduction/CreateProject/ConvertJPAProject.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/Tutorials/Introduction/CreateProject/ConvertJPAProject.png -------------------------------------------------------------------------------- /jpa/odata-jpa-test/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | **/target/ 3 | /.pmd 4 | /derby.log 5 | /test/ 6 | /*.log 7 | 8 | # JDT-specific (Eclipse Java Development Tools) 9 | .classpath 10 | /.sts4-cache/ 11 | -------------------------------------------------------------------------------- /jpa-tutorial/Tutorials/Introduction/CreateProject/MavenProjectGroupID.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/Tutorials/Introduction/CreateProject/MavenProjectGroupID.png -------------------------------------------------------------------------------- /jpa-tutorial/Tutorials/Introduction/CreateProject/MavenProjectArchivetype.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/olingo-jpa-processor-v4/HEAD/jpa-tutorial/Tutorials/Introduction/CreateProject/MavenProjectArchivetype.png -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/src/test/java/com/sap/olingo/jpa/processor/cb/testobjects/UserType.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb.testobjects; 2 | 3 | public enum UserType { 4 | BATCH, INTERACTIVE; 5 | } 6 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/KeyAccess.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | public interface KeyAccess { 4 | public Object getKey(); 5 | } 6 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/src/main/java/com/sap/olingo/jpa/processor/cb/joiner/SetExpression.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb.joiner; 2 | 3 | public interface SetExpression extends SqlConvertible { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/api/CardinalityValue.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.api; 2 | 3 | public enum CardinalityValue { 4 | ONE, MANY; 5 | } 6 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/filter/JPAFilterAggregationType.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.filter; 2 | 3 | public enum JPAFilterAggregationType { 4 | COUNT; 5 | } 6 | -------------------------------------------------------------------------------- /jpa/.gitignore: -------------------------------------------------------------------------------- 1 | .settings/ 2 | target/ 3 | **/target/ 4 | /target/ 5 | /.pmd 6 | .classpath 7 | 8 | # --- EclipseIDE stuff START 9 | .settings/ 10 | .metadata 11 | *.log 12 | /old.project 13 | /Scripts/ 14 | /.dbeaver/ -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/api/JPASingleton.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.api; 2 | 3 | public interface JPASingleton extends JPATopLevelEntity { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/src/test/java/com/sap/olingo/jpa/processor/cb/testobjects/SubTablePerClass.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb.testobjects; 2 | 3 | public class SubTablePerClass extends SuperTablePerClass { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/modify/JPAUpdateResult.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.modify; 2 | 3 | public final record JPAUpdateResult(boolean wasCreate, Object modifiedEntity) {} 4 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/api/JPAAction.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.api; 2 | 3 | public interface JPAAction extends JPAOperation, JPAJavaOperation { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | **/target/ 3 | /target/ 4 | /.pmd 5 | /derby.log 6 | /test/ 7 | /.settings/ 8 | /*.log 9 | 10 | # JDT-specific (Eclipse Java Development Tools) 11 | .classpath 12 | /model/ 13 | /.sts4-cache/ 14 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/api/JPAInheritanceType.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.api; 2 | 3 | public enum JPAInheritanceType { 4 | NON, SINGLE_TABLE, JOIN_TABLE; 5 | } 6 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/.gitignore: -------------------------------------------------------------------------------- 1 | /.sts4-cache/ 2 | 3 | target/ 4 | **/target/ 5 | /target/ 6 | /.pmd 7 | /derby.log 8 | /test/ 9 | /.settings/ 10 | /*.log 11 | 12 | # JDT-specific (Eclipse Java Development Tools) 13 | .classpath 14 | /model/ -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/properties/JPACollectionProperty.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.properties; 2 | 3 | public interface JPACollectionProperty extends JPAProcessorAttribute { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /jpa/odata-jpa-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/core/edm/extension/vocabularies/AliasAccess.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.extension.vocabularies; 2 | 3 | public interface AliasAccess { 4 | String alias(); 5 | } 6 | -------------------------------------------------------------------------------- /jpa/odata-jpa-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/core/edm/extension/vocabularies/TermAccess.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.extension.vocabularies; 2 | 3 | public interface TermAccess { 4 | String term(); 5 | } 6 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/api/JPAJavaFunction.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.api; 2 | 3 | public interface JPAJavaFunction extends JPAFunction, JPAJavaOperation { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/properties/JPAProcessorCountAttribute.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.properties; 2 | 3 | public interface JPAProcessorCountAttribute extends JPAProcessorAttribute { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /jpa/odata-jpa-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/core/edm/extension/vocabularies/PropertyAccess.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.extension.vocabularies; 2 | 3 | public interface PropertyAccess { 4 | String property(); 5 | } 6 | -------------------------------------------------------------------------------- /jpa/odata-jpa-annotation/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/exception/ODataJPAMessageKey.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.exception; 2 | 3 | public interface ODataJPAMessageKey { 4 | public String getKey(); 5 | } 6 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/properties/JPAProcessorSimpleAttribute.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.properties; 2 | 3 | public interface JPAProcessorSimpleAttribute extends JPAProcessorAttribute { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /jpa/odata-jpa-annotation/src/main/java/com/sap/olingo/jpa/metadata/core/edm/annotation/EdmFunctionType.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.annotation; 2 | 3 | public enum EdmFunctionType { 4 | UserDefinedFunction, // NOSONAR 5 | JavaClass // NOSONAR 6 | } 7 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-ext/src/main/java/com/sap/olingo/jpa/processor/cb/ProcessorSubQueryProvider.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb; 2 | 3 | public interface ProcessorSubQueryProvider { 4 | public ProcessorSubquery subquery(Class type); 5 | } 6 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/properties/JPAProcessorNavigationAttribute.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.properties; 2 | 3 | public interface JPAProcessorNavigationAttribute extends JPAProcessorAttribute { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding//src/test/java=UTF-8 5 | encoding//src/test/resources=UTF-8 6 | encoding/=UTF-8 7 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | olingo-jpa-processor-v4 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /jpa-tutorial/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | jpa-tutorial 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding//src/test/java=UTF-8 5 | encoding//src/test/resources=UTF-8 6 | encoding/=UTF-8 7 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/filter/JPAPrimitiveTypeOperator.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.filter; 2 | 3 | public interface JPAPrimitiveTypeOperator extends JPAOperator { 4 | 5 | public boolean isNull(); 6 | 7 | } -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/properties/JPAProcessorDescriptionAttribute.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.properties; 2 | 3 | public interface JPAProcessorDescriptionAttribute extends JPAProcessorAttribute { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/api/JPAOnConditionItem.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.api; 2 | 3 | public interface JPAOnConditionItem { 4 | public JPAPath getLeftPath(); 5 | 6 | public JPAPath getRightPath(); 7 | } 8 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/filter/JPAExpressionOperator.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.filter; 2 | 3 | public interface JPAExpressionOperator extends JPAExpression { 4 | 5 | public > Enum getOperator(); 6 | } 7 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/serializer/JPAPrimitivePropertyInfo.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.serializer; 2 | 3 | import org.apache.olingo.commons.api.data.Property; 4 | 5 | record JPAPrimitivePropertyInfo(String path, Property property) {} 6 | -------------------------------------------------------------------------------- /jpa-archetype/odata-jpa-archetype-spring/src/test/resources/projects/createWithAllParameter/archetype.properties: -------------------------------------------------------------------------------- 1 | groupId=com.test 2 | artifactId=withParameter 3 | version=0.0.1 4 | punit=Test 5 | schema=Archetype 6 | entity-table=TABLE_1 7 | value-object-table=TEST_TABLE_2 8 | port=9999 9 | package=test -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/api/JPAOperationResultParameter.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.api; 2 | 3 | public interface JPAOperationResultParameter extends JPAParameterFacet { 4 | 5 | public boolean isCollection(); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/src/main/java/com/sap/olingo/jpa/processor/cb/impl/SqlDefaultPattern.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb.impl; 2 | 3 | import com.sap.olingo.jpa.processor.cb.ProcessorSqlPatternProvider; 4 | 5 | class SqlDefaultPattern implements ProcessorSqlPatternProvider { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-ext/src/main/java/com/sap/olingo/jpa/processor/cb/ProcessorSqlOperator.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb; 2 | 3 | import java.util.List; 4 | 5 | public record ProcessorSqlOperator(List parameters) 6 | implements ProcessorSqlPattern { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/UserType.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmEnumeration; 4 | 5 | @EdmEnumeration 6 | public enum UserType { 7 | BATCH, INTERACTIVE; 8 | } 9 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/api/JPAODataSkipTokenProvider.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.api; 2 | 3 | import java.util.List; 4 | 5 | public interface JPAODataSkipTokenProvider { 6 | 7 | String get(final List foreignKeyStack); 8 | } 9 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/ABCClassification.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmEnumeration; 4 | 5 | @EdmEnumeration() 6 | public enum ABCClassification { 7 | A, B, C; 8 | } 9 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/src/main/java/com/sap/olingo/jpa/processor/cb/joiner/SqlConvertible.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb.joiner; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public interface SqlConvertible { 6 | 7 | public StringBuilder asSQL(@Nonnull final StringBuilder statement); 8 | } 9 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-ext/src/main/java/com/sap/olingo/jpa/processor/cb/ProcessorSqlFunction.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb; 2 | 3 | import java.util.List; 4 | 5 | public record ProcessorSqlFunction(String function, List parameters) 6 | implements ProcessorSqlPattern { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/query/JPAExpandItemPageable.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.query; 2 | 3 | import com.sap.olingo.jpa.processor.core.api.JPAODataExpandPage; 4 | 5 | public interface JPAExpandItemPageable { 6 | 7 | void setPage(JPAODataExpandPage page); 8 | } 9 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/query/JPAQuery.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.query; 2 | 3 | import org.apache.olingo.server.api.ODataApplicationException; 4 | 5 | public interface JPAQuery { 6 | JPAConvertibleResult execute() throws ODataApplicationException; 7 | } 8 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/query/JPAExpandQuery.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.query; 2 | 3 | import org.apache.olingo.server.api.ODataApplicationException; 4 | 5 | public interface JPAExpandQuery { 6 | JPAExpandQueryResult execute() throws ODataApplicationException; 7 | } 8 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/extension/ODataEnumerationType.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.extension; 2 | 3 | /** 4 | * 5 | * @author Oliver Grande 6 | * 7 | */ 8 | public interface ODataEnumerationType { 9 | public Integer getValue(); 10 | } 11 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/api/JPAODataExpandPage.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.api; 2 | 3 | import org.apache.olingo.server.api.uri.UriInfoResource; 4 | 5 | public record JPAODataExpandPage(UriInfoResource uriInfo, int skip, int top, JPAODataSkipTokenProvider skipToken) { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /jpa-tutorial/Tutorials/RetrieveData/2-0-Overview.md: -------------------------------------------------------------------------------- 1 | # 2.0: Overview 2 | The second series of tutorial shall introduce into the options when you want to retrieve data: 3 | 4 | [Tutorial 2.1: Preparation](2-1-Preparation.md) 5 | [Tutorial 2.2: Retrieving Data](2-2-RetrievingData.md) 6 | [Tutorial 2.3: Using Functions](2-3-UsingFunctions.md) -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/exception/ODataJPAModelIgnoreException.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.exception; 2 | 3 | public class ODataJPAModelIgnoreException extends Exception { 4 | 5 | private static final long serialVersionUID = -5527636158836324228L; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/extension/ODataOperation.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.extension; 2 | 3 | /** 4 | * Tag interface as super type for Function and Action 5 | * @author Oliver Grande 6 | * 7 | */ 8 | public interface ODataOperation { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/filter/JPAOperator.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.filter; 2 | 3 | import org.apache.olingo.server.api.ODataApplicationException; 4 | 5 | public interface JPAOperator { 6 | public Object get() throws ODataApplicationException; 7 | 8 | String getName(); 9 | } -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/test/java/com/sap/olingo/jpa/metadata/core/edm/mapper/testobjects/ComplexSubTypeOfIgnore.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.testobjects; 2 | 3 | import com.sap.olingo.jpa.processor.core.testmodel.DummyEmbeddedToIgnore; 4 | 5 | public class ComplexSubTypeOfIgnore extends DummyEmbeddedToIgnore { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/test/java/com/sap/olingo/jpa/metadata/core/edm/mapper/testobjects/TestActionCollection.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.testobjects; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAAction; 4 | 5 | public interface TestActionCollection extends TestCollectionInterface, JPAAction { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/test/java/com/sap/olingo/jpa/metadata/core/edm/mapper/testobjects/TestCollectionInterface.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.testobjects; 2 | 3 | import java.io.Serializable; 4 | import java.util.Collection; 5 | 6 | public interface TestCollectionInterface extends Serializable, Collection { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/src/main/java/com/sap/olingo/jpa/processor/cb/exceptions/NotImplementedException.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb.exceptions; 2 | 3 | public class NotImplementedException extends RuntimeException { 4 | 5 | /** 6 | * 7 | */ 8 | private static final long serialVersionUID = -5704193843480029363L; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/src/test/java/com/sap/olingo/jpa/processor/cb/testobjects/SubJoined.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb.testobjects; 2 | 3 | import jakarta.persistence.PrimaryKeyJoinColumn; 4 | 5 | @PrimaryKeyJoinColumn(name = "\"Key1\"", referencedColumnName = "\"Value1\"") 6 | public class SubJoined extends SuperJoined { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /jpa/odata-jpa-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/vocabularies/Named.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.vocabularies; 2 | 3 | import org.apache.olingo.commons.api.edm.provider.CsdlNamed; 4 | 5 | interface Named { 6 | public String getName(); 7 | 8 | public CsdlNamed setName(final String name); 9 | } 10 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/api/JPARequestParameterMap.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.api; 2 | 3 | import java.util.Map; 4 | 5 | /** 6 | * 7 | * @author Oliver Grande 8 | * @since 1.0.3 9 | * 20.05.2021 10 | */ 11 | public interface JPARequestParameterMap extends Map { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/api/JPADataBaseFunction.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.api; 2 | 3 | public interface JPADataBaseFunction extends JPAFunction { 4 | /** 5 | * 6 | * @return Name of the function on the database 7 | */ 8 | public String getDBName(); 9 | } 10 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/ComplexBaseType.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import jakarta.persistence.Column; 4 | import jakarta.persistence.Embeddable; 5 | 6 | @Embeddable 7 | public class ComplexBaseType { 8 | 9 | @Column 10 | private String oneAttribute; 11 | } 12 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/exception/ODataJPAMessageBufferRead.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.exception; 2 | 3 | public interface ODataJPAMessageBufferRead { 4 | 5 | String getText(Object execution, String iD); 6 | 7 | String getText(Object execution, String iD, String... parameters); 8 | 9 | } -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/test/java/com/sap/olingo/jpa/metadata/core/edm/mapper/testobjects/DayOfWeek.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.testobjects; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmEnumeration; 4 | 5 | @EdmEnumeration 6 | public enum DayOfWeek { 7 | MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY; 8 | } 9 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-ext/src/main/java/com/sap/olingo/jpa/processor/cb/ProcessorSqlParameter.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb; 2 | 3 | public record ProcessorSqlParameter(String keyword, String parameter, boolean isOptional) { 4 | 5 | public ProcessorSqlParameter(final String parameter, final boolean isOptional) { 6 | this("", parameter, isOptional); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/query/InExpressionValue.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.query; 2 | 3 | /** 4 | * Tag interface to indicate that a sub query shall be used for an IN expression 5 | * @author Oliver Grande 6 | * @since 2.0.1 7 | * 20.11.2023 8 | */ 9 | public interface InExpressionValue { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/api/JPAODataCRUDRequestContext.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.api; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public interface JPAODataCRUDRequestContext extends JPAODataRequestContext { 6 | public void setCUDRequestHandler(@Nonnull final JPACUDRequestHandler jpaCUDRequestHandler); 7 | } 8 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/query/JPAQueryPair.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.query; 2 | 3 | record JPAQueryPair(JPAAbstractQuery inner, JPAAbstractQuery outer) { 4 | 5 | @Override 6 | public String toString() { 7 | return "JPAQueryPair [outer=" + outer + ", inner=" + inner + "]"; 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/uri/JPAUriInfoResource.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.uri; 2 | 3 | import org.apache.olingo.server.api.uri.UriInfoResource; 4 | import org.apache.olingo.server.api.uri.UriResource; 5 | 6 | public interface JPAUriInfoResource extends UriInfoResource { 7 | public UriResource getLastResourcePart(); 8 | } 9 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/ComplexSubType.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import jakarta.persistence.Column; 4 | import jakarta.persistence.Embeddable; 5 | 6 | @Embeddable 7 | public class ComplexSubType extends ComplexBaseType { 8 | 9 | @Column 10 | private Integer num; 11 | } 12 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/api/JPAHttpHeaderMap.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.api; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | /** 7 | * 8 | * @author Oliver Grande 9 | * @since 1.0.3 10 | * 20.05.2021 11 | */ 12 | public interface JPAHttpHeaderMap extends Map> { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/cache/InstanceCache.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.cache; 2 | 3 | import java.util.Optional; 4 | 5 | import com.sap.olingo.jpa.metadata.core.edm.mapper.exception.ODataJPAModelException; 6 | 7 | public interface InstanceCache { 8 | Optional get() throws ODataJPAModelException; 9 | } -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/query/ExistsExpressionValue.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.query; 2 | 3 | /** 4 | * Tag interface to indicate that a sub query shall be used for an EXISTS expression 5 | * @author Oliver Grande 6 | * @since 2.0.1 7 | * 20.11.2023 8 | */ 9 | public interface ExistsExpressionValue { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "maven" 4 | directory: "/jpa" 5 | schedule: 6 | interval: "weekly" 7 | - package-ecosystem: "maven" 8 | directory: "/jpa-archetype" 9 | schedule: 10 | interval: "weekly" 11 | - package-ecosystem: "github-actions" 12 | directory: "/" 13 | schedule: 14 | interval: "weekly" 15 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/test/java/com/sap/olingo/jpa/metadata/core/edm/mapper/testobjects/EnumWithConverterError.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.testobjects; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmEnumeration; 4 | 5 | @EdmEnumeration(converter = ConverterWithConstructorError.class) 6 | public enum EnumWithConverterError { 7 | TEST, DUMMY; 8 | } 9 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/api/JPAErrorProcessor.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.api; 2 | 3 | import org.apache.olingo.server.api.ODataRequest; 4 | import org.apache.olingo.server.api.ODataServerError; 5 | 6 | public interface JPAErrorProcessor { 7 | public void processError(final ODataRequest request, final ODataServerError serverError); 8 | } 9 | -------------------------------------------------------------------------------- /jpa-tutorial/Tutorials/SpecialTopics/4-0-Overview.md: -------------------------------------------------------------------------------- 1 | # 4.0: Overview 2 | 3 | [4.1: Large Objects](4-1-LargeObjects.md)
4 | [4.2: OData Conformance](4-2-Conformance.md)
5 | [4.3: Server Driven Paging](4-3-ServerDrivenPaging.md)
6 | [4.4: Instance Based Authorizations](4-4-InstanceBasedAuthorizations.md)
7 | [4.5: Field Groups](4-5-FieldGroups.md)
8 | [4.6: Transient Fields](4-6-TransientFields.md)
-------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/query/JPAStandardExtension.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.query; 2 | 3 | import com.sap.olingo.jpa.processor.core.converter.JPAExpandResult; 4 | 5 | public class JPAStandardExtension implements JPAExtension { 6 | 7 | @Override 8 | public JPAExpandResult executeExpandTopSkipQuery() { 9 | return null; 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/META-INF/persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/src/test/java/com/sap/olingo/jpa/processor/cb/testobjects/SuperJoined.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb.testobjects; 2 | 3 | import jakarta.persistence.Entity; 4 | import jakarta.persistence.Inheritance; 5 | import jakarta.persistence.InheritanceType; 6 | 7 | @Entity(name = "Super") 8 | @Inheritance(strategy = InheritanceType.JOINED) 9 | public class SuperJoined { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/cache/ListCache.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.cache; 2 | 3 | import java.util.List; 4 | 5 | import javax.annotation.Nonnull; 6 | 7 | import com.sap.olingo.jpa.metadata.core.edm.mapper.exception.ODataJPAModelException; 8 | 9 | public interface ListCache { 10 | @Nonnull 11 | List get() throws ODataJPAModelException; 12 | } -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/filter/JPAAggregationOperation.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.filter; 2 | 3 | import org.apache.olingo.server.api.ODataApplicationException; 4 | 5 | public interface JPAAggregationOperation extends JPAOperator { 6 | @Override 7 | public Object get() throws ODataApplicationException; 8 | 9 | JPAFilterAggregationType getAggregation(); 10 | 11 | } -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/filter/JPAExpression.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.filter; 2 | 3 | import jakarta.persistence.criteria.Expression; 4 | 5 | import org.apache.olingo.server.api.ODataApplicationException; 6 | 7 | public interface JPAExpression extends JPAOperator { 8 | 9 | @Override 10 | Expression get() throws ODataApplicationException; 11 | } -------------------------------------------------------------------------------- /jpa/odata-jpa-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/core/edm/extension/vocabularies/ODataPropertyPath.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.sap.olingo.jpa.metadata.core.edm.extension.vocabularies; 5 | 6 | /** 7 | * @author Oliver Grande 8 | * @since 1.1.1 9 | * 13.02.2023 10 | */ 11 | public interface ODataPropertyPath { 12 | 13 | /** 14 | * @return 15 | */ 16 | String getPathAsString(); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /jpa/odata-jpa-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/core/edm/extension/vocabularies/ODataNavigationPath.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.sap.olingo.jpa.metadata.core.edm.extension.vocabularies; 5 | 6 | /** 7 | * @author Oliver Grande 8 | * @since 1.1.1 9 | * 13.02.2023 10 | */ 11 | public interface ODataNavigationPath { 12 | 13 | /** 14 | * @return 15 | */ 16 | String getPathAsString(); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/api/JPAQueryExtension.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.api; 2 | 3 | import java.lang.reflect.Constructor; 4 | 5 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmQueryExtensionProvider; 6 | 7 | public interface JPAQueryExtension { 8 | 9 | Constructor getConstructor(); 10 | } 11 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/api/JPAEntitySet.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.api; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.mapper.exception.ODataJPAModelException; 4 | 5 | public interface JPAEntitySet extends JPATopLevelEntity { 6 | 7 | JPAEntityType getODataEntityType() throws ODataJPAModelException; 8 | 9 | JPAEntityType getEntityType(); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/cache/MapCache.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.cache; 2 | 3 | import java.util.Map; 4 | 5 | import javax.annotation.Nonnull; 6 | 7 | import com.sap.olingo.jpa.metadata.core.edm.mapper.exception.ODataJPAModelException; 8 | 9 | public interface MapCache { 10 | 11 | @Nonnull 12 | Map get() throws ODataJPAModelException; 13 | 14 | } -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/src/main/java/com/sap/olingo/jpa/processor/cb/exceptions/SqlParameterException.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb.exceptions; 2 | 3 | public class SqlParameterException extends RuntimeException { 4 | 5 | /** 6 | * 7 | */ 8 | private static final long serialVersionUID = 3404311627671683055L; 9 | 10 | public SqlParameterException(final String message) { 11 | super(message); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/src/test/java/com/sap/olingo/jpa/processor/cb/testobjects/SuperTablePerClass.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb.testobjects; 2 | 3 | import jakarta.persistence.Entity; 4 | import jakarta.persistence.Inheritance; 5 | import jakarta.persistence.InheritanceType; 6 | 7 | @Entity(name = "Super") 8 | @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) 9 | public class SuperTablePerClass { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /jpa-archetype/odata-jpa-archetype-spring/src/main/resources/archetype-resources/src/main/java/SpringApp.java: -------------------------------------------------------------------------------- 1 | package $package; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringApp { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringApp.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/exception/ODataJPAModelInternalException.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.exception; 2 | 3 | public class ODataJPAModelInternalException extends RuntimeException { 4 | 5 | private static final long serialVersionUID = 1L; 6 | 7 | public ODataJPAModelInternalException(final ODataJPAModelException rootCause) { 8 | super(rootCause); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/src/main/java/com/sap/olingo/jpa/processor/cb/impl/SqlSelection.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb.impl; 2 | 3 | import jakarta.persistence.criteria.Selection; 4 | 5 | import com.sap.olingo.jpa.processor.cb.ProcessorSelection; 6 | import com.sap.olingo.jpa.processor.cb.joiner.SqlConvertible; 7 | 8 | interface SqlSelection extends ProcessorSelection, SqlConvertible { 9 | Selection getSelection(); 10 | } 11 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/api/JPAODataBatchProcessorFactory.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.api; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public interface JPAODataBatchProcessorFactory { 6 | 7 | T getBatchProcessor(@Nonnull final JPAODataSessionContextAccess serviceContext, 8 | @Nonnull final JPAODataRequestContextAccess requestContext); 9 | } 10 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/test/java/com/sap/olingo/jpa/processor/core/testobjects/ClassWithIdClassWithoutConstructor.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testobjects; 2 | 3 | public class ClassWithIdClassWithoutConstructor { 4 | @SuppressWarnings("unused") 5 | private final ClassWithMultipleKeysConstructor key; 6 | 7 | public ClassWithIdClassWithoutConstructor(final ClassWithMultipleKeysConstructor key) { 8 | this.key = key; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/src/main/java/com/sap/olingo/jpa/processor/cb/impl/SqlWindowFunctions.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb.impl; 2 | 3 | enum SqlWindowFunctions { 4 | 5 | ROW_NUMBER("ROW_NUMBER"); 6 | 7 | private String keyWord; 8 | 9 | private SqlWindowFunctions(final String keyWord) { 10 | this.keyWord = keyWord; 11 | } 12 | 13 | @Override 14 | public String toString() { 15 | return keyWord; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /jpa-archetype/odata-jpa-archetype-spring/src/main/resources/archetype-resources/src/test/java/AppTest.java: -------------------------------------------------------------------------------- 1 | package ${package}; 2 | 3 | import static org.junit.jupiter.api.Assertions.assertTrue; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | /** 8 | * Unit test for simple App. 9 | */ 10 | 11 | class AppTest { 12 | 13 | /** 14 | * Rigorous Test :-) 15 | */ 16 | @Test 17 | void testApp() { 18 | assertTrue(true); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /jpa/odata-jpa-coverage/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | jpa-coverage 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.m2e.core.maven2Builder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.m2e.core.maven2Nature 16 | 17 | 18 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/src/main/java/com/sap/olingo/jpa/processor/cb/impl/SqlNullCheck.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb.impl; 2 | 3 | enum SqlNullCheck { 4 | 5 | NULL("IS NULL"), 6 | NOT_NULL("IS NOT NULL"); 7 | 8 | private String keyWord; 9 | 10 | private SqlNullCheck(final String keyWord) { 11 | this.keyWord = keyWord; 12 | } 13 | 14 | @Override 15 | public String toString() { 16 | return keyWord; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/test/java/com/sap/olingo/jpa/processor/core/testobjects/BusinessPartnerRoleWithoutSetter.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testobjects; 2 | 3 | public class BusinessPartnerRoleWithoutSetter { 4 | 5 | @SuppressWarnings("unused") 6 | private String businessPartnerID; 7 | @SuppressWarnings("unused") 8 | private String roleCategory; 9 | 10 | public BusinessPartnerRoleWithoutSetter() { 11 | super(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/JoinRelation.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import jakarta.persistence.EmbeddedId; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.Table; 6 | 7 | @Entity(name = "JoinRelation") 8 | @Table(schema = "\"OLINGO\"", name = "\"JoinRelation\"") 9 | public class JoinRelation { 10 | 11 | @EmbeddedId 12 | private JoinRelationKey key; 13 | } 14 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/api/JPAParameter.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.api; 2 | 3 | public interface JPAParameter extends JPAParameterFacet { 4 | 5 | /** 6 | * Name of the parameter at the UDF or the java method 7 | * @return 8 | */ 9 | public String getInternalName(); 10 | 11 | /** 12 | * Externally used name 13 | * @return 14 | */ 15 | public String getName(); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/query/JPAExpandCountQuery.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.query; 2 | 3 | import java.util.Map; 4 | 5 | import org.apache.olingo.server.api.ODataApplicationException; 6 | 7 | /** 8 | * 9 | * @author Oliver Grande 10 | * @since 2.2.0 11 | * 2024-08-25 12 | * 13 | */ 14 | public interface JPAExpandCountQuery { 15 | 16 | Map count() throws ODataApplicationException; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/test/java/com/sap/olingo/jpa/metadata/core/edm/mapper/testobjects/ComplexSubTypeError.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.testobjects; 2 | 3 | import org.apache.olingo.commons.api.edm.geo.Point; 4 | import org.apache.olingo.commons.api.edm.geo.SRID; 5 | 6 | public class ComplexSubTypeError extends Point { 7 | 8 | public ComplexSubTypeError(final Dimension dimension, final SRID srid) { 9 | super(dimension, srid); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/api/example/JPAExampleAuditable.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.api.example; 2 | 3 | import java.time.LocalDateTime; 4 | 5 | public interface JPAExampleAuditable { 6 | 7 | void setCreatedBy(final String user); 8 | 9 | void setCreatedAt(final LocalDateTime dateTime); 10 | 11 | void setUpdatedBy(final String user); 12 | 13 | void setUpdatedAt(final LocalDateTime dateTime); 14 | } 15 | -------------------------------------------------------------------------------- /jpa-archetype/odata-jpa-archetype-spring/src/main/resources/archetype-resources/src/main/resources/db/migration/V1_0__jpa.sql: -------------------------------------------------------------------------------- 1 | SET schema "${schema}"; 2 | 3 | CREATE SEQUENCE "TemplateId"; 4 | 5 | CREATE TABLE "${entity-table}"( 6 | "ID" BIGINT NOT NULL , 7 | "Data" VARCHAR(255), 8 | PRIMARY KEY ("ID")); 9 | 10 | CREATE TABLE "${value-object-table}"( 11 | "Entity" BIGINT NOT NULL , 12 | "ID" VARCHAR(32) NOT NULL , 13 | "Data" VARCHAR(255), 14 | PRIMARY KEY ("Entity", "ID")); -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/src/main/java/com/sap/olingo/jpa/processor/cb/exceptions/InternalServerError.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb.exceptions; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.mapper.exception.ODataJPAModelException; 4 | 5 | public class InternalServerError extends RuntimeException { 6 | 7 | private static final long serialVersionUID = -2239224331308130011L; 8 | 9 | public InternalServerError(ODataJPAModelException e) { 10 | super(e); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /jpa/odata-jpa-spring-support/src/main/resources/META-INF/additional-spring-configuration-metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "properties": [ 3 | { 4 | "name": "odata.jpa.punit_name", 5 | "type": "java.lang.String", 6 | "description": "Name of the JPA processing unit to be used" 7 | }, 8 | { 9 | "name": "odata.jpa.root_packages", 10 | "type": "java.lang.String", 11 | "description": "List of root packages JPA processor shall look for Operations and Enumerations" 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/api/JPAEtagValidator.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.api; 2 | 3 | /** 4 | * Strength of the entity tag (ETag) validator according to 5 | * RFC 7232 Section-2.1
6 | * 7 | * @author Oliver Grande 8 | * @since 25.06.2024 9 | * @version 2.1.3 10 | */ 11 | public enum JPAEtagValidator { 12 | WEAK, 13 | STRONG 14 | } 15 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/src/main/java/com/sap/olingo/jpa/processor/cb/impl/SqlSubQuery.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb.impl; 2 | 3 | enum SqlSubQuery { 4 | 5 | EXISTS("EXISTS"), 6 | SOME("SOME"), 7 | ALL("ALL"), 8 | ANY("ANY"); 9 | 10 | private String keyWord; 11 | 12 | private SqlSubQuery(final String keyWord) { 13 | this.keyWord = keyWord; 14 | } 15 | 16 | @Override 17 | public String toString() { 18 | return keyWord; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/api/JPAODataQueryContext.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.api; 2 | 3 | import jakarta.persistence.criteria.CriteriaBuilder; 4 | import jakarta.persistence.criteria.From; 5 | 6 | import com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAEntityType; 7 | 8 | public interface JPAODataQueryContext { 9 | 10 | CriteriaBuilder getCriteriaBuilder(); 11 | 12 | From getFrom(); 13 | 14 | JPAEntityType getEntityType(); 15 | } 16 | -------------------------------------------------------------------------------- /jpa-tutorial/Tutorials/ChangeData/3-0-Overview.md: -------------------------------------------------------------------------------- 1 | # 3.0: Overview 2 | The third series of tutorial shall give you an introduction how you can manipulate data: 3 | 4 | [Tutorial 3.1: Preparation](3-1-Preparation.md) 5 | [Tutorial 3.2: Creating Data](3-2-CreatingEntities.md) 6 | [Tutorial 3.3: Updating Entities](3-3-UpdatingEntities.md) 7 | [Tutorial 3.4: Deleting Entities](3-4-DeletingEntities.md) 8 | [Tutorial 3.5: Deep Insert](3-5-DeepInsert.md) 9 | [Tutorial 3.6: Batch Requests](3-6-BatchRequests.md) -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/src/main/java/com/sap/olingo/jpa/processor/cb/impl/SqlArithmetic.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb.impl; 2 | 3 | enum SqlArithmetic { 4 | 5 | SUM("+"), 6 | PROD("*"), 7 | DIFF("-"), 8 | MOD("%"), 9 | QUOT("/"); 10 | 11 | private String keyWord; 12 | 13 | private SqlArithmetic(final String keyWord) { 14 | this.keyWord = keyWord; 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return keyWord; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/api/JPAODataQueryDirectivesBuilder.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.api; 2 | 3 | import com.sap.olingo.jpa.processor.core.api.JPAODataQueryDirectives.UuidSortOrder; 4 | 5 | public interface JPAODataQueryDirectivesBuilder { 6 | 7 | JPAODataQueryDirectivesBuilder maxValuesInInClause(int i); 8 | 9 | JPAODataQueryDirectivesBuilder uuidSortOrder(UuidSortOrder order); 10 | 11 | JPAODataServiceContextBuilder build(); 12 | 13 | } -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/filter/JPABooleanOperator.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.filter; 2 | 3 | import jakarta.persistence.criteria.Expression; 4 | 5 | import org.apache.olingo.server.api.ODataApplicationException; 6 | 7 | public interface JPABooleanOperator extends JPAExpressionOperator { 8 | 9 | Expression getLeft() throws ODataApplicationException; 10 | 11 | Expression getRight() throws ODataApplicationException; 12 | 13 | } -------------------------------------------------------------------------------- /jpa/odata-jpa-annotation/src/main/java/com/sap/olingo/jpa/metadata/core/edm/annotation/EdmFunctions.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target(ElementType.TYPE) 10 | public @interface EdmFunctions { 11 | public abstract EdmFunction[] value(); 12 | } 13 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/extension/IntermediateEntityContainerAccess.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.extension; 2 | 3 | import java.util.List; 4 | 5 | import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation; 6 | 7 | public interface IntermediateEntityContainerAccess { 8 | /** 9 | * Enables to add annotations to the entity container 10 | */ 11 | public void addAnnotations(final List annotations); 12 | } 13 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/api/JPAODataPageExpandInfo.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.api; 2 | 3 | /** 4 | * 5 | * @param navigationPropertyPath Concatenated path information leading to the next expand 6 | * @param keyPath Concatenated key information to be used to convert the expand 7 | * 8 | * @author Oliver Grande 9 | * @since 2.2.0 10 | * 11 | */ 12 | public record JPAODataPageExpandInfo(String navigationPropertyPath, String keyPath) { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/exception/ODataJPAIllegalAccessException.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.exception; 2 | 3 | /** 4 | * The exception is thrown if a method got called that should not 5 | * 6 | * @author Oliver Grande 7 | * Created: 03.07.2019 8 | * 9 | */ 10 | public class ODataJPAIllegalAccessException extends Exception { 11 | 12 | /** 13 | * 14 | */ 15 | private static final long serialVersionUID = 1L; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/src/main/java/com/sap/olingo/jpa/processor/cb/impl/CompoundPath.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb.impl; 2 | 3 | import jakarta.persistence.criteria.Path; 4 | 5 | import com.sap.olingo.jpa.processor.cb.joiner.SqlConvertible; 6 | 7 | /** 8 | * 9 | * @author Oliver Grande 10 | * @since 2.0.1 11 | * @created 12.11.2023 12 | */ 13 | interface CompoundPath extends SqlConvertible { 14 | 15 | boolean isEmpty(); 16 | 17 | Path getFirst() throws IllegalStateException; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/src/main/java/com/sap/olingo/jpa/processor/cb/impl/SqlAggregation.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb.impl; 2 | 3 | enum SqlAggregation { 4 | 5 | AVG("AVG"), 6 | COUNT("COUNT"), 7 | SUM("SUM"), 8 | MAX("MAX"), 9 | MIN("MIN"); 10 | 11 | private String keyWord; 12 | 13 | private SqlAggregation(final String keyWord) { 14 | this.keyWord = keyWord; 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return keyWord; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/src/main/java/com/sap/olingo/jpa/processor/cb/impl/SqlTimeFunctions.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb.impl; 2 | 3 | enum SqlTimeFunctions { 4 | 5 | TIMESTAMP("CURRENT_TIMESTAMP"), 6 | DATE("CURRENT_DATE"), 7 | TIME("CURRENT_TIME"); 8 | 9 | private String keyWord; 10 | 11 | private SqlTimeFunctions(final String keyWord) { 12 | this.keyWord = keyWord; 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return keyWord; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/api/JPAODataGroupProvider.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.api; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Container that provides field groups 7 | * @author Oliver Grande 8 | * Created: 30.06.2019 9 | * 10 | */ 11 | public interface JPAODataGroupProvider { 12 | /** 13 | * Provides a list of all field groups to be taken into account 14 | * @return 15 | */ 16 | public List getGroups(); 17 | } 18 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/test/java/com/sap/olingo/jpa/processor/test/UUIDToStringConverterTest.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.test; 2 | 3 | import java.util.UUID; 4 | 5 | import org.junit.jupiter.api.BeforeEach; 6 | 7 | import com.sap.olingo.jpa.processor.core.testmodel.UUIDToStringConverter; 8 | 9 | final class UUIDToStringConverterTest extends AbstractConverterTest { 10 | 11 | @BeforeEach 12 | void setup() { 13 | cut = new UUIDToStringConverter(); 14 | exp = UUID.randomUUID(); 15 | } 16 | } -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/test/java/com/sap/olingo/jpa/processor/core/testobjects/OrganizationWithoutGetter.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testobjects; 2 | 3 | /** 4 | * Needed for testing.
5 | * Should not have a getter for the id 6 | * @author Oliver Grande 7 | * 8 | */ 9 | public class OrganizationWithoutGetter { 10 | @SuppressWarnings("unused") 11 | private String id; 12 | 13 | public OrganizationWithoutGetter(String id) { 14 | super(); 15 | this.id = id; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/test/java/com/sap/olingo/jpa/processor/test/UUIDToBinaryConverterTest.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.test; 2 | 3 | import java.util.UUID; 4 | 5 | import org.junit.jupiter.api.BeforeEach; 6 | 7 | import com.sap.olingo.jpa.processor.core.testmodel.UUIDToBinaryConverter; 8 | 9 | final class UUIDToBinaryConverterTest extends AbstractConverterTest { 10 | 11 | @BeforeEach 12 | void setup() { 13 | cut = new UUIDToBinaryConverter(); 14 | exp = UUID.randomUUID(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/api/JPAODataDatabaseProcessor.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.api; 2 | 3 | import com.sap.olingo.jpa.processor.core.database.JPAODataDatabaseSearch; 4 | import com.sap.olingo.jpa.processor.core.database.JPAODataDatabaseTableFunction; 5 | 6 | /** 7 | * Interface is in a beta state 8 | * @author Oliver Grande 9 | * 10 | */ 11 | public interface JPAODataDatabaseProcessor extends JPAODataDatabaseSearch, JPAODataDatabaseTableFunction { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/api/JPAOperation.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.api; 2 | 3 | import org.apache.olingo.commons.api.edm.provider.CsdlReturnType; 4 | 5 | public interface JPAOperation extends JPAElement, JPAUserGroupRestrictable { 6 | /** 7 | * 8 | * @return The return or result parameter of the function 9 | */ 10 | public JPAOperationResultParameter getResultParameter(); 11 | 12 | public CsdlReturnType getReturnType(); 13 | } 14 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/api/ODataJPAModelCopyException.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.api; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.mapper.exception.ODataJPAModelException; 4 | 5 | public class ODataJPAModelCopyException extends RuntimeException { 6 | 7 | private static final long serialVersionUID = -1695284009828517502L; 8 | 9 | public ODataJPAModelCopyException(final String message, final ODataJPAModelException exception) { 10 | super(message, exception); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/src/main/java/com/sap/olingo/jpa/processor/cb/impl/AliasBuilder.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb.impl; 2 | 3 | class AliasBuilder { 4 | private static final String ALIAS_PREFIX = "E"; 5 | private int aliasCount = 0; 6 | private final String prefix; 7 | 8 | AliasBuilder() { 9 | this(ALIAS_PREFIX); 10 | } 11 | 12 | AliasBuilder(final String prefix) { 13 | this.prefix = prefix; 14 | } 15 | 16 | String getNext() { 17 | return prefix + aliasCount++; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/src/test/java/com/sap/olingo/jpa/processor/cb/joiner/AsSqlAnswer.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb.joiner; 2 | 3 | import org.mockito.invocation.InvocationOnMock; 4 | import org.mockito.stubbing.Answer; 5 | 6 | class AsSqlAnswer implements Answer { 7 | 8 | @Override 9 | public StringBuilder answer(final InvocationOnMock invocation) throws Throwable { 10 | final StringBuilder statement = invocation.getArgument(0); 11 | return statement.append("Test"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-parallel/src/main/java/com/sap/olingo/jpa/processor/core/exception/ODataJPABatchRuntimeException.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.exception; 2 | 3 | import org.apache.olingo.commons.api.ex.ODataException; 4 | 5 | public class ODataJPABatchRuntimeException extends RuntimeException { 6 | 7 | /** 8 | * 9 | */ 10 | private static final long serialVersionUID = -4042442300828284445L; 11 | 12 | public ODataJPABatchRuntimeException(ODataException e) { 13 | super(e); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/api/JPAODataApiVersionAccess.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.api; 2 | 3 | import jakarta.persistence.EntityManagerFactory; 4 | 5 | import com.sap.olingo.jpa.metadata.api.JPAEdmProvider; 6 | 7 | public interface JPAODataApiVersionAccess { 8 | public final String DEFAULT_VERSION = "DEFAULT"; 9 | 10 | String getId(); 11 | 12 | JPAEdmProvider getEdmProvider(); 13 | 14 | EntityManagerFactory getEntityManagerFactory(); 15 | 16 | String getMappingPath(); 17 | } 18 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/filter/JPAEnumerationBasedOperator.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.filter; 2 | 3 | import com.sap.olingo.jpa.processor.core.exception.ODataJPAFilterException; 4 | 5 | /** 6 | * Main purpose of this interface is to increase testability of JPAEnumerationBasedOperator 7 | * @author Oliver Grande 8 | * 9 | */ 10 | public interface JPAEnumerationBasedOperator extends JPAPrimitiveTypeOperator { 11 | 12 | Number getValue() throws ODataJPAFilterException; 13 | 14 | } -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/filter/JPAVisitableExpression.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.filter; 2 | 3 | import org.apache.olingo.server.api.uri.UriInfoResource; 4 | import org.apache.olingo.server.api.uri.queryoption.expression.Literal; 5 | import org.apache.olingo.server.api.uri.queryoption.expression.VisitableExpression; 6 | 7 | public interface JPAVisitableExpression extends VisitableExpression { 8 | 9 | public UriInfoResource getMember(); 10 | 11 | public Literal getLiteral(); 12 | } 13 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/extension/IntermediateEntityTypeAccess.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.extension; 2 | 3 | import java.util.List; 4 | 5 | import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation; 6 | 7 | public interface IntermediateEntityTypeAccess extends IntermediateModelItemAccess { 8 | /** 9 | * Enables to add annotations to the entity container 10 | * @param annotations 11 | */ 12 | public void addAnnotations(final List annotations); 13 | } 14 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/api/JPADefaultBatchProcessorFactory.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.api; 2 | 3 | public class JPADefaultBatchProcessorFactory implements JPAODataBatchProcessorFactory { 4 | 5 | @Override 6 | public JPAODataBatchProcessor getBatchProcessor(final JPAODataSessionContextAccess serviceContext, 7 | final JPAODataRequestContextAccess requestContext) { 8 | 9 | return new JPAODataBatchProcessor(serviceContext, requestContext); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/api/JPAAssociationAttribute.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.api; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.mapper.exception.ODataJPAModelException; 4 | 5 | public interface JPAAssociationAttribute extends JPAAttribute { 6 | 7 | public JPAStructuredType getTargetEntity() throws ODataJPAModelException; 8 | 9 | public JPAAssociationAttribute getPartner(); 10 | 11 | public JPAAssociationPath getPath() throws ODataJPAModelException; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /jpa/odata-jpa-odata-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/odata/v4/general/Aliases.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.odata.v4.general; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.extension.vocabularies.AliasAccess; 4 | 5 | public enum Aliases implements AliasAccess { 6 | 7 | CORE("Core"), 8 | CAPABILITIES("Capabilities"); 9 | 10 | private final String alias; 11 | 12 | Aliases(final String alias) { 13 | this.alias = alias; 14 | } 15 | 16 | @Override 17 | public String alias() { 18 | return alias; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/src/test/java/com/sap/olingo/jpa/processor/cb/impl/ClassAnswer.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb.impl; 2 | 3 | import org.mockito.invocation.InvocationOnMock; 4 | import org.mockito.stubbing.Answer; 5 | 6 | class ClassAnswer implements Answer> { 7 | private final Class clazz; 8 | 9 | protected ClassAnswer(final Class clazz) { 10 | this.clazz = clazz; 11 | } 12 | 13 | @Override 14 | public Class answer(final InvocationOnMock invocation) throws Throwable { 15 | return clazz; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-parallel/src/main/java/com/sap/olingo/jpa/processor/core/processor/JPAODataBatchRequestGroup.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.processor; 2 | 3 | import java.util.List; 4 | 5 | import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart; 6 | 7 | import com.sap.olingo.jpa.processor.core.exception.ODataJPABatchRuntimeException; 8 | 9 | public interface JPAODataBatchRequestGroup { 10 | /** 11 | * 12 | * @return 13 | * @throws ODataJPABatchRuntimeException 14 | */ 15 | List execute(); 16 | } -------------------------------------------------------------------------------- /jpa/odata-jpa-annotation/src/main/java/com/sap/olingo/jpa/metadata/core/edm/annotation/EdmIgnore.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.sap.olingo.jpa.metadata.core.edm.annotation; 5 | 6 | import java.lang.annotation.ElementType; 7 | import java.lang.annotation.Retention; 8 | import java.lang.annotation.RetentionPolicy; 9 | import java.lang.annotation.Target; 10 | 11 | /** 12 | * @author Oliver Grande 13 | * 14 | */ 15 | @Target({ ElementType.TYPE, ElementType.FIELD }) 16 | @Retention(value = RetentionPolicy.RUNTIME) 17 | public @interface EdmIgnore { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /jpa/odata-jpa-annotation/src/main/java/com/sap/olingo/jpa/metadata/core/edm/annotation/EdmSearchable.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Marks an attribute as searchable 10 | * @author Oliver Grande 11 | * 12 | */ 13 | @Target({ ElementType.FIELD }) 14 | @Retention(value = RetentionPolicy.RUNTIME) 15 | public @interface EdmSearchable { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /jpa/odata-jpa-odata-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/odata/v4/core/terms/GenaralProperty.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.odata.v4.core.terms; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.extension.vocabularies.PropertyAccess; 4 | 5 | public enum GenaralProperty implements PropertyAccess { 6 | VALUE("Value"); 7 | 8 | private final String property; 9 | 10 | GenaralProperty(final String property) { 11 | this.property = property; 12 | } 13 | 14 | @Override 15 | public String property() { 16 | return property; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /jpa/odata-jpa-odata-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/odata/v4/core/terms/GeneralProperty.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.odata.v4.core.terms; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.extension.vocabularies.PropertyAccess; 4 | 5 | public enum GeneralProperty implements PropertyAccess { 6 | VALUE("Value"); 7 | 8 | private final String property; 9 | 10 | GeneralProperty(final String property) { 11 | this.property = property; 12 | } 13 | 14 | @Override 15 | public String property() { 16 | return property; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/query/JPANoSelectionException.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.query; 2 | 3 | /** 4 | * The exception shall be raised in case no selection left, so it is not necessary to perform a query.
5 | * It is expected that the exception is handled internally. 6 | * 7 | * @author Oliver Grande 8 | * Created: 14.07.2019 9 | * 10 | */ 11 | public class JPANoSelectionException extends Exception { 12 | 13 | private static final long serialVersionUID = -2120984389807283569L; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /jpa/odata-jpa-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/core/edm/extension/vocabularies/NullAsDefault.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.extension.vocabularies; 2 | 3 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 4 | 5 | import java.lang.annotation.Retention; 6 | 7 | /** 8 | * Meta annotation to marks a field of an annotation that the real default value shall be null instead of the given one. 9 | * This is necessary as null as default is not supported by Java 10 | */ 11 | @Retention(RUNTIME) 12 | public @interface NullAsDefault { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /jpa/odata-jpa-annotation/src/main/java/com/sap/olingo/jpa/metadata/odata/v4/core/annotation/Immutable.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.odata.v4.core.annotation; 2 | 3 | import static java.lang.annotation.ElementType.FIELD; 4 | 5 | import java.lang.annotation.Target; 6 | 7 | /** 8 | * OData core annotation Immutable
9 | * A value for this non-key property can be provided on insert and remains unchanged on update 10 | * @author Oliver Grande 11 | * 12 | */ 13 | @Target(FIELD) 14 | public @interface Immutable { 15 | boolean value() default true; 16 | } 17 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/query/JPAQueryCreationResult.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.query; 2 | 3 | import jakarta.persistence.Tuple; 4 | import jakarta.persistence.TypedQuery; 5 | 6 | import com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath; 7 | 8 | record JPAQueryCreationResult(TypedQuery query, SelectionPathInfo selection) { 9 | 10 | @Override 11 | public String toString() { 12 | return "JPAQueryCreationResult [query=" + query + ", selection=" + selection + "]"; 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/test/java/com/sap/olingo/jpa/metadata/core/edm/mapper/testobjects/WrongMember.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.testobjects; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmEnumeration; 4 | 5 | @EdmEnumeration(isFlags = true, converter = WrongMemberConverter.class) 6 | public enum WrongMember { 7 | Right(1), Wrong(-2); 8 | private final int value; 9 | 10 | private WrongMember(final int value) { 11 | this.value = value; 12 | } 13 | 14 | public int getValue() { 15 | return value; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/api/JPATopLevelEntity.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.api; 2 | 3 | import java.util.Optional; 4 | 5 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmQueryExtensionProvider; 6 | import com.sap.olingo.jpa.metadata.core.edm.mapper.exception.ODataJPAModelException; 7 | 8 | public interface JPATopLevelEntity extends JPAElement, JPAAnnotatable, JPAUserGroupRestrictable { 9 | public Optional> getQueryExtension() throws ODataJPAModelException; 10 | } 11 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/JoinPartnerRoleRelation.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import jakarta.persistence.EmbeddedId; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.Table; 6 | 7 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmIgnore; 8 | 9 | @EdmIgnore 10 | @Entity(name = "JoinPartnerRoleRelation") 11 | @Table(schema = "\"OLINGO\"", name = "\"JoinPartnerRoleRelation\"") 12 | 13 | public class JoinPartnerRoleRelation { 14 | @EmbeddedId 15 | private JoinPartnerRoleRelationKey key; 16 | } 17 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/src/main/java/com/sap/olingo/jpa/processor/cb/impl/SqlStringFunctions.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb.impl; 2 | 3 | enum SqlStringFunctions { 4 | 5 | LOWER("LOWER"), 6 | UPPER("UPPER"), 7 | TRIM("TRIM"), 8 | LENGTH("LENGTH"), 9 | SUBSTRING("SUBSTRING"), 10 | CONCAT("CONCAT"), 11 | LOCATE("LOCATE"); 12 | 13 | private final String keyWord; 14 | 15 | private SqlStringFunctions(final String keyWord) { 16 | this.keyWord = keyWord; 17 | } 18 | 19 | @Override 20 | public String toString() { 21 | return keyWord; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/processor/JPARequestProcessor.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.processor; 2 | 3 | import org.apache.olingo.commons.api.ex.ODataException; 4 | import org.apache.olingo.commons.api.format.ContentType; 5 | import org.apache.olingo.server.api.ODataRequest; 6 | import org.apache.olingo.server.api.ODataResponse; 7 | 8 | public interface JPARequestProcessor { 9 | 10 | public > void retrieveData(ODataRequest request, ODataResponse response, 11 | ContentType responseFormat) throws ODataException; 12 | } 13 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/query/JPANavigationPropertyInfoAccess.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.query; 2 | 3 | import java.util.List; 4 | 5 | import org.apache.olingo.server.api.uri.UriParameter; 6 | import org.apache.olingo.server.api.uri.UriResourcePartTyped; 7 | 8 | import com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAAssociationPath; 9 | 10 | public interface JPANavigationPropertyInfoAccess { 11 | 12 | JPAAssociationPath getAssociationPath(); 13 | 14 | UriResourcePartTyped getUriResource(); 15 | 16 | List getKeyPredicates(); 17 | 18 | } -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/query/EdmBindingTargetInfo.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.query; 2 | 3 | import java.util.List; 4 | 5 | import org.apache.olingo.commons.api.edm.EdmBindingTarget; 6 | import org.apache.olingo.server.api.uri.UriParameter; 7 | 8 | public interface EdmBindingTargetInfo { 9 | 10 | public EdmBindingTarget getEdmBindingTarget(); 11 | 12 | public List getKeyPredicates(); 13 | 14 | public String getName(); 15 | 16 | public String getNavigationPath(); 17 | 18 | public EdmBindingTarget getTargetEdmBindingTarget(); 19 | } 20 | -------------------------------------------------------------------------------- /jpa/odata-jpa-annotation/src/main/java/com/sap/olingo/jpa/metadata/core/edm/annotation/EdmAlias.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Inherited; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | /** 10 | * @author Oliver Grande 11 | * 12 | */ 13 | @Target({ ElementType.TYPE, ElementType.FIELD }) 14 | @Retention(value = RetentionPolicy.RUNTIME) 15 | @Inherited 16 | public @interface EdmAlias { 17 | String name(); 18 | } 19 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/test/java/com/sap/olingo/jpa/metadata/core/edm/mapper/testobjects/WrongType.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.testobjects; 2 | 3 | import java.math.BigDecimal; 4 | 5 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmEnumeration; 6 | 7 | @EdmEnumeration(converter = WrongTypeConverter.class) 8 | public enum WrongType { 9 | TEST(BigDecimal.valueOf(2L)); 10 | 11 | private BigDecimal value; 12 | 13 | private WrongType(BigDecimal value) { 14 | this.value = value; 15 | } 16 | 17 | public BigDecimal getValue() { 18 | return value; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/test/java/com/sap/olingo/jpa/processor/core/testobjects/FileAccess.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testobjects; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmEnumeration; 4 | 5 | @EdmEnumeration(isFlags = true, converter = FileAccessConverter.class) 6 | public enum FileAccess { 7 | Read((short) 1), Write((short) 2), Create((short) 4), Delete((short) 8); 8 | 9 | private final short value; 10 | 11 | private FileAccess(final short value) { 12 | this.value = value; 13 | } 14 | 15 | public short getValue() { 16 | return value; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /jpa/odata-jpa-odata-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/odata/v4/core/terms/ExampleProperties.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.odata.v4.core.terms; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.extension.vocabularies.PropertyAccess; 4 | 5 | public enum ExampleProperties implements PropertyAccess { 6 | DESCRIPTION("Description"), 7 | EXTERNAL_VALUE("ExternalValue"); 8 | 9 | private final String property; 10 | 11 | ExampleProperties(final String property) { 12 | this.property = property; 13 | } 14 | 15 | @Override 16 | public String property() { 17 | return property; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /jpa/odata-jpa-odata-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/odata/v4/core/terms/Terms.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.odata.v4.core.terms; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.extension.vocabularies.TermAccess; 4 | 5 | public enum Terms implements TermAccess { 6 | 7 | COMPUTED("Computed"), 8 | COMPUTED_DEFAULT_VALUE("ComputedDefaultValue"), 9 | IMMUTABLE("Immutable"), 10 | EXAMPLE("Example"); 11 | 12 | private final String term; 13 | 14 | Terms(final String term) { 15 | this.term = term; 16 | } 17 | 18 | @Override 19 | public String term() { 20 | return term; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/test/java/com/sap/olingo/jpa/processor/test/LocalDateTimeConverterTest.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.test; 2 | 3 | import java.time.LocalDateTime; 4 | import java.time.Month; 5 | import java.util.Date; 6 | 7 | import org.junit.jupiter.api.BeforeEach; 8 | 9 | import com.sap.olingo.jpa.processor.core.testmodel.LocalDateTimeConverter; 10 | 11 | final class LocalDateTimeConverterTest extends AbstractConverterTest { 12 | 13 | @BeforeEach 14 | void setup() { 15 | cut = new LocalDateTimeConverter(); 16 | exp = LocalDateTime.of(2020, Month.FEBRUARY, 29, 12, 0, 0); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/api/JPAODataPathInformation.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.api; 2 | 3 | import java.io.Serializable; 4 | 5 | import javax.annotation.Nullable; 6 | 7 | import org.apache.olingo.server.api.ODataRequest; 8 | 9 | public record JPAODataPathInformation(String baseUri, String oDataPath, @Nullable String queryPath, 10 | @Nullable String fragments) implements Serializable { 11 | 12 | public JPAODataPathInformation(final ODataRequest request) { 13 | this(request.getRawBaseUri(), request.getRawODataPath(), request.getRawQueryPath(), null); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/filter/JPAExpressionVisitor.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.filter; 2 | 3 | import jakarta.persistence.criteria.From; 4 | 5 | import org.apache.olingo.server.api.OData; 6 | import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitor; 7 | 8 | import com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAEntityType; 9 | 10 | public interface JPAExpressionVisitor extends ExpressionVisitor { 11 | 12 | public OData getOData(); 13 | 14 | public From getRoot(); 15 | 16 | public JPAEntityType getEntityType(); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/serializer/JPAValueSerializerResult.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.serializer; 2 | 3 | import java.io.InputStream; 4 | 5 | import org.apache.olingo.server.api.serializer.SerializerResult; 6 | 7 | final class JPAValueSerializerResult implements SerializerResult { 8 | /** 9 | * 10 | */ 11 | private final InputStream result; 12 | 13 | public JPAValueSerializerResult(final InputStream inputStream) { 14 | this.result = inputStream; 15 | } 16 | 17 | @Override 18 | public InputStream getContent() { 19 | return result; 20 | } 21 | } -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/api/JPAParameterFacet.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.api; 2 | 3 | import org.apache.olingo.commons.api.edm.FullQualifiedName; 4 | import org.apache.olingo.commons.api.edm.geo.SRID; 5 | 6 | import com.sap.olingo.jpa.metadata.core.edm.mapper.exception.ODataJPAModelException; 7 | 8 | public interface JPAParameterFacet { 9 | 10 | Integer getMaxLength(); 11 | 12 | Integer getPrecision(); 13 | 14 | Integer getScale(); 15 | 16 | SRID getSrid(); 17 | 18 | Class getType(); 19 | 20 | FullQualifiedName getTypeFQN() throws ODataJPAModelException; 21 | } -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/test/java/com/sap/olingo/jpa/processor/test/TimestampLongConverterTest.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.test; 2 | 3 | import java.sql.Timestamp; 4 | import java.time.LocalDateTime; 5 | import java.time.Month; 6 | 7 | import org.junit.jupiter.api.BeforeEach; 8 | 9 | import com.sap.olingo.jpa.processor.core.testmodel.TimestampLongConverter; 10 | 11 | final class TimestampLongConverterTest extends AbstractConverterTest { 12 | 13 | @BeforeEach 14 | void setup() { 15 | cut = new TimestampLongConverter(); 16 | exp = Timestamp.valueOf(LocalDateTime.of(2020, Month.FEBRUARY, 29, 12, 0, 0)); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/processor/JPAETagValidationResult.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.processor; 2 | 3 | import org.apache.olingo.commons.api.http.HttpStatusCode; 4 | 5 | enum JPAETagValidationResult { 6 | NOT_MODIFIED(HttpStatusCode.NOT_MODIFIED), 7 | SUCCESS(HttpStatusCode.OK), 8 | PRECONDITION_FAILED(HttpStatusCode.PRECONDITION_FAILED); 9 | 10 | private final HttpStatusCode statusCode; 11 | 12 | JPAETagValidationResult(final HttpStatusCode statusCode) { 13 | this.statusCode = statusCode; 14 | } 15 | 16 | HttpStatusCode getStatusCode() { 17 | return statusCode; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/serializer/JPAEntityCollectionExtension.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.serializer; 2 | 3 | import java.net.URI; 4 | import java.util.List; 5 | 6 | import org.apache.olingo.commons.api.data.Entity; 7 | 8 | public interface JPAEntityCollectionExtension extends Iterable { 9 | 10 | boolean hasResults(); 11 | 12 | Entity getFirstResult(); 13 | 14 | void setNext(final URI nextLink); 15 | 16 | URI getNext(); 17 | 18 | void setCount(final Integer count); 19 | 20 | Integer getCount(); 21 | 22 | List getEntities(); 23 | 24 | boolean hasSingleResult(); 25 | } -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/DetailSettings.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import jakarta.persistence.Column; 4 | import jakarta.persistence.Embeddable; 5 | 6 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmIgnore; 7 | 8 | @Embeddable 9 | public class DetailSettings { 10 | 11 | @Column(name = "\"Id\"") 12 | private Integer id; 13 | 14 | @Column(name = "\"Name\"", length = 255) 15 | private String name; 16 | 17 | @EdmIgnore 18 | @Column(name = "\"GeneralName\"", length = 255, insertable = true, updatable = false) 19 | private String generalName; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/api/JPADescriptionAttribute.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.api; 2 | 3 | import java.util.Map; 4 | 5 | public interface JPADescriptionAttribute extends JPAAttribute { 6 | 7 | public boolean isLocationJoin(); 8 | 9 | /** 10 | * @return Property of description entity that contains the text/description 11 | */ 12 | public JPAAttribute getDescriptionAttribute(); 13 | 14 | public JPAPath getLocaleFieldName(); 15 | 16 | public Map getFixedValueAssignment(); 17 | 18 | public JPAAssociationAttribute asAssociationAttribute(); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/errormodel/TeamWithTransientEmbeddableKey.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.errormodel; 2 | 3 | import jakarta.persistence.EmbeddedId; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.Table; 6 | 7 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmTransient; 8 | 9 | @Entity(name = "TeamWithTransientEmbeddableKey") 10 | @Table(schema = "\"OLINGO\"", name = "\"Team\"") 11 | public class TeamWithTransientEmbeddableKey { 12 | 13 | @EmbeddedId 14 | @EdmTransient(calculator = DummyPropertyCalculator.class) 15 | private CompoundKey key; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /jpa-archetype/odata-jpa-archetype-spring/src/main/resources/archetype-resources/src/main/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | logging: 2 | level: 3 | org: 4 | springframework: INFO 5 | com: 6 | sap: 7 | olingo: 8 | jpa: TRACE 9 | odata: 10 | jpa: 11 | punit_name: ${punit} 12 | root_packages: ${package} 13 | server: 14 | port: ${port} 15 | spring: 16 | datasource: 17 | url: jdbc:h2:mem:testdb;MODE=PostgreSQL 18 | driverClassName: org.h2.Driver 19 | username: sa 20 | password: '' 21 | flyway: 22 | enabled: true 23 | schemas: 24 | - ${schema} 25 | servlet: 26 | multipart: 27 | enabled: false 28 | -------------------------------------------------------------------------------- /jpa-archetype/odata-jpa-archetype-spring/src/main/resources/archetype-resources/src/test/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | logging: 2 | level: 3 | org: 4 | springframework: INFO 5 | com: 6 | sap: 7 | olingo: 8 | jpa: TRACE 9 | odata: 10 | jpa: 11 | punit_name: ${punit} 12 | root_packages: ${package} 13 | server: 14 | port: ${port} 15 | spring: 16 | datasource: 17 | url: jdbc:h2:mem:testdb;MODE=PostgreSQL 18 | driverClassName: org.h2.Driver 19 | username: sa 20 | password: '' 21 | flyway: 22 | enabled: true 23 | schemas: 24 | - ${schema} 25 | servlet: 26 | multipart: 27 | enabled: false 28 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/processor/JPAAbstractGetRequestProcessor.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.processor; 2 | 3 | import org.apache.olingo.commons.api.ex.ODataException; 4 | import org.apache.olingo.server.api.OData; 5 | 6 | import com.sap.olingo.jpa.processor.core.api.JPAODataRequestContextAccess; 7 | 8 | abstract class JPAAbstractGetRequestProcessor extends JPAAbstractRequestProcessor implements JPARequestProcessor { 9 | 10 | JPAAbstractGetRequestProcessor(final OData odata, final JPAODataRequestContextAccess requestContext) 11 | throws ODataException { 12 | super(odata, requestContext); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/test/java/com/sap/olingo/jpa/processor/core/util/matcher/EntitySerializerOptionsMatcher.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.util.matcher; 2 | 3 | import java.net.URI; 4 | 5 | import org.apache.olingo.server.api.serializer.EntitySerializerOptions; 6 | 7 | public class EntitySerializerOptionsMatcher extends SerializerOptionsMatcher { 8 | 9 | public EntitySerializerOptionsMatcher(final String pattern) { 10 | super(pattern); 11 | } 12 | 13 | @Override 14 | protected URI getService(final EntitySerializerOptions options) { 15 | return options.getContextURL().getServiceRoot(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /jpa/odata-jpa-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/core/edm/extension/vocabularies/AnnotationProvider.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.extension.vocabularies; 2 | 3 | import java.util.Collection; 4 | 5 | import javax.annotation.Nonnull; 6 | 7 | import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation; 8 | 9 | public interface AnnotationProvider { 10 | 11 | Collection getAnnotations(@Nonnull final Applicability appliesTo, 12 | @Nonnull ODataAnnotatable annotatable, @Nonnull JPAReferences references); 13 | 14 | void addReferences(@Nonnull ReferenceList references) throws ODataVocabularyReadException; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/test/java/com/sap/olingo/jpa/processor/core/testobjects/ClassWithOneKeyConstructor.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testobjects; 2 | 3 | import java.util.UUID; 4 | 5 | public class ClassWithOneKeyConstructor { 6 | private final UUID key; 7 | 8 | public ClassWithOneKeyConstructor(final String key) { 9 | this.key = UUID.fromString(key); 10 | } 11 | 12 | public ClassWithOneKeyConstructor(final UUID key) { 13 | this.key = key; 14 | } 15 | 16 | public ClassWithOneKeyConstructor(final byte[] key) { 17 | this.key = UUID.nameUUIDFromBytes(key); 18 | } 19 | 20 | public UUID getKey() { 21 | return key; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /jpa-archetype/odata-jpa-archetype-spring/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | jpa-archetype-spring 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/processor/JPAHttpHeaderHashMap.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.processor; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import com.sap.olingo.jpa.metadata.api.JPAHttpHeaderMap; 8 | 9 | class JPAHttpHeaderHashMap extends HashMap> implements JPAHttpHeaderMap { 10 | private static final long serialVersionUID = 7678027573813050132L; 11 | 12 | public JPAHttpHeaderHashMap(final Map> map) { 13 | super(map); 14 | } 15 | 16 | public JPAHttpHeaderHashMap() { 17 | super(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/test/java/com/sap/olingo/jpa/processor/core/util/matcher/ComplexSerializerOptionsMatcher.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.util.matcher; 2 | 3 | import java.net.URI; 4 | 5 | import org.apache.olingo.server.api.serializer.ComplexSerializerOptions; 6 | 7 | public class ComplexSerializerOptionsMatcher extends SerializerOptionsMatcher { 8 | 9 | public ComplexSerializerOptionsMatcher(final String pattern) { 10 | super(pattern); 11 | } 12 | 13 | @Override 14 | protected URI getService(final ComplexSerializerOptions options) { 15 | return options.getContextURL().getServiceRoot(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/CurrentUserQueryExtension.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import jakarta.persistence.criteria.CriteriaBuilder; 4 | import jakarta.persistence.criteria.Expression; 5 | import jakarta.persistence.criteria.From; 6 | 7 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmQueryExtensionProvider; 8 | 9 | public class CurrentUserQueryExtension implements EdmQueryExtensionProvider { 10 | 11 | @Override 12 | public Expression getFilterExtension(final CriteriaBuilder cb, final From from) { 13 | return cb.equal(from.get("iD"), "97"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/test/java/com/sap/olingo/jpa/processor/core/testobjects/ClassWithOneKeyAndEmptyConstructor.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testobjects; 2 | 3 | import java.util.UUID; 4 | 5 | public class ClassWithOneKeyAndEmptyConstructor { 6 | private final UUID key; 7 | 8 | public ClassWithOneKeyAndEmptyConstructor(final String key) { 9 | this.key = UUID.fromString(key); 10 | } 11 | 12 | public ClassWithOneKeyAndEmptyConstructor() { 13 | this.key = UUID.randomUUID(); 14 | } 15 | 16 | public ClassWithOneKeyAndEmptyConstructor(final UUID key) { 17 | this.key = key; 18 | } 19 | 20 | public UUID getKey() { 21 | return key; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/extension/IntermediateModelItemAccess.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.extension; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAElement; 4 | 5 | /** 6 | * @author Oliver Grande 7 | * 8 | */ 9 | public interface IntermediateModelItemAccess extends JPAElement { 10 | /** 11 | * Element shall be ignored for metadata generation. 12 | * @return 13 | */ 14 | boolean ignore(); 15 | 16 | /** 17 | * Enables to switch if a model item shall be ignored during runtime. 18 | * @param ignore 19 | */ 20 | void setIgnore(boolean ignore); 21 | 22 | } -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/filter/JPAInOperator.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.filter; 2 | 3 | import java.util.List; 4 | 5 | import jakarta.persistence.criteria.Expression; 6 | 7 | import org.apache.olingo.server.api.ODataApplicationException; 8 | import org.apache.olingo.server.api.uri.queryoption.expression.BinaryOperatorKind; 9 | 10 | public interface JPAInOperator extends JPAExpressionOperator { 11 | 12 | @SuppressWarnings("unchecked") 13 | @Override 14 | BinaryOperatorKind getOperator(); 15 | 16 | List getFixValues(); 17 | 18 | Expression getLeft() throws ODataApplicationException; 19 | } 20 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/test/java/com/sap/olingo/jpa/processor/core/util/matcher/PrimitiveSerializerOptionsMatcher.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.util.matcher; 2 | 3 | import java.net.URI; 4 | 5 | import org.apache.olingo.server.api.serializer.PrimitiveSerializerOptions; 6 | 7 | public class PrimitiveSerializerOptionsMatcher extends SerializerOptionsMatcher { 8 | 9 | public PrimitiveSerializerOptionsMatcher(final String pattern) { 10 | super(pattern); 11 | } 12 | 13 | @Override 14 | protected URI getService(final PrimitiveSerializerOptions options) { 15 | return options.getContextURL().getServiceRoot(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/processor/JPARequestParameterHashMap.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.processor; 2 | 3 | import java.util.HashMap; 4 | 5 | import com.sap.olingo.jpa.metadata.api.JPARequestParameterMap; 6 | 7 | public class JPARequestParameterHashMap extends HashMap implements JPARequestParameterMap { 8 | 9 | private static final long serialVersionUID = 1869470620805799005L; 10 | 11 | public JPARequestParameterHashMap(final JPARequestParameterMap requestParameter) { 12 | super(requestParameter); 13 | } 14 | 15 | public JPARequestParameterHashMap() { 16 | super(); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/StringConverter.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import jakarta.persistence.AttributeConverter; 4 | import jakarta.persistence.Converter; 5 | 6 | //This converter has to be mentioned at all columns it is applicable 7 | @Converter(autoApply = false) 8 | public class StringConverter implements AttributeConverter { 9 | 10 | @Override 11 | public String convertToDatabaseColumn(final String entityString) { 12 | return entityString; 13 | } 14 | 15 | @Override 16 | public String convertToEntityAttribute(final String dbString) { 17 | return dbString; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/test/java/com/sap/olingo/jpa/metadata/core/edm/mapper/testobjects/WrongTypeConverter.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.testobjects; 2 | 3 | import java.math.BigDecimal; 4 | 5 | import jakarta.persistence.AttributeConverter; 6 | 7 | public class WrongTypeConverter implements AttributeConverter { 8 | 9 | @Override 10 | public BigDecimal convertToDatabaseColumn(final WrongType[] attribute) { 11 | return WrongType.TEST.getValue(); 12 | } 13 | 14 | @Override 15 | public WrongType[] convertToEntityAttribute(final BigDecimal dbData) { 16 | return new WrongType[] { WrongType.TEST }; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /jpa/odata-jpa-odata-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/odata/v4/capabilities/terms/DeepInsertSupportProperties.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.odata.v4.capabilities.terms; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.extension.vocabularies.PropertyAccess; 4 | 5 | public enum DeepInsertSupportProperties implements PropertyAccess { 6 | 7 | SUPPORTED("supported"), 8 | CONTENT_ID_SUPPORTED("contentIDSupported"); 9 | 10 | private final String property; 11 | 12 | private DeepInsertSupportProperties(final String property) { 13 | this.property = property; 14 | } 15 | 16 | @Override 17 | public String property() { 18 | return property; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /jpa/odata-jpa-odata-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/odata/v4/capabilities/terms/DeepUpdateSupportProperties.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.odata.v4.capabilities.terms; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.extension.vocabularies.PropertyAccess; 4 | 5 | public enum DeepUpdateSupportProperties implements PropertyAccess { 6 | 7 | SUPPORTED("supported"), 8 | CONTENT_ID_SUPPORTED("contentIDSupported"); 9 | 10 | private final String property; 11 | 12 | private DeepUpdateSupportProperties(final String property) { 13 | this.property = property; 14 | } 15 | 16 | @Override 17 | public String property() { 18 | return property; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/src/test/java/com/sap/olingo/jpa/processor/cb/impl/AliasBuilderTest.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb.impl; 2 | 3 | import static org.junit.jupiter.api.Assertions.assertEquals; 4 | 5 | import org.junit.jupiter.api.BeforeEach; 6 | import org.junit.jupiter.api.Test; 7 | 8 | class AliasBuilderTest { 9 | private AliasBuilder cut; 10 | 11 | @BeforeEach 12 | void setup() { 13 | cut = new AliasBuilder(); 14 | } 15 | 16 | @Test 17 | void getFirstAlias() { 18 | assertEquals("E0", cut.getNext()); 19 | } 20 | 21 | @Test 22 | void getSecondAlias() { 23 | cut.getNext(); 24 | assertEquals("E1", cut.getNext()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/AccessRights.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmEnumeration; 4 | 5 | @EdmEnumeration(isFlags = true, converter = AccessRightsConverter.class) 6 | public enum AccessRights { 7 | READ((short) 1), WRITE((short) 2), CREATE((short) 4), DELETE((short) 8); 8 | 9 | private short value; 10 | 11 | private AccessRights(short value) { 12 | this.setValue(value); 13 | } 14 | 15 | public short getValue() { 16 | return value; 17 | } 18 | 19 | private void setValue(short value) { 20 | this.value = value; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/api/JPAElement.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.api; 2 | 3 | import org.apache.olingo.commons.api.edm.FullQualifiedName; 4 | 5 | public interface JPAElement { 6 | /** 7 | * Returns the full qualified name of an element 8 | * @return 9 | */ 10 | public FullQualifiedName getExternalFQN(); 11 | 12 | /** 13 | * Returns the element name published by the API 14 | * @return 15 | */ 16 | public String getExternalName(); 17 | 18 | /** 19 | * Returns the internally used (Java) name for an element 20 | * @return 21 | */ 22 | public String getInternalName(); 23 | } 24 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/SalesTeam.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import jakarta.persistence.Column; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.Table; 6 | 7 | @Entity(name = "SalesTeam") 8 | @Table(schema = "\"OLINGO\"", name = "\"SalesTeam\"") 9 | public class SalesTeam extends Group { 10 | 11 | @Column(name = "\"SalesArea\"") 12 | private String salesArea; 13 | 14 | @Override 15 | public boolean equals(final Object object) { 16 | return super.equals(object); 17 | } 18 | 19 | @Override 20 | public int hashCode() { 21 | return super.hashCode(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /jpa/odata-jpa-odata-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/odata/v4/capabilities/terms/UpdateMethod.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.sap.olingo.jpa.metadata.odata.v4.capabilities.terms; 5 | 6 | import org.apache.olingo.commons.api.http.HttpMethod; 7 | 8 | /** 9 | * @author Oliver Grande 10 | * Created: 29.04.2021 11 | * 12 | */ 13 | public enum UpdateMethod { 14 | PATCH(HttpMethod.PATCH), 15 | PUT(HttpMethod.PUT), 16 | NOT_SPECIFIED(null); 17 | 18 | private final HttpMethod value; 19 | 20 | /** 21 | * @param verb 22 | */ 23 | UpdateMethod(final HttpMethod verb) { 24 | this.value = verb; 25 | } 26 | 27 | public HttpMethod getValue() { 28 | return value; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/exception/ODataJPAIllegalArgumentException.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.exception; 2 | 3 | public class ODataJPAIllegalArgumentException extends RuntimeException { 4 | 5 | private static final long serialVersionUID = 8012137500100028346L; 6 | 7 | private final String[] params; 8 | 9 | public ODataJPAIllegalArgumentException(final Throwable cause) { 10 | super(cause); 11 | params = new String[0]; 12 | } 13 | 14 | public ODataJPAIllegalArgumentException(final String... params) { 15 | super(); 16 | this.params = params; 17 | } 18 | 19 | public String[] getParams() { 20 | return params; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/filter/JPALambdaAnyOperation.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.filter; 2 | 3 | import org.apache.olingo.server.api.uri.queryoption.expression.Member; 4 | 5 | final class JPALambdaAnyOperation extends JPALambdaOperation implements JPAExpressionOperator { 6 | 7 | JPALambdaAnyOperation(final JPAFilterComplierAccess jpaComplier, final Member member) { 8 | super(jpaComplier, member); 9 | } 10 | 11 | @SuppressWarnings("unchecked") 12 | @Override 13 | public Enum getOperator() { 14 | return null; 15 | } 16 | 17 | @Override 18 | public String getName() { 19 | return "ANY"; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/query/JPACountQuery.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.query; 2 | 3 | import org.apache.olingo.server.api.ODataApplicationException; 4 | 5 | public interface JPACountQuery { 6 | /** 7 | * Fulfill $count requests. For details see 8 | * OData Version 4.0 Part 1 - 11.2.5.5 System Query Option $count 11 | * @return 12 | * @throws ODataApplicationException 13 | */ 14 | Long countResults() throws ODataApplicationException; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/ByteConverter.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import jakarta.persistence.AttributeConverter; 4 | import jakarta.persistence.Converter; 5 | 6 | //This converter has to be mentioned at all columns it is applicable 7 | @Converter(autoApply = false) 8 | public class ByteConverter implements AttributeConverter { 9 | 10 | @Override 11 | public byte[] convertToDatabaseColumn(final String entityString) { 12 | return entityString.getBytes(); 13 | } 14 | 15 | @Override 16 | public String convertToEntityAttribute(final byte[] dbString) { 17 | return new String(dbString); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /jpa/odata-jpa-annotation/src/main/java/com/sap/olingo/jpa/metadata/core/edm/annotation/ValidatorStrength.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.annotation; 2 | 3 | /** 4 | * Strength of the entity tag (ETag) validator according to 5 | * RFC 7232 Section-2.1
6 | * In case DEFAULT is chosen, in case the attribute marked with {@link jakarta.persistence.Version} is seen as WEAK in 7 | * case it is of type {@link java.sql.Timestamp}, 8 | * otherwise as STRONG. 9 | * 10 | * @author Oliver Grande 11 | * @since 24.06.2024 12 | * @version 2.1.3 13 | */ 14 | public enum ValidatorStrength { 15 | 16 | DEFAULT, 17 | WEAK, 18 | STRONG; 19 | } 20 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/test/java/com/sap/olingo/jpa/metadata/core/edm/mapper/testobjects/FileAccess.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.testobjects; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmEnumeration; 4 | 5 | @EdmEnumeration(isFlags = true, converter = FileAccessConverter.class) 6 | public enum FileAccess { 7 | Read((short) 1), Write((short) 2), Create((short) 4), Delete((short) 8); 8 | 9 | private short value; 10 | 11 | private FileAccess(short value) { 12 | this.setValue(value); 13 | } 14 | 15 | public short getValue() { 16 | return value; 17 | } 18 | 19 | private void setValue(short value) { 20 | this.value = value; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/filter/JPAUnaryBooleanOperator.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.filter; 2 | 3 | import jakarta.persistence.criteria.Expression; 4 | 5 | import org.apache.olingo.server.api.ODataApplicationException; 6 | import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind; 7 | 8 | public interface JPAUnaryBooleanOperator extends JPAExpressionOperator { 9 | 10 | @Override 11 | public Expression get() throws ODataApplicationException; 12 | 13 | public Expression getLeft() throws ODataApplicationException; 14 | 15 | @SuppressWarnings("unchecked") 16 | @Override 17 | public UnaryOperatorKind getOperator(); 18 | 19 | } -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/RestrictedEntityUnrestrictedSource.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import java.util.UUID; 4 | 5 | import jakarta.persistence.Column; 6 | import jakarta.persistence.Embedded; 7 | import jakarta.persistence.Entity; 8 | import jakarta.persistence.Id; 9 | import jakarta.persistence.Table; 10 | 11 | @Entity(name = "RestrictedEntityUnrestrictedSource") 12 | @Table(schema = "\"OLINGO\"", name = "\"RestrictedEntityUnrestrictedSource\"") 13 | public class RestrictedEntityUnrestrictedSource { 14 | @Id 15 | @Column(name = "\"Id\"") 16 | private UUID id; 17 | 18 | @Embedded 19 | private RestrictedEntityComplex relation; 20 | } 21 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/converter/JPACollectionResult.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.converter; 2 | 3 | import java.util.Collection; 4 | 5 | import com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAAssociationPath; 6 | 7 | public interface JPACollectionResult extends JPAExpandResult { 8 | 9 | /** 10 | * Returns the result of a query for a collection property, which is either a list of attributes e.g. Integer for 11 | * primitive properties or a list of ComplexValues 12 | * @param key 13 | * @return 14 | */ 15 | public Collection getPropertyCollection(final String key); 16 | 17 | public JPAAssociationPath getAssociation(); 18 | } 19 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/LocaleEnumeration.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import java.util.Enumeration; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | import java.util.Locale; 7 | 8 | public class LocaleEnumeration implements Enumeration { // NOSONAR 9 | private final Iterator keys; 10 | 11 | public LocaleEnumeration(final List keySet) { 12 | keys = keySet.iterator(); 13 | } 14 | 15 | @Override 16 | public boolean hasMoreElements() { 17 | return keys.hasNext(); 18 | } 19 | 20 | @Override 21 | public Locale nextElement() { 22 | return keys.next(); 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/RestrictedEntityComplex.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import jakarta.persistence.CascadeType; 4 | import jakarta.persistence.Embeddable; 5 | import jakarta.persistence.FetchType; 6 | import jakarta.persistence.JoinColumn; 7 | import jakarta.persistence.ManyToOne; 8 | 9 | @Embeddable 10 | public class RestrictedEntityComplex { 11 | 12 | // @Column() 13 | 14 | @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH) 15 | @JoinColumn(name = "\"MemberId\"", referencedColumnName = "\"ParentId\"", insertable = false, updatable = false, 16 | nullable = true) 17 | private RestrictedEntity restricted; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build OData JPA Processor 2 | on: 3 | push: 4 | branches: 5 | - main 6 | pull_request: 7 | types: [opened, synchronize, reopened] 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | strategy: 12 | matrix: 13 | java-version: [ 17, 25 ] 14 | name: Build with Java ${{ matrix.java-version }} 15 | steps: 16 | - uses: actions/checkout@v6 17 | - name: Set up JDK ${{ matrix.java-version }} 18 | uses: actions/setup-java@v5 19 | with: 20 | java-version: ${{ matrix.java-version }} 21 | distribution: 'temurin' 22 | cache: maven 23 | - name: Build with Maven 24 | run: cd ./jpa && mvn clean install 25 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/api/JPAApiVersion.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.api; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | import jakarta.persistence.EntityManagerFactory; 6 | 7 | import com.sap.olingo.jpa.metadata.core.edm.mapper.impl.JPAApiVersionProvider.Builder; 8 | 9 | public interface JPAApiVersion { 10 | 11 | public static JPAApiVersionBuilder with() { 12 | return new Builder(); 13 | } 14 | 15 | public String getId(); 16 | 17 | public EntityManagerFactory getEntityManagerFactory(); 18 | 19 | public @Nonnull String[] getPackageNames(); 20 | 21 | public String getRequestMappingPath(); 22 | 23 | public JPAEdmMetadataPostProcessor getMetadataPostProcessor(); 24 | } 25 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/api/JPAJoinColumn.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.sap.olingo.jpa.metadata.api; 5 | 6 | /** 7 | * @author Oliver Grande 8 | * Created: 02.02.2020 9 | * 10 | */ 11 | public interface JPAJoinColumn { 12 | /** 13 | * Returns the name of the column of the target table. This can be different from the name given in the @JoinColumn 14 | * annotation. 15 | * @return 16 | */ 17 | String getReferencedColumnName(); 18 | 19 | /** 20 | * Returns the name of the column of the source table. This can be different from the name given in the @JoinColumn 21 | * annotation. 22 | * @return 23 | */ 24 | String getName(); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/test/java/com/sap/olingo/jpa/processor/core/util/matcher/EntityCollectionSerializerOptionsMatcher.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.util.matcher; 2 | 3 | import java.net.URI; 4 | 5 | import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions; 6 | 7 | public class EntityCollectionSerializerOptionsMatcher extends 8 | SerializerOptionsMatcher { 9 | 10 | public EntityCollectionSerializerOptionsMatcher(final String pattern) { 11 | super(pattern); 12 | } 13 | 14 | @Override 15 | protected URI getService(final EntityCollectionSerializerOptions options) { 16 | return options.getContextURL().getServiceRoot(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /jpa/odata-jpa-odata-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/odata/v4/capabilities/terms/ExpandRestrictionsProperties.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.odata.v4.capabilities.terms; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.extension.vocabularies.PropertyAccess; 4 | 5 | public enum ExpandRestrictionsProperties implements PropertyAccess { 6 | 7 | EXPANDABLE("Expandable"), 8 | NON_EXPANDABLE_PROPERTIES("NonExpandableProperties"), 9 | MAX_LEVELS("MaxLevels"); 10 | 11 | private final String property; 12 | 13 | private ExpandRestrictionsProperties(final String property) { 14 | this.property = property; 15 | } 16 | 17 | @Override 18 | public String property() { 19 | return property; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /jpa/odata-jpa-odata-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/odata/v4/capabilities/terms/FilterRestrictionsProperties.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.odata.v4.capabilities.terms; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.extension.vocabularies.PropertyAccess; 4 | 5 | public enum FilterRestrictionsProperties implements PropertyAccess { 6 | 7 | FILTERABLE("Filterable"), 8 | REQUIRES_FILTER("RequiresFilter"), 9 | REQUIRED_PROPERTIES("RequiredProperties"); 10 | 11 | private final String property; 12 | 13 | private FilterRestrictionsProperties(final String property) { 14 | this.property = property; 15 | } 16 | 17 | @Override 18 | public String property() { 19 | return property; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/test/java/com/sap/olingo/jpa/processor/core/util/TupleElementDouble.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.util; 2 | 3 | import jakarta.persistence.TupleElement; 4 | 5 | public class TupleElementDouble implements TupleElement { 6 | // alias 7 | private final String alias; 8 | private final Object value; 9 | 10 | public TupleElementDouble(final String alias, final Object value) { 11 | super(); 12 | this.alias = alias; 13 | this.value = value; 14 | } 15 | 16 | @Override 17 | public String getAlias() { 18 | return alias; 19 | } 20 | 21 | @Override 22 | public Class getJavaType() { 23 | return value.getClass(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/BooleanConverter.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import jakarta.persistence.AttributeConverter; 4 | import jakarta.persistence.Converter; 5 | 6 | @Converter 7 | public class BooleanConverter implements AttributeConverter { 8 | 9 | @Override 10 | public String convertToDatabaseColumn(final Boolean attribute) { 11 | if (attribute != null) 12 | return attribute.toString(); 13 | return null; 14 | } 15 | 16 | @Override 17 | public Boolean convertToEntityAttribute(final String dbData) { 18 | if (dbData != null) 19 | return Boolean.valueOf(dbData); 20 | return null;// NOSONAR 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/GroupNameCalculator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.sap.olingo.jpa.processor.core.testmodel; 5 | 6 | import jakarta.persistence.Tuple; 7 | 8 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmTransientPropertyCalculator; 9 | 10 | /** 11 | * @author Oliver Grande 12 | * Created: 17.03.2020 13 | * 14 | */ 15 | public class GroupNameCalculator implements EdmTransientPropertyCalculator { 16 | 17 | @Override 18 | public String calculateProperty(final Tuple row) { 19 | final String id = ((String) row.get("ID")); 20 | final String name = ((String) row.get("Name")); 21 | return id + " " + name; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/api/Cardinality.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.api; 2 | 3 | import static com.sap.olingo.jpa.metadata.core.edm.mapper.api.CardinalityValue.MANY; 4 | import static com.sap.olingo.jpa.metadata.core.edm.mapper.api.CardinalityValue.ONE; 5 | 6 | public enum Cardinality { 7 | 8 | MANY_TO_ONE(MANY, ONE), 9 | ONE_TO_ONE(ONE, ONE), 10 | MANY_TO_MANY(MANY, MANY), 11 | ONE_TO_MANY(ONE, MANY); 12 | 13 | public final CardinalityValue source; 14 | public final CardinalityValue target; 15 | 16 | private Cardinality(final CardinalityValue source, final CardinalityValue target) { 17 | this.source = source; 18 | this.target = target; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 4 | org.eclipse.jdt.core.compiler.compliance=17 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 7 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 8 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 9 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning 10 | org.eclipse.jdt.core.compiler.processAnnotations=disabled 11 | org.eclipse.jdt.core.compiler.release=disabled 12 | org.eclipse.jdt.core.compiler.source=17 13 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/test/java/com/sap/olingo/jpa/metadata/core/edm/mapper/testaction/function/Function.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.testaction.function; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmFunction; 4 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmFunction.ReturnType; 5 | import com.sap.olingo.jpa.metadata.core.edm.mapper.extension.ODataFunction; 6 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmParameter; 7 | 8 | public class Function implements ODataFunction { 9 | @EdmFunction(name = "", returnType = @ReturnType) 10 | public Integer sum( 11 | @EdmParameter(name = "A") short a, @EdmParameter(name = "B") int b) { 12 | return a + b; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/uri/JPATopOptionImpl.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.uri; 2 | 3 | import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind; 4 | import org.apache.olingo.server.api.uri.queryoption.TopOption; 5 | 6 | public record JPATopOptionImpl(int value) implements TopOption { 7 | 8 | @Override 9 | public SystemQueryOptionKind getKind() { 10 | return SystemQueryOptionKind.TOP; 11 | } 12 | 13 | @Override 14 | public String getName() { 15 | return null; 16 | } 17 | 18 | @Override 19 | public String getText() { 20 | return String.valueOf(value); 21 | } 22 | 23 | @Override 24 | public int getValue() { 25 | return value; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/test/java/com/sap/olingo/jpa/processor/core/testobjects/ClassWithIdClassConstructor.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testobjects; 2 | 3 | public class ClassWithIdClassConstructor { 4 | 5 | private final ClassWithMultipleKeysSetter key; 6 | 7 | public ClassWithIdClassConstructor(final ClassWithMultipleKeysSetter key) { 8 | this.key = key; 9 | } 10 | 11 | public ClassWithIdClassConstructor() { 12 | key = null; 13 | } 14 | 15 | public ClassWithIdClassConstructor(final String id1, final String id3, final Integer id2) { 16 | super(); 17 | this.key = new ClassWithMultipleKeysSetter(id1, id3, id2); 18 | } 19 | 20 | public ClassWithMultipleKeysSetter getKey() { 21 | return key; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/BestOrganization.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import jakarta.persistence.DiscriminatorValue; 4 | import jakarta.persistence.Entity; 5 | 6 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmEntityType; 7 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmTopLevelElementRepresentation; 8 | 9 | //Problem with multi-level inheritance hierarchy Inheritance Type SINGLE_TABLE. Therefore inherit also from 10 | //Business Partner 11 | @Entity(name = "BestOrganization") 12 | @DiscriminatorValue(value = "2") 13 | @EdmEntityType(as = EdmTopLevelElementRepresentation.AS_ENTITY_SET_ONLY) 14 | public class BestOrganization extends BusinessPartner {} 15 | -------------------------------------------------------------------------------- /jpa/odata-jpa-annotation/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 4 | org.eclipse.jdt.core.compiler.compliance=17 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 7 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 8 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 9 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning 10 | org.eclipse.jdt.core.compiler.processAnnotations=disabled 11 | org.eclipse.jdt.core.compiler.release=disabled 12 | org.eclipse.jdt.core.compiler.source=17 13 | -------------------------------------------------------------------------------- /jpa/odata-jpa-annotation/src/main/java/com/sap/olingo/jpa/metadata/core/edm/annotation/EdmProtections.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.annotation; 2 | 3 | import static java.lang.annotation.ElementType.FIELD; 4 | 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | /** 10 | * Allows to combine either multiple claims for a simple attribute, which will be combined with AND, 11 | * or to be able to protect multiple attributes at a complex attribute. 12 | * @author Oliver Grande 13 | * 14 | */ 15 | @Retention(RetentionPolicy.RUNTIME) 16 | @Target(FIELD) 17 | public @interface EdmProtections { 18 | public abstract EdmProtectedBy[] value(); 19 | } 20 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 4 | org.eclipse.jdt.core.compiler.compliance=17 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 7 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 8 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 9 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning 10 | org.eclipse.jdt.core.compiler.processAnnotations=disabled 11 | org.eclipse.jdt.core.compiler.release=disabled 12 | org.eclipse.jdt.core.compiler.source=17 13 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/uri/JPASkipOptionImpl.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.uri; 2 | 3 | import org.apache.olingo.server.api.uri.queryoption.SkipOption; 4 | import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind; 5 | 6 | public record JPASkipOptionImpl(int value) implements SkipOption { 7 | 8 | @Override 9 | public String getName() { 10 | return null; 11 | } 12 | 13 | @Override 14 | public String getText() { 15 | return String.valueOf(value); 16 | } 17 | 18 | @Override 19 | public int getValue() { 20 | return value; 21 | } 22 | 23 | @Override 24 | public SystemQueryOptionKind getKind() { 25 | return SystemQueryOptionKind.SKIP; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/util/TestDataConstants.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.util; 2 | 3 | public enum TestDataConstants { 4 | 5 | NO_ATTRIBUTES_POSTAL_ADDRESS(10), 6 | NO_ATTRIBUTES_POSTAL_ADDRESS_T(1), 7 | NO_ATTRIBUTES_COMMUNICATION_DATA(4), 8 | NO_ATTRIBUTES_CHANGE_INFO(2), 9 | NO_ATTRIBUTES_BUSINESS_PARTNER(6), 10 | NO_ATTRIBUTES_BUSINESS_PARTNER_T(1), 11 | NO_ATTRIBUTES_ORGANIZATION(4), 12 | NO_ATTRIBUTES_PERSON(2), 13 | NO_DEC_ATTRIBUTES_BUSINESS_PARTNER(9), 14 | NO_ENTITY_TYPES(46), 15 | NO_ENTITY_SETS(42), 16 | NO_SINGLETONS(3), 17 | NO_COMPLEX_TYPES(26); 18 | 19 | public final int value; 20 | 21 | TestDataConstants(final int i) { 22 | value = i; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /jpa-archetype/odata-jpa-archetype-spring/src/main/resources/archetype-resources/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | logging: 2 | level: 3 | org: 4 | springframework: INFO 5 | com: 6 | sap: 7 | olingo: 8 | jpa: TRACE 9 | odata: 10 | jpa: 11 | punit_name: ${punit} 12 | root_packages: ${package} 13 | server: 14 | port: ${port} 15 | spring: 16 | datasource: 17 | driver-class-name: org.hsqldb.jdbc.JDBCDriver 18 | password: '' 19 | url: jdbc:hsqldb:file:${punit};DB_CLOSE_DELAY=-1 20 | username: sa 21 | flyway: 22 | password: '' 23 | schemas: 24 | - ${schema} 25 | url: jdbc:hsqldb:file:${punit};DB_CLOSE_DELAY=-1 26 | user: sa 27 | servlet: 28 | multipart: 29 | enabled: false 30 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-parallel/src/main/java/com/sap/olingo/jpa/processor/core/api/JPAODataParallelBatchProcessorFactory.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.api; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | import com.sap.olingo.jpa.processor.core.processor.JPAODataParallelBatchProcessor; 6 | 7 | public class JPAODataParallelBatchProcessorFactory implements 8 | JPAODataBatchProcessorFactory { 9 | 10 | @Override 11 | public JPAODataParallelBatchProcessor getBatchProcessor(@Nonnull final JPAODataSessionContextAccess serviceContext, 12 | @Nonnull final JPAODataRequestContextAccess requestContext) { 13 | return new JPAODataParallelBatchProcessor(serviceContext, requestContext); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/serializer/JPAEntityCollection.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.serializer; 2 | 3 | import org.apache.olingo.commons.api.data.Entity; 4 | import org.apache.olingo.commons.api.data.EntityCollection; 5 | 6 | public class JPAEntityCollection extends EntityCollection implements JPAEntityCollectionExtension { 7 | 8 | @Override 9 | public boolean hasResults() { 10 | return !getEntities().isEmpty(); 11 | } 12 | 13 | @Override 14 | public Entity getFirstResult() { 15 | if (hasResults()) 16 | return getEntities().get(0); 17 | return null; 18 | } 19 | 20 | @Override 21 | public boolean hasSingleResult() { 22 | return getEntities().size() == 1; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/LauFilter.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import jakarta.persistence.criteria.CriteriaBuilder; 4 | import jakarta.persistence.criteria.Expression; 5 | import jakarta.persistence.criteria.From; 6 | 7 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmQueryExtensionProvider; 8 | 9 | public class LauFilter implements EdmQueryExtensionProvider { 10 | 11 | @Override 12 | public Expression getFilterExtension(final CriteriaBuilder cb, final From from) { 13 | 14 | return cb.and( 15 | cb.equal(from.get(AnnotationsParent.CODE_PUBLISHER), "Eurostat"), 16 | cb.like(from.get(AnnotationsParent.CODE_ID), "LAU%")); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/Membership.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import jakarta.persistence.Column; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.Id; 6 | import jakarta.persistence.IdClass; 7 | import jakarta.persistence.Table; 8 | 9 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmIgnore; 10 | 11 | @EdmIgnore 12 | @Entity 13 | @Table(schema = "\"OLINGO\"", name = "\"Membership\"") 14 | @IdClass(MembershipKey.class) 15 | public class Membership { 16 | @Id 17 | @Column(name = "\"PersonID\"", length = 32) 18 | private String personID; 19 | @Id 20 | @Column(name = "\"TeamID\"", length = 32) 21 | private String teamID; 22 | } 23 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/uri/JPASkipTokenOptionImpl.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.uri; 2 | 3 | import org.apache.olingo.server.api.uri.queryoption.SkipTokenOption; 4 | import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind; 5 | 6 | record JPASkipTokenOptionImpl(String skipToken) implements SkipTokenOption { 7 | 8 | @Override 9 | public SystemQueryOptionKind getKind() { 10 | return SystemQueryOptionKind.SKIPTOKEN; 11 | } 12 | 13 | @Override 14 | public String getName() { 15 | return null; 16 | } 17 | 18 | @Override 19 | public String getText() { 20 | return skipToken; 21 | } 22 | 23 | @Override 24 | public String getValue() { 25 | return skipToken; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /jpa/odata-jpa-spring-support/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | 6 | com.sap.olingo 7 | odata-jpa 8 | 2.4.1-SNAPSHOT 9 | 10 | 11 | odata-jpa-spring-support 12 | 13 | 14 | com.sap.hcp.cf.logging 15 | cf-java-logging-support-log4j2 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /.github/workflows/build-wo-cb.yml: -------------------------------------------------------------------------------- 1 | name: Build OData JPA Processor 2 | on: 3 | push: 4 | branches: 5 | - main 6 | pull_request: 7 | types: [opened, synchronize, reopened] 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | name: Build without criteria builder 12 | steps: 13 | - uses: actions/checkout@v6 14 | - name: Set up JDK to 17 15 | uses: actions/setup-java@v5 16 | with: 17 | java-version: 17 18 | distribution: 'temurin' 19 | cache: maven 20 | - name: 1. Build JPA 21 | run: cd ./jpa && mvn clean install -Dmaven.test.skip 22 | - name: 2. Build processor without criteria builder 23 | run: cd ./jpa && mvn --projects odata-jpa-processor -Pwo-extension clean install 24 | -------------------------------------------------------------------------------- /jpa/odata-jpa-odata-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/odata/v4/capabilities/terms/CountRestrictionsProperties.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.odata.v4.capabilities.terms; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.extension.vocabularies.PropertyAccess; 4 | 5 | public enum CountRestrictionsProperties implements PropertyAccess { 6 | 7 | COUNTABLE("Countable"), 8 | NON_COUNTABLE_PROPERTIES("NonCountableProperties"), 9 | NON_COUNTABLE_NAVIGATION_PROPERTIES("NonCountableNavigationProperties"); 10 | 11 | private final String property; 12 | 13 | private CountRestrictionsProperties(final String property) { 14 | this.property = property; 15 | } 16 | 17 | @Override 18 | public String property() { 19 | return property; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/errormodel/ChangeInformation.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.errormodel; 2 | 3 | import java.util.Date; 4 | 5 | import jakarta.persistence.Column; 6 | import jakarta.persistence.Embeddable; 7 | import jakarta.persistence.Temporal; 8 | import jakarta.persistence.TemporalType; 9 | 10 | @Embeddable 11 | public class ChangeInformation { 12 | 13 | @Column 14 | private String by; 15 | @Column(precision = 9) 16 | @Temporal(TemporalType.TIMESTAMP) 17 | private Date at; 18 | 19 | String user; 20 | 21 | public ChangeInformation() {} 22 | 23 | public ChangeInformation(final String by, final Date at) { 24 | super(); 25 | this.by = by; 26 | this.at = at; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/CurrentUser.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import jakarta.persistence.DiscriminatorValue; 4 | import jakarta.persistence.Entity; 5 | 6 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmEntityType; 7 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmTopLevelElementRepresentation; 8 | 9 | //Problem with multi-level inheritance hierarchy Inheritance Type SINGLE_TABLE. Therefore inherit also from 10 | //Business Partner 11 | @Entity(name = "CurrentUser") 12 | @DiscriminatorValue(value = "1") 13 | @EdmEntityType(as = EdmTopLevelElementRepresentation.AS_SINGLETON_ONLY, 14 | extensionProvider = CurrentUserQueryExtension.class) 15 | public class CurrentUser extends Person {} 16 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/query/JPAExtension.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.query; 2 | 3 | import com.sap.olingo.jpa.processor.core.converter.JPAExpandResult; 4 | 5 | public interface JPAExtension { 6 | /** 7 | * Process a expand query, which contains a $skip and/or a $top option.

8 | * This a tricky problem, as it can not be done easily with SQL. It could be that a database offers special solutions. 9 | * There is an worth reading blog regards this topic: 10 | * How to select 11 | * the first/least/max row per group in SQL 12 | * @return query result 13 | */ 14 | JPAExpandResult executeExpandTopSkipQuery(); 15 | } 16 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/EmptyQueryExtensionProvider.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import jakarta.persistence.criteria.CriteriaBuilder; 4 | import jakarta.persistence.criteria.Expression; 5 | import jakarta.persistence.criteria.From; 6 | 7 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmQueryExtensionProvider; 8 | 9 | /** 10 | * Empty implementation to check inheritance of query provider. 11 | * @author Oliver Grande 12 | * 13 | */ 14 | public class EmptyQueryExtensionProvider implements EdmQueryExtensionProvider { 15 | 16 | @Override 17 | public Expression getFilterExtension(final CriteriaBuilder cb, final From from) { 18 | return null; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/SupportRelationship.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import jakarta.persistence.Column; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.Id; 6 | import jakarta.persistence.Table; 7 | 8 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmIgnore; 9 | 10 | @EdmIgnore 11 | @Entity 12 | @Table(schema = "\"OLINGO\"", name = "\"SupportRelationship\"") 13 | public class SupportRelationship { 14 | @Id 15 | @Column(name = "\"ID\"") 16 | private Integer iD; 17 | 18 | @Column(name = "\"OrganizationID\"", length = 32) 19 | private String organizationID; 20 | 21 | @Column(name = "\"PersonID\"", length = 32) 22 | private String personID; 23 | } 24 | -------------------------------------------------------------------------------- /jpa-archetype/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | jpa-archetype 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.m2e.core.maven2Builder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.m2e.core.maven2Nature 16 | 17 | 18 | 19 | 1634102235489 20 | 21 | 30 22 | 23 | org.eclipse.core.resources.regexFilterMatcher 24 | node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/test/java/com/sap/olingo/jpa/processor/core/query/JPAExpandItemWrapperTest.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.query; 2 | 3 | import static org.mockito.Mockito.mock; 4 | 5 | import org.apache.olingo.server.api.uri.queryoption.ExpandItem; 6 | import org.junit.jupiter.api.BeforeEach; 7 | 8 | import com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAEntityType; 9 | 10 | class JPAExpandItemWrapperTest extends JPAExpandItemPageableTest { 11 | private JPAExpandItemWrapper cut; 12 | 13 | @BeforeEach 14 | void setup() { 15 | et = mock(JPAEntityType.class); 16 | expandItem = mock(ExpandItem.class); 17 | cut = new JPAExpandItemWrapper(expandItem, et); 18 | } 19 | 20 | @Override 21 | JPAExpandItemPageable getCut() { 22 | return cut; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/NestedComplexKey.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import java.util.Objects; 4 | 5 | import jakarta.persistence.Column; 6 | import jakarta.persistence.Id; 7 | 8 | public class NestedComplexKey { 9 | 10 | @Id 11 | @Column(name = "\"ID\"") 12 | private String iD; 13 | 14 | @Id 15 | @Column(name = "\"Number\"") 16 | private Long number; 17 | 18 | @Override 19 | public int hashCode() { 20 | return Objects.hash(iD, number); 21 | } 22 | 23 | @Override 24 | public boolean equals(final Object obj) { 25 | if (obj instanceof final NestedComplexKey other) 26 | return Objects.equals(iD, other.iD) && Objects.equals(number, other.number); 27 | return false; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /jpa-tutorial/.asciidoctorconfig.adoc: -------------------------------------------------------------------------------- 1 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 | // + Initial AsciiDoc editor configuration file - V1.0 + 3 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 | // 5 | // Did not find any configuration files, so creating this at project root level. 6 | // If you do not like those files to be generated - you can turn it off inside Asciidoctor Editor preferences. 7 | // 8 | // You can define editor specific parts here. 9 | // For example: with next line you could set imagesdir attribute to subfolder "images" relative to the folder where this config file is located. 10 | // :imagesdir: {asciidoctorconfigdir}/images 11 | // 12 | // For more information please take a look at https://github.com/de-jcup/eclipse-asciidoctor-editor/wiki/Asciidoctor-configfiles 13 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/test/java/com/sap/olingo/jpa/processor/core/query/TestNotImplemented.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.query; 2 | 3 | import java.io.IOException; 4 | 5 | import org.apache.olingo.commons.api.ex.ODataException; 6 | import org.junit.jupiter.api.Test; 7 | 8 | import com.sap.olingo.jpa.processor.core.util.IntegrationTestHelper; 9 | import com.sap.olingo.jpa.processor.core.util.TestBase; 10 | 11 | class TestNotImplemented extends TestBase { 12 | 13 | @Test 14 | void testApplyThrowsException() throws IOException, ODataException { 15 | 16 | final IntegrationTestHelper helper = new IntegrationTestHelper(emf, 17 | "AdministrativeDivisions?$apply=aggregate(Area with sum as TotalArea)"); 18 | helper.assertStatus(501); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/InheritanceByJoinLockedSavingAccount.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import jakarta.persistence.Column; 4 | import jakarta.persistence.DiscriminatorValue; 5 | import jakarta.persistence.Entity; 6 | import jakarta.persistence.PrimaryKeyJoinColumn; 7 | import jakarta.persistence.Table; 8 | 9 | @DiscriminatorValue("LockedSavingAccount") 10 | @Entity(name = "InheritanceLockedSavingAccount") 11 | @Table(schema = "\"OLINGO\"", name = "\"InheritanceByJoinLockedSavingAccount\"") 12 | @PrimaryKeyJoinColumn(name = "\"AccountId\"") 13 | public class InheritanceByJoinLockedSavingAccount extends InheritanceByJoinSavingAccount { 14 | 15 | @Column(name = "\"LockingPeriod\"") 16 | private int lockingPeriod; 17 | } 18 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/src/main/java/com/sap/olingo/jpa/processor/cb/impl/RootImpl.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb.impl; 2 | 3 | import jakarta.persistence.criteria.CriteriaBuilder; 4 | import jakarta.persistence.criteria.Root; 5 | import jakarta.persistence.metamodel.EntityType; 6 | 7 | import com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAEntityType; 8 | import com.sap.olingo.jpa.processor.cb.exceptions.NotImplementedException; 9 | 10 | class RootImpl extends FromImpl implements Root { 11 | 12 | RootImpl(final JPAEntityType type, final AliasBuilder aliasBuilder, final CriteriaBuilder cb) { 13 | super(type, aliasBuilder, cb); 14 | } 15 | 16 | @Override 17 | public EntityType getModel() { 18 | throw new NotImplementedException(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/test/java/com/sap/olingo/jpa/processor/core/api/JPAODataClaimProviderTest.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.api; 2 | 3 | import static org.junit.jupiter.api.Assertions.assertFalse; 4 | 5 | import java.util.List; 6 | import java.util.Optional; 7 | 8 | import org.junit.jupiter.api.Test; 9 | 10 | class JPAODataClaimProviderTest { 11 | 12 | @Test 13 | void testDefaultImplementationsReturnsEmpty() { 14 | final JPAODataClaimProvider cut = new DummyImpl(); 15 | final Optional act = cut.user(); 16 | assertFalse(act.isPresent()); 17 | } 18 | 19 | private static class DummyImpl implements JPAODataClaimProvider { 20 | 21 | @Override 22 | public List> get(final String attributeName) { 23 | return null; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/StreetPropertyCalculator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.sap.olingo.jpa.processor.core.testmodel; 5 | 6 | import jakarta.persistence.Tuple; 7 | 8 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmTransientPropertyCalculator; 9 | 10 | /** 11 | * @author Oliver Grande 12 | * Created: 17.03.2020 13 | * 14 | */ 15 | public class StreetPropertyCalculator implements EdmTransientPropertyCalculator { 16 | 17 | @Override 18 | public String calculateProperty(final Tuple row) { 19 | 20 | return new StringBuffer() 21 | .append(row.get("Address/StreetName")) 22 | .append(" ") 23 | .append(row.get("Address/HouseNumber")) 24 | .toString(); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /jpa/odata-jpa-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/core/edm/extension/vocabularies/ReferenceList.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.sap.olingo.jpa.metadata.core.edm.extension.vocabularies; 5 | 6 | import java.net.URI; 7 | 8 | import javax.annotation.Nonnull; 9 | 10 | /** 11 | * @author Oliver Grande 12 | * @since 1.1.1 13 | * 13.02.2023 14 | */ 15 | public interface ReferenceList { 16 | 17 | /** 18 | * @param uri URI of the vocabulary e.g. 19 | * "http://docs.oasisopen.org/odata/odata/v4.0/os/vocabularies/Org.OData.Capabilities.V1.xml" 20 | * @param sub-path the vocabulary is stored within a resource folder 21 | * @return 22 | */ 23 | ReferenceAccess addReference(@Nonnull final URI uri, @Nonnull final String path) 24 | throws ODataVocabularyReadException; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /jpa/odata-jpa-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/vocabularies/EdmxDataServices.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.vocabularies; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 7 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; 8 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | @JacksonXmlRootElement(localName = "DataServices", namespace = "edmx") 12 | public class EdmxDataServices { 13 | 14 | @JacksonXmlProperty(localName = "Schema") 15 | private Schema[] schemas; 16 | 17 | List getSchemas() { 18 | return Arrays.asList(schemas); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /jpa-archetype/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 4.0.0 5 | com.sap.olingo 6 | odata-jpa-archetype 7 | 2.4.1-SNAPSHOT 8 | pom 9 | https://github.com/SAP/olingo-jpa-processor-v4 10 | 11 | 12 | UTF-8 13 | 17 14 | 15 | 16 | 17 | odata-jpa-archetype-spring 18 | 19 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-parallel/README.md: -------------------------------------------------------------------------------- 1 | # Parallel Processing 2 | 3 | __This project is under construction! Feel free to try it.__ 4 | 5 | This project contains JPA Processor enhancements to process OData requests in parallel. As a first step GET requests that a combined in a $batch request are executed in parallel. The parallel processing is used if the corresponding factory is provided via the service context: 6 | 7 | ```java 8 | .setBatchProcessorFactory(new JPAODataParallelBatchProcessorFactory()) 9 | ``` 10 | 11 | It shall be mentioned that the OData specification would allow a parallel processing only if the clients sends a `continue-on-error` header, see: [Preference continue-on-error (odata.continue-on-error)](https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#_Toc31358874) 12 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/processor/ODATARequestContext.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.processor; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | import org.apache.olingo.server.api.uri.UriInfo; 6 | 7 | import com.sap.olingo.jpa.processor.core.exception.ODataJPAIllegalAccessException; 8 | import com.sap.olingo.jpa.processor.core.serializer.JPASerializer; 9 | 10 | interface ODATARequestContext { 11 | 12 | /** 13 | * 14 | * @param uriInfo 15 | * @throws ODataJPAIllegalAccessException In case UriInfo already exists e.g. because a page was provided 16 | */ 17 | void setUriInfo(@Nonnull final UriInfo uriInfo) throws ODataJPAIllegalAccessException; 18 | 19 | void setJPASerializer(@Nonnull final JPASerializer serializer); 20 | } 21 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/FullNameCalculator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.sap.olingo.jpa.processor.core.testmodel; 5 | 6 | import jakarta.persistence.Tuple; 7 | 8 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmTransientPropertyCalculator; 9 | 10 | /** 11 | * @author Oliver Grande 12 | * Created: 17.03.2020 13 | * 14 | */ 15 | public class FullNameCalculator implements EdmTransientPropertyCalculator { 16 | 17 | @Override 18 | public String calculateProperty(final Tuple row) { 19 | final Person dummyPerson = new Person(); 20 | dummyPerson.setFirstName((String) row.get("FirstName")); 21 | dummyPerson.setLastName((String) row.get("LastName")); 22 | return dummyPerson.getFullName(); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /jpa/odata-jpa-odata-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/odata/v4/capabilities/terms/SortRestrictionsProperties.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.odata.v4.capabilities.terms; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.extension.vocabularies.PropertyAccess; 4 | 5 | public enum SortRestrictionsProperties implements PropertyAccess { 6 | 7 | SORTABLE("Sortable"), 8 | ASCENDING_ONLY_PROPERTIES("AscendingOnlyProperties"), 9 | DESCENDING_ONLE_PROPERTIES("DescendingOnlyProperties"), 10 | NON_SORTABLE_PROPERTIES("NonSortableProperties"); 11 | 12 | private final String property; 13 | 14 | private SortRestrictionsProperties(final String property) { 15 | this.property = property; 16 | } 17 | 18 | @Override 19 | public String property() { 20 | return property; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/filter/JPAComparisonOperator.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.filter; 2 | 3 | import jakarta.persistence.criteria.Expression; 4 | 5 | import org.apache.olingo.server.api.ODataApplicationException; 6 | import org.apache.olingo.server.api.uri.queryoption.expression.BinaryOperatorKind; 7 | 8 | public interface JPAComparisonOperator> extends JPAExpressionOperator { 9 | 10 | Expression getLeft() throws ODataApplicationException; 11 | 12 | Object getRight(); 13 | 14 | Comparable getRightAsComparable() throws ODataApplicationException; 15 | 16 | Expression getRightAsExpression() throws ODataApplicationException; 17 | 18 | @SuppressWarnings("unchecked") 19 | @Override 20 | BinaryOperatorKind getOperator(); 21 | } -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/test/java/com/sap/olingo/jpa/metadata/core/edm/mapper/testobjects/ExampleJavaOneAction.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.testobjects; 2 | 3 | import java.math.BigDecimal; 4 | 5 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmAction; 6 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmParameter; 7 | import com.sap.olingo.jpa.metadata.core.edm.mapper.extension.ODataAction; 8 | import com.sap.olingo.jpa.processor.core.testmodel.Person; 9 | 10 | public class ExampleJavaOneAction implements ODataAction { 11 | 12 | @EdmAction(isBound = false) 13 | public void unbound( 14 | @EdmParameter(name = "Person") Person person, 15 | @EdmParameter(name = "A", precision = 34, scale = 10) BigDecimal a) { 16 | // Do nothing 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/serializer/JPAOperationSerializer.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.serializer; 2 | 3 | import org.apache.olingo.commons.api.data.Annotatable; 4 | import org.apache.olingo.commons.api.edm.EdmType; 5 | import org.apache.olingo.server.api.ODataRequest; 6 | import org.apache.olingo.server.api.serializer.SerializerException; 7 | import org.apache.olingo.server.api.serializer.SerializerResult; 8 | 9 | import com.sap.olingo.jpa.processor.core.exception.ODataJPASerializerException; 10 | 11 | public interface JPAOperationSerializer extends JPASerializer { 12 | public SerializerResult serialize(final Annotatable result, final EdmType entityType, final ODataRequest request) 13 | throws SerializerException, ODataJPASerializerException; 14 | } 15 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/uri/JPALevelsExpandOption.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.uri; 2 | 3 | import org.apache.olingo.server.api.uri.queryoption.LevelsExpandOption; 4 | 5 | class JPALevelsExpandOption implements LevelsExpandOption { 6 | 7 | private final boolean isMax; 8 | private int value = 0; 9 | 10 | JPALevelsExpandOption(final LevelsExpandOption levelsOption) { 11 | this.isMax = levelsOption.isMax(); 12 | this.value = levelsOption.getValue(); 13 | } 14 | 15 | @Override 16 | public boolean isMax() { 17 | return isMax; 18 | } 19 | 20 | @Override 21 | public int getValue() { 22 | return value; 23 | } 24 | 25 | LevelsExpandOption levelResolved() { 26 | if (value > 0) 27 | value -= 1; 28 | return this; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/InheritanceByJoinSavingAccount.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import java.math.BigDecimal; 4 | 5 | import jakarta.persistence.Column; 6 | import jakarta.persistence.DiscriminatorValue; 7 | import jakarta.persistence.Entity; 8 | import jakarta.persistence.PrimaryKeyJoinColumn; 9 | import jakarta.persistence.Table; 10 | 11 | @DiscriminatorValue("SavingAccount") 12 | @Entity(name = "InheritanceSavingAccount") 13 | @Table(schema = "\"OLINGO\"", name = "\"InheritanceByJoinSavingAccount\"") 14 | @PrimaryKeyJoinColumn(name = "\"ID\"") 15 | public class InheritanceByJoinSavingAccount extends InheritanceByJoinAccount { 16 | 17 | @Column(name = "\"InterestRate\"", precision = 5, scale = 2) 18 | private BigDecimal interestRate; 19 | } 20 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/processor/JPARequestLink.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.processor; 2 | 3 | import java.util.Map; 4 | 5 | import com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAEntityType; 6 | import com.sap.olingo.jpa.processor.core.exception.ODataJPAProcessorException; 7 | 8 | public interface JPARequestLink { 9 | /** 10 | * Provides an instance of the target entity metadata 11 | * @return 12 | */ 13 | public JPAEntityType getEntityType(); 14 | 15 | /** 16 | * Map of related keys 17 | * @return 18 | * @throws ODataJPAProcessorException 19 | */ 20 | public Map getRelatedKeys() throws ODataJPAProcessorException; 21 | 22 | public Map getValues() throws ODataJPAProcessorException; 23 | } 24 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/DummyEmbeddedToIgnore.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import java.sql.Blob; 4 | import java.sql.Clob; 5 | 6 | import jakarta.persistence.Basic; 7 | import jakarta.persistence.Column; 8 | import jakarta.persistence.Embeddable; 9 | import jakarta.persistence.FetchType; 10 | import jakarta.persistence.Lob; 11 | 12 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmIgnore; 13 | 14 | @EdmIgnore 15 | @Embeddable 16 | public class DummyEmbeddedToIgnore { 17 | 18 | @Lob 19 | @Column(name = "\"Command\"") 20 | @Basic(fetch = FetchType.LAZY) 21 | private Clob command; 22 | 23 | @Lob 24 | @Column(name = "\"LargeBytes\"") 25 | @Basic(fetch = FetchType.LAZY) 26 | private Blob largeBytes; 27 | } 28 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/JoinComplex.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import java.util.List; 4 | 5 | import jakarta.persistence.Column; 6 | import jakarta.persistence.Embeddable; 7 | import jakarta.persistence.JoinColumn; 8 | import jakarta.persistence.JoinTable; 9 | import jakarta.persistence.OneToMany; 10 | 11 | @Embeddable 12 | public class JoinComplex { 13 | 14 | @Column(name = "\"Number\"") 15 | private Long number; 16 | 17 | @OneToMany 18 | @JoinTable(name = "\"JoinRelation\"", schema = "\"OLINGO\"", 19 | joinColumns = @JoinColumn(name = "\"SourceID\"", referencedColumnName = "\"SourceKey\""), 20 | inverseJoinColumns = @JoinColumn(name = "\"TargetID\"")) 21 | private List oneToManyComplex; 22 | } 23 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/api/JPAInheritanceInformation.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.api; 2 | 3 | import java.util.List; 4 | 5 | import com.sap.olingo.jpa.metadata.core.edm.mapper.exception.ODataJPAModelException; 6 | 7 | /** 8 | * 9 | * 10 | * 11 | * 2025-10-21 12 | * 13 | */ 14 | public interface JPAInheritanceInformation { 15 | default JPAInheritanceType getInheritanceType() { 16 | return JPAInheritanceType.NON; 17 | } 18 | 19 | /** 20 | * 21 | * @return The join condition in case of inheritance by join 22 | * @throws ODataJPAModelException 23 | */ 24 | List getJoinColumnsList() throws ODataJPAModelException; 25 | 26 | List getReversedJoinColumnsList() throws ODataJPAModelException; 27 | } 28 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/test/java/com/sap/olingo/jpa/metadata/core/edm/mapper/testobjects/ConverterWithConstructorError.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.testobjects; 2 | 3 | import jakarta.persistence.AttributeConverter; 4 | 5 | public class ConverterWithConstructorError implements AttributeConverter[], Integer> { 6 | 7 | private final int counter; 8 | 9 | public ConverterWithConstructorError(final int counter) { 10 | super(); 11 | this.counter = counter; 12 | } 13 | 14 | @Override 15 | public Integer convertToDatabaseColumn(final Enum[] attribute) { 16 | return null; 17 | } 18 | 19 | @Override 20 | public Enum[] convertToEntityAttribute(final Integer dbData) { 21 | return null; 22 | } 23 | 24 | public int getCounter() { 25 | return counter; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /jpa/odata-jpa-odata-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/odata/v4/capabilities/terms/DeleteRestrictionsProperties.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.odata.v4.capabilities.terms; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.extension.vocabularies.PropertyAccess; 4 | 5 | public enum DeleteRestrictionsProperties implements PropertyAccess { 6 | 7 | DELETABLE("Deletable"), 8 | NON_DELETABLE_NAVIGATION_PROPERTIES("NonDeletableNavigationProperties"), 9 | MAX_LEVELS("MaxLevels"), 10 | DESCRIPTION("Description"), 11 | LONG_DESCRIPTION("LongDescription"); 12 | 13 | private final String property; 14 | 15 | private DeleteRestrictionsProperties(final String property) { 16 | this.property = property; 17 | } 18 | 19 | @Override 20 | public String property() { 21 | return property; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/exception/ODataJPAKeyPairException.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.exception; 2 | 3 | import static org.apache.olingo.commons.api.http.HttpStatusCode.INTERNAL_SERVER_ERROR; 4 | 5 | public class ODataJPAKeyPairException extends ODataJPAProcessException { 6 | 7 | private static final long serialVersionUID = 6006099025067551818L; 8 | private static final String BUNDLE_NAME = "processor-exceptions-i18n"; 9 | private static final String MESSAGE_KEY = "KEY_PAIR_CONVERSION_ERROR"; 10 | 11 | public ODataJPAKeyPairException(final Throwable cause, final String... params) { 12 | super(MESSAGE_KEY, INTERNAL_SERVER_ERROR, cause, params); 13 | } 14 | 15 | @Override 16 | protected String getBundleName() { 17 | return BUNDLE_NAME; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/errormodel/MissingCardinalityAnnotation.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.errormodel; 2 | 3 | import java.util.List; 4 | 5 | import jakarta.persistence.Column; 6 | import jakarta.persistence.Entity; 7 | import jakarta.persistence.Id; 8 | import jakarta.persistence.JoinColumn; 9 | import jakarta.persistence.JoinTable; 10 | 11 | @Entity() 12 | public class MissingCardinalityAnnotation { 13 | 14 | @Id 15 | @Column(name = "\"ID\"") 16 | protected String id; 17 | 18 | @JoinTable(name = "\"Membership\"", schema = "\"OLINGO\"", 19 | joinColumns = @JoinColumn(name = "\"PersonID\""), 20 | inverseJoinColumns = @JoinColumn(name = "\"TeamID\"")) 21 | private List teams; 22 | 23 | @JoinColumn(name = "\"TeamKey\"") 24 | private Team oneTeam; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/AssociationOneToOneTarget.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import jakarta.persistence.Column; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.FetchType; 6 | import jakarta.persistence.Id; 7 | import jakarta.persistence.OneToOne; 8 | import jakarta.persistence.Table; 9 | 10 | @Entity(name = "AssociationOneToOneTarget") 11 | @Table(schema = "\"OLINGO\"", name = "\"AssociationOneToOneTarget\"") 12 | public class AssociationOneToOneTarget { 13 | 14 | @Id 15 | @Column(name = "\"ID\"") 16 | protected String iD; 17 | 18 | @Column(name = "\"SOURCE\"") 19 | protected String source; 20 | 21 | @OneToOne(mappedBy = "defaultTarget", fetch = FetchType.LAZY) 22 | private AssociationOneToOneSource defaultSource; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/extension/IntermediateEntitySetAccess.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.extension; 2 | 3 | import java.util.List; 4 | 5 | import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation; 6 | 7 | import com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAElement; 8 | 9 | public interface IntermediateEntitySetAccess extends JPAElement { 10 | /** 11 | * Enables to add or overwrite annotations to an entity set, e.g. because the type of annotation is not enabled via 12 | * {@link com.sap.olingo.jpa.metadata.core.edm.annotation.EdmAnnotation EdmAnnotation} or they should be changed 13 | * during runtime. 14 | * @param annotations 15 | */ 16 | public void addAnnotations(final List annotations); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/errormodel/TeamWithTransientError.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.errormodel; 2 | 3 | import jakarta.persistence.Column; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.Id; 6 | import jakarta.persistence.Table; 7 | 8 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmTransient; 9 | 10 | @Entity(name = "TeamWithTransientError") 11 | @Table(schema = "\"OLINGO\"", name = "\"Team\"") 12 | public class TeamWithTransientError { 13 | 14 | @Id 15 | @Column(name = "\"TeamKey\"") 16 | private String iD; 17 | 18 | @Column(name = "\"Name\"") 19 | private String name; 20 | 21 | @EdmTransient(requiredAttributes = { "name", "unknown" }, calculator = DummyPropertyCalculator.class) 22 | private String completeName; 23 | } 24 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/UUIDToStringConverter.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import java.util.UUID; 4 | 5 | import jakarta.persistence.AttributeConverter; 6 | import jakarta.persistence.Converter; 7 | 8 | /** 9 | * Default converter to convert from {@link java.util.UUID} to a byte array. 10 | * 11 | * @author Oliver Grande 12 | */ 13 | @Converter(autoApply = false) 14 | public class UUIDToStringConverter implements AttributeConverter { 15 | 16 | @Override 17 | public String convertToDatabaseColumn(final UUID uuid) { 18 | return uuid == null ? null : uuid.toString(); 19 | } 20 | 21 | @Override 22 | public UUID convertToEntityAttribute(final String dbData) { 23 | return dbData == null ? null : UUID.fromString(dbData); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/errormodel/EmbeddedKeyPartOfGroup.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.sap.olingo.jpa.processor.core.errormodel; 5 | 6 | import jakarta.persistence.Column; 7 | import jakarta.persistence.EmbeddedId; 8 | import jakarta.persistence.Entity; 9 | import jakarta.persistence.Version; 10 | 11 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmVisibleFor; 12 | import com.sap.olingo.jpa.processor.core.testmodel.CountryKey; 13 | 14 | /** 15 | * @author Oliver Grande 16 | * Created: 29.06.2019 17 | * 18 | */ 19 | @Entity 20 | public class EmbeddedKeyPartOfGroup { 21 | 22 | @EdmVisibleFor("Person") 23 | @EmbeddedId 24 | private CountryKey key; 25 | 26 | @Version 27 | @Column(name = "\"ETag\"", nullable = false) 28 | protected long eTag; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/DateConverter.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import java.sql.Date; 4 | import java.time.LocalDate; 5 | 6 | import jakarta.persistence.AttributeConverter; 7 | import jakarta.persistence.Converter; 8 | 9 | //This converter has to be mentioned at all columns it is applicable 10 | @Converter(autoApply = false) 11 | public class DateConverter implements AttributeConverter { 12 | 13 | @Override 14 | public Date convertToDatabaseColumn(final LocalDate locDate) { 15 | return (locDate == null ? null : Date.valueOf(locDate)); 16 | } 17 | 18 | @Override 19 | public LocalDate convertToEntityAttribute(final Date sqlDate) { 20 | return (sqlDate == null ? null : sqlDate.toLocalDate()); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/api/JPAODataClaimProvider.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.api; 2 | 3 | import java.util.List; 4 | import java.util.Optional; 5 | 6 | import javax.annotation.Nonnull; 7 | 8 | /** 9 | * Container that provides claims 10 | * 11 | * @author Oliver Grande 12 | * Created: 30.06.2019 13 | * 14 | */ 15 | public interface JPAODataClaimProvider { 16 | /** 17 | * @param attributeName 18 | * @return Provides a list claim values for a given attribute. 19 | */ 20 | @Nonnull 21 | List> get(final String attributeName); // NOSONAR 22 | 23 | /** 24 | * 25 | * @return An optional that may contain the user id for the current request 26 | */ 27 | default Optional user() { 28 | return Optional.empty(); 29 | } 30 | } -------------------------------------------------------------------------------- /.github/workflows/archetype.yml: -------------------------------------------------------------------------------- 1 | name: Build Archetype 2 | on: 3 | push: 4 | branches: 5 | - main 6 | pull_request: 7 | types: [opened, synchronize, reopened] 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | strategy: 12 | matrix: 13 | java-version: [ 17 ] 14 | name: Archetype with Java ${{ matrix.java-version }} 15 | steps: 16 | - uses: actions/checkout@v6 17 | - name: Set up JDK ${{ matrix.java-version }} 18 | uses: actions/setup-java@v5 19 | with: 20 | java-version: ${{ matrix.java-version }} 21 | distribution: 'temurin' 22 | cache: maven 23 | - name: 1. Build JPA 24 | run: cd ./jpa && mvn clean install -Dmaven.test.skip 25 | - name: 2. Build and test archetype 26 | run: cd ./jpa-archetype && mvn clean install archetype:integration-test 27 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor-cb/src/test/java/com/sap/olingo/jpa/processor/cb/impl/SqlJoinTypeTest.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.cb.impl; 2 | 3 | import static org.junit.jupiter.api.Assertions.assertEquals; 4 | 5 | import jakarta.persistence.criteria.JoinType; 6 | 7 | import org.junit.jupiter.api.Test; 8 | 9 | class SqlJoinTypeTest { 10 | 11 | @Test 12 | void testGetJoinTypeReturnsValue() { 13 | assertEquals(JoinType.INNER, SqlJoinType.INNER.getJoinType()); 14 | assertEquals(JoinType.LEFT, SqlJoinType.LEFT.getJoinType()); 15 | assertEquals(JoinType.RIGHT, SqlJoinType.RIGHT.getJoinType()); 16 | } 17 | 18 | @Test 19 | void testByJoinType() { 20 | assertEquals(SqlJoinType.INNER, SqlJoinType.byJoinType(JoinType.INNER)); 21 | assertEquals(SqlJoinType.INNER, SqlJoinType.byJoinType(JoinType.INNER)); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/converter/JPARowConverter.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.converter; 2 | 3 | import java.util.Collection; 4 | import java.util.List; 5 | 6 | import jakarta.persistence.Tuple; 7 | 8 | import org.apache.olingo.commons.api.data.Entity; 9 | import org.apache.olingo.server.api.ODataApplicationException; 10 | 11 | import com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAEntityType; 12 | import com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath; 13 | import com.sap.olingo.jpa.processor.core.api.JPAODataPageExpandInfo; 14 | 15 | public interface JPARowConverter { 16 | 17 | Entity convertRow(JPAEntityType rowEntity, Tuple row, Collection requestedSelection, 18 | List expandInfo, JPAExpandResult jpaResult) throws ODataApplicationException; 19 | 20 | } -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/test/java/com/sap/olingo/jpa/metadata/core/edm/mapper/impl/ExampleJavaOneFunction.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.impl; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmFunction; 4 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmFunction.ReturnType; 5 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmParameter; 6 | import com.sap.olingo.jpa.metadata.core.edm.mapper.extension.ODataFunction; 7 | 8 | public class ExampleJavaOneFunction implements ODataFunction { 9 | 10 | public ExampleJavaOneFunction() { 11 | super(); 12 | } 13 | 14 | @EdmFunction(name = "", returnType = @ReturnType, hasFunctionImport = true) 15 | public Integer sum( 16 | @EdmParameter(name = "A") final short a, @EdmParameter(name = "B") final int b) { 17 | return a + b; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/exception/ODataJPANotImplementedException.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.exception; 2 | 3 | import static org.apache.olingo.commons.api.http.HttpStatusCode.NOT_IMPLEMENTED; 4 | 5 | /* 6 | * This exception is thrown when an exception occurs in a jpa pojo method 7 | */ 8 | public class ODataJPANotImplementedException extends ODataJPAProcessException { // NOSONAR 9 | 10 | private static final long serialVersionUID = 2410838419178517426L; 11 | private static final String BUNDLE_NAME = "processor-exceptions-i18n"; 12 | 13 | public ODataJPANotImplementedException(final String... params) { 14 | super(NOT_IMPLEMENTED.name(), NOT_IMPLEMENTED, params); 15 | } 16 | 17 | @Override 18 | protected String getBundleName() { 19 | return BUNDLE_NAME; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /jpa/odata-jpa-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/vocabularies/Member.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.vocabularies; 2 | 3 | import org.apache.olingo.commons.api.edm.provider.CsdlEnumMember; 4 | 5 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 6 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; 7 | 8 | @JsonIgnoreProperties(ignoreUnknown = true) 9 | public class Member extends CsdlEnumMember { 10 | 11 | @Override 12 | @JacksonXmlProperty(localName = "Name", isAttribute = true) 13 | public CsdlEnumMember setName(final String name) { 14 | return super.setName(name); 15 | } 16 | 17 | @Override 18 | @JacksonXmlProperty(localName = "Value", isAttribute = true) 19 | public CsdlEnumMember setValue(final String value) { 20 | return super.setValue(value); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/test/java/com/sap/olingo/jpa/metadata/core/edm/mapper/testobjects/ExampleJavaOneFunction.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.testobjects; 2 | 3 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmFunction; 4 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmFunction.ReturnType; 5 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmParameter; 6 | import com.sap.olingo.jpa.metadata.core.edm.mapper.extension.ODataFunction; 7 | 8 | public class ExampleJavaOneFunction implements ODataFunction { 9 | 10 | public ExampleJavaOneFunction() { 11 | super(); 12 | } 13 | 14 | @EdmFunction(returnType = @ReturnType, hasFunctionImport = true) 15 | public Integer sum( 16 | @EdmParameter(name = "A") final short a, @EdmParameter(name = "B") final int b) { 17 | return a + b; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/errormodel/TeamWithTransientCalculatorError.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.errormodel; 2 | 3 | import jakarta.persistence.Column; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.Id; 6 | import jakarta.persistence.Table; 7 | 8 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmTransient; 9 | 10 | @Entity(name = "TeamWithTransientCalculatorError") 11 | @Table(schema = "\"OLINGO\"", name = "\"Team\"") 12 | public class TeamWithTransientCalculatorError { 13 | 14 | @Id 15 | @Column(name = "\"TeamKey\"") 16 | private String iD; 17 | 18 | @Column(name = "\"Name\"") 19 | private String name; 20 | 21 | @EdmTransient(requiredAttributes = { "name" }, calculator = TransientPropertyCalculatorTwoConstructors.class) 22 | private String completeName; 23 | } 24 | -------------------------------------------------------------------------------- /jpa/odata-jpa-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/core/edm/extension/vocabularies/ReferenceAccess.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.sap.olingo.jpa.metadata.core.edm.extension.vocabularies; 5 | 6 | /** 7 | * @author Oliver Grande 8 | * @since 1.1.1 9 | * 13.02.2023 10 | */ 11 | public interface ReferenceAccess { 12 | 13 | /** 14 | * See: 3.4 17 | * Element edmx:Include 18 | * @param namespace Namespace of a schema defined in the referenced CSDL document to be included. The same namespace 19 | * MUST NOT be included more than once. 20 | * @param alias Alias for the given namespace. The alias must be unique. 21 | */ 22 | void addInclude(String namespace, String alias); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /jpa/odata-jpa-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/core/edm/extension/vocabularies/JPAReferences.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.extension.vocabularies; 2 | 3 | import java.util.List; 4 | import java.util.Optional; 5 | 6 | import javax.annotation.Nonnull; 7 | 8 | import org.apache.olingo.commons.api.edm.FullQualifiedName; 9 | import org.apache.olingo.commons.api.edm.provider.CsdlNamed; 10 | import org.apache.olingo.commons.api.edm.provider.CsdlTerm; 11 | 12 | public interface JPAReferences { 13 | 14 | public String convertAlias(@Nonnull final String alias); 15 | 16 | public Optional getTerm(@Nonnull final FullQualifiedName termName); 17 | 18 | public Optional getType(@Nonnull final FullQualifiedName fqn); 19 | 20 | public List getTerms(@Nonnull String schemaAlias, @Nonnull Applicability appliesTo); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /jpa/odata-jpa-metadata/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/extension/IntermediateNavigationPropertyAccess.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.extension; 2 | 3 | import java.util.List; 4 | 5 | import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation; 6 | import org.apache.olingo.commons.api.edm.provider.CsdlOnDelete; 7 | 8 | public interface IntermediateNavigationPropertyAccess extends IntermediateModelItemAccess { 9 | public void setOnDelete(CsdlOnDelete onDelete); 10 | 11 | /** 12 | * Enables to add annotations to a navigation property, e.g. because the type of annotation is not enabled via 13 | * {@link com.sap.olingo.jpa.metadata.core.edm.annotation.EdmAnnotation EdmAnnotation} or should be changed during 14 | * runtime 15 | * @param annotations 16 | */ 17 | public void addAnnotations(final List annotations); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/test/java/com/sap/olingo/jpa/processor/test/AbstractConverterTest.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.test; 2 | 3 | import static org.junit.jupiter.api.Assertions.assertEquals; 4 | import static org.junit.jupiter.api.Assertions.assertNull; 5 | 6 | import jakarta.persistence.AttributeConverter; 7 | 8 | import org.junit.jupiter.api.Test; 9 | 10 | abstract class AbstractConverterTest { 11 | protected AttributeConverter cut; 12 | protected E exp; 13 | 14 | @Test 15 | void testConversion() { 16 | assertEquals(exp, cut.convertToEntityAttribute(cut.convertToDatabaseColumn(exp))); 17 | } 18 | 19 | @Test 20 | void testToDatabaseReturnsNullOnNull() { 21 | assertNull(cut.convertToDatabaseColumn(null)); 22 | } 23 | 24 | @Test 25 | void testToEntityAttributeReturnsNullOnNull() { 26 | assertNull(cut.convertToEntityAttribute(null)); 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /jpa/odata-jpa-vocabularies/src/main/java/com/sap/olingo/jpa/metadata/core/edm/mapper/vocabularies/EdmxReferenceInclude.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.mapper.vocabularies; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; 5 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; 6 | 7 | @JsonIgnoreProperties(ignoreUnknown = true) 8 | @JacksonXmlRootElement(localName = "Reference", namespace = "edmx") 9 | public class EdmxReferenceInclude { 10 | 11 | @JacksonXmlProperty(localName = "Namespace") 12 | private String namespace; 13 | 14 | @JacksonXmlProperty(localName = "Alias") 15 | private String alias; 16 | 17 | public String getNamespace() { 18 | return namespace; 19 | } 20 | 21 | public String getAlias() { 22 | return alias; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /jpa/odata-jpa-processor/src/test/java/com/sap/olingo/jpa/processor/core/testobjects/HeaderParamTransientPropertyConverter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.sap.olingo.jpa.processor.core.testobjects; 5 | 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | import com.sap.olingo.jpa.metadata.api.JPAHttpHeaderMap; 10 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmTransientPropertyCalculator; 11 | 12 | /** 13 | * @author Oliver Grande 14 | * Created: 17.03.2020 15 | * 16 | */ 17 | public class HeaderParamTransientPropertyConverter implements EdmTransientPropertyCalculator { 18 | private final JPAHttpHeaderMap header; 19 | 20 | public HeaderParamTransientPropertyConverter(final JPAHttpHeaderMap header) { 21 | super(); 22 | this.header = header; 23 | } 24 | 25 | public Map> getHeader() { 26 | return header; 27 | } 28 | } -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/errormodel/TeamWithTransientCalculatorConstructorError.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.errormodel; 2 | 3 | import jakarta.persistence.Column; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.Id; 6 | import jakarta.persistence.Table; 7 | 8 | import com.sap.olingo.jpa.metadata.core.edm.annotation.EdmTransient; 9 | 10 | @Entity(name = "TeamWithTransientConstructorError") 11 | @Table(schema = "\"OLINGO\"", name = "\"Team\"") 12 | public class TeamWithTransientCalculatorConstructorError { 13 | 14 | @Id 15 | @Column(name = "\"TeamKey\"") 16 | private String iD; 17 | 18 | @Column(name = "\"Name\"") 19 | private String name; 20 | 21 | @EdmTransient(requiredAttributes = { "name" }, calculator = TransientPropertyCalculatorWrongConstructor.class) 22 | private String completeName; 23 | } 24 | -------------------------------------------------------------------------------- /jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/JoinTarget.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.processor.core.testmodel; 2 | 3 | import jakarta.persistence.Column; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.Id; 6 | import jakarta.persistence.JoinColumn; 7 | import jakarta.persistence.JoinTable; 8 | import jakarta.persistence.ManyToOne; 9 | import jakarta.persistence.Table; 10 | 11 | @Entity(name = "JoinTarget") 12 | @Table(schema = "\"OLINGO\"", name = "\"JoinTarget\"") 13 | public class JoinTarget { 14 | @Id 15 | @Column(name = "\"TargetKey\"") 16 | private Integer targetID; 17 | 18 | @ManyToOne() 19 | @JoinTable(name = "\"JoinRelation\"", schema = "\"OLINGO\"", 20 | joinColumns = @JoinColumn(name = "\"TargetID\""), 21 | inverseJoinColumns = @JoinColumn(name = "\"SourceID\"")) 22 | private JoinSource manyToOne; 23 | } 24 | -------------------------------------------------------------------------------- /jpa/odata-jpa-annotation/src/main/java/com/sap/olingo/jpa/metadata/core/edm/annotation/EdmMediaStream.java: -------------------------------------------------------------------------------- 1 | package com.sap.olingo.jpa.metadata.core.edm.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Marks an attribute as one that is a data stream. Two options are given to describe the content. Either static as 10 | * string (contentType) or dynamically in another attribute (contentTypeAttribute). Exactly on has to be given. 11 | * @author Oliver Grande 12 | * 13 | */ 14 | @Target({ ElementType.FIELD }) 15 | @Retention(value = RetentionPolicy.RUNTIME) 16 | public @interface EdmMediaStream { 17 | boolean stream() default true; 18 | 19 | String contentType() default ""; 20 | 21 | String contentTypeAttribute() default ""; 22 | } 23 | --------------------------------------------------------------------------------