org.apache.jackrabbit.webdav.ordering
Class Position

java.lang.Object
  extended byorg.apache.jackrabbit.webdav.ordering.Position
All Implemented Interfaces:
OrderingConstants

public class Position
extends Object
implements OrderingConstants

Position encapsulates the position in ordering information contained in a Webdav request. This includes both the Position header and the position Xml element present in the request body of an ORDERPATCH request.

See Also:
OrderingConstants.HEADER_POSITION, OrderingConstants.XML_POSITION, OrderPatch

Field Summary
static int TYPE_AFTER
           
static int TYPE_BEFORE
           
static int TYPE_FIRST
           
static int TYPE_LAST
           
 
Fields inherited from interface org.apache.jackrabbit.webdav.ordering.OrderingConstants
HEADER_ORDERING_TYPE, HEADER_POSITION, 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
 
Constructor Summary
Position(org.jdom.Element position)
          Create a new Position object from the specified position element.
Position(String type)
          Create a new Position object with the specified type.
Position(String type, String segment)
          Create a new Position object with the specified type and segment.
 
Method Summary
 String getSegment()
          Returns the segment used to create this Position object or null if no segment is present with the type.
 int getType()
          Return the type of this Position object, which may be any of the following valid types: first, last, after, before
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_FIRST

public static final int TYPE_FIRST
See Also:
Constant Field Values

TYPE_LAST

public static final int TYPE_LAST
See Also:
Constant Field Values

TYPE_BEFORE

public static final int TYPE_BEFORE
See Also:
Constant Field Values

TYPE_AFTER

public static final int TYPE_AFTER
See Also:
Constant Field Values
Constructor Detail

Position

public Position(String type)
Create a new Position object with the specified type. Since any type except for first and last must be combined with a segment, only the mentioned types are valid arguments.

Parameters:
type - first or last
Throws:
IllegalArgumentException - if the given type is other than OrderingConstants.XML_FIRST or OrderingConstants.XML_LAST.

Position

public Position(org.jdom.Element position)
Create a new Position 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:
position - Xml element defining the position.
Throws:
IllegalArgumentException - if the given Xml element is not valid.

Position

public Position(String type,
                String segment)
Create a new Position 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 int getType()
Return the type of this Position 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 this Position object or null if no segment is present with the type.

Returns:
segment or null
See Also:
getType()


Copyright © 2005 . All Rights Reserved.