Domino, Ajax e ?ReadViewEntries

From Wiki

Domino, Ajax e ?ReadViewEntries


Com o Ajax tornando-se um padrão para aplicações Web, muitos desenvolvedores Domino estão percebendo a importância das capacidades XML do Lotus Domino. A URL de comando ReadViewEntries foi adicionada ao código da versão 5.0.2 do Notes/Domino. Permitindo que uma visão seja representada puramente como XML.

Na Ajuda do Domino Designer estas url estão documentadas, mas neste artigo vamos explorar detalhes sobre o comando ReadViewEntries. A seguir daremos exemplos de seu uso e limitação.



?ReadViewEntries - comando para ler uma visão como XML

The following applies to all databases under the notes/data directory on a Domino server. Hidden design elements are hidden from the server too; you can’t use Domino URL commands to access documents in hidden views. Domino's security model applies. If a user is allowed to see a document, then it will be listed as an entry. Keep this in mind when designing all Domino databases. Hiding documents is not security. Utilize ACLs, Element access, and document level security. Don't rely on $ViewTemplates, they do not apply to views being requested as XML via ReadViewEnries.

In many ways the ReadViewEntries command works the same as the OpenView command. ReadViewEntries can be applied to view and folder elements with additional parameters that allow for control of the data set. In the example below, simply replace 'ReadViewEntries' with 'OpenView" in the URL, to get a better look at the request. That being said, searching a view and having the results returned as XML is not available at this time. The Query parameter will be ignored when used in conjunction with ReadViewEntries.

The results from the ReadViewEntries command is well formed XML. The schema for this and all Domino elements can be found in the notes\xmlschemas directory of any Domino or Notes install.

Caution: If the database property "Do Not Allow URL Open" is set, URL commands are disabled.

Estrutura Básica

Clique no Link para ver como é a estrutura Básica retornada pelo comando


[1]


Retorno em XML

<?xml version="1.0" encoding="UTF-8"?>
<viewentries toplevelentries="22">
 <viewentry position="1" unid="248DA8555A7B76DD852571BE004381F6" noteid="111646" siblings="22">
  <entrydata columnnumber="0" name="$1">
   <text>The Power of Flight</text>
  </entrydata>
 </viewentry>
 <viewentry position="2" unid="BE431990CDFBCFA5852571BE004331B8" noteid="111642" siblings="22">
  <entrydata columnnumber="0" name="$1">
   <text>X-Ray Vision</text>
  </entrydata>
 </viewentry>
 <viewentry position="3" unid="BD5D4670EA8B1984852571BE004308D4" noteid="111636" siblings="22">
  <entrydata columnnumber="0" name="$1">
   <text>Invulnerability</text>
  </entrydata>
 </viewentry>
</viewentries>


Exemplos e Síntaxe

http://Host/Database/ViewName?ReadViewEntries

http://www.lotus.com/ldd/nd6forum.nsf/Search?ReadViewEntries


http://Host/Database/ViewUniversalID?ReadViewEntries

http://www.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0?ReadViewEntries


http://Host/Database/$defaultview?ReadViewEntries

http://www.lotus.com/ldd/nd6forum.nsf/$defaultview?ReadViewEntries

(note: a default view must exist in the database)


Argumentos Opcionais para ReadViewEntries

Append optional arguments to refine the URL. Combine any of the following arguments for the desired result except where otherwise noted.


Collapse=n

Where n is the row number to display in collapsed format in a hierarchical view. Do not combine this argument with the ExpandView or CollapseView arguments. This works best on views that do not have the "Collapse all when database is first opened." property selected.

http://www.lotus.com/ldd/nd6forum.nsf/CategoryAllThreadedWeb?ReadViewEntries&Collapse=3


CollapseView

Displays the view in collapsed format. This works best on views that do not have the "Collapse all when database is first opened." property selected.

http://www.lotus.com/ldd/nd6forum.nsf/CategoryAllThreadedWeb?ReadViewEntries&CollapseView



Count=n

Where n is the number of rows to display. This is a request and is ultimately controlled by the "Maximum lines per view page" setting on the Domino Web Engine tab in the Server's Document. A value of -1 will request the maximum amount.

