本文整理汇总了Java中org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException类的典型用法代码示例。如果您正苦于以下问题:Java ODataJPAModelException类的具体用法?Java ODataJPAModelException怎么用?Java ODataJPAModelException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ODataJPAModelException类属于org.apache.olingo.odata2.jpa.processor.api.exception包,在下文中一共展示了ODataJPAModelException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: build
import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException; //导入依赖的package包/类
@Override
public JPQLContext build() throws ODataJPAModelException, ODataJPARuntimeException {
try {
setType(JPQLContextType.JOIN_SINGLE);
setJPAJoinClause(generateJoinClauses());
if (!jpaJoinClauses.isEmpty()) {
JPAJoinClause joinClause = jpaJoinClauses.get(jpaJoinClauses.size() - 1);
setJPAEntityName(joinClause.getEntityName());
setJPAEntityAlias(joinClause.getEntityRelationShipAlias());
}
setKeyPredicates(entityView.getKeyPredicates());
setSelectExpression(generateSelectExpression());
ODataExpressionParser.reInitializePositionalParameters();
} catch (EdmException e) {
throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL, e);
}
return JPQLJoinSelectSingleContext.this;
}
示例2: buildEdmFunctionImport
import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException; //导入依赖的package包/类
private FunctionImport buildEdmFunctionImport(final Method method,
final EdmFunctionImport edmAnnotationFunctionImport)
throws ODataJPAModelException {
if (edmAnnotationFunctionImport != null && edmAnnotationFunctionImport.returnType() != null) {
FunctionImport functionImport = new FunctionImport();
if ("".equals(edmAnnotationFunctionImport.name())) {
functionImport.setName(method.getName());
} else {
functionImport.setName(edmAnnotationFunctionImport.name());
}
JPAEdmMapping mapping = new JPAEdmMappingImpl();
((Mapping) mapping).setInternalName(method.getName());
mapping.setJPAType(method.getDeclaringClass());
functionImport.setMapping((Mapping) mapping);
functionImport.setHttpMethod(edmAnnotationFunctionImport.httpMethod().name().toString());
buildEdmReturnType(functionImport, method, edmAnnotationFunctionImport);
buildEdmParameter(functionImport, method);
return functionImport;
}
return null;
}
示例3: firstBuild
import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException; //导入依赖的package包/类
private void firstBuild() throws ODataJPAModelException, ODataJPARuntimeException {
firstBuild = false;
if (principalRoleView == null && dependentRoleView == null) {
principalRoleView =
new JPAEdmReferentialConstraintRole(RoleType.PRINCIPAL, entityTypeView, propertyView, associationView);
principalRoleView.getBuilder().build();
dependentRoleView =
new JPAEdmReferentialConstraintRole(RoleType.DEPENDENT, entityTypeView, propertyView, associationView);
dependentRoleView.getBuilder().build();
if (referentialConstraint == null) {
referentialConstraint = new ReferentialConstraint();
}
}
}
示例4: buildSimpleProperty
import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException; //导入依赖的package包/类
private SimpleProperty buildSimpleProperty(final Attribute<?, ?> jpaAttribute, final SimpleProperty simpleProperty,
final JoinColumn joinColumn)
throws ODataJPAModelException, ODataJPARuntimeException {
boolean isForeignKey = joinColumn != null;
JPAEdmNameBuilder.build(JPAEdmProperty.this, isBuildModeComplexType, skipDefaultNaming, isForeignKey);
EdmSimpleTypeKind simpleTypeKind = JPATypeConverter
.convertToEdmSimpleType(jpaAttribute
.getJavaType(), jpaAttribute);
simpleProperty.setType(simpleTypeKind);
Facets facets = JPAEdmFacets.createAndSet(jpaAttribute, simpleProperty);
if(isForeignKey) {
facets.setNullable(joinColumn.nullable());
}
return simpleProperty;
}
示例5: addForeignKey
import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException; //导入依赖的package包/类
private void addForeignKey(final Attribute<?, ?> jpaAttribute) throws ODataJPAModelException,
ODataJPARuntimeException {
AnnotatedElement annotatedElement = (AnnotatedElement) jpaAttribute.getJavaMember();
joinColumnNames = null;
if (annotatedElement == null) {
return;
}
JoinColumn joinColumn = annotatedElement.getAnnotation(JoinColumn.class);
if (joinColumn == null) {
JoinColumns joinColumns = annotatedElement.getAnnotation(JoinColumns.class);
if (joinColumns != null) {
for (JoinColumn jc : joinColumns.value()) {
buildForeignKey(jc, jpaAttribute);
}
}
} else {
buildForeignKey(joinColumn, jpaAttribute);
}
}
示例6: process
import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException; //导入依赖的package包/类
@Override
public Object process(DeleteUriInfo uriParserResultView, final String contentType)
throws ODataJPAModelException, ODataJPARuntimeException {
if (uriParserResultView instanceof DeleteUriInfo) {
if (((UriInfo) uriParserResultView).isLinks()) {
return deleteLink(uriParserResultView);
}
}
Object selectedObject = readEntity(new JPAQueryBuilder(oDataJPAContext).build(uriParserResultView));
if (selectedObject != null) {
try{
boolean isLocalTransaction = setTransaction();
em.remove(selectedObject);
em.flush();
if (isLocalTransaction) {
oDataJPAContext.getODataJPATransaction().commit();
}
} catch(PersistenceException e){
em.getTransaction().rollback();
throw ODataJPARuntimeException.throwException(
ODataJPARuntimeException.ERROR_JPQL_DELETE_REQUEST, e);
}
}
return selectedObject;
}
示例7: buildJPQLContext
import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException; //导入依赖的package包/类
private JPQLContext buildJPQLContext(JPQLContextType contextType, UriInfo uriParserResultView)
throws ODataJPAModelException, ODataJPARuntimeException {
JPQLContext jpqlContext = null;
if (pageSize > 0 && (contextType == JPQLContextType.SELECT || contextType == JPQLContextType.JOIN)) {
jpqlContext = JPQLContext.createBuilder(contextType, uriParserResultView, true).build();
} else {
jpqlContext = JPQLContext.createBuilder(contextType, uriParserResultView).build();
}
return jpqlContext;
}
示例8: build
import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException; //导入依赖的package包/类
@Override
public JPQLContext build() throws ODataJPAModelException, ODataJPARuntimeException {
if (entitySetView != null) {
try {
if (isCountOnly) {
setType(JPQLContextType.SELECT_COUNT);
} else {
setType(JPQLContextType.SELECT);
}
if (withPaging) {
isPagingRequested(withPaging);
}
EdmEntityType entityType = entitySetView.getTargetEntitySet().getEntityType();
EdmMapping mapping = entityType.getMapping();
if (mapping != null) {
setJPAEntityName(mapping.getInternalName());
} else {
setJPAEntityName(entityType.getName());
}
setJPAEntityAlias(generateJPAEntityAlias());
setOrderByCollection(generateOrderByFileds());
setSelectExpression(generateSelectExpression());
setWhereExpression(generateWhereExpression());
} catch (ODataException e) {
throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
}
}
return JPQLSelectContext.this;
}
示例9: build
import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException; //导入依赖的package包/类
@Override
public JPQLContext build() throws ODataJPAModelException, ODataJPARuntimeException {
try {
if (JPQLJoinSelectContext.this.isCountOnly) {
setType(JPQLContextType.JOIN_COUNT);
} else {
setType(JPQLContextType.JOIN);
}
if (withPaging) {
isPagingRequested(withPaging);
}
setJPAOuterJoinClause(generateJoinClauses());
if (!jpaJoinClauses.isEmpty()) {
JPAJoinClause joinClause = jpaJoinClauses.get(jpaJoinClauses.size() - 1);
setJPAEntityName(joinClause.getEntityName());
setJPAEntityAlias(joinClause.getEntityRelationShipAlias());
}
setOrderByCollection(generateOrderByFileds());
setSelectExpression(generateSelectExpression());
setWhereExpression(generateWhereExpression());
} catch (ODataException e) {
throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
}
return JPQLJoinSelectContext.this;
}
示例10: getSchemas
import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException; //导入依赖的package包/类
@Override
public List<Schema> getSchemas() throws ODataException {
if (schemas == null && jpaEdmModel != null) {
jpaEdmModel.getBuilder().build();
schemas = new ArrayList<Schema>();
schemas.add(jpaEdmModel.getEdmSchemaView().getEdmSchema());
}
if (jpaEdmModel == null) {
throw ODataJPAModelException.throwException(ODataJPAModelException.BUILDER_NULL, null);
}
return schemas;
}
示例11: buildFunctionImport
import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException; //导入依赖的package包/类
private FunctionImport buildFunctionImport(final Method method) throws ODataJPAModelException {
EdmFunctionImport edmAnnotationFunctionImport = method.getAnnotation(EdmFunctionImport.class);
if (edmAnnotationFunctionImport != null && edmAnnotationFunctionImport.returnType() != null) {
return buildEdmFunctionImport(method, edmAnnotationFunctionImport);
}
return null;
}
示例12: build
import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException; //导入依赖的package包/类
@Override
public void build() throws ODataJPAModelException, ODataJPARuntimeException {
if (firstBuild) {
firstBuild();
} else {
if (exists && !firstBuild && principalRoleView.isConsistent() == false) {
principalRoleView.getBuilder().build();
}
if (exists && !firstBuild && dependentRoleView.isConsistent() == false) {
dependentRoleView.getBuilder().build();
}
}
if (principalRoleView.isConsistent()) {
referentialConstraint.setPrincipal(principalRoleView.getEdmReferentialConstraintRole());
}
if (dependentRoleView.isConsistent()) {
referentialConstraint.setDependent(dependentRoleView.getEdmReferentialConstraintRole());
}
exists = principalRoleView.isExists() && dependentRoleView.isExists();
isConsistent = principalRoleView.isConsistent() && dependentRoleView.isConsistent();
}
示例13: build
import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException; //导入依赖的package包/类
@Override
public void build() throws ODataJPAModelException, ODataJPARuntimeException {
if (consistentEntitySetList == null) {
consistentEntitySetList = new ArrayList<EntitySet>();
}
entityTypeView = new JPAEdmEntityType(schemaView);
entityTypeView.getBuilder().build();
if (entityTypeView.isConsistent() && entityTypeView.getConsistentEdmEntityTypes() != null) {
String nameSpace = schemaView.getEdmSchema().getNamespace();
for (EntityType entityType : entityTypeView.getConsistentEdmEntityTypes()) {
currentEntitySet = new EntitySet();
currentEntitySet.setEntityType(new FullQualifiedName(nameSpace, entityType.getName()));
JPAEdmNameBuilder.build(JPAEdmEntitySet.this, entityTypeView);
consistentEntitySetList.add(currentEntitySet);
}
isConsistent = true;
} else {
isConsistent = false;
return;
}
}
示例14: build
import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException; //导入依赖的package包/类
@Override
public void build() throws ODataJPAModelException, ODataJPARuntimeException {
currentEntityContainer = new EntityContainer();
if (consistentEntityContainerList == null) {
currentEntityContainer.setDefaultEntityContainer(true);
consistentEntityContainerList = new ArrayList<EntityContainer>();
}
entitySetView = new JPAEdmEntitySet(schemaView);
entitySetView.getBuilder().build();
if (entitySetView.isConsistent()) {
currentEntityContainer.setEntitySets(entitySetView.getConsistentEdmEntitySetList());
} else {
isConsistent = false;
return;
}
if (!schemaView.getJPAEdmAssociationView().isConsistent()) {
schemaView.getJPAEdmAssociationView().getBuilder().build();
}
associationSetView = new JPAEdmAssociationSet(schemaView);
associationSetView.getBuilder().build();
if (associationSetView.isConsistent()) {
currentEntityContainer.setAssociationSets(associationSetView.getConsistentEdmAssociationSetList());
} else {
isConsistent = false;
return;
}
JPAEdmNameBuilder.build(JPAEdmEntityContainer.this);
consistentEntityContainerList.add(currentEntityContainer);
isConsistent = true;
}
示例15: build
import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException; //导入依赖的package包/类
@Override
public void build() throws ODataJPAModelException {
currentAssociationEnd1 = new AssociationEnd();
currentAssociationEnd2 = new AssociationEnd();
JPAEdmNameBuilder.build(JPAEdmAssociationEnd.this, entityTypeView, propertyView);
currentAssociationEnd1.setRole(currentAssociationEnd1.getType().getName());
if (currentAssociationEnd1.getType().getName().equals(currentAssociationEnd2.getType().getName())) {
currentAssociationEnd2.setRole(currentAssociationEnd2.getType().getName() + "2");
} else {
currentAssociationEnd2.setRole(currentAssociationEnd2.getType().getName());
}
setEdmMultiplicity(propertyView.getJPAAttribute().getPersistentAttributeType());
List<String[]> joinColumnNames = propertyView.getJPAJoinColumns();
if (joinColumnNames != null) {
int i = 0;
columnNames = (String[]) Array.newInstance(String.class, joinColumnNames.size());
referencedColumnNames = (String[]) Array.newInstance(String.class, joinColumnNames.size());
for (String[] jc : joinColumnNames) {
columnNames[i] = jc[0];
referencedColumnNames[i++] = jc[1];
}
}
ownerPropertyName = propertyView.getJPAAttribute().getName();
}