Docs » Getting Started
The following screenshots show the Wicket and Restful Objects viewers running a simple 'todo app', as generated by the quickstart archetype.
Wicket Viewer | |
| Welcome Page The archetype's welcome page describes how the application is configured, and the most significant files |
|
| Wicket Home Page The Wicket viewer displays a home page showing the domain services as menu items. These are registered in WEB-INF/isis.properties The welcome text links to the main ToDoItem domain class over on github. (You can easily change this text). |
|
| Domain class source code Most of the functionality of the quickstart app is inferred from the ToDoItem class. |
|
| Install Fixtures The quickstart app is configured to run using the JDO objectstore, but with an in-memory database. The Fixtures domain service allows the administrator (user: sven, password: pass) to install sample data:
@Named("Fixtures")
public class ToDoItemsFixturesService {
public String install() { ... }
...
public String installFor(
@Named("User") String user) { ... }
...
}
|
|
| Fixtures Installed Invoking an action that returns a scalar value, such as the information message, is displayed on the page. |
|
| Query using a domain service Domain services more usually act as both repositories and factories. In this case the ToDoItems domain service can be used to lookup existing ToDoItems, or to create new ones:
@Named("ToDos")
public class ToDoItems {
...
@MemberOrder(sequence = "1")
public List |
|
| Results shown in table Actions that return collections of entities are shown in a table. In this case the action has returned a list of ToDoItems. Not every property of the entity need be shown. |
|
| Bulk collections Bulk actions can be invoked on all selected elements. Bulk actions are indicated using @Bulk annotation:
public class ToDoItem {
...
@Bulk
public void complete() {
setComplete(true);
}
...
}
|
|
|
|
| Follow Link Navigation to an entity's detailed page is by following the hyperlink. This navigation is consistent throughout the UI. |
|
| Entity detail pages The Wicket viewer builds the UI from the domain class's structure. It shows an icon and title for the entity top left:
public class ToDoItem {
public String title() {
final TitleBuffer buf =
new TitleBuffer();
buf.append(getDescription());
if (isComplete()) {
buf.append(" - Completed!");
} else {
if (getDueBy() != null) {
buf.append(" due by ",
getDueBy());
}
}
return buf.toString();
}
...
}
...(scalar) properties are displayed underneath:
...
@RegEx(validation =
"\w[@&:\-\,\.\+ \w]*")
@MemberOrder(sequence = "1")
public String getDescription() { ... }
public void setDescription(
String description) { ... }
...
}
... (vector) collections on the right:
...
@Disabled
@MemberOrder(sequence = "1")
@Resolve(Type.EAGERLY)
public List... and actions are shown top right:
...
@Named("Clone")
@MemberOrder(sequence = "3")
public ToDoItem duplicate() { ... }
...
}
|
|
| Edit entity The entity's properties can be edited through the 'Edit' button. Some properties may not be editable:
public class ToDoItem {
...
@Disabled
@MemberOrder(sequence = "4")
public boolean isComplete() { ... }
public void setComplete(
final boolean complete) { ... }
...
}
|
|
| Drop downs Drop downs are provided for enums (such as Category):
public class ToDoItem {
public static enum Category {
Professional, Domestic, Other;
}
...
}
|
|
| Optimistic locking Updating the entity bumps up its version number. Behind the scenes this is done by the JDO objectstore
@javax.jdo.annotations.Version(
strategy=VersionStrategy.VERSION_NUMBER,
column="VERSION")
...
public class ToDoItem {
...
@Hidden(where=Where.ALL_TABLES)
@Disabled
@MemberOrder(name="Detail",
sequence = "99")
@Named("Version")
public Long getVersionSequence() {
if(!(this instanceof
PersistenceCapable)) {
return null;
}
PersistenceCapable pc =
(PersistenceCapable) this;
final Long version =
(Long) JDOHelper.
getVersion(pc);
return version;
}
...
}
|
|
| Invoking actions Actions can be invoked; there may or may not be arguments:
public class ToDoItem {
...
public ToDoItem completed() {
setComplete(true);
return this;
}
...
}
|
|
| Disabling actions Actions can be disabled (as can editing properties) using supporting methods:
public class ToDoItem {
...
public ToDoItem completed() { ... }
public String disableCompleted() {
return complete ?
"Already completed" : null;
}
}
|
|
| Actions grouped Often actions relate to a particular colleciton of an entity. The Wicket viewer renders such actions next to that collection. For example:
public class ToDoItem {
...
@MemberOrder(
name="dependencies",
sequence = "3")
public ToDoItem add(
final ToDoItem toDoItem) { ... }
getDependencies().add(toDoItem);
return this;
}
...
}
There might also be validation logic:
public class ToDoItem {
...
public String validateAdd(
final ToDoItem toDoItem) {
if(getDependencies().
contains(toDoItem)) {
return "Already a dependency";
}
if(toDoItem == this) {
return "Can't set up a " +
"dependency to self";
}
return null;
}
...
}
|
|
| Actions can take arguments In the case of arguments (or indeed when editing properties) that are references to entities, these can be looked up using an autocomplete action on a repository:
@AutoComplete(repository=ToDoItems.class, action="autoComplete")
public class ToDoItem { ... }
and:
public class ToDoItems {
...
@Hidden
public List
|
|
| Collections (and properties) can be derived The viewer will render the state of the object, which can be persisted state or derived on the fly. A common pattern is to delegate to an (automatically injected) domain service:
public class ToDoItem {
...
@MemberOrder(sequence = "5")
@NotPersisted
@Resolve(Type.EAGERLY)
public List |
|
| Breadcrumbs The Wicket viewer has breadcrumbs which can be used either to get back to a previous entity or to invoke a (query-only) action:
public class ToDoItems {
...
@ActionSemantics(Of.SAFE)
public List
|
|
| Audit Service The JDO Objectstore supports an auditing service. The quickstart app provides an example implementation of this service:
public class AuditServiceDemo implements AuditService {
...
public void audit(
String user,
long currentTimestampEpoch,
String objectType, String identifier,
String preValue, String postValue) {
...
}
}
|
|
| Audit Records The demo audit service simply persists an audit entry for each update. |
|
| Multi-User Apache Isis is a multi-user system. The administrator (sven/pass) has the permissions to be able to install fixtures for other users. |
|
| |
|
| |
|
| Login as user The quickstart app provides a 'guest' user that has a limited set of permissions.... |
|
| Permissions ... the guest user can use the 'ToDoItems' domain service, but the other services are not available. In the case of the quickstart this is specified in WEB-INF/shiro.ini configuration file. |
|
RestfulObjects Viewer | |
| Access the RESTful API The Restful Objects viewer exposes the domain object model through a JSON-based RESTful API. Typically access will be restricted, in this case using HTTP BASIC authentication (though this is configurable). |
|
| List domain services Most interactions with the RESTful API start by accessing the resource that represents the list of domain services. However, the Restful Objects viewer also exposes templated URLs (as per the Restful Objects spec that it implements). |
|
| Domain service members Navigating to a particular domain service returns a representation of the members provided by that domain service. |
|
| Domain service action A detailed representation of each individual action can be accessed; this can be considered as analogous to the action parameter prompt page in the Wicket viewer. |
|
| Invoking a domain service action One of the links provided in the detailed representation is to invoke the action. Note that the link specifies the HTTP method to use, along with the arguments (if any) to be provided. |
|
| Action returning a list Invoking an action will return a scalar value, or a reference to an entity, or (as in this case) a list of references to entities. |
|
| Representation of an entity The entity's representation shows the state of its (scalar) properties, links to its (vector) collections contents, and also links to invoke the entity's actions. |
|