@Override public void handle(HttpServletRequest request, HttpServletResponse response, HandlerChain chain) throws Exception { LumifyVisibility lumifyVisibility = new LumifyVisibility(); final String propertyName = getRequiredParameter(request, "propertyName"); final String propertyKey = getRequiredParameter(request, "propertyKey"); final String sourceId = getRequiredParameter(request, "source"); final String destId = getRequiredParameter(request, "dest"); final String edgeId = getRequiredParameter(request, "edgeId"); User user = getUser(request); Authorizations authorizations = getAuthorizations(request, user); String workspaceId = getActiveWorkspaceId(request); OntologyProperty property = ontologyRepository.getProperty(propertyName); if (property == null) { throw new RuntimeException("Could not find property: " + propertyName); } // TODO remove all properties from all edges? I don't think so Edge edge = graph.getEdge(edgeId, authorizations); Object oldValue = null; Property oldProperty = edge.getProperty(propertyKey, propertyName); if (oldProperty != null) { oldValue = oldProperty.getValue(); } // TODO: replace "" when we implement commenting on ui auditRepository.auditRelationshipProperty( AuditAction.DELETE, sourceId, destId, propertyKey, property.getDisplayName(), oldValue, null, edge, "", "", user, lumifyVisibility.getVisibility()); edge.removeProperty(propertyKey, propertyName, authorizations); graph.flush(); List<Property> properties = new ArrayList<Property>(); for (Property p : edge.getProperties()) { properties.add(p); } workQueueRepository.pushGraphPropertyQueue(edge, null, propertyName); JSONArray resultsJson = JsonSerializer.toJsonProperties(properties, workspaceId); respondWithJson(response, resultsJson); }
private Object jsonValueToObject(JSONArray values, PropertyType propertyDataType, int index) throws ParseException { return OntologyProperty.convert(values, propertyDataType, index); }