Package net.solarnetwork.central.domain
Class BasicSolarNodeOwnership
java.lang.Object
net.solarnetwork.central.domain.BasicSolarNodeOwnership
- All Implemented Interfaces:
Serializable,SolarNodeOwnership,net.solarnetwork.domain.Differentiable<SolarNodeOwnership>
public class BasicSolarNodeOwnership
extends Object
implements Serializable, SolarNodeOwnership, net.solarnetwork.domain.Differentiable<SolarNodeOwnership>
Basic implementation of
SolarNodeOwnership.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionBasicSolarNodeOwnership(Long nodeId, Long userId, String country, ZoneId zone, boolean requiresAuthorization, boolean archived) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleandiffersFrom(SolarNodeOwnership other) booleanCompare node ownership.Get the ISO 3166-1 alpha-2 character country code.Get the node ID.Get the user ID of the owner of a node.getZone()Get the node's time zone.inthashCode()booleanFlag indicating if a node has been "archived".booleanFlag indicating if a node's data is "public" vs "private".booleanisSameAs(SolarNodeOwnership other) Test if the properties of another object are the same as in this instance.static BasicSolarNodeOwnershipownershipFor(Long nodeId, Long userId) Create a new ownership instance.static BasicSolarNodeOwnershipownershipFor(Long nodeId, Long userId, String country, String timeZoneId) Create a new private ownership instance.static BasicSolarNodeOwnershipprivateOwnershipFor(Long nodeId, Long userId) Create a new private ownership instance.static BasicSolarNodeOwnershipprivateOwnershipFor(Long nodeId, Long userId, String country, String timeZoneId) Create a new private ownership instance.toString()
-
Constructor Details
-
BasicSolarNodeOwnership
public BasicSolarNodeOwnership(Long nodeId, Long userId, String country, ZoneId zone, boolean requiresAuthorization, boolean archived) Constructor.- Parameters:
nodeId- the node IDuserId- the owner user IDcountry- the country codezone- the zone, or null to use UTCrequiresAuthorization- true if authorization is required to access the node's dataarchived- true if the node has been archived- Throws:
IllegalArgumentException- ifnodeIdoruserIdis null
-
-
Method Details
-
ownershipFor
Create a new ownership instance.The zone will be set to UTC. The
requiresAuthorizationandarchivedproperties will be set to false.- Parameters:
nodeId- the node IDuserId- the user ID- Returns:
- the new ownership
- Throws:
IllegalArgumentException- ifnodeIdoruserIdis null
-
ownershipFor
public static BasicSolarNodeOwnership ownershipFor(Long nodeId, Long userId, String country, String timeZoneId) Create a new private ownership instance.The
requiresAuthorizationproperty will be set to true. Thearchivedproperty will be set to false.- Parameters:
nodeId- the node IDuserId- the user IDcountry- the countrytimeZoneId- the time zone ID- Returns:
- the new ownership
- Throws:
IllegalArgumentException- ifnodeIdoruserIdis null
-
privateOwnershipFor
Create a new private ownership instance.The zone will be set to UTC. The
requiresAuthorizationproperty will be set to true. Thearchivedproperty will be set to false.- Parameters:
nodeId- the node IDuserId- the user ID- Returns:
- the new ownership
- Throws:
IllegalArgumentException- ifnodeIdoruserIdis null
-
privateOwnershipFor
public static BasicSolarNodeOwnership privateOwnershipFor(Long nodeId, Long userId, String country, String timeZoneId) Create a new private ownership instance.The
requiresAuthorizationproperty will be set to true. Thearchivedproperty will be set to false.- Parameters:
nodeId- the node IDuserId- the user IDcountry- the countrytimeZoneId- the time zone ID- Returns:
- the new ownership
- Throws:
IllegalArgumentException- ifnodeIdoruserIdis null
-
isSameAs
Test if the properties of another object are the same as in this instance.- Parameters:
other- the other entity to compare to- Returns:
- true if the properties of this instance are equal to the other
-
differsFrom
- Specified by:
differsFromin interfacenet.solarnetwork.domain.Differentiable<SolarNodeOwnership>
-
toString
-
hashCode
public int hashCode() -
equals
Compare node ownership.This compares only by node ID.
-
getNodeId
Description copied from interface:SolarNodeOwnershipGet the node ID.- Specified by:
getNodeIdin interfaceSolarNodeOwnership- Returns:
- the node ID
-
getUserId
Description copied from interface:SolarNodeOwnershipGet the user ID of the owner of a node.- Specified by:
getUserIdin interfaceSolarNodeOwnership- Returns:
- the owner user ID
-
getCountry
Description copied from interface:SolarNodeOwnershipGet the ISO 3166-1 alpha-2 character country code.- Specified by:
getCountryin interfaceSolarNodeOwnership- Returns:
- 2-character country code
-
getZone
Description copied from interface:SolarNodeOwnershipGet the node's time zone.- Specified by:
getZonein interfaceSolarNodeOwnership- Returns:
- the time zone
-
isRequiresAuthorization
public boolean isRequiresAuthorization()Description copied from interface:SolarNodeOwnershipFlag indicating if a node's data is "public" vs "private".- Specified by:
isRequiresAuthorizationin interfaceSolarNodeOwnership- Returns:
- true if the node requires authorization for viewing its data
-
isArchived
public boolean isArchived()Description copied from interface:SolarNodeOwnershipFlag indicating if a node has been "archived".- Specified by:
isArchivedin interfaceSolarNodeOwnership- Returns:
- true if the node has been archived
-