com.esri.adf.web.ags.data.edit.bean
Class ResourceBean

java.lang.Object
  extended by com.esri.adf.web.ags.data.edit.bean.ResourceBean
All Implemented Interfaces:
Serializable

public class ResourceBean
extends Object
implements Serializable

Defines all the dependencies for the edit bean, e.g. feature layers, workspaces. The object has an auto-cache mechanism. You can call dispose() method to release the cache.

See Also:
Serialized Form

Constructor Summary
ResourceBean(AGSLocalMapResource resource)
          Deprecated.  
ResourceBean(AGSLocalMapResource resource, String version, ConfigBean config)
          Instantiates an object of ResourceBean from a given resource.
 
Method Summary
 void clearAllSelection()
          Removes the highlight of the selection from the map.
 void clearAllVertices(WebGraphics graphic)
          Turnoff vertices on map.
 void clearSelection(Integer layerID)
          Clears the selection on the layer.
 void clearVertices(Integer layerID, WebGraphics graphic)
          Turns off vertices.
 void discard()
          Discards all the changes, and releases the workspace.
 void dispose()
          Releases all the cached resources.
protected  void finalize()
           
 void fireUnselectedEvent(ActionEventListener eventListener, WebContext context, Integer layerID, boolean removeAll)
          Fires a FeatureUnselectedEvent to the given listener.
 ActionContext getActionContext(Integer layerID, WebContext context)
          Creates an ActionContext from a WebContext object for the given layer.
 Map<Integer,com.esri.arcgis.carto.IFeatureLayer> getAllFeatureLayers()
          Gets all feature layers from the IMap.
 com.esri.arcgis.carto.IFeatureLayer getFeatureLayer(Integer layerID)
          Gets a feature layer by the given layer index..
 Map<Integer,com.esri.arcgis.carto.IFeatureLayer> getFeatureLayers()
          Gets valid feature layers from the IMap, only the layers conform the current config will be returned.
 com.esri.arcgisws.LayerDescription getLayerDescription(Integer layerID)
          Gets the LayerDescription by the given layer index.
 int getOID(Integer layerID, int index)
          Gets the selected feature by index.
 AGSLocalMapResource getResource()
          Gets the map service.
 Attribute[] getSelectedAttributes(Integer layerID, int indexOID, AttributeFilter filter, DateFormat dateFormat)
          Gets all attributes of the current selected feature.
 int[] getSelection(Integer layerID)
          Gets the feature selection on the given layer.
 com.esri.arcgis.geodatabase.IFeatureCursor getSelectionCusor(Integer layerID)
          Gets the feature cursor of the feature selections on the given layer.
 com.esri.arcgis.server.IServerContext getServerContext()
          Gets the IServerContext associated with the map service.
 EditBean.GeometryType getShapeType(Integer layerID)
          Gets the geometry type of the layer.
 SnapHandler getSnapHandler()
          Gets the SnapHandler associated with this map service.
 SnapRulesBean[] getSnapRules()
          Gets the snap rules.
 SnapRulesBean getSnapRules(Integer layerId)
          Gets the snap rules for the given layer.
 Map<Integer,LayerDefinition> getWebLayerDefinition()
          The LayerDefinitions are defined in faces-config.xml.
 EditWorkspace getWorkspace(Integer layerID)
          Gets the workspace associated with the layer.
 boolean hasEdits()
          Returns true if there are edits available.
 boolean hasRedo()
          Returns true if the action can be redo.
 boolean hasSelection(Integer layerID)
          Returns true if there are features selected on the given layer.
 boolean hasUndo()
          Return true if the action can be undo.
 boolean hasVertices(Integer layerID)
          Returns true if the show vertices is enabled on the given layer.
 boolean isBeingEdited()
          Returns true if it is in the middle of a editing session.
 boolean isPooled()
          Returns true if the map service is pooled.
 boolean isSnapEnabled()
          Returns true if snapping is enabled.
 void process(WebContext context, EditAction action, Integer layerID, boolean updateSelection, ActionEventListener editEventListener)
          Processes the action.
 void redo()
          Redo the action
 void reset(String newversion, ConfigBean configBean)
          Resets ResourceBean with the given version.
 void save()
          Saves all the changes and releases the workspace.
 void setHighLightColor(com.esri.arcgisws.RgbColor color)
          Sets the highlight color on the map service.
 void setWebLayerDefinition(Map<Integer,LayerDefinition> webLayerDefinition)
          The LayerDefinitions are defined in faces-config.xml.
 void showVertices(Integer layerID, WebGraphics graphic, WebSimpleMarkerSymbol sms, WebSpatialReference webref)
          Shows vertices on the selected features.
 void undo()
          Undo the previous action.
 void updateSelection(Integer layerID)
          Updated the selection feature on the given layer.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceBean

