Author: adamw
Date: 2008-11-05 04:23:49 -0500 (Wed, 05 Nov 2008)
New Revision: 15519
Removed:
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/query/OneVersionsEntityQueryGenerator.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AggregatedFieldVersionsExpression.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/BetweenVersionsExpression.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/IdentifierEqVersionsExpression.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/InVersionsExpression.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/LogicalVersionsExpression.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/NotNullVersionsExpression.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/NotVersionsExpression.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/NullVersionsExpression.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/PropertyVersionsExpression.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/RelatedVersionsExpression.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/RevisionVersionsExpression.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/SimpleVersionsExpression.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/order/RevisionVersionsOrder.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/projection/RevisionVersionsProjection.java
Modified:
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/MetadataTools.java
Log:
HHH-3568: all audit entites are mapped with update="false"
Modified:
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/MetadataTools.java
===================================================================
---
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/MetadataTools.java 2008-11-05
09:17:10 UTC (rev 15518)
+++
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/MetadataTools.java 2008-11-05
09:23:49 UTC (rev 15519)
@@ -59,6 +59,7 @@
prop_mapping.addAttribute("name", name);
prop_mapping.addAttribute("insert", Boolean.toString(insertable));
+ prop_mapping.addAttribute("update", "false");
if (type != null) {
prop_mapping.addAttribute("type", type);
Deleted:
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/query/OneVersionsEntityQueryGenerator.java
===================================================================
---
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/query/OneVersionsEntityQueryGenerator.java 2008-11-05
09:17:10 UTC (rev 15518)
+++
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/query/OneVersionsEntityQueryGenerator.java 2008-11-05
09:23:49 UTC (rev 15519)
@@ -1,110 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.entities.mapper.relation.query;
-
-import java.util.Collections;
-
-import org.hibernate.envers.RevisionType;
-import org.hibernate.envers.configuration.GlobalConfiguration;
-import org.hibernate.envers.configuration.AuditEntitiesConfiguration;
-import org.hibernate.envers.entities.mapper.id.IdMapper;
-import org.hibernate.envers.entities.mapper.id.QueryParameterData;
-import org.hibernate.envers.entities.mapper.relation.MiddleIdData;
-import org.hibernate.envers.reader.AuditReaderImplementor;
-import org.hibernate.envers.tools.query.Parameters;
-import org.hibernate.envers.tools.query.QueryBuilder;
-
-import org.hibernate.Query;
-
-/**
- * Selects data from a versions entity.
- * @author Adam Warski (adam at warski dot org)
- */
-public final class OneVersionsEntityQueryGenerator implements RelationQueryGenerator {
- private final String queryString;
- private final MiddleIdData referencingIdData;
-
- public OneVersionsEntityQueryGenerator(GlobalConfiguration globalCfg,
AuditEntitiesConfiguration verEntCfg,
- MiddleIdData referencingIdData, String
referencedEntityName,
- IdMapper referencedIdMapper) {
- this.referencingIdData = referencingIdData;
-
- /*
- * The query that we need to create:
- * SELECT new list(e) FROM versionsReferencedEntity e
- * WHERE
- * (only entities referenced by the association; id_ref_ing = id of the
referencing entity)
- * e.id_ref_ing = :id_ref_ing AND
- * (selecting e entities at revision :revision)
- * e.revision = (SELECT max(e2.revision) FROM versionsReferencedEntity e2
- * WHERE e2.revision <= :revision AND e2.id = e.id) AND
- * (only non-deleted entities)
- * e.revision_type != DEL
- */
- String revisionPropertyPath = verEntCfg.getRevisionPropPath();
- String originalIdPropertyName = verEntCfg.getOriginalIdPropName();
-
- String versionsReferencedEntityName =
verEntCfg.getVersionsEntityName(referencedEntityName);
-
- // SELECT new list(e) FROM versionsEntity e
- QueryBuilder qb = new QueryBuilder(versionsReferencedEntityName, "e");
- qb.addProjection("new list", "e", false, false);
- // WHERE
- Parameters rootParameters = qb.getRootParameters();
- // e.id_ref_ed = :id_ref_ed
- referencingIdData.getPrefixedMapper().addNamedIdEqualsToQuery(rootParameters,
null, true);
-
- // SELECT max(e.revision) FROM versionsReferencedEntity e2
- QueryBuilder maxERevQb = qb.newSubQueryBuilder(versionsReferencedEntityName,
"e2");
- maxERevQb.addProjection("max", revisionPropertyPath, false);
- // WHERE
- Parameters maxERevQbParameters = maxERevQb.getRootParameters();
- // e2.revision <= :revision
- maxERevQbParameters.addWhereWithNamedParam(revisionPropertyPath,
"<=", "revision");
- // e2.id = e.id
- referencedIdMapper.addIdsEqualToQuery(maxERevQbParameters,
- "e." + originalIdPropertyName, "e2." +
originalIdPropertyName);
-
- // e.revision = (SELECT max(...) ...)
- rootParameters.addWhere(revisionPropertyPath, false,
globalCfg.getCorrelatedSubqueryOperator(), maxERevQb);
-
- // e.revision_type != DEL
- rootParameters.addWhereWithNamedParam(verEntCfg.getRevisionTypePropName(), false,
"!=", "delrevisiontype");
-
- StringBuilder sb = new StringBuilder();
- qb.build(sb, Collections.<String, Object>emptyMap());
- queryString = sb.toString();
- }
-
- public Query getQuery(AuditReaderImplementor versionsReader, Object primaryKey,
Number revision) {
- Query query = versionsReader.getSession().createQuery(queryString);
- query.setParameter("revision", revision);
- query.setParameter("delrevisiontype", RevisionType.DEL);
- for (QueryParameterData paramData:
referencingIdData.getPrefixedMapper().mapToQueryParametersFromId(primaryKey)) {
- paramData.setParameterValue(query);
- }
-
- return query;
- }
-}
\ No newline at end of file
Deleted:
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AggregatedFieldVersionsExpression.java
===================================================================
---
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AggregatedFieldVersionsExpression.java 2008-11-05
09:17:10 UTC (rev 15518)
+++
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AggregatedFieldVersionsExpression.java 2008-11-05
09:23:49 UTC (rev 15519)
@@ -1,82 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.query.criteria;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hibernate.envers.configuration.AuditConfiguration;
-import org.hibernate.envers.tools.query.Parameters;
-import org.hibernate.envers.tools.query.QueryBuilder;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class AggregatedFieldVersionsExpression implements AuditCriterion,
ExtendableCriterion {
- public static enum AggregatedMode {
- MAX,
- MIN
- }
-
- private String propertyName;
- private AggregatedMode mode;
- private List<AuditCriterion> criterions;
-
- public AggregatedFieldVersionsExpression(String propertyName, AggregatedMode mode) {
- this.propertyName = propertyName;
- this.mode = mode;
- criterions = new ArrayList<AuditCriterion>();
- }
-
- public AggregatedFieldVersionsExpression add(AuditCriterion criterion) {
- criterions.add(criterion);
- return this;
- }
-
- public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb,
Parameters parameters) {
- CriteriaTools.checkPropertyNotARelation(verCfg, entityName, propertyName);
-
- // This will be the aggregated query, containing all the specified conditions
- QueryBuilder subQb = qb.newSubQueryBuilder();
-
- // Adding all specified conditions both to the main query, as well as to the
- // aggregated one.
- for (AuditCriterion versionsCriteria : criterions) {
- versionsCriteria.addToQuery(verCfg, entityName, qb, parameters);
- versionsCriteria.addToQuery(verCfg, entityName, subQb,
subQb.getRootParameters());
- }
-
- // Setting the desired projection of the aggregated query
- switch (mode) {
- case MIN:
- subQb.addProjection("min", propertyName, false);
- break;
- case MAX:
- subQb.addProjection("max", propertyName, false);
- }
-
- // Adding the constrain on the result of the aggregated criteria
- parameters.addWhere(propertyName, "=", subQb);
- }
-}
\ No newline at end of file
Deleted:
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/BetweenVersionsExpression.java
===================================================================
---
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/BetweenVersionsExpression.java 2008-11-05
09:17:10 UTC (rev 15518)
+++
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/BetweenVersionsExpression.java 2008-11-05
09:23:49 UTC (rev 15519)
@@ -1,49 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.query.criteria;
-
-import org.hibernate.envers.configuration.AuditConfiguration;
-import org.hibernate.envers.tools.query.Parameters;
-import org.hibernate.envers.tools.query.QueryBuilder;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class BetweenVersionsExpression implements AuditCriterion {
- private String propertyName;
- private Object lo;
- private Object hi;
-
- public BetweenVersionsExpression(String propertyName, Object lo, Object hi) {
- this.propertyName = propertyName;
- this.lo = lo;
- this.hi = hi;
- }
-
- public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb,
Parameters parameters) {
- CriteriaTools.checkPropertyNotARelation(verCfg, entityName, propertyName);
- parameters.addWhereWithParam(propertyName, ">=", lo);
- parameters.addWhereWithParam(propertyName, "<=", hi);
- }
-}
Deleted:
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/IdentifierEqVersionsExpression.java
===================================================================
---
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/IdentifierEqVersionsExpression.java 2008-11-05
09:17:10 UTC (rev 15518)
+++
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/IdentifierEqVersionsExpression.java 2008-11-05
09:23:49 UTC (rev 15519)
@@ -1,44 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.query.criteria;
-
-import org.hibernate.envers.configuration.AuditConfiguration;
-import org.hibernate.envers.tools.query.Parameters;
-import org.hibernate.envers.tools.query.QueryBuilder;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class IdentifierEqVersionsExpression implements AuditCriterion {
- private Object id;
-
- public IdentifierEqVersionsExpression(Object id) {
- this.id = id;
- }
-
- public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb,
Parameters parameters) {
- verCfg.getEntCfg().get(entityName).getIdMapper()
- .addIdEqualsToQuery(parameters, id,
verCfg.getAuditEntCfg().getOriginalIdPropName(), true);
- }
-}
Deleted:
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/InVersionsExpression.java
===================================================================
---
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/InVersionsExpression.java 2008-11-05
09:17:10 UTC (rev 15518)
+++
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/InVersionsExpression.java 2008-11-05
09:23:49 UTC (rev 15519)
@@ -1,46 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.query.criteria;
-
-import org.hibernate.envers.configuration.AuditConfiguration;
-import org.hibernate.envers.tools.query.Parameters;
-import org.hibernate.envers.tools.query.QueryBuilder;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class InVersionsExpression implements AuditCriterion {
- private String propertyName;
- private Object[] values;
-
- public InVersionsExpression(String propertyName, Object[] values) {
- this.propertyName = propertyName;
- this.values = values;
- }
-
- public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb,
Parameters parameters) {
- CriteriaTools.checkPropertyNotARelation(verCfg, entityName, propertyName);
- parameters.addWhereWithParams(propertyName, "in (", values,
")");
- }
-}
Deleted:
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/LogicalVersionsExpression.java
===================================================================
---
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/LogicalVersionsExpression.java 2008-11-05
09:17:10 UTC (rev 15518)
+++
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/LogicalVersionsExpression.java 2008-11-05
09:23:49 UTC (rev 15519)
@@ -1,50 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.query.criteria;
-
-import org.hibernate.envers.configuration.AuditConfiguration;
-import org.hibernate.envers.tools.query.Parameters;
-import org.hibernate.envers.tools.query.QueryBuilder;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class LogicalVersionsExpression implements AuditCriterion {
- private AuditCriterion lhs;
- private AuditCriterion rhs;
- private String op;
-
- public LogicalVersionsExpression(AuditCriterion lhs, AuditCriterion rhs, String op)
{
- this.lhs = lhs;
- this.rhs = rhs;
- this.op = op;
- }
-
- public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb,
Parameters parameters) {
- Parameters opParameters = parameters.addSubParameters(op);
-
- lhs.addToQuery(verCfg, entityName, qb,
opParameters.addSubParameters("and"));
- rhs.addToQuery(verCfg, entityName, qb,
opParameters.addSubParameters("and"));
- }
-}
Deleted:
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/NotNullVersionsExpression.java
===================================================================
---
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/NotNullVersionsExpression.java 2008-11-05
09:17:10 UTC (rev 15518)
+++
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/NotNullVersionsExpression.java 2008-11-05
09:23:49 UTC (rev 15519)
@@ -1,50 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.query.criteria;
-
-import org.hibernate.envers.configuration.AuditConfiguration;
-import org.hibernate.envers.entities.RelationDescription;
-import org.hibernate.envers.tools.query.Parameters;
-import org.hibernate.envers.tools.query.QueryBuilder;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class NotNullVersionsExpression implements AuditCriterion {
- private String propertyName;
-
- public NotNullVersionsExpression(String propertyName) {
- this.propertyName = propertyName;
- }
-
- public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb,
Parameters parameters) {
- RelationDescription relatedEntity = CriteriaTools.getRelatedEntity(verCfg,
entityName, propertyName);
-
- if (relatedEntity == null) {
- parameters.addWhereWithParam(propertyName, "<>", null);
- } else {
- relatedEntity.getIdMapper().addIdEqualsToQuery(parameters, null,
propertyName, false);
- }
- }
-}
Deleted:
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/NotVersionsExpression.java
===================================================================
---
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/NotVersionsExpression.java 2008-11-05
09:17:10 UTC (rev 15518)
+++
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/NotVersionsExpression.java 2008-11-05
09:23:49 UTC (rev 15519)
@@ -1,43 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.query.criteria;
-
-import org.hibernate.envers.configuration.AuditConfiguration;
-import org.hibernate.envers.tools.query.Parameters;
-import org.hibernate.envers.tools.query.QueryBuilder;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class NotVersionsExpression implements AuditCriterion {
- private AuditCriterion criterion;
-
- public NotVersionsExpression(AuditCriterion criterion) {
- this.criterion = criterion;
- }
-
- public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb,
Parameters parameters) {
- criterion.addToQuery(verCfg, entityName, qb, parameters.addNegatedParameters());
- }
-}
Deleted:
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/NullVersionsExpression.java
===================================================================
---
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/NullVersionsExpression.java 2008-11-05
09:17:10 UTC (rev 15518)
+++
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/NullVersionsExpression.java 2008-11-05
09:23:49 UTC (rev 15519)
@@ -1,50 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.query.criteria;
-
-import org.hibernate.envers.configuration.AuditConfiguration;
-import org.hibernate.envers.entities.RelationDescription;
-import org.hibernate.envers.tools.query.Parameters;
-import org.hibernate.envers.tools.query.QueryBuilder;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class NullVersionsExpression implements AuditCriterion {
- private String propertyName;
-
- public NullVersionsExpression(String propertyName) {
- this.propertyName = propertyName;
- }
-
- public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb,
Parameters parameters) {
- RelationDescription relatedEntity = CriteriaTools.getRelatedEntity(verCfg,
entityName, propertyName);
-
- if (relatedEntity == null) {
- parameters.addWhereWithParam(propertyName, "=", null);
- } else {
- relatedEntity.getIdMapper().addIdEqualsToQuery(parameters, null,
propertyName, true);
- }
- }
-}
Deleted:
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/PropertyVersionsExpression.java
===================================================================
---
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/PropertyVersionsExpression.java 2008-11-05
09:17:10 UTC (rev 15518)
+++
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/PropertyVersionsExpression.java 2008-11-05
09:23:49 UTC (rev 15519)
@@ -1,49 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.query.criteria;
-
-import org.hibernate.envers.configuration.AuditConfiguration;
-import org.hibernate.envers.tools.query.Parameters;
-import org.hibernate.envers.tools.query.QueryBuilder;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class PropertyVersionsExpression implements AuditCriterion {
- private String propertyName;
- private String otherPropertyName;
- private String op;
-
- public PropertyVersionsExpression(String propertyName, String otherPropertyName,
String op) {
- this.propertyName = propertyName;
- this.otherPropertyName = otherPropertyName;
- this.op = op;
- }
-
- public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb,
Parameters parameters) {
- CriteriaTools.checkPropertyNotARelation(verCfg, entityName, propertyName);
- CriteriaTools.checkPropertyNotARelation(verCfg, entityName, otherPropertyName);
- parameters.addWhere(propertyName, op, otherPropertyName);
- }
-}
Deleted:
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/RelatedVersionsExpression.java
===================================================================
---
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/RelatedVersionsExpression.java 2008-11-05
09:17:10 UTC (rev 15518)
+++
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/RelatedVersionsExpression.java 2008-11-05
09:23:49 UTC (rev 15519)
@@ -1,56 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.query.criteria;
-
-import org.hibernate.envers.configuration.AuditConfiguration;
-import org.hibernate.envers.entities.RelationDescription;
-import org.hibernate.envers.exception.AuditException;
-import org.hibernate.envers.tools.query.Parameters;
-import org.hibernate.envers.tools.query.QueryBuilder;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class RelatedVersionsExpression implements AuditCriterion {
- private String propertyName;
- private Object id;
- private boolean equals;
-
- public RelatedVersionsExpression(String propertyName, Object id, boolean equals) {
- this.propertyName = propertyName;
- this.id = id;
- this.equals = equals;
- }
-
- public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb,
Parameters parameters) {
- RelationDescription relatedEntity = CriteriaTools.getRelatedEntity(verCfg,
entityName, propertyName);
-
- if (relatedEntity == null) {
- throw new AuditException("This criterion can only be used on a property
that is " +
- "a relation to another property.");
- } else {
- relatedEntity.getIdMapper().addIdEqualsToQuery(parameters, id, propertyName,
equals);
- }
- }
-}
\ No newline at end of file
Deleted:
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/RevisionVersionsExpression.java
===================================================================
---
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/RevisionVersionsExpression.java 2008-11-05
09:17:10 UTC (rev 15518)
+++
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/RevisionVersionsExpression.java 2008-11-05
09:23:49 UTC (rev 15519)
@@ -1,45 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.query.criteria;
-
-import org.hibernate.envers.configuration.AuditConfiguration;
-import org.hibernate.envers.tools.query.Parameters;
-import org.hibernate.envers.tools.query.QueryBuilder;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class RevisionVersionsExpression implements AuditCriterion {
- private Object value;
- private String op;
-
- public RevisionVersionsExpression(Object value, String op) {
- this.value = value;
- this.op = op;
- }
-
- public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb,
Parameters parameters) {
- parameters.addWhereWithParam(verCfg.getAuditEntCfg().getRevisionPropPath(), op,
value);
- }
-}
\ No newline at end of file
Deleted:
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/SimpleVersionsExpression.java
===================================================================
---
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/SimpleVersionsExpression.java 2008-11-05
09:17:10 UTC (rev 15518)
+++
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/SimpleVersionsExpression.java 2008-11-05
09:23:49 UTC (rev 15519)
@@ -1,62 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.query.criteria;
-
-import org.hibernate.envers.configuration.AuditConfiguration;
-import org.hibernate.envers.entities.RelationDescription;
-import org.hibernate.envers.exception.AuditException;
-import org.hibernate.envers.tools.query.Parameters;
-import org.hibernate.envers.tools.query.QueryBuilder;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class SimpleVersionsExpression implements AuditCriterion {
- private String propertyName;
- private Object value;
- private String op;
-
- public SimpleVersionsExpression(String propertyName, Object value, String op) {
- this.propertyName = propertyName;
- this.value = value;
- this.op = op;
- }
-
- public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb,
Parameters parameters) {
- RelationDescription relatedEntity = CriteriaTools.getRelatedEntity(verCfg,
entityName, propertyName);
-
- if (relatedEntity == null) {
- parameters.addWhereWithParam(propertyName, op, value);
- } else {
- if (!"=".equals(op) && !"<>".equals(op)) {
- throw new AuditException("This type of operation: " + op +
" (" + entityName + "." + propertyName +
- ") isn't supported and can't be used in
queries.");
- }
-
- Object id = relatedEntity.getIdMapper().mapToIdFromEntity(value);
-
- relatedEntity.getIdMapper().addIdEqualsToQuery(parameters, id, propertyName,
"=".equals(op));
- }
- }
-}
Deleted:
core/trunk/envers/src/main/java/org/hibernate/envers/query/order/RevisionVersionsOrder.java
===================================================================
---
core/trunk/envers/src/main/java/org/hibernate/envers/query/order/RevisionVersionsOrder.java 2008-11-05
09:17:10 UTC (rev 15518)
+++
core/trunk/envers/src/main/java/org/hibernate/envers/query/order/RevisionVersionsOrder.java 2008-11-05
09:23:49 UTC (rev 15519)
@@ -1,43 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.query.order;
-
-import org.hibernate.envers.configuration.AuditConfiguration;
-import org.hibernate.envers.tools.Pair;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class RevisionVersionsOrder implements AuditOrder {
- private final boolean asc;
-
- public RevisionVersionsOrder(boolean asc) {
- this.asc = asc;
- }
-
- public Pair<String, Boolean> getData(AuditConfiguration verCfg) {
- String revisionPropPath = verCfg.getAuditEntCfg().getRevisionPropPath();
- return Pair.make(revisionPropPath, asc);
- }
-}
Deleted:
core/trunk/envers/src/main/java/org/hibernate/envers/query/projection/RevisionVersionsProjection.java
===================================================================
---
core/trunk/envers/src/main/java/org/hibernate/envers/query/projection/RevisionVersionsProjection.java 2008-11-05
09:17:10 UTC (rev 15518)
+++
core/trunk/envers/src/main/java/org/hibernate/envers/query/projection/RevisionVersionsProjection.java 2008-11-05
09:23:49 UTC (rev 15519)
@@ -1,60 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.query.projection;
-
-import org.hibernate.envers.configuration.AuditConfiguration;
-import org.hibernate.envers.tools.Triple;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class RevisionVersionsProjection implements AuditProjection {
- public static enum ProjectionType {
- MAX,
- MIN,
- COUNT,
- COUNT_DISTINCT,
- DISTINCT
- }
-
- private final ProjectionType type;
-
- public RevisionVersionsProjection(ProjectionType type) {
- this.type = type;
- }
-
- public Triple<String, String, Boolean> getData(AuditConfiguration verCfg) {
- String revisionPropPath = verCfg.getAuditEntCfg().getRevisionPropPath();
-
- switch (type) {
- case MAX: return Triple.make("max", revisionPropPath, false);
- case MIN: return Triple.make("min", revisionPropPath, false);
- case COUNT: return Triple.make("count", revisionPropPath, false);
- case COUNT_DISTINCT: return Triple.make("count", revisionPropPath,
true);
- case DISTINCT: return Triple.make(null, revisionPropPath, true);
- }
-
- throw new IllegalArgumentException("Unknown type " + type +
".");
- }
-}