/** * Defines if the definition of the edge is equal to the given one. * This is quite different than the equals method of the object itself. * * @return true if equal, otherwise false */ public boolean equalsDefinition(BusinessServiceEdgeEntity other) { if (other == null) return false; if (!getClass().equals(other.getClass())) return false; boolean equals = Objects.equals(getWeight(), other.getWeight()) && Objects.equals(getBusinessService().getId(), other.getBusinessService().getId()) && getMapFunction().equalsDefinition(other.getMapFunction()); return equals; }
@Override public MapFunction getMapFunction() { return new MapFunctionMapper().toServiceFunction(getEntity().getMapFunction()); }
@Override public void setMapFunction(final Edge edge, final MapFunction mapFunction) { // This is a workaround for a hibernate bug which does not remove // orphan elements if the element is replaced using the setter. See: // https://hibernate.atlassian.net/browse/HHH-6484 final BusinessServiceEdgeEntity edgeEntity = this.getBusinessServiceEdgeEntity(edge); final AbstractMapFunctionEntity prevMapFunctionEntity = edgeEntity.getMapFunction(); if (prevMapFunctionEntity != null && prevMapFunctionEntity.getId() != null) { this.mapFunctionDao.delete(prevMapFunctionEntity); } final AbstractMapFunctionEntity mapFunctionEntity = new MapFunctionMapper().toPersistenceFunction(mapFunction); edgeEntity.setMapFunction(mapFunctionEntity); }