Author: scottbw
Date: Mon Feb 20 14:52:16 2012
New Revision: 1291294
URL: http://svn.apache.org/viewvc?rev=1291294&view=rev
Log:
Removed services and types from JCR module (see WOOKIE-263)
Removed:
incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetDefaultImpl.java
incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetServiceImpl.java
incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetTypeImpl.java
Modified:
incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/JCRPersistenceManager.java
incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetImpl.java
Modified:
incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/JCRPersistenceManager.java
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/JCRPersistenceManager.java?rev=1291294&r1=1291293&r2=1291294&view=diff
==============================================================================
---
incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/JCRPersistenceManager.java
(original)
+++
incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/JCRPersistenceManager.java
Mon Feb 20 14:52:16 2012
@@ -64,11 +64,8 @@ import org.apache.wookie.beans.IPreferen
import org.apache.wookie.beans.ISharedData;
import org.apache.wookie.beans.IStartFile;
import org.apache.wookie.beans.IWidget;
-import org.apache.wookie.beans.IWidgetDefault;
import org.apache.wookie.beans.IWidgetIcon;
import org.apache.wookie.beans.IWidgetInstance;
-import org.apache.wookie.beans.IWidgetService;
-import org.apache.wookie.beans.IWidgetType;
import org.apache.wookie.beans.jcr.impl.ApiKeyImpl;
import org.apache.wookie.beans.jcr.impl.DescriptionImpl;
import org.apache.wookie.beans.jcr.impl.FeatureImpl;
@@ -80,12 +77,9 @@ import org.apache.wookie.beans.jcr.impl.
import org.apache.wookie.beans.jcr.impl.PreferenceImpl;
import org.apache.wookie.beans.jcr.impl.SharedDataImpl;
import org.apache.wookie.beans.jcr.impl.StartFileImpl;
-import org.apache.wookie.beans.jcr.impl.WidgetDefaultImpl;
import org.apache.wookie.beans.jcr.impl.WidgetIconImpl;
import org.apache.wookie.beans.jcr.impl.WidgetImpl;
import org.apache.wookie.beans.jcr.impl.WidgetInstanceImpl;
-import org.apache.wookie.beans.jcr.impl.WidgetServiceImpl;
-import org.apache.wookie.beans.jcr.impl.WidgetTypeImpl;
import org.apache.wookie.beans.util.IPersistenceManager;
import org.apache.wookie.beans.util.PersistenceCommitException;
@@ -127,18 +121,13 @@ public class JCRPersistenceManager imple
INTERFACE_TO_CLASS_MAP.put(ISharedData.class, SharedDataImpl.class);
INTERFACE_TO_CLASS_MAP.put(IStartFile.class, StartFileImpl.class);
INTERFACE_TO_CLASS_MAP.put(IWidget.class, WidgetImpl.class);
- INTERFACE_TO_CLASS_MAP.put(IWidgetDefault.class,
WidgetDefaultImpl.class);
INTERFACE_TO_CLASS_MAP.put(IWidgetIcon.class, WidgetIconImpl.class);
INTERFACE_TO_CLASS_MAP.put(IWidgetInstance.class,
WidgetInstanceImpl.class);
- INTERFACE_TO_CLASS_MAP.put(IWidgetService.class,
WidgetServiceImpl.class);
- INTERFACE_TO_CLASS_MAP.put(IWidgetType.class, WidgetTypeImpl.class);
BEAN_INTERFACE_TO_CLASS_MAP.put(IApiKey.class, ApiKeyImpl.class);
BEAN_INTERFACE_TO_CLASS_MAP.put(IParticipant.class,
ParticipantImpl.class);
BEAN_INTERFACE_TO_CLASS_MAP.put(IWidget.class, WidgetImpl.class);
- BEAN_INTERFACE_TO_CLASS_MAP.put(IWidgetDefault.class,
WidgetDefaultImpl.class);
BEAN_INTERFACE_TO_CLASS_MAP.put(IWidgetInstance.class,
WidgetInstanceImpl.class);
- BEAN_INTERFACE_TO_CLASS_MAP.put(IWidgetService.class,
WidgetServiceImpl.class);
IMPLEMENTATION_FIELD_MAP.put("widget", "widgetImpl");
}
@@ -816,99 +805,6 @@ public class JCRPersistenceManager imple
}
/* (non-Javadoc)
- * @see
org.apache.wookie.beans.util.IPersistenceManager#findWidgetDefaultByType(java.lang.String)
- */
- public IWidget findWidgetDefaultByType(String widgetContext)
- {
- // validate object content manager transaction
- if (ocm == null)
- {
- throw new IllegalStateException("Transaction not initiated or
already closed");
- }
-
- // get default widget by type
- if (widgetContext != null)
- {
- try
- {
- IWidgetDefault [] widgetDefault =
findByValue(IWidgetDefault.class, "widgetContext", widgetContext);
- if (widgetDefault.length == 1)
- {
- return widgetDefault[0].getWidget();
- }
- }
- catch (Exception e)
- {
- logger.error("Unexpected exception: "+e, e);
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see
org.apache.wookie.beans.util.IPersistenceManager#findWidgetInstance(java.lang.String,
java.lang.String, java.lang.String, java.lang.String)
- */
- public IWidgetInstance findWidgetInstance(String apiKey, String userId,
String sharedDataKey, String serviceContext)
- {
- // validate object content manager transaction
- if (ocm == null)
- {
- throw new IllegalStateException("Transaction not initiated or
already closed");
- }
-
- // get widget instance
- if ((apiKey != null) && (userId != null) && (sharedDataKey != null) &&
(serviceContext != null))
- {
- try
- {
- // get candidate widget instances
- Map<String, Object> values = new HashMap<String, Object>();
- values.put("apiKey", apiKey);
- values.put("userId", userId);
- values.put("sharedDataKey", sharedDataKey);
- IWidgetInstance [] widgetInstances =
findByValues(IWidgetInstance.class, values);
-
- // filter widget instances by widget type/context
- IWidgetInstance foundWidgetInstance = null;
- for (IWidgetInstance widgetInstance : widgetInstances)
- {
- // check widget type/context
- boolean hasServiceContext = false;
- for (IWidgetType widgetType :
widgetInstance.getWidget().getWidgetTypes())
- {
- if
(widgetType.getWidgetContext().equals(serviceContext))
- {
- hasServiceContext = true;
- break;
- }
- }
- if (hasServiceContext)
- {
- // validate search matches only one widget
- if (foundWidgetInstance != null)
- {
- foundWidgetInstance = null;
- break;
- }
- foundWidgetInstance = widgetInstance;
- }
- }
-
- // return single matching widget instance
- if (foundWidgetInstance != null)
- {
- return foundWidgetInstance;
- }
- }
- catch (Exception e)
- {
- logger.error("Unexpected exception: "+e, e);
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
* @see
org.apache.wookie.beans.util.IPersistenceManager#findWidgetInstanceByGuid(java.lang.String,
java.lang.String, java.lang.String, java.lang.String)
*/
public IWidgetInstance findWidgetInstanceByGuid(String apiKey, String
userId, String sharedDataKey, String widgetGuid)
@@ -979,46 +875,6 @@ public class JCRPersistenceManager imple
return null;
}
- public IWidget[] findWidgetsByType(String widgetContext)
- {
- // validate object content manager transaction
- if (ocm == null)
- {
- throw new IllegalStateException("Transaction not initiated or
already closed");
- }
-
- // get widgets by type
- if (widgetContext != null)
- {
- try
- {
- // get candidate widgets
- IWidget [] widgets = findAll(IWidget.class);
-
- // filter widgets by widget type/context
- Collection<IWidget> foundWidgets = new ArrayList<IWidget>();
- for (IWidget widget : widgets)
- {
- // check widget type/context
- for (IWidgetType widgetType : widget.getWidgetTypes())
- {
- if
(widgetType.getWidgetContext().equals(widgetContext))
- {
- foundWidgets.add(widget);
- break;
- }
- }
- }
- return foundWidgets.toArray(new IWidget[foundWidgets.size()]);
- }
- catch (Exception e)
- {
- logger.error("Unexpected exception: "+e, e);
- }
- }
- return new IWidget[0];
- }
-
/* (non-Javadoc)
* @see
org.apache.wookie.beans.util.IPersistenceManager#newInstance(java.lang.Class)
*/
Modified:
incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetImpl.java
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetImpl.java?rev=1291294&r1=1291293&r2=1291294&view=diff
==============================================================================
---
incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetImpl.java
(original)
+++
incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetImpl.java
Mon Feb 20 14:52:16 2012
@@ -29,7 +29,6 @@ import org.apache.wookie.beans.IPreferen
import org.apache.wookie.beans.IStartFile;
import org.apache.wookie.beans.IWidget;
import org.apache.wookie.beans.IWidgetIcon;
-import org.apache.wookie.beans.IWidgetType;
import org.apache.wookie.beans.jcr.IPathBean;
import org.apache.wookie.beans.jcr.IUuidBean;
import org.apache.wookie.beans.jcr.IdCollection;
@@ -73,9 +72,6 @@ public class WidgetImpl extends Localize
@Field(jcrName="wookie:widgetVersion")
private String version;
-
@org.apache.jackrabbit.ocm.mapper.impl.annotation.Collection(jcrName="wookie:widgetTypes",
elementClassName=WidgetTypeImpl.class)
- private Collection<WidgetTypeImpl> widgetTypeImpls;
-
@org.apache.jackrabbit.ocm.mapper.impl.annotation.Collection(jcrName="wookie:features",
elementClassName=FeatureImpl.class)
private Collection<FeatureImpl> featureImpls;
@@ -682,53 +678,6 @@ public class WidgetImpl extends Localize
}
/* (non-Javadoc)
- * @see org.apache.wookie.beans.IWidget#getWidgetTypes()
- */
- public Collection<IWidgetType> getWidgetTypes()
- {
- if (widgetTypeImpls == null)
- {
- widgetTypeImpls = new ArrayList<WidgetTypeImpl>();
- }
- return new IdCollection<WidgetTypeImpl,IWidgetType>(widgetTypeImpls);
- }
-
- /* (non-Javadoc)
- * @see
org.apache.wookie.beans.IWidget#setWidgetTypes(java.util.Collection)
- */
- public void setWidgetTypes(Collection<IWidgetType> widgetTypes)
- {
- getWidgetTypes().clear();
- if (widgetTypes != null)
- {
- for (IWidgetType widgetType : widgetTypes)
- {
- getWidgetTypes().add((WidgetTypeImpl)widgetType);
- }
- }
- }
-
- /**
- * Get widget type implementations collection.
- *
- * @return widget type implementations collection
- */
- public Collection<WidgetTypeImpl> getWidgetTypeImpls()
- {
- return widgetTypeImpls;
- }
-
- /**
- * Set widget type implementations collection.
- *
- * @param widgetTypeImpls widget type implementations collection
- */
- public void setWidgetTypeImpls(Collection<WidgetTypeImpl> widgetTypeImpls)
- {
- this.widgetTypeImpls = widgetTypeImpls;
- }
-
- /* (non-Javadoc)
* @see org.apache.wookie.beans.IWidget#getWidth()
*/
public Integer getWidth()