/* * Copyright (C) 2005 Alfresco, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * 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 Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.alfresco.repo.node.integrity; import java.util.List; import org.alfresco.service.cmr.dictionary.AssociationDefinition; import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.repository.AssociationRef; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.RegexQNamePattern; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Event raised to check the target multiplicity for an association type * from the given node. *
* Checks are ignored is the target node doesn't exist.
*
* @author Derek Hulley
*/
public class AssocTargetMultiplicityIntegrityEvent extends AbstractIntegrityEvent
{
private static Log logger = LogFactory.getLog(AssocTargetMultiplicityIntegrityEvent.class);
/** true if the assoc type may not be valid, e.g. during association deletions */
private boolean isDelete;
public AssocTargetMultiplicityIntegrityEvent(
NodeService nodeService,
DictionaryService dictionaryService,
NodeRef sourceNodeRef,
QName assocTypeQName,
boolean isDelete)
{
super(nodeService, dictionaryService, sourceNodeRef, assocTypeQName, null);
this.isDelete = isDelete;
}
@Override
public boolean equals(Object obj)
{
if (!super.equals(obj))
{
return false;
}
// so far, so good
AssocTargetMultiplicityIntegrityEvent that = (AssocTargetMultiplicityIntegrityEvent) obj;
return this.isDelete == that.isDelete;
}
public void checkIntegrity(List