= Identifiers

:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
:page-partial:


The Apache Isis framework tracks the identity of each domain object.
This identity is represented to the end-user in human-readable form so that they know which object they are interacting with, and is also used and is available internally/for integrations.

This section explores these two related concepts.

[[title-and-icon-and-css-class]]
== Title, Icon etc.

To allow the end-user to distinguish one domain object from another, it is rendered with a title and an icon.
The icon informally identifies the type of the domain object, while the title identifies the instance.

* Title
+
The title of a domain object is shown in several places: as the main heading for an object; as a link text or tooltip for an object referencing another object, and also in tables representing collections of objects.
+
The title is not formally required to be a unique identify the object within its type, but it needs to be "unique enough" that a human user is able to distinguish one instance from another.
+
The title is usually just a simple string, but the framework also allows for the title to be translated into different locales.

* Icon
+
Sometimes it's helpful for the icon to represent more than just the object's type; it might also indicate the state of an object.
For example, a shipped `Order` might have a slightly different icon to a yet-to-be-shipped `Order`; or a library book that is `loaned out` might be distinguished from one that is `available`.


[TIP]
====
Details on how to actually write titles and icons (the programming model) can be found xref:userguide:fun:ui.adoc#object-titles-and-icons[here].
====


[[oid]]
== OIDs

As well as defining a xref:userguide:fun:concepts-patterns.adoc#metamodel[metamodel] of the structure (domain classes) of its domain objects, Apache Isis also manages the runtime instances of said domain objects.

When a domain entity is recreated from the database, the framework keeps track of its identity through an "OID": an object identifier.
Fundamentally this is a combination of its type (domain class), along with an identifier.
You can think of it as its "primary key", except across all domain entity types.

For portability and resilience, though, the object type is generally an alias for the actual domain class: thus "customers.CUS", say, rather than "com.mycompany.myapp.customers.Customer".
This is derived from an annotation.
The identifier meanwhile is always converted to a string.

Although simple, the OID is an enormously powerful concept: it represents a URI to any domain object managed by a given Apache Isis application.
With it, we have the ability to lookup any arbitrary domain objects.

Some examples:

* an OID allows sharing of information between users, eg as a deep link to be pasted into an email.

* the information within an OID could be converted into a barcode, and stamped onto a PDF form.
When the PDF is scanned by the mail room, the barcode could be read to attach the correspondence to the relevant domain object.

* as a handle to any object in an audit record, as used by xref:refguide:applib:index/services/publishing/spi/EntityPropertyChangeSubscriber.adoc[EntityPropertyChangeSubscriber];

* similarly within implementations of xref:refguide:applib:index/services/publishing/spi/CommandSubscriber.adoc[CommandSubscriber] to persist xref:refguide:applib:index/services/command/Command.adoc[Command] objects

* similarly within implementations of xref:refguide:applib:index/services/publishing/spi/ExecutionSubscriber.adoc[ExecutionSubscriber] to persist published action invocations

* and of course both the xref:vro:ROOT:about.adoc[RestfulObjects viewer] and xref:vw:ROOT:about.adoc[Web UI (Wicket viewer)] use the oid tuple to look up, render and allow the user to interact with domain objects.

Although the exact content of an OID should be considered opaque by domain objects, it is possible for domain objects to obtain OIDs.
These are represented as ``Bookmark``s, obtained from the xref:refguide:applib:index/services/bookmark/BookmarkService.adoc[BookmarkService].
Deep links meanwhile can be obtained from the xref:refguide:applib:index/services/linking/DeepLinkService.adoc[DeepLinkService].

OIDs can also be converted into XML format, useful for integration scenarios.
The xref:refguide:schema:common.adoc[common schema] XSD defines the `oidDto` complex type for precisely this purpose.

