From: <ga...@us...> - 2009-09-25 18:24:08
|
Revision: 4111 http://jaffa.svn.sourceforge.net/jaffa/?rev=4111&view=rev Author: gautamj Date: 2009-09-25 18:24:01 +0000 (Fri, 25 Sep 2009) Log Message: ----------- Reintroduced objectName and auditTransactionFields into AuditTransactionCriteria Modified Paths: -------------- trunk/JaffaComponents/source/java/org/jaffa/components/audit/apis/data/AuditTransactionCriteria.java Added Paths: ----------- trunk/JaffaComponents/source/java/org/jaffa/components/audit/apis/data/AuditTransactionFieldCriteria.java Modified: trunk/JaffaComponents/source/java/org/jaffa/components/audit/apis/data/AuditTransactionCriteria.java =================================================================== --- trunk/JaffaComponents/source/java/org/jaffa/components/audit/apis/data/AuditTransactionCriteria.java 2009-09-25 01:27:39 UTC (rev 4110) +++ trunk/JaffaComponents/source/java/org/jaffa/components/audit/apis/data/AuditTransactionCriteria.java 2009-09-25 18:24:01 UTC (rev 4111) @@ -48,7 +48,9 @@ */ package org.jaffa.components.audit.apis.data; +import org.jaffa.components.audit.domain.AuditTransactionFieldMeta; import org.jaffa.components.audit.domain.AuditTransactionMeta; +import org.jaffa.components.audit.domain.AuditTransactionObjectMeta; import org.jaffa.components.finder.DateTimeCriteriaField; import org.jaffa.components.finder.FinderTx; import org.jaffa.components.finder.StringCriteriaField; @@ -67,6 +69,8 @@ private StringCriteriaField reason; private StringCriteriaField createdBy; private DateTimeCriteriaField createdOn; + private String objectName; + private AuditTransactionFieldCriteria[] auditTransactionFields; /** Returns the criteria object used for retrieving WorkOrder records. * @param c Criteria object @@ -82,6 +86,30 @@ FinderTx.addCriteria(getReason(), AuditTransactionMeta.REASON, c); FinderTx.addCriteria(getCreatedBy(), AuditTransactionMeta.CREATED_BY, c); FinderTx.addCriteria(getCreatedOn(), AuditTransactionMeta.CREATED_ON, c); + + // Join AuditTransactionObject with AuditTransaction + if (getObjectName() != null) { + Criteria oc = new Criteria(); + oc.setTable(AuditTransactionObjectMeta.getName()); + oc.addInnerCriteria(AuditTransactionObjectMeta.TRANSACTION_ID, AuditTransactionMeta.TRANSACTION_ID); + oc.addCriteria(AuditTransactionObjectMeta.OBJECT_NAME, getObjectName()); + c.addAggregate(oc); + + // Join each AuditTransactionField with AuditTransactionObject + if (getAuditTransactionFields() != null) { + for (AuditTransactionFieldCriteria atf : getAuditTransactionFields()) { + if (atf.getFieldName() != null) { + Criteria fc = new Criteria(); + fc.setTable(AuditTransactionFieldMeta.getName()); + fc.addInnerCriteria(AuditTransactionFieldMeta.OBJECT_ID, AuditTransactionObjectMeta.OBJECT_ID); + fc.addCriteria(AuditTransactionFieldMeta.FIELD_NAME, atf.getFieldName()); + FinderTx.addCriteria(atf.getToValue(), AuditTransactionFieldMeta.TO_VALUE, fc); + FinderTx.addCriteria(atf.getChanged(), AuditTransactionFieldMeta.CHANGED, fc); + oc.addAggregate(fc); + } + } + } + } return c; } @@ -132,4 +160,20 @@ public void setCreatedOn(DateTimeCriteriaField createdOn) { this.createdOn = createdOn; } + + public String getObjectName() { + return objectName; + } + + public void setObjectName(String objectName) { + this.objectName = objectName; + } + + public AuditTransactionFieldCriteria[] getAuditTransactionFields() { + return auditTransactionFields; + } + + public void setAuditTransactionFields(AuditTransactionFieldCriteria[] auditTransactionFields) { + this.auditTransactionFields = auditTransactionFields; + } } Added: trunk/JaffaComponents/source/java/org/jaffa/components/audit/apis/data/AuditTransactionFieldCriteria.java =================================================================== --- trunk/JaffaComponents/source/java/org/jaffa/components/audit/apis/data/AuditTransactionFieldCriteria.java (rev 0) +++ trunk/JaffaComponents/source/java/org/jaffa/components/audit/apis/data/AuditTransactionFieldCriteria.java 2009-09-25 18:24:01 UTC (rev 4111) @@ -0,0 +1,87 @@ +/* + * ==================================================================== + * JAFFA - Java Application Framework For All + * + * Copyright (C) 2002 JAFFA Development Group + * + * This library 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 2.1 of the License, or (at your option) any later version. + * + * This library 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 library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Redistribution and use of this software and associated documentation ("Software"), + * with or without modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain copyright statements and notices. + * Redistributions must also contain a copy of this document. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name "JAFFA" must not be used to endorse or promote products derived from + * this Software without prior written permission. For written permission, + * please contact mail to: jaf...@ya.... + * 4. Products derived from this Software may not be called "JAFFA" nor may "JAFFA" + * appear in their names without prior written permission. + * 5. Due credit should be given to the JAFFA Project (http://jaffa.sourceforge.net). + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + */ +package org.jaffa.components.audit.apis.data; + +import org.jaffa.components.finder.BooleanCriteriaField; +import org.jaffa.components.finder.StringCriteriaField; + +/** + * + * @author GautamJ + */ +public class AuditTransactionFieldCriteria { + + private String fieldName; + private StringCriteriaField toValue; + private BooleanCriteriaField changed; + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + public StringCriteriaField getToValue() { + return toValue; + } + + public void setToValue(StringCriteriaField toValue) { + this.toValue = toValue; + } + + public BooleanCriteriaField getChanged() { + return changed; + } + + public void setChanged(BooleanCriteriaField changed) { + this.changed = changed; + } +} Property changes on: trunk/JaffaComponents/source/java/org/jaffa/components/audit/apis/data/AuditTransactionFieldCriteria.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |