Class Position
- java.lang.Object
-
- org.apache.jackrabbit.webdav.ordering.Position
-
- All Implemented Interfaces:
OrderingConstants
,XmlSerializable
public class Position extends Object implements OrderingConstants, XmlSerializable
Position
encapsulates the position in ordering information contained in a Webdav request. This includes both thePosition header
and the position Xml element present in the request body of an ORDERPATCH request.
-
-
Field Summary
-
Fields inherited from interface org.apache.jackrabbit.webdav.ordering.OrderingConstants
HEADER_ORDERING_TYPE, HEADER_POSITION, NAMESPACE, ORDERING_TYPE, ORDERING_TYPE_CUSTOM, ORDERING_TYPE_UNORDERED, SUPPORTED_LIVE_PROPERTY_SET, SUPPORTED_METHOD_SET, XML_AFTER, XML_BEFORE, XML_FIRST, XML_LAST, XML_ORDER_MEMBER, XML_ORDERING_TYPE, XML_ORDERPATCH, XML_POSITION, XML_SEGMENT
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Position
createFromXml(Element positionElement)
Create a newPosition
object from the specified position element.String
getSegment()
Returns the segment used to create thisPosition
object ornull
if no segment is present with the type.String
getType()
Element
toXml(Document document)
Returns the xml representation of the implementing object asElement
.
-
-
-
Constructor Detail
-
Position
public Position(String type)
Create a newPosition
object with the specified type. Since any type except forfirst
andlast
must be combined with a segment, only the mentioned types are valid arguments.- Parameters:
type
-first
orlast
- Throws:
IllegalArgumentException
- if the given type is other thanOrderingConstants.XML_FIRST
orOrderingConstants.XML_LAST
.
-
Position
public Position(String type, String segment)
Create a newPosition
object with the specified type and segment.- Parameters:
type
-segment
-- Throws:
IllegalArgumentException
- if the specified type and segment do not form a valid pair.
-
-
Method Detail
-
getType
public String getType()
Return the type of thisPosition
object, which may be any of the following valid types:first
,last
,after
,before
- Returns:
- type
-
getSegment
public String getSegment()
Returns the segment used to create thisPosition
object ornull
if no segment is present with the type.- Returns:
- segment or
null
- See Also:
getType()
-
toXml
public Element toXml(Document document)
Description copied from interface:XmlSerializable
Returns the xml representation of the implementing object asElement
. The givenDocument
is used as factory and represents theowner document
of the returned DOM element.- Specified by:
toXml
in interfaceXmlSerializable
- Parameters:
document
-- Returns:
- a w3c element representing this object
- See Also:
XmlSerializable.toXml(Document)
-
createFromXml
public static Position createFromXml(Element positionElement)
Create a newPosition
object from the specified position element. The element must fulfill the following structure:
<!ELEMENT position (first | last | before | after) > <!ELEMENT segment (#PCDATA) > <!ELEMENT first EMPTY > <!ELEMENT last EMPTY > <!ELEMENT before segment > <!ELEMENT after segment >
- Parameters:
positionElement
- Xml element defining the position.- Throws:
IllegalArgumentException
- if the given Xml element is not valid.
-
-