if dependency relationships were drawn between every class and the types of it's attributes, the class diagram becomes cluttered very quickly
this dependency is obvious if the type is indicated for each attribute
if a subclass sets an attribute to null, implements a method returning null or throwing a NotImplementedException, it really isn't a subclass, or the superclass needs to be decomposed
7.
Aggregation and Composition Guidelines
object is made up of other objects
aggregation
“is part of” relationships
whole-part relationship between two
objects
Composition
stronger
form of aggregation where the whole and parts have
coincident lifetimes, and it
is very common for the whole to manage the lifecycle of its parts
Apply the Sentence Rule for Aggregation
Depict the Whole to the Left of the Part
Don’t Worry About Getting the Diamonds Right
associations, aggregation, composition, dependencies,
inheritance, and realizations
line on a UML
class diagram
defines a cohesive set of behaviors
Indicate Visibility Only On Design Models
Design Class Diagrams Should Reflect Language Naming Conventions
generally speaking, there can be a few independent but overlapping mechanism that will control who is allowed to do what with content:
1. any subject's access to the content itself can be controlled via authorization rules (ie. required vs granted permissions) enforced via system-wide resource-based access control
2. content licensors (~content owners) can restrict the usage of their content by:
* whom - ie. content licensee (legally/commercially represented by an organization)
* how - eg. reuse as unmodified, create derivatives, composite, redistribute, etc
* where - ie. distribution channels their content can be used (eg. only on hotel's vbrochure site, but not in any ids/gds channels)
* when - temporal restrictions may limit scope of content license grant by: start, end, duration, season, etc
3. content licensees can further filter or funnel content available to them (resulting from a combination of license granted to them and access control) based on their own criteria (eg. generate a templated hotel presentation only if: at least 1 textual description, 5 photos and 1 video for a hotel is available with a license to combine them (composite content)
if ecm/vfml is to manage content licensing as a third party between organizations (content licensors & licensees) shouldn't ecm *know* if the user('s organization) has rights to use the content in question?
is this question posed to the user (with required explicit acknowledgement) purely to absolve vfml from liability issues that may result from licensing disagreements?
this being the user's (organization's) 'version'or 'view'of the hotel, since this user normally wouldn't/shouldn't be granted permissions to replace content for a hotel on a different organization's 'view'or 'version' of the same hotel
this implies that *at least* one version of such (temporarily) replaceable content needs to be managed/maintaned to allow reverting
what if, deliberately, ignorantly or maliciously, a user replaces the same piece of--textual or any type, really--content for this hotel n times? will all n versions be required to be managed as an undo history?
the user's ''original content'' might have been version 1, but equally might have been 1 mean:
- previous version of the content, regardless of which user
- initial version of that content attached to the hotel regardless of which user created/updated it and ignoring which organization owns it?, or,
-
map multiple properties as @Id
properties and declare an external class to be the identifier
type
declared on the entity via
the @IdClass annotation
The identifier
type must contain the same properties as the identifier properties
of the entity: each property name must be the same, its type must
be the same as well if the entity property is of a
basic type
last case is far from obvious
recommend you not to use it (for simplicity sake)
@EmbeddedId property
@EmbeddedId
@Embeddable
@EmbeddedId
@Embeddable
@Embeddable
@EmbeddedId
Multiple @Id properties
arguably more natural, approach
place
@Id on multiple properties of my entity
only supported by Hibernate
does not require an
extra embeddable component.
@IdClass
@IdClass on an entity points to the
class (component) representing the identifier of the class
WarningThis approach is inherited from the EJB 2 days and we
recommend against its use. But, after all it's your application
and Hibernate supports it.
Mapping entity associations/relationships
One-to-one
three cases for
one-to-one associations:
associated entities share the same
primary keys values
foreign key is held by one of the entities
(note that this FK column in the database should be constrained unique
to simulate one-to-one multiplicity)
association table is used
to store the link between the 2 entities (a unique constraint has to
be defined on each fk to ensure the one to one multiplicity)
@PrimaryKeyJoinColumn
shared primary
keys:
explicit foreign key column:
@JoinColumn(name="passport_fk")
foreign key column named
passport_fk in the Customer
table
may be bidirectional
owner is responsible for the association column(s) update
In a bidirectional
relationship, one of the sides (and only one) has to be the owner
To declare
a side as
not responsible for the relationship
the attribute
mappedBy
is used
mappedBy
Indexed collections (List, Map)
Lists can be mapped in two different ways:
as ordered lists
as indexed lists
@OrderBy("number")
List<Order>
List<Order>
List<Order>
To use one of the target entity property as a key of the map,
use