[lsc-changes] r510 - lsc/trunk/src/main/java/org/lsc/beans

rschermesser at lsc-project.org rschermesser at lsc-project.org
Mon Nov 30 12:03:26 CET 2009


Author: rschermesser
Date: 2009-11-30 12:03:26 +0100 (Mon, 30 Nov 2009)
New Revision: 510

Modified:
   lsc/trunk/src/main/java/org/lsc/beans/LscBean.java
Log:
Reformat and simplify logging arguments

Modified: lsc/trunk/src/main/java/org/lsc/beans/LscBean.java
===================================================================
--- lsc/trunk/src/main/java/org/lsc/beans/LscBean.java	2009-11-30 10:00:53 UTC (rev 509)
+++ lsc/trunk/src/main/java/org/lsc/beans/LscBean.java	2009-11-30 11:03:26 UTC (rev 510)
@@ -88,14 +88,14 @@
 
 	/** The attributes map. */
 	private Map<String, Set<Object>> attrs;
-	
+
 	/** Data schema related to this bean - must always be set just after initiating the bean */
 	private DataSchemaProvider dataSchemaProvider;
 
 	public LscBean() {
 		attrs = new HashMap<String, Set<Object>>();
 	}
-	
+
 	/**
 	 * Get an attribute from its name.
 	 *
@@ -106,8 +106,7 @@
 		// use lower case since attribute names are case-insensitive
 		return SetUtils.setToAttribute(id, attrs.get(id.toLowerCase()));
 	}
-	
-	
+
 	/**
 	 * Get an attribute from its name as a Set.
 	 *
@@ -119,7 +118,6 @@
 		return attrs.get(id.toLowerCase());
 	}
 
-
 	/**
 	 * Get the <b>first</b> value of an attribute from its name
 	 *
@@ -133,7 +131,6 @@
 		return getAttributeFirstValueById(id);
 	}
 
-	
 	/**
 	 * Get the <b>first</b> value of an attribute from its name
 	 * 
@@ -148,7 +145,6 @@
 		return allValues.size() >= 1 ? allValues.get(0) : "";
 	}
 
-	
 	/**
 	 * Get all values of an attribute from its name
 	 * 
@@ -162,18 +158,18 @@
 		List<String> resultsArray = new ArrayList<String>();
 
 		Set<Object> attributeValues = attrs.get(id.toLowerCase());
-		
+
 		if (attributeValues != null) {
 			for (Object value : attributeValues) {
 				String stringValue;
-	
+
 				// convert to String because this method only returns Strings
 				if (value instanceof byte[]) {
 					stringValue = new String((byte[]) value);
 				} else {
 					stringValue = value.toString();
 				}
-	
+
 				resultsArray.add(stringValue);
 			}
 		}
@@ -181,7 +177,6 @@
 		return resultsArray;
 	}
 
-	
 	/**
 	 * Get the attributes name list.
 	 *
@@ -191,7 +186,6 @@
 		return attrs.keySet();
 	}
 
-	
 	/**
 	 * Set an attribute.
 	 * API CHANGE: Do nothing if attribute is empty
@@ -204,28 +198,24 @@
 			// convert the Attribute into a Set of values
 			try {
 				setAttribute(attr.getID(), SetUtils.attributeToSet(attr));
-			}
-			catch (NamingException e) {
-				LOGGER.error("Error storing the attribute {}: {}", new Object[]{attr.getID(), e.toString()});
+			} catch (NamingException e) {
+				LOGGER.error("Error storing the attribute {}: {}", attr.getID(), e.toString());
 				LOGGER.debug(e.toString(), e);
 			}
 		}
 	}
 
-	
 	/**
 	 * Set an attribute.
 	 *
 	 * @param attrName The attribute name.
 	 * @param attrValues A set of values for the attribute.
 	 */
-	public final void setAttribute(String attrName, Set<Object> attrValues)
-	{
+	public final void setAttribute(String attrName, Set<Object> attrValues) {
 		// use lower case since attribute names are case-insensitive
 		attrs.put(attrName.toLowerCase(), attrValues);
 	}
 
-	
 	/**
 	 * Default distinguish name getter.
 	 *
@@ -235,7 +225,6 @@
 		return distinguishedName;
 	}
 
-	
 	/**
 	 * Distinguish name getter that makes sure to return the FULL DN (including suffix).
 	 *
@@ -248,7 +237,6 @@
 			return distinguishedName;
 		}
 	}
-	
 
 	/**
 	 * Default distinguishName setter.
@@ -260,11 +248,9 @@
 		distinguishedName = dn;
 	}
 
-	
 	public void generateDn() throws NamingException {
 	}
 
-	
 	/**
 	 * Bean pretty printer.
 	 *
@@ -275,7 +261,7 @@
 		StringBuilder sb = new StringBuilder();
 		sb.append("dn: ").append(distinguishedName).append('\n');
 
-		for (String key: attrs.keySet()) {
+		for (String key : attrs.keySet()) {
 			Set<Object> values = attrs.get(key);
 			if (values != null) {
 				sb.append("=> " + key);
@@ -288,7 +274,6 @@
 		return sb.toString();
 	}
 
-	
 	/**
 	 * Clone this Bean object.
 	 * @return Object
@@ -299,7 +284,7 @@
 		try {
 			LscBean bean = (LscBean) this.getClass().newInstance();
 			bean.setDistinguishName(this.getDistinguishName());
-			
+
 			for (String attributeName : this.getAttributesNames()) {
 				bean.setAttribute(attributeName, this.getAttributeAsSetById(attributeName));
 			}
@@ -311,17 +296,14 @@
 		}
 	}
 
-	
 	public void setDataSchema(DataSchemaProvider dataSchema) {
 		this.dataSchemaProvider = dataSchema;
 	}
 
-	
 	public DataSchemaProvider getDataSchema() {
 		return dataSchemaProvider;
 	}
-	
-	
+
 	/**
 	 * Manage something there !
 	 * @param metaData
@@ -329,5 +311,4 @@
 	public static void setMetadata(ResultSetMetaData metaData) {
 		// TODO Auto-generated method stub
 	}
-
 }



More information about the lsc-changes mailing list