http://www-10.lotus.com/ldd/nd6forum.nsf/CategoryAllThreadedWeb?ReadViewEntries&Count=22



Expand=n

Where n is the row number to display in expanded format in a hierarchical view. Do not combine this argument with the ExpandView or CollapseView arguments.

http://www.lotus.com/ldd/nd6forum.nsf/CategoryAllThreadedWeb?ReadViewEntries&Expand=3


ExpandView

Displays the view in expanded format.

http://www.lotus.com/ldd/nd6forum.nsf/CategoryAllThreadedWeb?ReadViewEntries&ExpandView



KeyType=text|time

Specifies the type of StartKey. The default when no argument is specified is text. Setting the KeyType to time allows you to use a time value as the value for StartKey which dictates from what row to display the view and the value for UntilKey, which specifies where to stop display of the view. If &KeyType=time is specified, then &StartKey and &UntilKey may be ISO date time values. For example, you might use the time value 20020101T140000,00Z to represent 9:00AM Eastern standard Time in Coordinated Universal Time (UTC) or Greenwich Mean Time (GMT), or you might use the time value 20020101T090000,00-05 to represent the same date and time in local time plus offset.

http://www.lotus.com/ldd/nd6forum.nsf/Dateallflatweb?ReadViewEntries&StartKey=20060901T162000,00Z&KeyType=time


http://www.lotus.com/ldd/nd6forum.nsf/PlatformAllThreadedweb?ReadViewEntries&StartKey=Linux&KeyType=text


PreFormat

Causes all data types to be converted to text on the server. Text lists, numbers, dates and lists of numbers are converted to text before being sent. The server's locale is used for all formatting. Without this argument, the XML output stream contains information in structured, locale-neutral formats.

http://www.lotus.com/ldd/nd6forum.nsf/CategoryAllThreadedWeb?ReadViewEntries&ExpandView&PreFormat



ResortAscending=column number

Where column number is the 0-based number of the column in the view you wish to resort in ascending or descending alphanumeric order. The column to be sorted must be set up as sortable in the view design. If not no action is taken.

http://www.lotus.com/ldd/nd6forum.nsf/ReleaseAllThreadedWeb?ReadViewEntries&ExpandView&ResortAscending=3



ResortDecending=column number

Where column number is the 0-based number of the column in the view you wish to resort in ascending or descending alphanumeric order. The colue to be sorted must be set up as sortable in the view design. If not no action is taken.

http://www.lotus.com/ldd/nd6forum.nsf/ReleaseAllThreadedWeb?ReadViewEntries&ExpandView&ResortDecending=3



RestrictToCategory=category

Where category is the category to be displayed in the view. Sets the category for the "Show Single Category" object. Results will not include the Category, just its entries.

http://www-10.lotus.com/ldd/nd6forum.nsf/PlatformAllThreadedweb?ReadViewEntries&RestrictToCategory=iSeries


Start=n

Where n is the row number to start with when displaying the view. The row number in a hierarchical view can include subindexes (for example, Start=3.5.1 means the view will start at the third main topic, subtopic 5, document 1).

http://www.lotus.com/ldd/nd6forum.nsf/AuthorAllThreadedweb?ReadViewEntries&Start=11751



StartKey=string

Onde string é a chave para um documento numa visão ordenada. Se o documento existir mostrará o documento, senão o próximo documento dentro do critério será o ponto de início.

http://www.lotus.com/ldd/nd6forum.nsf/AuthorAllThreadedweb?ReadViewEntries&StartKey=Mac%20Guidera



UntilKey=string

UntilKey é somente válido quando usado com StartKey. Permite que você veja as entradas da Visão que começam com a StartKey e vão até os valores especificados na UntilKey. Por exemplo, o &StartKey=A&UntilKey=B mostrará todas as entradas que começam com A. Use a palavra-chave &Count limitar a quantidade de entradas retornadas dentro desta restrição.

http://www.lotus.com/ldd/nd6forum.nsf/PlatformAllThreadedweb?ReadViewEntries&Startkey=Linux&UntilKey=Windows

Ver também