Main Classes

#### Search Results

Search

# Main Classes

Adabas Client for Java uses a small set of classes to read or write data into or out of an Adabas database. The following table provides an overview of these main classes.

Class | Description | Example
--- | --- | ---
`AdabasConnection` | This class is used to create a main Adabas context. The parameter for `AdabasConnection` is an SQL-like string that contains all of the parameter needed to create a connection to Adabas. `AdabasSession` and `AdabasTarget` are created inside the `AdabasConnection` instance.
    AdabasConnection conn = AdabasConnection.createSession("ajc:map=MAPNAME;config=[1,4]");
    ReadRequest request = conn.createReadRequest();
| ComplexQueryWithMappingExample.java
`AdabasSession` | The `AdabasSession` class defines the user and security credentials. If no credentials are required, the basic Adabas ID is automatically generated.
    AdabasSession session = new AdabasSession(AuthType.ADA_PW_SECURITY);
    session.addCredentials(username.getBytes(), password.getBytes());
| AdabasAuthSearchExample.java
`AdabasTarget` | The `AdabasTarget` class defines the Adabas target URL, and is the basic handle for Adabas access. If multiple request classes are used, the common handle underneath is the `AdabasTarget` instance managing synchronization.
    AdabasTarget target = new AdabasTarget(dbid);
    target.open();
    target.et();
| QueryWithMappingExample.java
`ReadRequest` | The `ReadRequest` class handles a read of Adabas data. In the `ReadRequest` instance, a set of fields to be read is defined. The `ReadRequest` creates corresponding Adabas read definitions (metadata) in order to be able to call the query. In addition, the read offset, number of records and search criteria are provide to the `ReadRequest` instance to manage the corresponding Adabas read or search.
    ReadRequest request = new ReadRequest("MAP");
    request.setStart(1);
    request.setLimit(10);
    request.readIsnSequence();
| QueryWithMappingExample.java
`StoreRequest` | The `StoreRequest` class provides update and store functionality. A `StoreRequest` instance can define a set of fields, and these fields can be filled with value data. If a `ReadRequest` reads a record entry, this entry can be modified and updated in the database using the`StoreRequest` instance.
    StoreRequest request = conn.createStoreRequest();
    RecordEntry entry = request.createRecordEntry(new String[] {"NAME"});
    entry.addValue("NAME","ADAM");
    request.storeEntry(entry);
| StoreDataWithMappingExample.java
`DeleteRequest` | The `DeleteRequest` class is used to delete a single ISN or a set of ISNs.
    DeleteRequest deleteRequest = new DeleteRequest(request);
    deleteRequest.setIsnList(isnList.toArray(new Long[0]));
    deleteRequest.deleteRecords();
| DeleteExample.java
`RecordDefinition` | The `RecordDefinition` class describes the metadata information of the set of fields in a Request. The field information in the `RecordDefinition` can be overwritten, for example, the name or the field type can be changed. | QueryOverwriteMappingExample.java
`IRecordEntry` | The `IRecordEntry` interface defines a current Adabas record used by a request. The request can read or write the record entry. The `RecordEntry` class contains the Adabas specific hierarchical representation such Adabas groups, period groups or multiple fields. | QueryUsingAdabasNotationExample.java
`QueryResult` | If a listener class is using the `ReadRequest`, the read will return a `QueryResult` class instance. The instance contains a set of query information. That contains information about number of records. | QueryUsingListener.java
`QueryResultLis`t | The `QueryResultList` class provides the same information as the `QueryResult` class, but the `QueryResultList` contains a list of resulting records entries. The record list is stored in memory. When compared to `QueryResult`, `QueryResultList` is not recommended to be used with large lists of records. | ComplexQueryWithMappingExample.java
`QueryResultCursor` | QueryResultCursor is returned if readByCursor() read is used in a ReadRequest. The QueryResultCursor contains only a subset of records, unlike QueryResultList, which contains all of them. |
`AdaFieldType` | The `AdaFieldType` class is part of the `RecordDefinition` class. It contains all field options and metadata used in the request. In addition, map definitions and field type definitions are stored in the class instance. | QueryOverwriteMappingExample.java
`IAdaFieldValue` | The `IAdaFieldValue` interface provides data value information of the field.
    IAdaFieldValue fieldValueFirstName = record.valueOf("NAME");
    fieldValueFirstName.toString()
| QueryWithMappingExample.java
`IDataTypes.Types` | The Types enumeration contains all possible types of the fields. There is a default map automatism which generates, on behalf of the Adabas field or map definition, a corresponding field type to the metadata definition. It might be the case, that the default need to be overwritten. | AdabasToCsv.java
`SearchTree` | In simple queries, the setSearch() methods of `ReadRequest` instances might be sufficient to do search calls. For complex search queries, the `SearchTree` defines and chains a number of search criteria to a complex search. | QueryAdabasSpecialSearchExample.java