Dave Ward 174fd8fd77 Merged V3.2 to HEAD:
19472: ALF-725: Revert to using jTDS JDBC driver for SQL Server in 3.2 SP1, since the Microsoft driver doesn't work with the v3.2.r iBATIS stuff
      - All example/installer alfresco-global.properties updated
      - Wiki updated http://wiki.alfresco.com/wiki/Database_Configuration#MS-SQL_Databases
      - Logged doc bug ALF-2144 and release note bug ALF-2145
   19501:Merged DEV/BELARUS/V3.2-2010_02_24 to V3.2 (with corrections)
      19243: ALF-757: Cannot start up on JBoss 5.1 due to audit configuration error
         - Removed getPath() method because it is incompatible with JBoss and other app servers where resources can't be resolved to a file
         - Now use Spring ResourceLoader instead of creating FileInputStream
         - getLastModified() still returned where the resource resolves to a file; otherwise the server startup time
   19503: (RECORD ONLY) ALF-2100: Merged HEAD to V3.2
      19155: ALF-1995: Removed remaining direct dependencies on portlet API from Alfresco Explorer classes
         - Moved into AlfrescoFacesPortlet
         - portlet.jar was removed from alfresco.war for Liferay compatibility
   19506: Merged PATCHES/V3.1.2 to V3.2
      19218: (RECORD ONLY) Created hotfix branch off TAGS/ENTERPRISE/V3.1.2
      19229: (RECORD ONLY) Merged V3.1 to V3.1.2
         18577: Fix for ETHREEOH-4117, based on CHK-11154
      19341: Merged DEV/BELARUS/V3.1-2010_02_05 to PATCHES/V3.1.2 (with corrections)
         19156: ALF-1906: splitPersonCleanUpBootstrapBean is not able to remove duplicated users
         Also
         - improved detection of 'split' persons
         - added unit tests for person splitting and deleting
         - fixed duplicate person caching and sorting problems
         - prevented onUpdateProperties from firing needlessly in PersonServiceImpl and AuthorityDAOImpl when persons and authorities are created initially
      19342: (RECORD ONLY) Incremented version number
   19508: Merged PATCHES/V3.2.0 to V3.2
      18762: (RECORD ONLY) Created hotfix branch off V3.2.0-ENTERPRISE-FINAL
      18789: (RECORD ONLY) Merged BRANCHES/V3.2:r17905,18254,18319 to PATCHES/V3.2.0
         r17905 | markr | 2010-01-06 16:55:12 +0000 (Wed, 06 Jan 2010) | 3 lines
            ETHREEOH-3809 - WCM - First test server deploy fails.
               added yet another transaction to read the previous snapshot transaction.
               added a new system test based upon the WCM services.    The beginnings of testing against layered authored sandboxes.
         r18254 | janv | 2010-01-22 18:15:43 +0000 (Fri, 22 Jan 2010) | 1 line
            WCM/AVM - ETHREEOH-2057 (Submitting WCM Content through WF JSF Error - due to AVM Sync issue)
         r18319 | royw | 2010-01-27 12:18:27 +0000 (Wed, 27 Jan 2010) | 4 lines
            Merged BRANCHES/DEV/BELARUS/V3.2-2010_01_11 to V3.2
               18273: ETHREEOH-3834: WCM: An extral .xml.html file is created when editing newly created content
      18822: (RECORD ONLY) Merged DEV_TEMPORARY to PATCHES/V3.2.0
         18478: SAP XForms errors - ACT 15969
         18699: ETHREEOH-4171: HTTP 500 when filling in a WCM webform - ACT 15969
      18842: (RECORD ONLY)  Merged V3.2 to PATCHES/V3.2.0
         18701: Merged DEV_TEMPORARY to V3.2
            18693 : ETHREEOH-4182: ASR deployer fails to set the contentUrl of documents on the target system
               - Merged in fix related to closing output streams.
               - Increased coverage of unit test.
      18854: (RECORD ONLY) Merged V3.2 to V3.2.0
         18019: ETHREEOH-3770: LDAP sync now supports attribute range retrieval to get around limits imposed by Active Directory on multi-valued attributes
            - Meant that groups with more than 1000 members were getting truncated in Active Directory
            - Now switched on in ldap-ad and off in ldap subsystem
            - Also switched off result set paging in ldap subsystem by default for wider compatibility with non-AD systems
         18272: Merged DEV/BELARUS/V3.2-2010_01_11 to V3.2
            18257: ETHREEOH-4002: User/Group sync does not handle LDAP communication failures
               - Merged with corrections
         18276: ETHREEOH-4002: Correction to previous checkin - modification dates are only persisted after successful processing of users and groups, so need to delete them on comms failure
         18340: ETHREEOH-4069: LDAP sync cannot resolve DNs containing a slash character
            - Due to JNDI interpreting the slash character as a separator
         18403: ETHREEOH-4008: LDAP sync should preserve case of group members
            - Was incorrectly extracting attributes from lower-cased DN
         18846: ETHREEOH-4233: LDAP sync now synchronizes group display names
            - New ldap.synchronization.groupDisplayNameAttributeName property provides name of LDAP attribute
      18877: (RECORD ONLY) Merged /alfresco/BRANCHES/V3.2:r18616
         r18616 | markr | 2010-02-12 14:08:52 +0000 (Fri, 12 Feb 2010) | 1 line
            ETHREEOH-4181 - Access denied exception when deploying via avm deployment receiver
      19319: ALF-2043: User ID case sensitivity issues with Sharepoint Connector and External Authentication Subsystem
         - DefaultRemoteUserMapper and AlfrescoUserGroupServiceHandler should use personService.getUserIdentifier() to 'normalize' a username according to case sensitivity settings
         - NtlmAuthenticationHandler should also leave the normalization to personService
      19320: (RECORD ONLY) Incremented version label
      19380: ALF-2043: Revisit user ID case sensitivity in DefaultRemoteUserMapper
         - Has to use public PersonService in case it is accessed outside of a transaction
         - Fixed regular expression matching
         - Added unit tests to try out all the remote user mapper options
   19509: Merged PATCHES/V3.2.r to V3.2
      18803: (RECORD ONLY) Created hotfix branch off V3.2.r-ENTERPRISE-FINAL
      18833: (RECORD ONLY) Turn on Repo Doclib by default
      19054: (RECORD ONLY) Merging V3.2 to PATCHES/V3.2.r
         18787: MT: fix ETHREEOH-4125 - authority migration / batch processor (when upgrading groups from 3.1 to 3.2)
      19358: (RECORD ONLY) Merged DEV/BELARUS/V3.2-2010_01_11 to PATCHES/V3.2.r
         18699: ETHREEOH-4171: HTTP 500 when filling in a WCM webform
      19447: (RECORD ONLY) Incremented version label
   19518: ALF-757: Corrected audit config resource URL so that it resolves inside Tomcat as well as JUnit!
   19525: ALF-708: Use BatchProcessor to process duplicate persons in small batches in SplitPersonCleanupBootstrapBean
      - Even tested in a unit test!


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19536 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2010-03-24 13:49:03 +00:00

