You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by dl...@apache.org on 2004/06/05 18:52:52 UTC
cvs commit: jakarta-jetspeed-2/components/prefs/src/java/org/apache/jetspeed/prefs/impl PropertyManagerImpl.java
dlestrat 2004/06/05 09:52:52
Modified: components/prefs/src/java/org/apache/jetspeed/prefs/impl
PropertyManagerImpl.java
Log:
Patch from Artem Grinshtein.
Revision Changes Path
1.7 +47 -57 jakarta-jetspeed-2/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PropertyManagerImpl.java
Index: PropertyManagerImpl.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed-2/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PropertyManagerImpl.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- PropertyManagerImpl.java 27 May 2004 19:30:45 -0000 1.6
+++ PropertyManagerImpl.java 5 Jun 2004 16:52:52 -0000 1.7
@@ -33,10 +33,12 @@
import org.apache.jetspeed.util.ArgUtil;
/**
- * <p>{@link PropertyManager} implementation relying on Jetspeed OJB
- * based persistence plugin for persistence.
- *
- * @author <a href="mailto:dlestrat@apache.org">David Le Strat</a>
+ * <p>
+ * {@link PropertyManager}implementation relying on Jetspeed OJB based
+ * persistence plugin for persistence.
+ * </p>
+ *
+ * @author <a href="mailto:dlestrat@apache.org">David Le Strat </a>
*/
public class PropertyManagerImpl implements PropertyManager
{
@@ -48,13 +50,15 @@
/** System <tt>Preferences</tt> node type. */
private static final int SYSTEM_NODE_TYPE = 1;
- /** Common queries. **/
+ /** Common queries. * */
private CommonQueries commonQueries;
private PersistenceStore persistenceStore;
/**
- * <p>Constructor providing access to the persistence component.</p>
+ * <p>
+ * Constructor providing access to the persistence component.
+ * </p>
*/
public PropertyManagerImpl(PersistenceStore persistenceStore)
{
@@ -68,28 +72,24 @@
}
/**
- * @see org.apache.jetspeed.prefs.PropertyManager#addPropertyKeys(java.util.prefs.Preferences, java.util.Map)
+ * @see org.apache.jetspeed.prefs.PropertyManager#addPropertyKeys(java.util.prefs.Preferences,
+ * java.util.Map)
*/
public void addPropertyKeys(Preferences prefNode, Map propertyKeysMap) throws PropertyException
{
- ArgUtil.notNull(
- new Object[] { prefNode, propertyKeysMap },
- new String[] { "prefNode", "propertyKeysMap", },
- "addPropertyKeys(java.util.prefs.Preferences, java.util.Collection)");
+ ArgUtil.notNull(new Object[]{prefNode, propertyKeysMap}, new String[]{"prefNode", "propertyKeysMap",},
+ "addPropertyKeys(java.util.prefs.Preferences, java.util.Collection)");
-
Node nodeObj;
if (prefNode.isUserNode())
{
- nodeObj =
- (Node) persistenceStore.getObjectByQuery(
- commonQueries.newNodeQueryByPathAndType(prefNode.absolutePath(), new Integer(USER_NODE_TYPE)));
+ nodeObj = (Node) persistenceStore.getObjectByQuery(commonQueries.newNodeQueryByPathAndType(prefNode
+ .absolutePath(), new Integer(USER_NODE_TYPE)));
}
else
{
- nodeObj =
- (Node) persistenceStore.getObjectByQuery(
- commonQueries.newNodeQueryByPathAndType(prefNode.absolutePath(), new Integer(SYSTEM_NODE_TYPE)));
+ nodeObj = (Node) persistenceStore.getObjectByQuery(commonQueries.newNodeQueryByPathAndType(prefNode
+ .absolutePath(), new Integer(SYSTEM_NODE_TYPE)));
}
if (null != nodeObj)
{
@@ -103,7 +103,7 @@
for (Iterator j = propertyKeys.iterator(); j.hasNext();)
{
PropertyKey existingPpk = (PropertyKey) j.next();
- if (existingPpk.getPropertyKeyName().equals((String) propertyKeysMap.get(currentPropertyKeyName)))
+ if (propertyKeysMap.containsKey(existingPpk.getPropertyKeyName()))
{
if (log.isDebugEnabled())
log.debug("Existing Property: " + (String) propertyKeysMap.get(currentPropertyKeyName));
@@ -116,10 +116,8 @@
{
if (log.isDebugEnabled())
log.debug("New Property: " + currentPropertyKeyName);
- PropertyKey ppk =
- new PropertyKeyImpl(
- currentPropertyKeyName,
- ((Integer) propertyKeysMap.get(currentPropertyKeyName)).intValue());
+ PropertyKey ppk = new PropertyKeyImpl(currentPropertyKeyName, ((Integer) propertyKeysMap
+ .get(currentPropertyKeyName)).intValue());
newPropertyKeys.add(ppk);
}
}
@@ -149,27 +147,24 @@
throw new PropertyException(PropertyException.NODE_NOT_FOUND);
}
}
-
/**
* @see org.apache.jetspeed.prefs.PropertyManager#getPropertyKeys(java.util.prefs.Preferences)
*/
public Map getPropertyKeys(Preferences prefNode)
{
- ArgUtil.notNull(new Object[] { prefNode }, new String[] { "prefNode" }, "getPropertyKeys(java.util.prefs.Preferences)");
-
+ ArgUtil.notNull(new Object[]{prefNode}, new String[]{"prefNode"},
+ "getPropertyKeys(java.util.prefs.Preferences)");
Node nodeObj;
if (prefNode.isUserNode())
{
- nodeObj =
- (Node) persistenceStore.getObjectByQuery(
- commonQueries.newNodeQueryByPathAndType(prefNode.absolutePath(), new Integer(USER_NODE_TYPE)));
+ nodeObj = (Node) persistenceStore.getObjectByQuery(commonQueries.newNodeQueryByPathAndType(prefNode
+ .absolutePath(), new Integer(USER_NODE_TYPE)));
}
else
{
- nodeObj =
- (Node) persistenceStore.getObjectByQuery(
- commonQueries.newNodeQueryByPathAndType(prefNode.absolutePath(), new Integer(SYSTEM_NODE_TYPE)));
+ nodeObj = (Node) persistenceStore.getObjectByQuery(commonQueries.newNodeQueryByPathAndType(prefNode
+ .absolutePath(), new Integer(SYSTEM_NODE_TYPE)));
}
if (null != nodeObj)
{
@@ -189,27 +184,24 @@
}
/**
- * @see org.apache.jetspeed.prefs.PropertyManager#removePropertyKeys(java.util.prefs.Preferences, java.util.Collection)
+ * @see org.apache.jetspeed.prefs.PropertyManager#removePropertyKeys(java.util.prefs.Preferences,
+ * java.util.Collection)
*/
public void removePropertyKeys(Preferences prefNode, Collection propertyKeys) throws PropertyException
{
- ArgUtil.notNull(
- new Object[] { prefNode, propertyKeys },
- new String[] { "prefNode", "propertyKeys" },
- "removePropertyKeys(java.util.prefs.Preferences, java.util.Collection)");
+ ArgUtil.notNull(new Object[]{prefNode, propertyKeys}, new String[]{"prefNode", "propertyKeys"},
+ "removePropertyKeys(java.util.prefs.Preferences, java.util.Collection)");
Node nodeObj;
if (prefNode.isUserNode())
{
- nodeObj =
- (Node) persistenceStore.getObjectByQuery(
- commonQueries.newNodeQueryByPathAndType(prefNode.absolutePath(), new Integer(USER_NODE_TYPE)));
+ nodeObj = (Node) persistenceStore.getObjectByQuery(commonQueries.newNodeQueryByPathAndType(prefNode
+ .absolutePath(), new Integer(USER_NODE_TYPE)));
}
else
{
- nodeObj =
- (Node) persistenceStore.getObjectByQuery(
- commonQueries.newNodeQueryByPathAndType(prefNode.absolutePath(), new Integer(SYSTEM_NODE_TYPE)));
+ nodeObj = (Node) persistenceStore.getObjectByQuery(commonQueries.newNodeQueryByPathAndType(prefNode
+ .absolutePath(), new Integer(SYSTEM_NODE_TYPE)));
}
if (null != nodeObj)
{
@@ -258,28 +250,26 @@
}
/**
- * @see org.apache.jetspeed.prefs.PropertyManager#updatePropertyKey(java.lang.String, java.util.prefs.Preferences, java.util.Map)
+ * @see org.apache.jetspeed.prefs.PropertyManager#updatePropertyKey(java.lang.String,
+ * java.util.prefs.Preferences, java.util.Map)
*/
- public void updatePropertyKey(String oldPropertyKeyName, Preferences prefNode, Map newPropertyKey) throws PropertyException
+ public void updatePropertyKey(String oldPropertyKeyName, Preferences prefNode, Map newPropertyKey)
+ throws PropertyException
{
- ArgUtil.notNull(
- new Object[] { oldPropertyKeyName, prefNode, newPropertyKey },
- new String[] { "oldPropertyKeyName", "prefNode", "newPropertyKey" },
- "updatePropertyKey(java.lang.String, java.util.prefs.Preferences, java.util.Map)");
+ ArgUtil.notNull(new Object[]{oldPropertyKeyName, prefNode, newPropertyKey}, new String[]{"oldPropertyKeyName",
+ "prefNode", "newPropertyKey"},
+ "updatePropertyKey(java.lang.String, java.util.prefs.Preferences, java.util.Map)");
-
Node nodeObj;
if (prefNode.isUserNode())
{
- nodeObj =
- (Node) persistenceStore.getObjectByQuery(
- commonQueries.newNodeQueryByPathAndType(prefNode.absolutePath(), new Integer(USER_NODE_TYPE)));
+ nodeObj = (Node) persistenceStore.getObjectByQuery(commonQueries.newNodeQueryByPathAndType(prefNode
+ .absolutePath(), new Integer(USER_NODE_TYPE)));
}
else
{
- nodeObj =
- (Node) persistenceStore.getObjectByQuery(
- commonQueries.newNodeQueryByPathAndType(prefNode.absolutePath(), new Integer(SYSTEM_NODE_TYPE)));
+ nodeObj = (Node) persistenceStore.getObjectByQuery(commonQueries.newNodeQueryByPathAndType(prefNode
+ .absolutePath(), new Integer(SYSTEM_NODE_TYPE)));
}
if (null != nodeObj)
{
@@ -320,4 +310,4 @@
}
}
-}
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org