org.usergrid.persistence.cassandra
Class ConnectionRefImpl

java.lang.Object
  extended by org.usergrid.persistence.cassandra.ConnectionRefImpl
All Implemented Interfaces:
AssociatedEntityRef, ConnectedEntityRef, ConnectionRef, EntityRef

public class ConnectionRefImpl
extends Object
implements ConnectionRef

Author:
edanuff

Field Summary
static int ALL
           
static int BY_CONNECTION_AND_ENTITY_TYPE
           
static int BY_CONNECTION_TYPE
           
static int BY_ENTITY_TYPE
           
static String CONNECTED_ENTITY_ID
           
static String CONNECTED_ENTITY_TYPE
           
static String CONNECTING_ENTITY_ID
           
static String CONNECTING_ENTITY_TYPE
           
static String CONNECTION_ENTITY_CONNECTION_TYPE
           
static String CONNECTION_ENTITY_TYPE
           
static String CONNECTION_TYPE
           
static int MAX_LINKS
           
static String NULL_ENTITY_TYPE
           
static UUID NULL_ID
           
static String PAIRED_CONNECTING_ENTITY_ID
           
static String PAIRED_CONNECTING_ENTITY_TYPE
           
static String PAIRED_CONNECTION_TYPE
           
static String UUID_COMPARATOR
           
 
Constructor Summary
ConnectionRefImpl()
           
ConnectionRefImpl(ConnectionRef connection)
           
ConnectionRefImpl(ConnectionRef connection, ConnectedEntityRef... connections)
           
ConnectionRefImpl(EntityRef connectingEntity, ConnectedEntityRef... connections)
           
ConnectionRefImpl(EntityRef connectingEntity, List<ConnectedEntityRef> pairedConnections, ConnectedEntityRef connectedEntity)
           
ConnectionRefImpl(EntityRef connectingEntity, String connectionType, EntityRef connectedEntity)
           
ConnectionRefImpl(String connectingEntityType, UUID connectingEntityId, String connectionType, String connectedEntityType, UUID connectedEntityId)
           
 
Method Summary
 void addIndexExpressionsToQuery(me.prettyprint.cassandra.model.IndexedSlicesQuery<UUID,String,ByteBuffer> q)
           
static boolean connectionsNull(ConnectedEntityRef... pairedConnections)
           
static List<org.apache.cassandra.thrift.ColumnDef> getColumnDefinitions()
           
static List<String> getColumnNames()
           
static Set<String> getColumnNamesSet()
           
 ConnectedEntityRef getConnectedEntity()
           
 UUID getConnectedEntityId()
           
 String getConnectedEntityType()
           
 EntityRef getConnectingEntity()
           
 UUID getConnectingEntityId()
           
 String getConnectingEntityType()
           
 UUID getConnectingIndexId()
           
static ConnectedEntityRef[] getConnections(ConnectedEntityRef... connections)
           
static List<ConnectedEntityRef> getConnectionsList(ConnectedEntityRef... connections)
           
 ConnectionRefImpl getConnectionToConnectionEntity()
           
 String getConnectionType()
           
 UUID getFirstPairedConnectedEntityId()
           
 String getFirstPairedConnectedEntityType()
           
 ConnectedEntityRef getFirstPairedConnection()
           
 String getFirstPairedConnectionType()
           
static UUID getId(EntityRef connectingEntity, ConnectedEntityRef connectedEntity, ConnectedEntityRef... pairedConnections)
           
static UUID getId(UUID connectingEntityId, String connectionType, UUID connectedEntityId)
           
static UUID getId(UUID connectingEntityId, String pairedConnectionType, UUID pairedConnectingEntityId, String connectionType, UUID connectedEntityId)
          Connection id is constructed from packed structure of properties strings are truncated to 16 ascii bytes.
static List<String> getIdColumnNames()
           
static String getIndexes()
           
 UUID getIndexId()
           
static UUID getIndexId(EntityRef connectingEntity, String connectionType, String connectedEntityType, ConnectedEntityRef... pairedConnections)
           
static UUID getIndexId(int variant, EntityRef connectingEntity, String connectionType, String connectedEntityType, ConnectedEntityRef... pairedConnections)
           
static UUID getIndexId(int variant, UUID connectingEntityId, String pairedConnectionType, UUID pairedConnectingEntityId, String connectionType, String connectedEntityType)
           
static UUID getIndexId(UUID connectingEntityId, String connectionType, String connectedEntityType)
           
static UUID getIndexId(UUID connectingEntityId, String pairedConnectionType, UUID pairedConnectingEntityId, String connectionType, String connectedEntityType)
           
 UUID[] getIndexIds()
           
static UUID[] getIndexIds(EntityRef connectingEntity, String connectionType, String connectedEntityType, ConnectedEntityRef... pairedConnections)
           
static UUID[] getIndexIds(UUID connectingEntityId, String connectionType, String connectedEntityType)
           
static UUID[] getIndexIds(UUID connectingEntityId, String pairedConnectionType, UUID pairedConnectingEntityId, String connectionType, String connectedEntityType)
           
 List<ConnectedEntityRef> getPairedConnections()
           
 String getType()
          Gets the type.
 UUID getUuid()
          Gets the id.
