public ElementType toElementType() { switch (this) { case VERTEX: case VERTEX_EXTENDED_DATA: return ElementType.VERTEX; case EDGE: case EDGE_EXTENDED_DATA: return ElementType.EDGE; } throw new VertexiumException("Unhandled type: " + this); }
public IpV4Address(byte[] octets) { if (octets.length != 4) { throw new VertexiumException("Invalid IP address. Expected 4 octets, found " + octets.length); } this.octets = new int[4]; for (int i = 0; i < 4; i++) { this.octets[i] = octets[i]; } }
public static ElasticsearchDocumentType getExtendedDataDocumentTypeFromElementType(ElementType elementType) { switch (elementType) { case VERTEX: return VERTEX_EXTENDED_DATA; case EDGE: return EDGE_EXTENDED_DATA; default: throw new VertexiumException("Unhandled element type: " + elementType); } } }
public static ElasticsearchDocumentType getExtendedDataDocumentTypeFromElementType(ElementType elementType) { switch (elementType) { case VERTEX: return VERTEX_EXTENDED_DATA; case EDGE: return EDGE_EXTENDED_DATA; default: throw new VertexiumException("Unhandled element type: " + elementType); } } }
public static ElasticsearchDocumentType getExtendedDataDocumentTypeFromElementType(ElementType elementType) { switch (elementType) { case VERTEX: return VERTEX_EXTENDED_DATA; case EDGE: return EDGE_EXTENDED_DATA; default: throw new VertexiumException("Unhandled element type: " + elementType); } } }
/** * This method should be overridden if {@link #search(EnumSet, EnumSet)} is not overridden. */ protected QueryResultsIterable<? extends VertexiumObject> extendedData(FetchHints fetchHints) { throw new VertexiumException("not implemented"); }
private int argumentToInt(Object argument) { if (argument instanceof Long) { return (int) ((long) argument); } if (argument instanceof Integer) { return (int) argument; } throw new VertexiumException("Could not convert argument \"" + argument + "\" to int"); } }
public String toString() { switch (this) { case PLUS_EQUAL: return "+="; case EQUAL: return "="; default: throw new VertexiumException("unhandled op: " + this); } } }
@Override public InputStream getInputStream() { try { return fs.open(this.path); } catch (IOException ex) { throw new VertexiumException("Could not open: " + this.path, ex); } } }
public IpV4Address(int[] octets) { if (octets.length != 4) { throw new VertexiumException("Invalid IP address. Expected 4 octets, found " + octets.length); } this.octets = Arrays.copyOf(octets, 4); }
@SuppressWarnings("unchecked") public Class<? extends T> getMinMaxType() { if (min != null) { return (Class<? extends T>) min.getClass(); } if (max != null) { return (Class<? extends T>) max.getClass(); } throw new VertexiumException("Invalid state. min or max must not be null."); } }
@Override public String nextId() { synchronized (ids) { if (ids.size() == 0) { throw new VertexiumException("No ids in the queue to give out"); } return ids.remove(); } }
public static ElasticsearchDocumentType getExtendedDataDocumentTypeFromElement(Element element) { if (element instanceof Vertex) { return ElasticsearchDocumentType.VERTEX_EXTENDED_DATA; } if (element instanceof Edge) { return ElasticsearchDocumentType.EDGE_EXTENDED_DATA; } throw new VertexiumException("Unhandled element type: " + element.getClass().getName()); }
public String getAggregationName(String name) { Matcher m = AGGREGATION_NAME_PATTERN.matcher(name); if (m.matches()) { return m.group(1); } throw new VertexiumException("Could not get aggregation name from: " + name); }
public String getPropertyVisibilityHashFromDeflatedPropertyName(String deflatedPropertyName) { Matcher m = PROPERTY_NAME_PATTERN.matcher(deflatedPropertyName); if (m.matches()) { return m.group(3); } throw new VertexiumException("Could not match property name: " + deflatedPropertyName); }
public String getPropertyVisibilityHashFromPropertyName(String propertyName) { Matcher m = PROPERTY_NAME_PATTERN.matcher(propertyName); if (m.matches()) { return m.group(3); } throw new VertexiumException("Could not match property name: " + propertyName); }
public String getAggregationName(String name) { Matcher m = AGGREGATION_NAME_PATTERN.matcher(name); if (m.matches()) { return m.group(1); } throw new VertexiumException("Could not get aggregation name from: " + name); }
private static VertexiumBlueprintsFactory createFactory(String factoryClassName) { try { Class factoryClass = Class.forName(factoryClassName); Constructor constructor = factoryClass.getConstructor(); return (VertexiumBlueprintsFactory) constructor.newInstance(); } catch (Exception ex) { throw new VertexiumException("Could not create factory: " + factoryClassName, ex); } } }
public IpV4Address(String ipAddress) { Matcher m = IP_REGEX.matcher(ipAddress); if (!m.matches()) { throw new VertexiumException("Could not parse IP address: " + ipAddress); } octets = new int[4]; for (int i = 0; i < 4; i++) { octets[i] = Integer.parseInt(m.group(i + 1)); } }
public HasNotPropertyContainer(Class dataType, Collection<PropertyDefinition> propertyDefinitions) { this.keys = propertyDefinitions.stream() .filter(propertyDefinition -> isPropertyOfType(propertyDefinition, dataType)) .map(PropertyDefinition::getPropertyName) .collect(Collectors.toSet()); if (this.keys.isEmpty()) { throw new VertexiumException("Invalid query parameters, no properties of type " + dataType.getName() + " found"); } }