Public:BWmeta service/Java mapping

From YaddaWiki

< Public:BWmeta service(Difference between revisions)
Jump to: navigation, search
 
(39 intermediate revisions not shown)
Line 1: Line 1:
{{Infobox BWmeta service}}
{{Infobox BWmeta service}}
 +
 +
== History ==
 +
 +
Three different mappings of BWmeta to Java have been written in the project's lifetime.
 +
The following table summarizes the mappings.
 +
 +
{| class="bluetable"
 +
! Model Name !! Works with <br/> BWmeta versions !! Usage areas !! Comments
 +
|-
 +
| Repo model || 1.0.0 ÷ 1.0.5 || [[Processes service|Processes]], [[YaddaWeb application|YaddaWeb]] ||  Hibernate-oriented
 +
|-
 +
| DeskLight model || 1.0.0 ÷ 1.0.5 || [[Processes service|Processes]], [[DeskLight application|DeskLight]] ||
 +
|-
 +
| "Y" model || 1.2.0 ÷ 2.0.0 || [[Pack Management service|Pack Management]] ||
 +
|}
 +
 +
Current efforts are focused on replacing the older models (Repo and DeskLight) with the latest one ("Y").
 +
The remainder of this page and all the other pages on BWmeta usage in YADDA assume usage of the "Y" model.
== General contracts ==
== General contracts ==
Line 5: Line 23:
Unless explicitly stated in the documentation, every "Y" class has the following properties:
Unless explicitly stated in the documentation, every "Y" class has the following properties:
-
* has a public empty constructor.
+
* has a public default constructor.
* every property is protected, but has a public getter and setter.
* every property is protected, but has a public getter and setter.
-
* every setter and every list adder returns <code>this</code>, which allows chained setting, e.g.:
 
-
new YElement()
 
-
    .setId("bwmeta1.element.foo")
 
-
    .addName(new YName().setText("Foo").setLanguage(YLanguage.English))
 
-
    .addDescription(new YDescription().setText("Lorem ipsum").setLanguage(YLanguage.Latin));
 
* getters of <code>String</code>, <code>YLanguage</code> and <code>List</code> properties can never return <code>null</code>.  Instead, an empty <code>String</code>, <code>YLanguage.Undetermined</code> or an empty <code>List</code> is returned, respectively.
* getters of <code>String</code>, <code>YLanguage</code> and <code>List</code> properties can never return <code>null</code>.  Instead, an empty <code>String</code>, <code>YLanguage.Undetermined</code> or an empty <code>List</code> is returned, respectively.
-
* every <code>List</code> property has an adder (which returns <code>this</code>).
 
* for every <code>List&lt;T&gt;</code> property:
* for every <code>List&lt;T&gt;</code> property:
** its getter returns a modifiable <code>List&lt;T&gt;</code>;
** its getter returns a modifiable <code>List&lt;T&gt;</code>;
Line 19: Line 31:
** its setter accepts any <code>Collection&lt;T&gt;</code> (and copies the contents);
** its setter accepts any <code>Collection&lt;T&gt;</code> (and copies the contents);
** there's an adder (which returns <code>this</code>).
** there's an adder (which returns <code>this</code>).
 +
* every setter and every list adder returns <code>this</code>, which allows chained setting, e.g.:
 +
new YElement()
 +
    .setId("bwmeta1.element.foo")
 +
    .addName(new YName().setText("Foo").setLanguage(YLanguage.English))
 +
    .addDescription(new YDescription().setText("Lorem ipsum").setLanguage(YLanguage.Latin));
The folowing contracts are to be implemented/verified in the future:
The folowing contracts are to be implemented/verified in the future:
Line 24: Line 41:
<!-- * Only the following property types are present: a primitive type, a String, another "Y" object, a List of Strings or "Y" objects. -->
<!-- * Only the following property types are present: a primitive type, a String, another "Y" object, a List of Strings or "Y" objects. -->
 +
 +
== Nulls and empty texts ==
 +
In general nulls are not acceptible in places where should be text(String, YRichtext). If such field is set to null value then empty string is set automatically. Nulls are not returned from this fileds. Only exceptions that exists in system when nulls value are accepted on string fields are:
 +
* Identity w contributorze
 +
* TODO: tu wpisujemy miejsca gdzie są nulle
 +
 +
== Rich text support ==
 +
 +
''See [[BWmeta service/Java mapping/Rich text]].''

Latest revision as of 16:06, 15 January 2013

Service details
NameBWmeta
Code location
(relative to SVN root)
projects/dir/bwmeta-core
Javadoc
Contact personJakub Jurkiewicz

Contents

History

Three different mappings of BWmeta to Java have been written in the project's lifetime. The following table summarizes the mappings.

Model Name Works with
BWmeta versions
Usage areas Comments
Repo model 1.0.0 ÷ 1.0.5 Processes, YaddaWeb Hibernate-oriented
DeskLight model 1.0.0 ÷ 1.0.5 Processes, DeskLight
"Y" model 1.2.0 ÷ 2.0.0 Pack Management

Current efforts are focused on replacing the older models (Repo and DeskLight) with the latest one ("Y"). The remainder of this page and all the other pages on BWmeta usage in YADDA assume usage of the "Y" model.

General contracts

Unless explicitly stated in the documentation, every "Y" class has the following properties:

  • has a public default constructor.
  • every property is protected, but has a public getter and setter.
  • getters of String, YLanguage and List properties can never return null. Instead, an empty String, YLanguage.Undetermined or an empty List is returned, respectively.
  • for every List<T> property:
    • its getter returns a modifiable List<T>;
    • its getter returns the same reference all the time;
    • its setter accepts any Collection<T> (and copies the contents);
    • there's an adder (which returns this).
  • every setter and every list adder returns this, which allows chained setting, e.g.:
new YElement()
    .setId("bwmeta1.element.foo")
    .addName(new YName().setText("Foo").setLanguage(YLanguage.English))
    .addDescription(new YDescription().setText("Lorem ipsum").setLanguage(YLanguage.Latin));

The folowing contracts are to be implemented/verified in the future:

  • hashCode() and equals() methods are based on the values of all the properties, i.e., two "Y" objects are equal iff they are of the same type and all their properties are equal.


Nulls and empty texts

In general nulls are not acceptible in places where should be text(String, YRichtext). If such field is set to null value then empty string is set automatically. Nulls are not returned from this fileds. Only exceptions that exists in system when nulls value are accepted on string fields are:

  • Identity w contributorze
  • TODO: tu wpisujemy miejsca gdzie są nulle

Rich text support

See BWmeta service/Java mapping/Rich text.

Personal tools