public ResourceBean(AGSLocalMapResource resource,
                    String version,
                    ConfigBean config)
             throws Exception
Instantiates an object of ResourceBean from a given resource.

Parameters:
resource - a map service.
version - the working version of the workspace. Set to null for non-versioned editing.
Throws:
Exception

ResourceBean

@Deprecated
public ResourceBean(AGSLocalMapResource resource)
Deprecated. 

Instantiates an object of ResourceBean from a given resource.

Parameters:
resource - a map service.
Method Detail

reset

public void reset(String newversion,
                  ConfigBean configBean)
           throws Exception
Resets ResourceBean with the given version.

Parameters:
newversion - The version to set.
Throws:
Exception

dispose

public void dispose()
Releases all the cached resources.


finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

getResource

public AGSLocalMapResource getResource()
Gets the map service.

Returns:
Returns the resource.

getSnapRules

public SnapRulesBean[] getSnapRules()
Gets the snap rules.

Returns:
Returns the snapTypes.

getSnapRules

public SnapRulesBean getSnapRules(Integer layerId)
Gets the snap rules for the given layer.

Returns:
Returns the snapTypes.

isSnapEnabled

public boolean isSnapEnabled()
Returns true if snapping is enabled.


getLayerDescription

public com.esri.arcgisws.LayerDescription getLayerDescription(Integer layerID)
                                                       throws Exception
Gets the LayerDescription by the given layer index.

Parameters:
layerID - the layer index.
Throws:
Exception

getFeatureLayer

public com.esri.arcgis.carto.IFeatureLayer getFeatureLayer(Integer layerID)
                                                    throws Exception
Gets a feature layer by the given layer index..

Parameters:
layerID - the layer index.
Returns:
the feature layer if the index is valid.
Throws:
Exception

getShapeType

public EditBean.GeometryType getShapeType(Integer layerID)
Gets the geometry type of the layer.

Parameters:
layerID - the layer index.
Returns:
the type.

getServerContext

public com.esri.arcgis.server.IServerContext getServerContext()
Gets the IServerContext associated with the map service.


getFeatureLayers

public Map<Integer,com.esri.arcgis.carto.IFeatureLayer> getFeatureLayers()
                                                                  throws Exception
Gets valid feature layers from the IMap, only the layers conform the current config will be returned.

Returns:
the index and feature layer pairs in a Map.
Throws:
Exception

getAllFeatureLayers

public Map<Integer,com.esri.arcgis.carto.IFeatureLayer> getAllFeatureLayers()
                                                                     throws Exception
Gets all feature layers from the IMap.

Returns:
the index and feature layer pairs in a Map.
Throws:
Exception

updateSelection

public void updateSelection(Integer layerID)
Updated the selection feature on the given layer.

Parameters:
layerID -

fireUnselectedEvent

public void fireUnselectedEvent(ActionEventListener eventListener,
                                WebContext context,
                                Integer layerID,
                                boolean removeAll)
Fires a FeatureUnselectedEvent to the given listener. The method checks the selection IDs of LayerDescription and the IDs in cache. If the ID is only in cache, it will fire the event against the ID. It should be invoked before updateSelection(Integer).

Parameters:
eventListener - the event listener.
context - the WebContext.
layerID - the current layer ID.
removeAll - set to sure if all the selected features have been unselected.

hasSelection

public boolean hasSelection(Integer layerID)
Returns true if there are features selected on the given layer.

Parameters:
layerID - the layer index.

hasVertices

public boolean hasVertices(Integer layerID)
Returns true if the show vertices is enabled on the given layer.

Parameters:
layerID - the layer index.

getOID

public int getOID(Integer layerID,
                  int index)
Gets the selected feature by index.

Parameters:
layerID - the layer index.
index - the feature index in the selection.
Returns:
the feature OID.

getSelection

