public String getFirstPairedConnectionType() { ConnectedEntityRef pairedConnection = getFirstPairedConnection(); if (pairedConnection != null) { return pairedConnection.getConnectionType(); } return null; }
public UUID getFirstPairedConnectedEntityId() { ConnectedEntityRef pairedConnection = getFirstPairedConnection(); if (pairedConnection != null) { return pairedConnection.getUuid(); } return null; }
public static UUID getIndexId( EntityRef connectingEntity, String connectionType, String connectedEntityType, ConnectedEntityRef... pairedConnections) { UUID uuid = null; try { if (connectionsNull(pairedConnections) && ((connectionType == null) && (connectedEntityType == null))) { return connectingEntity.getUuid(); } ByteArrayOutputStream byteStream = new ByteArrayOutputStream(16 + (32 * pairedConnections.length)); byteStream.write(uuidToBytesNullOk(connectingEntity.getUuid())); for (ConnectedEntityRef connection : pairedConnections) { String type = connection.getConnectionType(); UUID id = connection.getUuid(); byteStream.write(ascii(StringUtils.lowerCase(type))); byteStream.write(uuidToBytesNullOk(id)); } if (connectionType == null) { connectionType = NULL_ENTITY_TYPE; } if (connectedEntityType == null) { connectedEntityType = NULL_ENTITY_TYPE; } byteStream.write(ascii(StringUtils.lowerCase(connectionType))); byteStream.write(ascii(StringUtils.lowerCase(connectedEntityType))); byte[] raw_id = byteStream.toByteArray(); logger.info("raw connection index id: " + Hex.encodeHexString(raw_id)); uuid = UUID.nameUUIDFromBytes(raw_id); logger.info("connection index uuid: " + uuid); } catch (IOException e) { logger.error("Unable to create connection index UUID", e); } return uuid; }
public static boolean connectionsNull(ConnectedEntityRef... pairedConnections) { if ((pairedConnections == null) || (pairedConnections.length == 0)) { return true; } for (ConnectedEntityRef pairedConnection : pairedConnections) { if (pairedConnection == null || pairedConnection.getUuid() == null || pairedConnection.getUuid().equals(NULL_ID)) { return true; } } return false; }
/** @return */ @Override public String getConnectionType() { if (connectedEntity == null) { return null; } return connectedEntity.getConnectionType(); }
/** @return */ public UUID getConnectedEntityId() { return connectedEntity.getUuid(); }
/** @return */ public String getConnectedEntityType() { if (connectedEntity == null) { return null; } return connectedEntity.getType(); }