Package lumis.portal.servicecontainer
Class ReplaceInterfacesStorage
- java.lang.Object
-
- lumis.portal.servicecontainer.ReplaceInterfacesStorage
-
public class ReplaceInterfacesStorage extends java.lang.Object
Storage for replace interfaces.- Since:
- 7.0.0
- Version:
- $Revision$ $Date$
-
-
Constructor Summary
Constructors Constructor Description ReplaceInterfacesStorage(java.lang.String replaceInterfacesStr)
Constructs a new storage with the given string.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getBaseItemForItem(java.lang.String item)
Returns the base item (root item) that is being replaced for the given item.java.util.Map<java.lang.String,java.lang.String>
getMap()
Returns the replace map.protected java.lang.String
getReplaceInterfaceParametersParameterName()
java.lang.String
getStackTopByExistentItem(java.lang.String item)
Returns the top of replace stack by a given item.java.lang.String
getStateString()
Returns the state of replace interface information as a string in the format forPortalRequestParameters.PAGE_PARAMETER_REPLACE_INTERFACES_STATE
.java.lang.String
handleReplaceInterfaceOperations(java.lang.String currentInterfaceInstanceId, java.lang.String[] replaceInterfaceOperations, PortalRequestParameters parameters)
Handles the replace interface commands.java.lang.String
put(java.lang.String source, java.lang.String target)
Creates a new replace mappingsource
->target
.java.lang.String
remove(java.lang.String item)
Removes the given interface instance from the replace map (searching it as the mapping key).
-
-
-
Constructor Detail
-
ReplaceInterfacesStorage
public ReplaceInterfacesStorage(java.lang.String replaceInterfacesStr) throws java.io.UnsupportedEncodingException
Constructs a new storage with the given string.The string must be formatted as following:
originInterfaceInstance=destinationInterfaceInstance(;originInterfaceInstance=destinationInterfaceInstance)*
Where:-
originInterfaceInstance
is the original interface instance. -
destinationInterfaceInstance
is the interface instance that is replacing the original one.
null
or empty no interface instance is being replaced.- Parameters:
replaceInterfacesStr
- the string of replaces.- Throws:
java.io.UnsupportedEncodingException
- Since:
- 7.0.0
-
-
-
Method Detail
-
getStateString
public java.lang.String getStateString()
Returns the state of replace interface information as a string in the format forPortalRequestParameters.PAGE_PARAMETER_REPLACE_INTERFACES_STATE
.- Returns:
- the state of replace interface information as a string in the format for
PortalRequestParameters.PAGE_PARAMETER_REPLACE_INTERFACES_STATE
. - Since:
- 7.0.0
-
getMap
public java.util.Map<java.lang.String,java.lang.String> getMap()
Returns the replace map.- Returns:
- the replace map.
- Since:
- 7.0.0
-
getStackTopByExistentItem
public java.lang.String getStackTopByExistentItem(java.lang.String item)
Returns the top of replace stack by a given item.- Parameters:
item
- the item used to search in the map.- Returns:
- the top of replace stack by a given item.
- Since:
- 7.0.0
-
getBaseItemForItem
public java.lang.String getBaseItemForItem(java.lang.String item)
Returns the base item (root item) that is being replaced for the given item.- Parameters:
item
- the item used to search in the map.- Returns:
- the base item.
- Since:
- 7.1.1
-
remove
public java.lang.String remove(java.lang.String item)
Removes the given interface instance from the replace map (searching it as the mapping key).- Parameters:
item
- the item to be removed.- Returns:
- the result of
Map.remove(Object)
. - Since:
- 7.0.0
-
put
public java.lang.String put(java.lang.String source, java.lang.String target)
Creates a new replace mappingsource
->target
.- Parameters:
source
- the interface instance that is going to be replaced.target
- the interface instance that is going to replace.- Returns:
- the result of
Map.put(Object, Object)
. - Since:
- 7.0.0
-
handleReplaceInterfaceOperations
public java.lang.String handleReplaceInterfaceOperations(java.lang.String currentInterfaceInstanceId, java.lang.String[] replaceInterfaceOperations, PortalRequestParameters parameters) throws PortalException
Handles the replace interface commands. Also applies the properly parameters inPortalRequestParameters
if needed. Returns the result interface instance after the commands are applied. The commands are formatted in a string array. Each command string may have multiple commands separated by a ',
' character.The supported commands are:
-
r
: removes the current interface instance from the replaces map. After this command is executed, the current interface instance becomes the one that it was replacing.
In other words, if the current interface instance is II-2, there is an interface instance II-1 such that II-2 is replacing II-1 and a commandr
is executed, the current interface instance becomes II-1. -
a
: this command adds a new replace mapping. It must be followed by the interface instance that is going to replace the current interface instance. After this command is executed, the current interface instance becomes the given one.
In other words, if II-1 is the current interface instance and the commandaII-2
is executed, the interface instance II-2 replaces the interface instance II-1 and II-2 becomes the current interface instance.
- Parameters:
currentInterfaceInstanceId
- the current interface instance.replaceInterfaceOperations
- the replace commands array.parameters
- the replace interface parameters.- Returns:
- the result interface instance after the commands are applied.
- Throws:
PortalException
- Since:
- 7.0.0
-
-
getReplaceInterfaceParametersParameterName
protected java.lang.String getReplaceInterfaceParametersParameterName()
-
-