680 lines
23 KiB
Java

/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco 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.
*
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.repo.audit.hibernate;
import java.io.BufferedInputStream;
import java.io.InputStream;
import java.io.Serializable;
import java.net.URL;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.alfresco.repo.audit.AuditState;
import org.alfresco.repo.content.ContentStore;
import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.content.filestore.FileContentStore;
import org.alfresco.repo.domain.audit.AuditDAO;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.transaction.TransactionalDao;
import org.alfresco.service.cmr.audit.AuditInfo;
import org.alfresco.service.cmr.audit.AuditQueryParameters;
import org.alfresco.service.cmr.audit.AuditService.AuditQueryCallback;
import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.datatype.Duration;
import org.alfresco.util.EqualsHelper;
import org.alfresco.util.GUID;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.mapping.Column;
import org.alfresco.util.Pair;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.orm.hibernate3.LocalSessionFactoryBean;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
/**
* Assumes mimetype and encoding sent to the content store (we are not saving this anywhere)
*
* @author Andy Hind
*/
public class HibernateAuditDAO extends HibernateDaoSupport implements AuditDAO, TransactionalDao
{
/**
* Logging
*/
private static Log s_logger = LogFactory.getLog(HibernateAuditDAO.class);
private static final String QUERY_LAST_AUDIT_DATE = "audit.GetLatestAuditDate";
private static final String QUERY_AUDIT_DATE = "audit.GetAuditDate";
private static final String QUERY_LAST_AUDIT_CONFIG = "audit.GetLatestAuditConfig";
private static final String QUERY_AUDIT_APP_SOURCE = "audit.GetAuditSourceByApplication";
private static final String QUERY_AUDIT_METHOD_SOURCE = "audit.GetAuditSourceByApplicationServiceMethod";
private static final String QUERY_AUDIT_APP_SOURCE_APP = "application";
private static final String QUERY_AUDIT_APP_SOURCE_SER = "service";
private static final String QUERY_AUDIT_APP_SOURCE_MET = "method";
private static final String QUERY_AUDIT_TRAIL = "audit.GetAuditTrailForNode";
private static final String QUERY_AUDIT_PROTOCOL = "protocol";
private static final String QUERY_AUDIT_STORE_ID = "store_id";
private static final String QUERY_AUDIT_NODE_ID = "node_id";
private static final String QUERY_AUDIT_NODE_REF = "nodeRef";
private static final String QUERY_AUDIT_DATE_PARAM = "date";
/** a uuid identifying this unique instance */
private String uuid;
private ContentStore contentStore;
private LocalSessionFactoryBean localSessionFactory;
public HibernateAuditDAO()
{
super();
this.uuid = GUID.generate();
}
public ContentStore getContentStore()
{
return contentStore;
}
public void setContentStore(ContentStore contentStore)
{
this.contentStore = contentStore;
}
public void setLocalSessionFactory(LocalSessionFactoryBean localSessionFactory)
{
this.localSessionFactory = localSessionFactory;
}
public void audit(AuditState auditInfo)
{
if (auditInfo.getUserIdentifier() == null)
{
auditInfo.setUserIdentifier(AuthenticationUtil.getSystemUserName());
}
if (AuthenticationUtil.getRunAsUser() == null)
{
AuthenticationUtil.setRunAsUserSystem();
try
{
audit0(auditInfo);
}
finally
{
AuthenticationUtil.clearCurrentSecurityContext();
}
}
else
{
audit0(auditInfo);
}
}
private void audit0(AuditState auditInfo)
{
// Find/Build the configuraton entry
AuditConfig auditConfig = getAuditConfig(auditInfo);
// Find/Build any dates
AuditDate auditDate = getAuditDate(auditInfo);
// Find/Build the source
AuditSource auditSource = getAuditSource(auditInfo);
// Build the new audit fact information
AuditFactImpl auditFact = new AuditFactImpl();
auditFact.setAuditConfig(auditConfig);
auditFact.setAuditDate(auditDate);
auditFact.setAuditSource(auditSource);
// Properties
Serializable[] args = auditInfo.getMethodArguments();
if (args != null)
{
switch (args.length)
{
default:
case 5:
auditFact.setArg5(getStringOrNull(args[4], getColumnLength("org.alfresco.repo.audit.hibernate.AuditFactImpl", "arg5")));
case 4:
auditFact.setArg4(getStringOrNull(args[3], getColumnLength("org.alfresco.repo.audit.hibernate.AuditFactImpl", "arg4")));
case 3:
auditFact.setArg3(getStringOrNull(args[2], getColumnLength("org.alfresco.repo.audit.hibernate.AuditFactImpl", "arg3")));
case 2:
auditFact.setArg2(getStringOrNull(args[1], getColumnLength("org.alfresco.repo.audit.hibernate.AuditFactImpl", "arg2")));
case 1:
auditFact.setArg1(getStringOrNull(args[0], getColumnLength("org.alfresco.repo.audit.hibernate.AuditFactImpl", "arg1")));
case 0:
}
}
auditFact.setClientInetAddress(getStringOrNull(auditInfo.getClientAddress(), getColumnLength("org.alfresco.repo.audit.hibernate.AuditFactImpl", "clientInetAddress")));
auditFact.setDate(auditInfo.getDate());
auditFact.setException(getStringOrNull((auditInfo.getThrowable() == null ? null : auditInfo.getThrowable().getMessage()), getColumnLength(
"org.alfresco.repo.audit.hibernate.AuditFactImpl", "exception")));
auditFact.setFail(auditInfo.isFail());
auditFact.setFiltered(auditInfo.isFiltered());
auditFact.setHostInetAddress(getStringOrNull(auditInfo.getHostAddress(), getColumnLength("org.alfresco.repo.audit.hibernate.AuditFactImpl", "hostInetAddress")));
auditFact.setMessage(getStringOrNull(auditInfo.getMessage(), getColumnLength("org.alfresco.repo.audit.hibernate.AuditFactImpl", "message")));
auditFact.setNodeUUID(getStringOrNull(auditInfo.getKeyGUID(), getColumnLength("org.alfresco.repo.audit.hibernate.AuditFactImpl", "nodeUUID")));
auditFact.setPath(getStringOrNull(auditInfo.getPath(), getColumnLength("org.alfresco.repo.audit.hibernate.AuditFactImpl", "path")));
auditFact.setReturnValue(getStringOrNull(auditInfo.getReturnObject(), getColumnLength("org.alfresco.repo.audit.hibernate.AuditFactImpl", "returnValue")));
// auditFact.setSerialisedURL()
auditFact.setSessionId(getStringOrNull(auditInfo.getSessionId(), getColumnLength("org.alfresco.repo.audit.hibernate.AuditFactImpl", "sessionId")));
if (auditInfo.getKeyStore() != null)
{
auditFact.setStoreId(getStringOrNull(auditInfo.getKeyStore().getIdentifier(), getColumnLength("org.alfresco.repo.audit.hibernate.AuditFactImpl", "storeId")));
auditFact.setStoreProtocol(getStringOrNull(auditInfo.getKeyStore().getProtocol(), getColumnLength("org.alfresco.repo.audit.hibernate.AuditFactImpl", "storeProtocol")));
}
auditFact.setTransactionId(getStringOrNull(auditInfo.getTxId(), getColumnLength("org.alfresco.repo.audit.hibernate.AuditFactImpl", "transactionId")));
auditFact.setUserId(getStringOrNull(auditInfo.getUserIdentifier(), getColumnLength("org.alfresco.repo.audit.hibernate.AuditFactImpl", "userId")));
// Save
getSession().save(auditFact);
}
private int getColumnLength(String entityName, String propertyName)
{
int length = -1;
Iterator it = localSessionFactory.getConfiguration().getClassMapping(entityName).getProperty(propertyName).getValue().getColumnIterator();
if (it.hasNext())
{
Column col = (Column) it.next();
length = col.getLength();
}
if (s_logger.isDebugEnabled())
{
s_logger.debug(entityName + " " + propertyName + " is of length " + length);
}
return length;
}
private String getStringOrNull(Object o, int size)
{
if (o == null)
{
return null;
}
else
{
try
{
String answer = o.toString();
if ((size > -1) && (answer.length() > size))
{
answer = answer.substring(0, size);
}
return answer;
}
catch (Throwable t)
{
String answer = "Throwable in toString implementation for " + o.getClass() + " was " + t.getMessage();
if ((size > -1) && (answer.length() > size))
{
answer = answer.substring(0, size);
}
return answer;
}
}
}
private AuditSource getAuditSource(final AuditState auditInfo)
{
AuditSource auditSourceImpl;
if ((auditInfo.getAuditService() != null)
&& (auditInfo.getAuditService().length() > 0) && (auditInfo.getAuditMethod() != null) && (auditInfo.getAuditMethod().length() > 0))
{
auditSourceImpl = queryApplicationSource(auditInfo.getAuditApplication(), auditInfo.getAuditService(), auditInfo.getAuditMethod());
if (auditSourceImpl == null)
{
auditSourceImpl = new AuditSourceImpl();
auditSourceImpl.setApplication(auditInfo.getAuditApplication());
auditSourceImpl.setService(auditInfo.getAuditService());
auditSourceImpl.setMethod(auditInfo.getAuditMethod());
Long id = (Long) getSession().save(auditSourceImpl);
}
}
else
{
auditSourceImpl = queryApplicationSource(auditInfo.getAuditApplication());
if (auditSourceImpl == null)
{
auditSourceImpl = new AuditSourceImpl();
auditSourceImpl.setApplication(auditInfo.getAuditApplication());
Long id = (Long) getSession().save(auditSourceImpl);
}
}
return auditSourceImpl;
}
private AuditDate getAuditDate(final AuditState auditInfo)
{
Calendar cal = GregorianCalendar.getInstance();
cal.setTime(auditInfo.getDate());
cal.set(Calendar.MILLISECOND, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.HOUR_OF_DAY, 0);
Date required = cal.getTime();
AuditDate auditDate;
auditDate = queryLatestDate(required);
if (auditDate == null)
{
auditDate = queryLatestDate();
if (auditDate == null)
{
// The first entry ever so we just make it
auditDate = new AuditDateImpl(auditInfo.getDate());
Long id = (Long) getSession().save(auditDate);
}
else
{
if (required.compareTo(auditDate.getDate()) < 0)
{
auditDate = new AuditDateImpl(required);
Long id = (Long) getSession().save(auditDate);
}
else if (required.compareTo(auditDate.getDate()) == 0)
{
// no action
}
else
{
while (!required.equals(auditDate.getDate()))
{
Date nextDate = Duration.add(auditDate.getDate(), new Duration("P1D"));
auditDate = new AuditDateImpl(nextDate);
Long id = (Long) getSession().save(auditDate);
}
}
}
}
else
{
// no action
}
return auditDate;
}
private AuditConfig getAuditConfig(final AuditState auditInfo)
{
AuditConfig auditConfig;
auditConfig = queryLatestConfig(getSession());
if (auditConfig == null)
{
auditConfig = createNewAuditConfigImpl(auditInfo);
}
else
{
if (contentStore instanceof FileContentStore)
{
long currTimestamp = auditInfo.getAuditConfiguration().getLastModified();
long timestamp = ((FileContentStore)contentStore).getReader(auditConfig.getConfigURL()).getLastModified();
if (timestamp < currTimestamp)
{
// Files are different - require a new entry
auditConfig = createNewAuditConfigImpl(auditInfo);
}
}
else
{
auditConfig = createNewAuditConfigImpl(auditInfo);
}
}
return auditConfig;
}
private AuditConfig createNewAuditConfigImpl(final AuditState auditInfo)
{
AuditConfigImpl auditConfig = new AuditConfigImpl();
InputStream is = new BufferedInputStream(auditInfo.getAuditConfiguration().getInputStream());
ContentWriter writer = contentStore.getWriter(ContentStore.NEW_CONTENT_CONTEXT);
writer.setMimetype(MimetypeMap.MIMETYPE_XML);
writer.setEncoding("UTF-8");
writer.putContent(is);
String contentUrl = writer.getContentUrl();
auditConfig.setConfigURL(contentUrl);
getSession().save(auditConfig);
return auditConfig;
}
/**
* Checks equality by type and uuid
*/
public boolean equals(Object obj)
{
if (obj == null)
{
return false;
}
else if (!(obj instanceof HibernateAuditDAO))
{
return false;
}
HibernateAuditDAO that = (HibernateAuditDAO) obj;
return this.uuid.equals(that.uuid);
}
/**
* @see #uuid
*/
public int hashCode()
{
return uuid.hashCode();
}
/**
* Does this <tt>Session</tt> contain any changes which must be synchronized with the store?
*
* @return true => changes are pending
*/
public boolean isDirty()
{
// create a callback for the task
HibernateCallback callback = new HibernateCallback()
{
public Object doInHibernate(Session session)
{
return session.isDirty();
}
};
// execute the callback
return ((Boolean) getHibernateTemplate().execute(callback)).booleanValue();
}
/**
* Just flushes the session
*/
public void flush()
{
getSession().flush();
}
/**
* NO-OP
*/
public void beforeCommit()
{
}
static class SourceKey
{
String application;
String service;
String method;
SourceKey(String application, String service, String method)
{
this.application = application;
this.service = service;
this.method = method;
}
@Override
public boolean equals(Object o)
{
if (this == o)
{
return true;
}
if (!(this instanceof SourceKey))
{
return false;
}
SourceKey other = (SourceKey) o;
return EqualsHelper.nullSafeEquals(this.application, other.application)
&& EqualsHelper.nullSafeEquals(this.service, other.service) && EqualsHelper.nullSafeEquals(this.method, other.method);
}
@Override
public int hashCode()
{
int hash = application.hashCode();
if (service != null)
{
hash = (hash * 37) + service.hashCode();
}
if (method != null)
{
hash = (hash * 37) + method.hashCode();
}
return hash;
}
}
public List<AuditInfo> getAuditTrail(NodeRef nodeRef)
{
if (nodeRef == null)
{
return Collections.<AuditInfo> emptyList();
}
List<? extends AuditFact> internalTrail = queryAuditTrail(nodeRef);
ArrayList<AuditInfo> answer = new ArrayList<AuditInfo>(internalTrail.size());
for (AuditFact auditFact : internalTrail)
{
AuditInfo info = new AuditInfoImpl(auditFact);
answer.add(info);
}
return answer;
}
/**
* Helper method to get the latest audit config
*/
public static AuditConfig queryLatestConfig(Session session)
{
Query query = session.getNamedQuery(QUERY_LAST_AUDIT_CONFIG);
return (AuditConfig) query.uniqueResult();
}
/**
* Helper method to get the latest audit date
*/
public AuditDate queryLatestDate()
{
Query query = getSession().getNamedQuery(QUERY_LAST_AUDIT_DATE);
return (AuditDate) query.uniqueResult();
}
/**
* Helper method to get all the audit entries for a node.
*/
@SuppressWarnings("unchecked")
public List<AuditFact> queryAuditTrail(NodeRef nodeRef)
{
Query query = getSession().getNamedQuery(QUERY_AUDIT_TRAIL);
query.setParameter(QUERY_AUDIT_PROTOCOL, nodeRef.getStoreRef().getProtocol());
query.setParameter(QUERY_AUDIT_STORE_ID, nodeRef.getStoreRef().getIdentifier());
query.setParameter(QUERY_AUDIT_NODE_ID, nodeRef.getId());
query.setParameter(QUERY_AUDIT_NODE_REF, "%" + nodeRef.toString() + "%");
return (List<AuditFact>) query.list();
}
/**
* Helper method to get the application source
*
* @param application
* @return
*/
public AuditSource queryApplicationSource(String application)
{
Query query = getSession().getNamedQuery(QUERY_AUDIT_APP_SOURCE);
query.setParameter(QUERY_AUDIT_APP_SOURCE_APP, application);
return (AuditSource) query.uniqueResult();
}
/**
* Helper method to get the application source
*
* @param application
* @return
*/
public AuditSource queryApplicationSource(String application, String service, String method)
{
Query query = getSession().getNamedQuery(HibernateAuditDAO.QUERY_AUDIT_METHOD_SOURCE);
query.setParameter(QUERY_AUDIT_APP_SOURCE_APP, application);
query.setParameter(QUERY_AUDIT_APP_SOURCE_SER, service);
query.setParameter(QUERY_AUDIT_APP_SOURCE_MET, method);
return (AuditSource) query.uniqueResult();
}
/**
* Helper method to get the latest audit date
*/
public AuditDate queryLatestDate(Date date)
{
Query query = getSession().getNamedQuery(HibernateAuditDAO.QUERY_AUDIT_DATE);
query.setParameter(QUERY_AUDIT_DATE_PARAM, date);
return (AuditDate) query.uniqueResult();
}
/*
* V3.2 from here on. Put all fixes to the older audit code before this point, please.
*/
/**
* Fallout implementation from new audit DAO
*
* @throws UnsupportedOperationException always
* @since 3.2
*/
public Pair<Long, ContentData> getOrCreateAuditModel(URL url)
{
throw new UnsupportedOperationException();
}
/**
* Fallout implementation from new audit DAO
*
* @throws UnsupportedOperationException always
* @since 3.2
*/
public AuditApplicationInfo createAuditApplication(String application, Long modelId)
{
throw new UnsupportedOperationException();
}
/**
* Fallout implementation from new audit DAO
*
* @throws UnsupportedOperationException always
* @since 3.2
*/
public AuditApplicationInfo getAuditApplication(String applicationName)
{
throw new UnsupportedOperationException();
}
/**
* Fallout implementation from new audit DAO
*
* @throws UnsupportedOperationException always
* @since 3.2
*/
public void updateAuditApplicationModel(Long id, Long modelId)
{
throw new UnsupportedOperationException();
}
/**
* Fallout implementation from new audit DAO
*
* @throws UnsupportedOperationException always
* @since 3.2
*/
public void updateAuditApplicationDisabledPaths(Long id, Set<String> disabledPaths)
{
throw new UnsupportedOperationException();
}
/**
* Fallout implementation from new audit DAO
*
* @throws UnsupportedOperationException always
* @since 3.2
*/
public void deleteAuditEntries(Long applicationId, Long from, Long to)
{
throw new UnsupportedOperationException();
}
/**
* Fallout implementation from new audit DAO
*
* @throws UnsupportedOperationException always
* @since 3.2
*/
public Long createAuditEntry(Long applicationId, long time, String username, Map<String, Serializable> values)
{
throw new UnsupportedOperationException();
}
/**
* Fallout implementation from new audit DAO
*
* @throws UnsupportedOperationException always
* @since 3.2
*/
public void findAuditEntries(AuditQueryCallback callback, AuditQueryParameters parameters, int maxResults)
{
throw new UnsupportedOperationException();
}
}