=== Bookmarks

: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 xref:refguide:applib:index/annotation/DomainObjectLayout.adoc#bookmarking[bookmarking()] element indicates that an entity is automatically bookmarked.

In the xref:vw:ROOT:about.adoc[Web UI (Wicket viewer)], a link to a bookmarked object is shown in the bookmarks panel, top right.


For example:

[source,java]
----
@DomainObject(bookmarking=BookmarkPolicy.AS_ROOT)
public class ToDoItem ... {
    ...
}
----

indicates that the `ToDoItem` class is bookmarkable:

It is also possible to nest bookmarkable entities.
For example:

image::refguide:applib-ant:reference-annotations/DomainObjectLayout/bookmarking-nested.png[width="720px"]


For example, the `Property` entity "[OXF] Oxford Super Mall" is a root bookmark, but the `Unit` child entity "[OXF-001] Unit 1" only appears as a bookmark _but only if_ its parent `Property` has already been bookmarked.

This is accomplished with the following annotations:

[source,java]
----
@DomainObject(bookmarking=BookmarkPolicy.AS_ROOT)
public class Property {
    // ...
}
----

and

[source,java]
----
@DomainObject(bookmarking=BookmarkPolicy.AS_CHILD)
public abstract class Unit {
    // ...
}
----

The nesting can be done to any level.

