Project

General

Profile

« Previous | Next » 

Revision 5846

add boolean return to indicate whether or not a property was modified

View differences:

src/edu/ucsb/nceas/metacat/properties/PropertyService.java
378 378
	 * @param propertyName
379 379
	 *            the name of the property to be checked and set
380 380
	 */
381
	public static void checkAndSetProperty(HttpServletRequest request, String propertyName)
381
	public static boolean checkAndSetProperty(HttpServletRequest request, String propertyName)
382 382
			throws GeneralPropertyException {
383
		properties.checkAndSetProperty(request, propertyName);
383
		return properties.checkAndSetProperty(request, propertyName);
384 384
	}
385 385

  
386 386
	/**
src/edu/ucsb/nceas/metacat/properties/SimpleProperties.java
189 189
	 * @param propertyName
190 190
	 *            the name of the property to be checked and set
191 191
	 */
192
	public void checkAndSetProperty(HttpServletRequest request, String propertyName) 
192
	public boolean checkAndSetProperty(HttpServletRequest request, String propertyName) 
193 193
			throws GeneralPropertyException {
194
		boolean changed = false;
194 195
		String value = getProperty(propertyName);
195 196
		String newValue = request.getParameter(propertyName);
196 197
		if (newValue != null && !newValue.trim().equals(value)) {
197 198
			setPropertyNoPersist(propertyName, newValue.trim());
199
			changed = true;
198 200
		}
201
		return changed;
199 202
	}
200 203
	
201 204
	public SortedProperties getMainBackupProperties() {
src/edu/ucsb/nceas/metacat/properties/ConfigurableProperties.java
517 517
	 * @param propertyName
518 518
	 *            the name of the property to be checked and set
519 519
	 */
520
	public void checkAndSetProperty(HttpServletRequest request, String propertyName) 
520
	public boolean checkAndSetProperty(HttpServletRequest request, String propertyName) 
521 521
			throws GeneralPropertyException {
522
		boolean changed = false;
522 523
		String value = getProperty(propertyName);
523 524
		String newValue = request.getParameter(propertyName);
524 525
		if (newValue != null && !newValue.trim().equals(value)) {
525 526
			setPropertyNoPersist(propertyName, newValue.trim());
527
			changed = true;
526 528
		}
529
		return changed;
527 530
	}
528 531

  
529 532
}
src/edu/ucsb/nceas/metacat/properties/PropertiesInterface.java
67 67
	
68 68
	public void persistProperties() throws GeneralPropertyException;
69 69
	
70
	public void checkAndSetProperty(HttpServletRequest request, String propertyName) throws GeneralPropertyException;
70
	public boolean checkAndSetProperty(HttpServletRequest request, String propertyName) throws GeneralPropertyException;
71 71

  
72 72
	public SortedProperties getMainBackupProperties() throws GeneralPropertyException;
73 73
	

Also available in: Unified diff