static ConnectionRefImpl loadFromColumns(List<me.prettyprint.hector.api.beans.HColumn<String,ByteBuffer>> columns)
           
 Map<String,Object> toColumnMap()
           
static ConnectionRefImpl toConnectedEntity(ConnectedEntityRef connectedEntity)
           
static ConnectionRefImpl toConnectedEntity(EntityRef entityRef)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_LINKS

public static final int MAX_LINKS
See Also:
Constant Field Values

ALL

public static final int ALL
See Also:
Constant Field Values

BY_CONNECTION_TYPE

public static final int BY_CONNECTION_TYPE
See Also:
Constant Field Values

BY_ENTITY_TYPE

public static final int BY_ENTITY_TYPE
See Also:
Constant Field Values

BY_CONNECTION_AND_ENTITY_TYPE

public static final int BY_CONNECTION_AND_ENTITY_TYPE
See Also:
Constant Field Values

NULL_ENTITY_TYPE

public static final String NULL_ENTITY_TYPE
See Also:
Constant Field Values

NULL_ID

public static final UUID NULL_ID

CONNECTING_ENTITY_TYPE

public static final String CONNECTING_ENTITY_TYPE
See Also:
Constant Field Values

CONNECTING_ENTITY_ID

public static final String CONNECTING_ENTITY_ID
See Also:
Constant Field Values

PAIRED_CONNECTION_TYPE

public static final String PAIRED_CONNECTION_TYPE
See Also:
Constant Field Values

PAIRED_CONNECTING_ENTITY_TYPE

public static final String PAIRED_CONNECTING_ENTITY_TYPE
See Also:
Constant Field Values

PAIRED_CONNECTING_ENTITY_ID

public static final String PAIRED_CONNECTING_ENTITY_ID
See Also:
Constant Field Values

CONNECTION_TYPE

public static final String CONNECTION_TYPE
See Also:
Constant Field Values

CONNECTED_ENTITY_TYPE

public static final String CONNECTED_ENTITY_TYPE
See Also:
Constant Field Values

CONNECTED_ENTITY_ID

public static final String CONNECTED_ENTITY_ID
See Also:
Constant Field Values

CONNECTION_ENTITY_TYPE

public static final String CONNECTION_ENTITY_TYPE
See Also:
Constant Field Values

CONNECTION_ENTITY_CONNECTION_TYPE

public static final String CONNECTION_ENTITY_CONNECTION_TYPE
See Also:
Constant Field Values

UUID_COMPARATOR

public static final String UUID_COMPARATOR
See Also:
Constant Field Values
Constructor Detail

ConnectionRefImpl

public ConnectionRefImpl()

ConnectionRefImpl

public ConnectionRefImpl(String connectingEntityType,
                         UUID connectingEntityId,
                         String connectionType,
                         String connectedEntityType,
                         UUID connectedEntityId)
Parameters:
connectingEntityType -
connectingEntityId -
connectionType -
connectedEntityType -
connectedEntityId -

ConnectionRefImpl

public ConnectionRefImpl(EntityRef connectingEntity,
                         String connectionType,
                         EntityRef connectedEntity)

ConnectionRefImpl

public ConnectionRefImpl(ConnectionRef connection)

ConnectionRefImpl

public ConnectionRefImpl(EntityRef connectingEntity,
                         ConnectedEntityRef... connections)

ConnectionRefImpl

public ConnectionRefImpl(ConnectionRef connection,
                         ConnectedEntityRef... connections)

ConnectionRefImpl

public ConnectionRefImpl(EntityRef connectingEntity,
                         List<ConnectedEntityRef> pairedConnections,
                         ConnectedEntityRef connectedEntity)
Method Detail

toConnectedEntity

public static ConnectionRefImpl toConnectedEntity(ConnectedEntityRef connectedEntity)

toConnectedEntity

public static ConnectionRefImpl toConnectedEntity(EntityRef entityRef)

getConnectingEntity

public EntityRef getConnectingEntity()
Specified by:
getConnectingEntity in interface ConnectionRef

getConnectingEntityType

public String getConnectingEntityType()
Returns:

getConnectingEntityId

public UUID getConnectingEntityId()
Returns:

getPairedConnections

public List<ConnectedEntityRef> getPairedConnections()
Specified by:
getPairedConnections in interface ConnectionRef

getFirstPairedConnection

public ConnectedEntityRef getFirstPairedConnection()

getFirstPairedConnectedEntityId

public UUID getFirstPairedConnectedEntityId()

getFirstPairedConnectedEntityType

public String getFirstPairedConnectedEntityType()

getFirstPairedConnectionType

public String getFirstPairedConnectionType()

getConnectedEntity

public ConnectedEntityRef getConnectedEntity()
Specified by:
getConnectedEntity in interface ConnectionRef

getConnectionType

public String getConnectionType()
Specified by:
getConnectionType in interface ConnectedEntityRef
Returns:

getConnectedEntityType

