Author: tchemit Date: 2013-11-22 21:45:02 +0100 (Fri, 22 Nov 2013) New Revision: 2889 Url: http://nuiton.org/projects/topia/repository/revisions/2889 Log: refs #2923: Drop all deprecated code (me first\!) Removed: trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaRuntimeException.java trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/EntityFilter.java trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFilter.java trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/ trunk/topia-persistence/src/main/resources/META-INF/services/ Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaException.java trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaException.java =================================================================== --- trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaException.java 2013-11-22 20:28:56 UTC (rev 2888) +++ trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaException.java 2013-11-22 20:45:02 UTC (rev 2889) @@ -33,7 +33,7 @@ * @author poussin <poussin@codelutin.com> * @version $Id$ */ -public class TopiaException extends TopiaRuntimeException { +public class TopiaException extends RuntimeException { /** Version UID */ private static final long serialVersionUID = -1251439453383121393L; Deleted: trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaRuntimeException.java =================================================================== --- trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaRuntimeException.java 2013-11-22 20:28:56 UTC (rev 2888) +++ trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaRuntimeException.java 2013-11-22 20:45:02 UTC (rev 2889) @@ -1,75 +0,0 @@ -/* - * #%L - * ToPIA :: Persistence - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2004 - 2010 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * 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 General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * #L% - */ - -package org.nuiton.topia; - -/** - * TODO bleny 03072013 remove this class and use TopiaException everywhere - * - * @author chatellier <chatellier@codelutin.com> - * @version $Id$ - * @deprecated since 3.0, to be replaced by TopiaException - */ -public class TopiaRuntimeException extends RuntimeException { - - /** Version UID */ - private static final long serialVersionUID = 4706337137948838375L; - - /** - * Default constructor. - */ - public TopiaRuntimeException() { - } - - /** - * Constructor with {@code message}. - * - * @param message exception message - */ - public TopiaRuntimeException(String message) { - super(message); - } - - /** - * Constructor for a wrapped TopiaRuntimeException over a {@code cause} - * with a {@code message}. - * - * @param message exception message - * @param cause exception cause - */ - public TopiaRuntimeException(String message, Throwable cause) { - super(message, cause); - } - - /** - * Constructor for a wrapped TopiaRuntimeException over a {@code cause}. - * - * @param cause exception cause - */ - public TopiaRuntimeException(Throwable cause) { - super(cause); - } - -} Deleted: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/EntityFilter.java =================================================================== --- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/EntityFilter.java 2013-11-22 20:28:56 UTC (rev 2888) +++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/EntityFilter.java 2013-11-22 20:45:02 UTC (rev 2889) @@ -1,172 +0,0 @@ -/* - * #%L - * ToPIA :: Persistence - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2004 - 2010 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * 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 General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * #L% - */ -package org.nuiton.topia.framework; - -import java.beans.PropertyChangeListener; - -/** - * Created: 3 juin 2010 - * - * @author fdesbois <fdesbois@codelutin.com> - * @version $Id$ - * @deprecated since 3.0 - */ -@Deprecated -public interface EntityFilter { - - String PROPERTY_START_INDEX = "startIndex"; - - String PROPERTY_END_INDEX = "endIndex"; - - String PROPERTY_ORDER_BY = "orderBy"; - - String PROPERTY_REFERENCE_ID = "referenceId"; - - String PROPERTY_REFERENCE_PROPERTY = "referenceProperty"; - - /** - * Get the value of startIndex - * - * @return the value of startIndex - */ - Integer getStartIndex(); - - /** - * Set the value of startIndex - * - * @param startIndex new value of startIndex - */ - void setStartIndex(Integer startIndex); - - /** - * Get the value of orderBy - * - * @return the value of orderBy - */ - String getOrderBy(); - - /** - * Set the value of orderBy - * - * @param orderBy new value of orderBy - */ - void setOrderBy(String orderBy); - - /** - * Get the value of endIndex - * - * @return the value of endIndex - */ - Integer getEndIndex(); - - /** - * Set the value of endIndex - * - * @param endIndex new value of endIndex - */ - void setEndIndex(Integer endIndex); - - /** - * Get the value of referenceId - * - * @return the value of referenceId - */ - String getReferenceId(); - - /** - * Set the value of referenceId - * - * @param referenceId - */ - void setReferenceId(String referenceId); - - /** - * Set the value of referenceId from {@code entity} - * - * @param entity - */ - void setReference(Object entity) throws IllegalArgumentException; - - /** - * Used to check if the filter contains a reference. - * - * @return true if the filter contains a reference - */ - boolean hasReference(); - - /** - * Use to check if {@code reference} class is supported by the current - * filter reference. The reference can be not {@code mandatory}. Exceptions - * are thrown if the check failed. If you prefer to have a boolean instead - * of exceptions, you can use {@link #isClassReference(Class)}. - * - * @param reference Class reference to check - * @param mandatory If the existence of the reference is mandatory - * @throws IllegalArgumentException for errors on check - * @see #hasReference() - * @see #isClassReference(Class) - */ - void checkReference(Class<?> reference, boolean mandatory) - throws IllegalArgumentException; - - /** - * Test if the {@code entityClass} is corresponding to the current reference - * in the filter. Will return false if no reference is set in the filter. - * - * @param entityClass Class reference to test - * @return true if the classReference is corresponding, false otherwise - * @see #checkReference(Class, boolean) - */ - boolean isClassReference(Class<?> entityClass); - - /** - * Get the value of referenceProperty - * - * @return the value of referenceProperty - */ - String getReferenceProperty(); - - /** - * Set the value of referenceProperty - * - * @param referenceProperty - */ - void setReferenceProperty(String referenceProperty); - - /** - * Add PropertyChangeListener. - * - * @param listener - */ - void addPropertyChangeListener(PropertyChangeListener listener); - - /** - * Remove PropertyChangeListener. - * - * @param listener - */ - void removePropertyChangeListener(PropertyChangeListener listener); - -} \ No newline at end of file Deleted: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFilter.java =================================================================== --- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFilter.java 2013-11-22 20:28:56 UTC (rev 2888) +++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFilter.java 2013-11-22 20:45:02 UTC (rev 2889) @@ -1,232 +0,0 @@ -/* - * #%L - * ToPIA :: Persistence - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2004 - 2010 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * 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 General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * #L% - */ -package org.nuiton.topia.framework; - -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.topia.TopiaNotFoundException; -import org.nuiton.topia.persistence.TopiaEntity; -import org.nuiton.topia.persistence.TopiaId; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; - -/** - * Filter - * <p/> - * Created: 23 avr. 2010 - * - * @author fdesbois - * @since 2.0 - * @deprecated since 3.0 - */ -@Deprecated -public class TopiaFilter implements EntityFilter { - - private static final Log log = LogFactory.getLog(TopiaFilter.class); - - protected Integer startIndex; - - protected Integer endIndex; - - protected String orderBy; - - protected String referenceId; - - protected String referenceProperty; - - private PropertyChangeSupport propertyChangeSupport = - new PropertyChangeSupport(this); - - @Override - public Integer getStartIndex() { - return startIndex; - } - - @Override - public void setStartIndex(Integer startIndex) { - Integer oldStartIndex = this.startIndex; - this.startIndex = startIndex; - propertyChangeSupport.firePropertyChange(PROPERTY_START_INDEX, - oldStartIndex, startIndex); - } - - @Override - public String getOrderBy() { - return orderBy; - } - - @Override - public void setOrderBy(String orderBy) { - String oldOrderBy = this.orderBy; - this.orderBy = orderBy; - propertyChangeSupport.firePropertyChange(PROPERTY_ORDER_BY, - oldOrderBy, orderBy); - } - - @Override - public Integer getEndIndex() { - return endIndex; - } - - @Override - public void setEndIndex(Integer endIndex) { - Integer oldEndIndex = this.endIndex; - this.endIndex = endIndex; - propertyChangeSupport.firePropertyChange(PROPERTY_END_INDEX, - oldEndIndex, endIndex); - } - - @Override - public String getReferenceId() { - return referenceId; - } - - @Override - public void setReferenceId(String referenceId) { - String oldReferenceId = this.referenceId; - this.referenceId = referenceId; - propertyChangeSupport.firePropertyChange(PROPERTY_REFERENCE_ID, - oldReferenceId, referenceId); - } - - @Override - public void setReference(Object entity) throws IllegalArgumentException { - - if (! (entity instanceof TopiaEntity)) { - throw new IllegalArgumentException("Can't set reference of type '" + - entity.getClass().getName() + "' need a TopiaEntity"); - } - - setReferenceId(((TopiaEntity)entity).getTopiaId()); - } - - @Override - public boolean hasReference() { - return StringUtils.isNotEmpty(referenceId); - } - - @Override - public String getReferenceProperty() { - return referenceProperty; - } - - @Override - public void setReferenceProperty(String referenceProperty) { - String oldReferenceProperty = this.referenceProperty; - this.referenceProperty = referenceProperty; - propertyChangeSupport.firePropertyChange(PROPERTY_REFERENCE_PROPERTY, - oldReferenceProperty, referenceProperty); - } - - @Override - public void addPropertyChangeListener(PropertyChangeListener listener) { - propertyChangeSupport.addPropertyChangeListener(listener); - } - - @Override - public void removePropertyChangeListener(PropertyChangeListener listener) { - propertyChangeSupport.removePropertyChangeListener(listener); - } - - /** - * Test if the {@code entityClass} is corresponding to the current reference - * in the filter. Will return false if no reference is set in the filter. - * - * @param entityClass Class reference to test - * @return true if the classReference is corresponding, false otherwise - * @see #checkReference(Class, boolean) - */ - @Override - public boolean isClassReference(Class<?> entityClass) { - - boolean result = false; - - if (hasReference()) { - try { - Class<?> referenceClass = TopiaId.getClassName(referenceId); - if (referenceClass.isAssignableFrom(entityClass)) { - result = true; - } - } catch (TopiaNotFoundException eee) { - if (log.isWarnEnabled()) { - log.warn("ReferenceId '" + referenceId + "' is not a" + - " compatible topiaId : " + eee.getMessage()); - } - } - } - return result; - } - - /** - * Use to check if {@code reference} class is supported by the current - * filter reference. The reference can be not {@code mandatory}. Exceptions - * are thrown if the check failed. If you prefer to have a boolean instead - * of exceptions, you can use {@link #isClassReference(Class)}. - * - * @param reference Class reference to check - * @param mandatory If the existence of the reference is mandatory - * @throws IllegalArgumentException for errors on check - * @see #hasReference() - * @see #isClassReference(Class) - */ - @Override - public void checkReference(Class<?> reference, boolean mandatory) - throws IllegalArgumentException { - - if (log.isTraceEnabled()) { - log.trace("referenceClass to check : " + reference.getName()); - log.trace("mandatory : " + mandatory); - log.trace("filter hasReference : " + hasReference()); - log.trace("filter isClassReference : " + isClassReference(reference)); - } - - if (mandatory && !hasReference()) { - throw new IllegalArgumentException("The filter reference" + - " of type '" + reference.getSimpleName() + "' is mandatory !"); - } - - if (hasReference() && - !isClassReference(reference)) { - throw new IllegalArgumentException("Reference filtered need to be" + - " a '" + reference.getSimpleName() + "' (referenceId = " + - referenceId + ")"); - } - - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder("TopiaFilter{"). - append("referenceProperty = '").append(referenceProperty). - append("', startIndex = ").append(startIndex). - append(", endIndex = ").append(endIndex). - append(", orderBy = '").append(orderBy). - append("' , referenceId = '").append(referenceId). - append("'}"); - return builder.toString(); - } -} \ No newline at end of file Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java =================================================================== --- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java 2013-11-22 20:28:56 UTC (rev 2888) +++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java 2013-11-22 20:45:02 UTC (rev 2889) @@ -104,7 +104,7 @@ * @param value value of the property to match * @return the first entity matching the request * @throws TopiaException if any pb while getting datas - * @deprecated @deprecated use new API and inline {@link LegacyTopiaDao#findByProperties(String, Object, Object...)} + * @deprecated @deprecated use new API and inline {@link TopiaDao#forProperties(String, Object, Object...)} */ E findByProperty(String propertyName, Object value) throws TopiaException; @@ -118,7 +118,7 @@ * [propertyName;value;propertyName;value;...] * @return the first entity matching the request * @throws TopiaException if any pb while getting datas - * @deprecated @deprecated use new API and inline {@link LegacyTopiaDao#findByProperties(String, Object, Object...)} + * @deprecated @deprecated use new API and inline {@link TopiaDao#forProperties(String, Object, Object...)} */ E findByProperties(String propertyName, Object value, @@ -130,7 +130,7 @@ * @param properties the properties key + value to match * @return the first entity matching the request * @throws TopiaException if any pb while getting datas - * @deprecated @deprecated use new API and inline {@link LegacyTopiaDao#findByProperties(java.util.Map)} + * @deprecated @deprecated use new API and inline {@link TopiaDao#forProperties(java.util.Map)} */ E findByProperties(Map<String, Object> properties) throws TopiaException; @@ -200,7 +200,7 @@ * @return the entity E found or null * @throws TopiaException if any pb while getting datas * @since 2.5.4 - * @deprecated use new API and inline {@link LegacyTopiaDao#findContains(String, Object)} + * @deprecated use new API and inline {@link TopiaDao#forContains(String, Object)} */ E findContains(String propertyName, Object value) throws TopiaException; @@ -231,7 +231,7 @@ * @param value value to expect * @return the list of entities E having the given value * @throws TopiaException if any pb while getting datas - * @deprecated use new API and inline {@link LegacyTopiaDao#findAllByProperties(String, Object, Object...)} + * @deprecated use new API and inline {@link TopiaDao#forProperties(String, Object, Object...)} */ List<E> findAllByProperty(String propertyName, Object value) throws TopiaException; @@ -246,7 +246,7 @@ * [propertyName;value;propertyName;value;...] * @return the list of entities E having the given value * @throws TopiaException if any pb while getting datas - * @deprecated use new API and inline {@link LegacyTopiaDao#findAllByProperties(String, Object, Object...)} + * @deprecated use new API and inline {@link TopiaDao#forProperties(String, Object, Object...)} */ List<E> findAllByProperties(String propertyName, Object value, @@ -258,7 +258,7 @@ * @param properties properties to match * @return the list of entities E having the given values * @throws TopiaException if any pb while getting datas - * @deprecated use new API and inline {@link LegacyTopiaDao#findAllByProperties(java.util.Map)} + * @deprecated use new API and inline {@link TopiaDao#forProperties(java.util.Map)} */ List<E> findAllByProperties(Map<String, Object> properties) throws TopiaException; @@ -464,7 +464,7 @@ * @return all the entities E found * @throws TopiaException if any pb while getting datas * @since 2.5.4 - * @deprecated use new API and inline {@link LegacyTopiaDao#findAllContains(String, Object)} + * @deprecated use new API and inline {@link TopiaDao#forContains(String, Object)} */ List<E> findAllContains(String propertyName, Object value) throws TopiaException; @@ -480,7 +480,7 @@ * @return true if entity exists, false otherwise * @throws TopiaException for any error * @since 2.3.4 - * @deprecated use new API and inline {@link LegacyTopiaDao#existByTopiaId(String)} + * @deprecated use new API and inline {@link TopiaDao#forTopiaIdEquals(String)} */ boolean existByTopiaId(String id) throws TopiaException;