@Entity public class CustomerAttributeImpl extends Object implements CustomerAttribute
Modifier and Type | Field and Description |
---|---|
protected Customer |
customer
The customer.
|
protected Long |
id
The id.
|
protected String |
name
The name.
|
protected String |
value
The value.
|
Constructor and Description |
---|
CustomerAttributeImpl() |
Modifier and Type | Method and Description |
---|---|
<G extends CustomerAttribute> |
createOrRetrieveCopyInstance(MultiTenantCopyContext context)
Clone this entity for the purpose of multiple tenancy.
|
boolean |
equals(Object obj) |
Customer |
getCustomer()
Gets the associated customer.
|
Long |
getId()
Gets the id.
|
String |
getName()
The name
|
String |
getValue()
The value
|
int |
hashCode() |
void |
setCustomer(Customer customer)
Sets the associated customer.
|
void |
setId(Long id)
Sets the id.
|
void |
setName(String name)
The name
|
void |
setValue(String value)
The value
|
String |
toString() |
protected Long id
protected String name
protected String value
protected Customer customer
public Long getId()
CustomerAttribute
getId
in interface CustomerAttribute
public void setId(Long id)
CustomerAttribute
setId
in interface CustomerAttribute
id
- the new idpublic String getValue()
ValueAssignable
getValue
in interface ValueAssignable<String>
public void setValue(String value)
ValueAssignable
setValue
in interface ValueAssignable<String>
value
- The valuepublic String getName()
ValueAssignable
getName
in interface ValueAssignable<String>
public void setName(String name)
ValueAssignable
setName
in interface ValueAssignable<String>
name
- The namepublic Customer getCustomer()
CustomerAttribute
getCustomer
in interface CustomerAttribute
public void setCustomer(Customer customer)
CustomerAttribute
setCustomer
in interface CustomerAttribute
public <G extends CustomerAttribute> CreateResponse<G> createOrRetrieveCopyInstance(MultiTenantCopyContext context) throws CloneNotSupportedException
MultiTenantCloneable
public CreateResponse<MyClass> createOrRetrieveCopyInstance(MultiTenantCopyContext context) throws CloneNotSupportedException {
CreateResponse<MyClass> createResponse = super.createOrRetrieveCopyInstance(context);
if (createResponse.isAlreadyPopulated()) {
return createResponse;
}
MyClass myClone = createResponse.getClone();
//copy extended field values on myClone here
return createResponse;
}
Support should also be added for @Embeddable classes that contribute fields (collections or basic) to a cloneable entity:
public CreateResponse<G extends MyClass> createOrRetrieveCopyInstance(MultiTenantCopyContext context) throws CloneNotSupportedException {
CreateResponse createResponse = context.createOrRetrieveCopyInstance(this);
MyClass myClone = createResponse.getClone();
//copy extended field values on myClone here
return createResponse;
}
createOrRetrieveCopyInstance
in interface MultiTenantCloneable<CustomerAttribute>
context
- a context object providing persistence and library functionality for copying entitiesCloneNotSupportedException
- if there's a problem detected with the cloning configurationCopyright © 2022. All rights reserved.