mirror of
				https://github.com/Alfresco/alfresco-community-repo.git
				synced 2025-10-29 15:21:53 +00:00 
			
		
		
		
	- Added getType and getParameters methods to Constraint interface - Updated existing constraint implementations Updates to FormService - Implemented regex pattern match for selecting appropriate form processor - Added constraints to Form object constructed in NodeHandler git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12396 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
		
			
				
	
	
		
			82 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			82 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
| /*
 | |
|  * Copyright (C) 2005-2007 Alfresco Software Limited.
 | |
|  *
 | |
|  * 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.
 | |
| 
 | |
|  * As a special exception to the terms and conditions of version 2.0 of 
 | |
|  * the GPL, you may redistribute this Program in connection with Free/Libre 
 | |
|  * and Open Source Software ("FLOSS") applications as described in Alfresco's 
 | |
|  * FLOSS exception.  You should have recieved a copy of the text describing 
 | |
|  * the FLOSS exception, and it is also available here: 
 | |
|  * http://www.alfresco.com/legal/licensing"
 | |
|  */
 | |
| package org.alfresco.service.cmr.dictionary;
 | |
| 
 | |
| import java.util.Map;
 | |
| 
 | |
| 
 | |
| /**
 | |
|  * The interface for classes that implement constraints on property values.
 | |
|  * <p>
 | |
|  * Implementations of the actual constraint code should must not synchronize
 | |
|  * or in any other way block threads.  Concurrent access of the evaluation
 | |
|  * method is expected, but will always occur after initialization has completed.
 | |
|  * <p>
 | |
|  * Attention to performance is <u>crucial</u> for all implementations as
 | |
|  * instances of this class are heavily used.
 | |
|  * <p>
 | |
|  * The constraint implementations can provide standard setter methods that will
 | |
|  * be populated by bean setter injection.  Once all the available properties have
 | |
|  * been set, the contraint will be initialized.
 | |
|  * 
 | |
|  * @author Derek Hulley
 | |
|  */
 | |
| public interface Constraint
 | |
| {
 | |
|     /**
 | |
|      * Returns the 'type' of the constraint, this is the identifier given to 
 | |
|      * constraint in the configuration.
 | |
|      *  
 | |
|      * @return The type
 | |
|      */
 | |
|     public String getType();
 | |
|     
 | |
|     /**
 | |
|      * Returns the parameters passed to the instance of the constraint.
 | |
|      * 
 | |
|      * @return Map of parameters, null if there are no parameters
 | |
|      */
 | |
|     public Map<String, Object> getParameters();
 | |
|     
 | |
|     /**
 | |
|      * Initializes the constraint with appropriate values, which will depend
 | |
|      * on the implementation itself.  This method can be implemented as a
 | |
|      * once-off, i.e. reinitialization does not have to be supported.
 | |
|      * 
 | |
|      * @param parameters constraint parameters
 | |
|      */
 | |
|     public void initialize();
 | |
|     
 | |
|     /**
 | |
|      * Evaluates a property value according to the implementation and initialization
 | |
|      * parameters provided.
 | |
|      * 
 | |
|      * @param value the property value to check
 | |
|      * 
 | |
|      * @throws ConstraintException if the value doesn't pass all constraints
 | |
|      */
 | |
|     public void evaluate(Object value);
 | |
| }
 |