public String getConnectedEntityType()
Returns:

getConnectedEntityId

public UUID getConnectedEntityId()
Returns:

getUuid

public UUID getUuid()
Description copied from interface: EntityRef
Gets the id.

Specified by:
getUuid in interface EntityRef
Returns:
connection id

getType

public String getType()
Description copied from interface: EntityRef
Gets the type.

Specified by:
getType in interface EntityRef
Returns:
the type

getIndexId

public UUID getIndexId()

getConnectingIndexId

public UUID getConnectingIndexId()

getConnectionToConnectionEntity

public ConnectionRefImpl getConnectionToConnectionEntity()

getIndexIds

public UUID[] getIndexIds()
Returns:
index ids

loadFromColumns

public static ConnectionRefImpl loadFromColumns(List<me.prettyprint.hector.api.beans.HColumn<String,ByteBuffer>> columns)
Parameters:
columns -

toColumnMap

public Map<String,Object> toColumnMap()
Returns:
columns for insert

addIndexExpressionsToQuery

public void addIndexExpressionsToQuery(me.prettyprint.cassandra.model.IndexedSlicesQuery<UUID,String,ByteBuffer> q)

connectionsNull

public static boolean connectionsNull(ConnectedEntityRef... pairedConnections)

getConnections

public static ConnectedEntityRef[] getConnections(ConnectedEntityRef... connections)

getConnectionsList

public static List<ConnectedEntityRef> getConnectionsList(ConnectedEntityRef... connections)

getId

public static UUID getId(UUID connectingEntityId,
                         String connectionType,
                         UUID connectedEntityId)
Parameters:
connectingEntityId -
connectionType -
connectedEntityId -
Returns:
connection id

getId

public static UUID getId(UUID connectingEntityId,
                         String pairedConnectionType,
                         UUID pairedConnectingEntityId,
                         String connectionType,
                         UUID connectedEntityId)
Connection id is constructed from packed structure of properties strings are truncated to 16 ascii bytes. Connection id is now MD5'd into a UUID via UUID.nameUUIDFromBytes() so, technically string concatenation could be used prior to MD5

Parameters:
connectingEntityId -
pairedConnectionType -
pairedConnectingEntityId -
connectionType -
connectedEntityId -
Returns:
connection id

getId

public static UUID getId(EntityRef connectingEntity,
                         ConnectedEntityRef connectedEntity,
                         ConnectedEntityRef... pairedConnections)

getIndexId

public static UUID getIndexId(UUID connectingEntityId,
                              String connectionType,
                              String connectedEntityType)
Parameters:
connectingEntityId -
connectionType -
connectedEntityType -
Returns:
connection index id

getIndexId

public static UUID getIndexId(UUID connectingEntityId,
                              String pairedConnectionType,
                              UUID pairedConnectingEntityId,
                              String connectionType,
                              String connectedEntityType)
Parameters:
connectingEntityId -
pairedConnectionType -
pairedConnectingEntityId -
connectionType -
connectedEntityType -
Returns:
connection index id

getIndexId

public static UUID getIndexId(EntityRef connectingEntity,
                              String connectionType,
                              String connectedEntityType,
                              ConnectedEntityRef... pairedConnections)

getIndexId

public static UUID getIndexId(int variant,
                              UUID connectingEntityId,
                              String pairedConnectionType,
                              UUID pairedConnectingEntityId,
                              String connectionType,
                              String connectedEntityType)
Parameters:
variant -
connectingEntityId -
pairedConnectionType -
pairedConnectingEntityId -
connectionType -
connectedEntityType -
Returns:
connection index id

getIndexId

public static UUID getIndexId(int variant,
                              EntityRef connectingEntity,
                              String connectionType,
                              String connectedEntityType,
                              ConnectedEntityRef... pairedConnections)

getIndexIds

public static UUID[] getIndexIds(UUID connectingEntityId,
                                 String connectionType,
                                 String connectedEntityType)
Parameters:
connectingEntityId -
connectionType -
connectedEntityType -
Returns:
index ids

getIndexIds

public static UUID[] getIndexIds(UUID connectingEntityId,
                                 String pairedConnectionType,
                                 UUID pairedConnectingEntityId,
                                 String connectionType,
                                 String connectedEntityType)
Parameters:
connectingEntityId -
pairedConnectionType -
pairedConnectingEntityId -
connectionType -
connectedEntityType -
Returns:
index ids

getIndexIds

public static UUID[] getIndexIds(EntityRef connectingEntity,
                                 String connectionType,
                                 String connectedEntityType,
                                 ConnectedEntityRef... pairedConnections)

getColumnNames

public static List<String> getColumnNames()
Returns:
columns for retrieving CF row

getColumnNamesSet

public static Set<String> getColumnNamesSet()

getIdColumnNames

public static List<String> getIdColumnNames()
Returns:
columns for retrieving CF row

getColumnDefinitions

public static List<org.apache.cassandra.thrift.ColumnDef> getColumnDefinitions()
Returns:
columns for creating CF

getIndexes

public static String getIndexes()


Copyright © 2013. All Rights Reserved.