org.springframework.roo.addon.surf.component
Class ComponentOperations

java.lang.Object
  extended by org.springframework.roo.addon.surf.component.ComponentOperations

public class ComponentOperations
extends Object

Provides Surf component related operations.

Since:
1.0
Author:
Yong Qu

Constructor Summary
ComponentOperations(org.springframework.roo.process.manager.FileManager fileManager, org.springframework.roo.project.PathResolver pathResolver, org.springframework.roo.metadata.MetadataService metadataService, org.springframework.roo.project.ProjectOperations projectOperations)
           
 
Method Summary
 void createComponent(String pageId, String regionId, String componentType, String options)
          Creates a new component.
 void createComponentProperty(String componentName, String propertyList)
          Adds new properties to the component configuration xml.
 void createComponentResource(String componentName, String attributeList, String contentBody)
          Adds a new resource to the component configuration xml.
 String getComponentInstanceName(String pageInstanceName, String templateInstanceName, String regionId, String scope)
          Returns component name.
 String getComponentUrl(String instanceName)
          Returns component url.
 boolean isSurfComponentAvailable(String componentId)
          Checks if a Surf component exists or not.
 boolean isSurfComponentOperationsAvailable()
          Checks if Surf component related operations are available.
 boolean isSurfComponentTypeAvailable(String componentPath)
          Checks if the component type is available.
 SortedSet<String> listGlobalScopedSurfComponents()
          Returns list of global scoped Surf components.
 SortedSet<String> listPageScopedSurfComponents(String pageId)
          List of page scoped Surf components.
 SortedSet<String> listSurfComponents(String scopeId, String pageId, String templateId)
          Returns all available components.
 SortedSet<String> listSurfComponentTypes()
          Returns list of all available component types.
 SortedSet<String> listTemplateScopedSurfComponents(String templateId)
          Returns list of template scoped Surf component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentOperations

public ComponentOperations(org.springframework.roo.process.manager.FileManager fileManager,
                           org.springframework.roo.project.PathResolver pathResolver,
                           org.springframework.roo.metadata.MetadataService metadataService,
                           org.springframework.roo.project.ProjectOperations projectOperations)
Parameters:
fileManager -
pathResolver -
metadataService -
projectOperations -
Method Detail

isSurfComponentOperationsAvailable

public boolean isSurfComponentOperationsAvailable()
Checks if Surf component related operations are available.

Returns:
true if Surf component related operations are available.

listGlobalScopedSurfComponents

public SortedSet<String> listGlobalScopedSurfComponents()
Returns list of global scoped Surf components.

Returns:
List of global scoped Surf components.

listPageScopedSurfComponents

public SortedSet<String> listPageScopedSurfComponents(String pageId)
List of page scoped Surf components.

Parameters:
pageId - Page id.
Returns:
List of page scoped Surf components.

listTemplateScopedSurfComponents

public SortedSet<String> listTemplateScopedSurfComponents(String templateId)
Returns list of template scoped Surf component.

Parameters:
templateId - Template id.
Returns:
List of template scoped Surf component.

listSurfComponents

public SortedSet<String> listSurfComponents(String scopeId,
                                            String pageId,
                                            String templateId)
Returns all available components.

Parameters:
scopeId - Component scope.
pageId - Page id.
templateId - Template id.
Returns:
List of components.

listSurfComponentTypes

public SortedSet<String> listSurfComponentTypes()
Returns list of all available component types.

Returns:
List of component types.

isSurfComponentAvailable

public boolean isSurfComponentAvailable(String componentId)
Checks if a Surf component exists or not.

Parameters:
componentId - Component id.
Returns:
True if it exists. False if it doesn't.

isSurfComponentTypeAvailable

public boolean isSurfComponentTypeAvailable(String componentPath)
Checks if the component type is available.

Parameters:
componentPath - Component path .
Returns:
True if it exists. False if it doesn't.

createComponent

public void createComponent(String pageId,
                            String regionId,
                            String componentType,
                            String options)
Creates a new component.

Parameters:
pageId - Page id.
templatePath - Path of the template used for creating component.
regionId - Region id.
componentType - Component type.
options - Additional options.

createComponentResource

public void createComponentResource(String componentName,
                                    String attributeList,
                                    String contentBody)
Adds a new resource to the component configuration xml. The format of attribute list looks like attr1:val1|attr2:val2|attr3:val3 .

Parameters:
componentName - Component name.
attributeList - List of attributes for the new resource.
contentBody - Resource text content.

createComponentProperty

public void createComponentProperty(String componentName,
                                    String propertyList)
Adds new properties to the component configuration xml. The format of input string looks like name1:val1|name2:val2|name3:val3 .

Parameters:
componentName - Component name.
propertyList - List of new properties.

getComponentInstanceName

public String getComponentInstanceName(String pageInstanceName,
                                       String templateInstanceName,
                                       String regionId,
                                       String scope)
Returns component name.

Parameters:
pageInstanceName - Page instance name.
templateInstanceName - Template instance name.
regionId - Region id.
scope - Region scope.
Returns:
Component name.

getComponentUrl

public String getComponentUrl(String instanceName)
Returns component url.

Parameters:
instanceName - Component instance.
Returns:
Component url.


Copyright © 2009 SpringSource, Inc. All Rights Reserved.