public int[] getSelection(Integer layerID)
Gets the feature selection on the given layer.

Parameters:
layerID - layer index.
Returns:
the feature OID array.

getActionContext

public ActionContext getActionContext(Integer layerID,
                                      WebContext context)
                               throws Exception
Creates an ActionContext from a WebContext object for the given layer.

Parameters:
layerID - the layer index.
context - the current WebContext
Returns:
the created context.
Throws:
Exception

getWorkspace

public EditWorkspace getWorkspace(Integer layerID)
                           throws Exception
Gets the workspace associated with the layer.

Parameters:
layerID - the index of the layer.
Throws:
Exception

process

public void process(WebContext context,
                    EditAction action,
                    Integer layerID,
                    boolean updateSelection,
                    ActionEventListener editEventListener)
             throws Exception
Processes the action.

Parameters:
context - the current webcontext.
action - the action to process
layerID - the target layer index.
updateSelection - set to true is the action will update the feature selection.
editEventListener - the listener to handler the action events.
Throws:
Exception

hasEdits

public boolean hasEdits()
Returns true if there are edits available.


isBeingEdited

public boolean isBeingEdited()
Returns true if it is in the middle of a editing session.


clearSelection

public void clearSelection(Integer layerID)
                    throws Exception
Clears the selection on the layer.

Parameters:
layerID - the layer index.
Throws:
Exception

clearVertices

public void clearVertices(Integer layerID,
                          WebGraphics graphic)
Turns off vertices.

Parameters:
layerID - the layer ID.
graphic - the web graphics reference from web context.

clearAllVertices

public void clearAllVertices(WebGraphics graphic)
Turnoff vertices on map.

Parameters:
graphic - the web graphics.

isPooled

public boolean isPooled()
Returns true if the map service is pooled.


getSelectionCusor

public com.esri.arcgis.geodatabase.IFeatureCursor getSelectionCusor(Integer layerID)
                                                             throws Exception
Gets the feature cursor of the feature selections on the given layer.

Parameters:
layerID - the layer index.
Throws:
Exception

getSelectedAttributes

public Attribute[] getSelectedAttributes(Integer layerID,
                                         int indexOID,
                                         AttributeFilter filter,
                                         DateFormat dateFormat)
                                  throws Exception
Gets all attributes of the current selected feature.

Parameters:
layerID - the layer index.
indexOID - the index of the selected feature.
filter - the attribute filter.
dateFormat - the date format for date data.
Returns:
all attributes of the current selected feature.
Throws:
Exception

showVertices

public void showVertices(Integer layerID,
                         WebGraphics graphic,
                         WebSimpleMarkerSymbol sms,
                         WebSpatialReference webref)
                  throws Exception
Shows vertices on the selected features.

Parameters:
layerID - the layer index.
graphic - web graphics from web context
sms - vertex symbol
Throws:
Exception

clearAllSelection

public void clearAllSelection()
                       throws Exception
Removes the highlight of the selection from the map.

Throws:
Exception

save

public void save()
          throws Exception
Saves all the changes and releases the workspace.

Throws:
Exception

discard

public void discard()
             throws Throwable
Discards all the changes, and releases the workspace.

Throws:
Throwable

hasUndo

public boolean hasUndo()
Return true if the action can be undo.


hasRedo

public boolean hasRedo()
Returns true if the action can be redo.


redo

public void redo()
          throws Exception
Redo the action

Throws:
Exception

undo

public void undo()
          throws Exception
Undo the previous action.

Throws:
Exception

getSnapHandler

public SnapHandler getSnapHandler()
                           throws Exception
Gets the SnapHandler associated with this map service.

Throws:
Exception

setHighLightColor

public void setHighLightColor(com.esri.arcgisws.RgbColor color)
Sets the highlight color on the map service.

Parameters:
color - the color to set.

getWebLayerDefinition

public Map<Integer,LayerDefinition> getWebLayerDefinition()
The LayerDefinitions are defined in faces-config.xml. Editing Task honors the field alias settings if defined.

Returns:
Returns the webLayerDefinition.

setWebLayerDefinition

public void setWebLayerDefinition(Map<Integer,LayerDefinition> webLayerDefinition)
The LayerDefinitions are defined in faces-config.xml. Editing Task honors the field alias settings if defined.

Parameters:
webLayerDefinition - The webLayerDefinition to set.