@Override public String toString() { return "{" + "name='" + name + '\'' + ", " + (element instanceof Vertex ? "vertex" : "edge") + "Id=" + (element == null ? null : element.getId()) + '}'; }
@Override public ExistingElementMutation<T> softDeleteProperties(String key, String name) { for (Property prop : this.element.getProperties(key, name)) { softDeleteProperty(prop); } return this; }
public ExistingElementMutationImpl(T element) { this.element = element; if (element != null) { this.oldElementVisibility = element.getVisibility(); } }
/** * Permanently deletes all properties with the given name that you have access to. Only properties which you have * access to will be deleted. * * @param name The name of the property to delete. */ default void deleteProperties(String name, Authorizations authorizations) { for (Property p : getProperties(name)) { deleteProperty(p.getKey(), p.getName(), p.getVisibility(), authorizations); } }
protected void deleteAllExtendedDataForElement(Element element, Authorizations authorizations) { if (!element.getFetchHints().isIncludeExtendedDataTableNames() || element.getExtendedDataTableNames().size() <= 0) { return; } for (ExtendedDataRow row : getExtendedData(ElementType.getTypeFromElement(element), element.getId(), null, authorizations)) { deleteExtendedDataRow(row.getId(), authorizations); } }
/** * Soft deletes all properties with the given name that you have access to. Only properties which you have * access to will be soft deleted. * * @param name The name of the property to delete. */ default void softDeleteProperties(String name, Authorizations authorizations) { for (Property property : getProperties(name)) { softDeleteProperty(property.getKey(), property.getName(), property.getVisibility(), authorizations); } }
for (Element element : elements) { if (i % 1000000 == 0) { LOGGER.debug("checking: %s", element.getId()); for (Property property : element.getProperties()) { visitor.visitProperty(element, property); for (String tableName : element.getExtendedDataTableNames()) { for (ExtendedDataRow extendedDataRow : element.getExtendedData(tableName)) { visitor.visitExtendedDataRow(element, tableName, extendedDataRow); for (Property property : extendedDataRow.getProperties()) {
long beforeActionTimestamp = System.currentTimeMillis() - 1; if (action == ClientApiPublishItem.Action.DELETE) { element.softDeleteProperty(key, name, authorizations); graph.flush(); workQueueRepository.pushPublishedPropertyDeletion(element, key, name, beforeActionTimestamp, Priority.HIGH); return; ExistingElementMutation elementMutation = element.prepareMutation(); List<Property> properties = IterableUtils.toList(element.getProperties(key, name)); SandboxStatus[] sandboxStatuses = SandboxStatusUtil.getPropertySandboxStatuses(properties, workspaceId); boolean foundProperty = false; element.softDeleteProperty(key, name, new Visibility(workspaceId), authorizations); graph.flush(); workQueueRepository.pushPublishedPropertyDeletion( element.softDeleteProperty(key, name, propertyVisibility, authorizations); workQueueRepository.pushPublishedPropertyDeletion( element, ); if (publicProperty != null) { element.markPropertyVisible(publicProperty, new Visibility(workspaceId), authorizations); element.softDeleteProperty(key, name, publicVisibility, authorizations); } else { newVisibility = publicVisibility; element.addPropertyValue(key, name, property.getValue(), metadata, newVisibility, authorizations);
public static JSONObject toJsonElement(Element element, String workspaceId) { JSONObject json = new JSONObject(); json.put("id", element.getId()); json.put("properties", toJsonProperties(element.getProperties(), workspaceId)); json.put("sandboxStatus", SandboxStatusUtil.getSandboxStatus(element, workspaceId).toString()); VisibilityJson visibilityJson = VisalloProperties.VISIBILITY_JSON.getPropertyValue(element); if (visibilityJson != null) { json.put("visibilitySource", visibilityJson.getSource()); } return json; }
private static void populateClientApiElement( ClientApiElement clientApiElement, org.vertexium.Element element, String workspaceId ) { clientApiElement.setId(element.getId()); clientApiElement.getProperties().addAll(toClientApiProperties(element.getProperties(), workspaceId)); clientApiElement.getExtendedDataTableNames().addAll(element.getExtendedDataTableNames()); clientApiElement.setSandboxStatus(SandboxStatusUtil.getSandboxStatus(element, workspaceId)); VisibilityJson visibilityJson = VisalloProperties.VISIBILITY_JSON.getPropertyValue(element); if (visibilityJson != null) { clientApiElement.setVisibilitySource(visibilityJson.getSource()); } if (clientApiElement instanceof ClientApiVertex) { ClientApiVertex clientApiVertex = (ClientApiVertex) clientApiElement; String conceptType = VisalloProperties.CONCEPT_TYPE.getPropertyValue(element, null); clientApiVertex.setConceptType(conceptType); } }
@Override protected boolean isMatch(Element element) { for (String authorization : authorizations) { if (element.getVisibility().hasAuthorization(authorization)) { return true; } boolean hiddenVisibilityMatches = StreamUtils.stream(element.getHiddenVisibilities()) .anyMatch(visibility -> visibility.hasAuthorization(authorization)); if (hiddenVisibilityMatches) { return true; } boolean propertyMatches = StreamUtils.stream(element.getProperties()) .anyMatch(property -> { if (property.getVisibility().hasAuthorization(authorization)) { return true; } return StreamUtils.stream(property.getHiddenVisibilities()) .anyMatch(visibility -> visibility.hasAuthorization(authorization)); }); if (propertyMatches) { return true; } } return false; }
MUTATION_LOGGER.trace("updateElement: %s", element.getId()); if (flushObjectQueue.containsElementId(element.getId())) { flushObjectQueue.flush(); addActionRequestBuilderForFlush(element, updateRequestBuilder); if (mutation.getNewElementVisibility() != null && element.getFetchHints().isIncludeExtendedDataTableNames()) { ImmutableSet<String> extendedDataTableNames = element.getExtendedDataTableNames(); if (extendedDataTableNames != null && !extendedDataTableNames.isEmpty()) { extendedDataTableNames.forEach(tableName -> graph, element, element.getExtendedData(tableName), mutation.getOldElementVisibility(), mutation.getNewElementVisibility()
Property property = getProperty(element, propertyKey, propertyName, oldVisibilitySource, workspaceId); if (property == null) { throw new VisalloResourceNotFoundException("Could not find property " + propertyKey + ":" + propertyName + " on element " + element.getId()); "%s Altering property visibility %s [%s:%s] from [%s] to [%s]", user.getUserId(), element.getId(), propertyKey, propertyName, ); ExistingElementMutation<T> m = element.<T>prepareMutation() .alterPropertyVisibility(property, newVisibility); VisalloProperties.VISIBILITY_JSON_METADATA.setMetadata(m, property, newVisibilityJson, defaultVisibility); T newElement = m.save(authorizations); Property newProperty = newElement.getProperty(propertyKey, propertyName, newVisibility); checkNotNull( newProperty, "Could not find altered property " + propertyKey + ":" + propertyName + " on element " + element.getId() );
Property oldProperty = element.getProperty(propertyKey, propertyName, oldPropertyVisibility); boolean isUpdate = oldProperty != null; propertyMetadata = VertexiumMetadataUtil.mergeMetadata(propertyMetadata, metadata); ExistingElementMutation<T> elementMutation = element.prepareMutation(); termMentionRepository.addSourceInfo( element, element.getId(), TermMentionFor.PROPERTY, propertyKey, Property publicProperty = element.getProperty(propertyKey, propertyName); long beforeDeletionTimestamp = System.currentTimeMillis() - 1; element.markPropertyHidden(publicProperty, new Visibility(workspaceId), authorizations); graph.flush(); workQueueRepository.pushGraphPropertyQueueHiddenOrDeleted(element, publicProperty, ElementOrPropertyStatus.HIDDEN, beforeDeletionTimestamp, workspaceId, Priority.HIGH);
ExistingElementMutation<Element> m = element.prepareMutation(); for (Property property : element.getProperties()) { if (ctx.isLabelProperty(property)) { continue;
/** * Similar to {@link GraphUpdateContext#update(Element, Update)} but calls * {@link ElementUpdateContext#updateBuiltInProperties(Date, VisibilityJson)} and * {@link ElementUpdateContext#setConceptType(String)} before calling * updateFn. */ public <T extends Element> UpdateFuture<T> update( T element, Date modifiedDate, VisibilityJson visibilityJson, String conceptType, Update<T> updateFn ) { checkNotNull(element, "element cannot be null"); return update(element.prepareMutation(), modifiedDate, visibilityJson, conceptType, updateFn); }
visibilityStrings.add(element.getVisibility().getVisibilityString()); for (Property property : element.getProperties()) { visibilityStrings.add(property.getVisibility().getVisibilityString());
/** * Permanently deletes a property given it's key and name from the element. Only properties which you have access * to can be deleted using this method. * * @param key The property key. * @param name The property name. */ default void deleteProperty(String key, String name, Authorizations authorizations) { deleteProperty(key, name, null, authorizations); }
@Override protected Iterable<? extends ExtendedDataRow> getIterable(Element element) { return new SelectManyIterable<String, ExtendedDataRow>(element.getExtendedDataTableNames()) { @Override protected Iterable<? extends ExtendedDataRow> getIterable(String tableName) { return element.getExtendedData(tableName); } }; } };
public Iterable<ExtendedDataRow> getRows() { return getElement().getExtendedData(tableName); }