[45/58] [abbrv] isis git commit: ISIS-1521: further minor updates to ugfun.adoc
http://git-wip-us.apache.org/repos/asf/isis/blob/480d6ff2/adocs/documentation/src/main/asciidoc/guides/ugfun/_ugfun_how-tos_class-structure_class-definition.adoc -- diff --git a/adocs/documentation/src/main/asciidoc/guides/ugfun/_ugfun_how-tos_class-structure_class-definition.adoc b/adocs/documentation/src/main/asciidoc/guides/ugfun/_ugfun_how-tos_class-structure_class-definition.adoc deleted file mode 100644 index 70b3659..000 --- a/adocs/documentation/src/main/asciidoc/guides/ugfun/_ugfun_how-tos_class-structure_class-definition.adoc +++ /dev/null @@ -1,201 +0,0 @@ -[[_ugfun_how-tos_class-structure_class-definition]] -= Class Definition -: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. -:_basedir: ../../ -:_imagesdir: images/ - - - -Apache Isis supports recognises three main types of domain classes: - -* domain entities - domain objects persisted to the database using JDO/DataNucleus; for example `Customer` - -* domain services - generally singletons, automatically injected, and providing various functionality; for example `CustomerRepository` - -* view models - domain objects that are a projection of some state held by the database, in support a particular use case; for example `CustomerDashboard` (to pull together commonly accessed information about a customer). - -Domain classes are generally recognized using annotations. -Apache Isis defines its own set of annotations, while entities are annotated using JDO/DataNucleus (though XML can also be used if required). -JAXB can also be used for view models. -Apache Isis recognizes some of the JDO and JAXB annotations and infers domain semantics from these annotations. - -You can generally recognize an Apache Isis domain class because it will be probably be annotated using `@DomainObject` and `@DomainService`. -The framework also defines supplementary annotations, `@DomainObjectLayout` and `@DomainServiceLayout`. -These provide hints relating to the layout of the domain object in the user interface. -(Alternatively, these UI hints can be defined in a supplementary xref:../ugvw/ugvw.adoc#_ugvw_layout[`.layout.xml`] file. - -We use Maven modules as a way to group related domain objects together; we can then reason about all the classes in that module as a single unit. -By convention there will be a single top-level package corresponding to the module. - -For example, the (non-ASF) link:https://github.com/incodehq/incode-module-document[Document module] (part of the link:http://catalog.incode.org[Incode Catalog]) has a top-level package of `org.incode.module.document`. -Within the module there may be various subpackages, but its the module defines the namespace. - -In the same way that the Java module act as a namespace for domain objects, it's good practice to map domain entities to their own (database) schemas. - - -[[__ugfun_how-tos_class-structure_class-definition_entities]] -== Entities - -Entities are persistent domain objects. -Their persistence is handled by JDO/DataNucleus, which means that it will generally be decorated with both DataNucleus and Apache Isis annotations. -The following is typical: - -[source,java] - -@javax.jdo.annotations.PersistenceCapable( // <1> -identityType=IdentityType.DATASTORE, // <2> -schema = "simple", // <3> -table = "SimpleObject" -) -@javax.jdo.annotations.DatastoreIdentity( // <4> -strategy=javax.jdo.annotations.IdGeneratorStrategy.IDENTITY, -column="id" -) -@javax.jdo.annotations.Version( // <5> -strategy= VersionStrategy.DATE_TIME, -column="version" -) -@javax.jdo.annotations.Queries({ -@javax.jdo.annotations.Query( // <6> -name = "findByName", -value = "SELECT " -+ "FROM domainapp.modules.simple.dom.impl.SimpleObject " -+ "WHERE name.indexOf(:name) >= 0 ") -}) -@javax.jdo.annotations.Unique(name="SimpleObject_name_UNQ",
[45/58] [abbrv] isis git commit: ISIS-1521: further minor updates to ugfun.adoc
http://git-wip-us.apache.org/repos/asf/isis/blob/480d6ff2/adocs/documentation/src/main/asciidoc/guides/ugfun/_ugfun_how-tos_class-structure_class-definition.adoc -- diff --git a/adocs/documentation/src/main/asciidoc/guides/ugfun/_ugfun_how-tos_class-structure_class-definition.adoc b/adocs/documentation/src/main/asciidoc/guides/ugfun/_ugfun_how-tos_class-structure_class-definition.adoc deleted file mode 100644 index 70b3659..000 --- a/adocs/documentation/src/main/asciidoc/guides/ugfun/_ugfun_how-tos_class-structure_class-definition.adoc +++ /dev/null @@ -1,201 +0,0 @@ -[[_ugfun_how-tos_class-structure_class-definition]] -= Class Definition -: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. -:_basedir: ../../ -:_imagesdir: images/ - - - -Apache Isis supports recognises three main types of domain classes: - -* domain entities - domain objects persisted to the database using JDO/DataNucleus; for example `Customer` - -* domain services - generally singletons, automatically injected, and providing various functionality; for example `CustomerRepository` - -* view models - domain objects that are a projection of some state held by the database, in support a particular use case; for example `CustomerDashboard` (to pull together commonly accessed information about a customer). - -Domain classes are generally recognized using annotations. -Apache Isis defines its own set of annotations, while entities are annotated using JDO/DataNucleus (though XML can also be used if required). -JAXB can also be used for view models. -Apache Isis recognizes some of the JDO and JAXB annotations and infers domain semantics from these annotations. - -You can generally recognize an Apache Isis domain class because it will be probably be annotated using `@DomainObject` and `@DomainService`. -The framework also defines supplementary annotations, `@DomainObjectLayout` and `@DomainServiceLayout`. -These provide hints relating to the layout of the domain object in the user interface. -(Alternatively, these UI hints can be defined in a supplementary xref:../ugvw/ugvw.adoc#_ugvw_layout[`.layout.xml`] file. - -We use Maven modules as a way to group related domain objects together; we can then reason about all the classes in that module as a single unit. -By convention there will be a single top-level package corresponding to the module. - -For example, the (non-ASF) link:https://github.com/incodehq/incode-module-document[Document module] (part of the link:http://catalog.incode.org[Incode Catalog]) has a top-level package of `org.incode.module.document`. -Within the module there may be various subpackages, but its the module defines the namespace. - -In the same way that the Java module act as a namespace for domain objects, it's good practice to map domain entities to their own (database) schemas. - - -[[__ugfun_how-tos_class-structure_class-definition_entities]] -== Entities - -Entities are persistent domain objects. -Their persistence is handled by JDO/DataNucleus, which means that it will generally be decorated with both DataNucleus and Apache Isis annotations. -The following is typical: - -[source,java] - -@javax.jdo.annotations.PersistenceCapable( // <1> -identityType=IdentityType.DATASTORE, // <2> -schema = "simple", // <3> -table = "SimpleObject" -) -@javax.jdo.annotations.DatastoreIdentity( // <4> -strategy=javax.jdo.annotations.IdGeneratorStrategy.IDENTITY, -column="id" -) -@javax.jdo.annotations.Version( // <5> -strategy= VersionStrategy.DATE_TIME, -column="version" -) -@javax.jdo.annotations.Queries({ -@javax.jdo.annotations.Query( // <6> -name = "findByName", -value = "SELECT " -+ "FROM domainapp.modules.simple.dom.impl.SimpleObject " -+ "WHERE name.indexOf(:name) >= 0 ") -}) -@javax.jdo.annotations.Unique(name="SimpleObject_name_UNQ",