Party is the building block of all interpersonal and organizational structures in CORM. Without it, the entire concept of commerce is academic.
/**
* ____________________ *
* ____ ____ ____ _ _ *
* |___ [__] |--< |\/| *
* ____________________ *
*
* THE CORM PROJECT
*
* This file may only be used in accordance with the
* terms of the Academic Free License ("AFL") v. 3.0,
* as published by the Open Software Initiative. A
* copy of this license is provided in this source
* release, and may be viewed online at:
*
* (http://www.opensource.org/licenses/afl-3.0.php)
*/
package org.eremite.corm.party;
import org.eremite.corm.BaseArchetype;
import org.eremite.corm.party.address.AssociatedAddress;
import org.eremite.corm.party.relationship.Capability;
import org.eremite.corm.party.relationship.PartyRole;
import javax.persistence.*;
import java.util.*;
@Entity
public class Party extends BaseArchetype {
@OneToMany(cascade={
CascadeType.PERSIST,
CascadeType.MERGE,
CascadeType.REMOVE}, mappedBy="party")
private Set addresses = new HashSet ();
// private long preferredAddressID;
@OneToMany(cascade={
CascadeType.PERSIST,
CascadeType.MERGE,
CascadeType.REMOVE})
private Set bindings = new HashSet ();
@OneToMany(cascade={
CascadeType.PERSIST,
CascadeType.MERGE,
CascadeType.REMOVE})
private Set registeredIds =
new HashSet ();
@OneToMany(cascade={
CascadeType.PERSIST,
CascadeType.MERGE,
CascadeType.REMOVE})
private Set capabilities = new HashSet();
@OneToMany(cascade={
CascadeType.PERSIST,
CascadeType.MERGE,
CascadeType.REMOVE}, mappedBy="party")
private Set roles = new HashSet ();
/* Default Zero-arg Constructor */
public Party() {}
public Set getAddresses() {
return addresses;
}
public void setAddresses(Set addresses) {
this.addresses = addresses;
}
public Set getPreferences() {
return bindings;
}
public void setPreferences(Set preferences) {
this.bindings = bindings;
}
public Set getRegisteredIdentifiers() {
return registeredIds;
}
public void setRegisteredIdentifiers(Set registeredIds) {
this.registeredIds = registeredIds;
}
public Set getPartyRoles() {
return roles;
}
public void setPartyRoles(Set roles) {
this.roles = roles;
}
public Set getCapabilities() {
return this.capabilities;
}
public void setCapabilities(Set capabilities) {
this.capabilities = capabilities;
}
public void addPartyRole(PartyRole ... roles) {
getPartyRoles().addAll(Arrays.asList(roles));
}
public void addPartyRole(PartyRole role) {
getPartyRoles().add(role);
}
public void addRegisteredIdentifier(RegisteredIdentifier rid) {
getRegisteredIdentifiers().add(rid);
}
public void addRegisteredIdentifier(RegisteredIdentifier ... rids) {
getRegisteredIdentifiers().addAll(java.util.Arrays.asList(rids));
}
public void addPreference(Binding ... bindings) {
getPreferences().addAll(Arrays.asList(bindings));
}
public void addCapability(Capability ... capabilities) {
getCapabilities().addAll(Arrays.asList(capabilities));
}
public void addCapability(Capability capability) {
getCapabilities().add(capability);
}
public void addAddress(AssociatedAddress ... addresses) {
getAddresses().addAll(Arrays.asList(addresses));
}
public void addAddress(AssociatedAddress address) {
getAddresses().add(address);
}
}