/** * 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 Long getId() { return m_entity.getId(); }
@Override public boolean equalsDefinition(BusinessServiceEdgeEntity other) { boolean equalsSuper = super.equalsDefinition(other); if (equalsSuper) { return Objects.equals(m_application, ((ApplicationEdgeEntity) other).m_application); } return false; }
@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); }
@Override public Edge getEdgeById(Long edgeId) { BusinessServiceEdgeEntity edgeEntity = getBusinessServiceEdgeEntity(edgeId); return edgeEntity.accept(new EdgeEntityVisitor<Edge>() { @Override public Edge visit(BusinessServiceChildEdgeEntity edgeEntity) { return new ChildEdgeImpl(BusinessServiceManagerImpl.this, edgeEntity); } @Override public Edge visit(SingleReductionKeyEdgeEntity edge) { return new ReductionKeyEdgeImpl(BusinessServiceManagerImpl.this, edge); } @Override public Edge visit(IPServiceEdgeEntity edge) { return new IpServiceEdgeImpl(BusinessServiceManagerImpl.this, edge); } @Override public Edge visit(ApplicationEdgeEntity edge) { return new ApplicationEdgeImpl(BusinessServiceManagerImpl.this, edge); } }); }
@Override public BusinessService getSource() { return new BusinessServiceImpl(m_manager, m_entity.getBusinessService()); }
@Override public int getWeight() { return getEntity().getWeight(); }
@Override public MapFunction getMapFunction() { return new MapFunctionMapper().toServiceFunction(getEntity().getMapFunction()); }
@Override public void setWeight(int weight) { getEntity().setWeight(weight); }
@Override public int hashCode() { return getEntity().hashCode(); }
@Override public void setSource(BusinessService source) { getEntity().setBusinessService(((BusinessServiceImpl) source).getEntity()); }
request.setAttributes(new HashMap<>(input.getAttributes())); request.setReduceFunction(transform(input.getReductionFunction())); input.getEdges().forEach(eachEdge -> eachEdge.accept(new EdgeEntityVisitor<Void>() { @Override public Void visit(BusinessServiceChildEdgeEntity edgeEntity) {
@Override public boolean equals(Object obj) { if (obj == null) return false; if (obj == this) return true; if (!(obj instanceof BusinessServiceEdgeEntity)) return false; final BusinessServiceEdgeEntity other = (BusinessServiceEdgeEntity) obj; if (getId() != null) { return getId().equals(other.getId()); } return super.equals(obj); }
@Override public boolean equalsDefinition(BusinessServiceEdgeEntity other) { boolean equalsSuper = super.equalsDefinition(other); if (equalsSuper) { return Objects.equals(m_ipService, ((IPServiceEdgeEntity) other).m_ipService) && Objects.equals(m_friendlyName, ((IPServiceEdgeEntity) other).m_friendlyName); } return false; }
@Override public boolean equalsDefinition(BusinessServiceEdgeEntity other) { boolean equalsSuper = super.equalsDefinition(other); if (equalsSuper) { return Objects.equals(reductionKey, ((SingleReductionKeyEdgeEntity) other).reductionKey) && Objects.equals(m_friendlyName, ((SingleReductionKeyEdgeEntity) other).m_friendlyName); } return false; }
@Override public boolean equalsDefinition(BusinessServiceEdgeEntity other) { boolean equalsSuper = super.equalsDefinition(other); if (equalsSuper) { return Objects.equals(child.getId(), ((BusinessServiceChildEdgeEntity) other).getChild().getId()); } return false; }