/** * Constructor. * * @param id * the identifier of the subject of this document * @param revisionId * the id of the last revision of this document */ EntityDocumentImpl(EntityIdValue id, long revisionId) { Validate.notNull(id); this.entityId = id.getId(); this.siteIri = id.getSiteIri(); this.revisionId = revisionId; }
/** * Constructor. * * @param id * the identifier of the subject of this document * @param revisionId * the id of the last revision of this document */ EntityDocumentImpl(EntityIdValue id, long revisionId) { Validate.notNull(id); this.entityId = id.getId(); this.siteIri = id.getSiteIri(); this.revisionId = revisionId; }
/** * Returns a hash code for the given object. * * @see java.lang.Object#hashCode() * @param o * the object to create a hash for * @return the hash code of the object */ public static int hashCode(EntityIdValue o) { int result; result = o.getId().hashCode(); result = prime * result + o.getSiteIri().hashCode(); result = prime * result + o.getEntityType().hashCode(); return result; }
/** * Returns a hash code for the given object. * * @see java.lang.Object#hashCode() * @param o * the object to create a hash for * @return the hash code of the object */ public static int hashCode(EntityIdValue o) { int result; result = o.getId().hashCode(); result = prime * result + o.getSiteIri().hashCode(); result = prime * result + o.getEntityType().hashCode(); return result; }
/** * Returns true if the parameters are two {@link EntityIdValue} objects with * exactly the same data. It does not matter if they are different * implementations of the interface as long as their content is the same. * * @param o1 * the first object to compare * @param o2 * the second object to compare * @return true if both objects are equal */ public static boolean equalsEntityIdValue(EntityIdValue o1, Object o2) { if (o2 == null) { return false; } if (o2 == o1) { return true; } if (!(o2 instanceof EntityIdValue)) { return false; } EntityIdValue other = (EntityIdValue) o2; return o1.getId().equals(other.getId()) && o1.getSiteIri().equals(other.getSiteIri()) && o1.getEntityType().equals(other.getEntityType()); }
/** * Returns true if the parameters are two {@link EntityIdValue} objects with * exactly the same data. It does not matter if they are different * implementations of the interface as long as their content is the same. * * @param o1 * the first object to compare * @param o2 * the second object to compare * @return true if both objects are equal */ public static boolean equalsEntityIdValue(EntityIdValue o1, Object o2) { if (o2 == null) { return false; } if (o2 == o1) { return true; } if (!(o2 instanceof EntityIdValue)) { return false; } EntityIdValue other = (EntityIdValue) o2; return o1.getId().equals(other.getId()) && o1.getSiteIri().equals(other.getSiteIri()) && o1.getEntityType().equals(other.getEntityType()); }
/** * Constructor. Marks the given lists of statements for being added to or * deleted from the given document, respectively. The current content of the * document is compared with the requested changes to avoid duplicates * (merging references of duplicate statements), and to avoid deletions of * statements that have changed or ceased to exist. * * @param currentDocument * the document with the current statements * @param addStatements * the list of new statements to be added * @param deleteStatements * the list of statements to be deleted */ public StatementUpdate(StatementDocument currentDocument, List<Statement> addStatements, List<Statement> deleteStatements) { this.currentDocument = currentDocument; this.toKeep = new HashMap<>(); this.toDelete = new ArrayList<>(); markStatementsForUpdate(currentDocument, addStatements, deleteStatements); this.mapper = new DatamodelMapper(currentDocument.getEntityId().getSiteIri()); }
/** * Constructor. Marks the given lists of statements for being added to or * deleted from the given document, respectively. The current content of the * document is compared with the requested changes to avoid duplicates * (merging references of duplicate statements), and to avoid deletions of * statements that have changed or ceased to exist. * * @param currentDocument * the document with the current statements * @param addStatements * the list of new statements to be added * @param deleteStatements * the list of statements to be deleted */ public StatementUpdate(StatementDocument currentDocument, List<Statement> addStatements, List<Statement> deleteStatements) { this.currentDocument = currentDocument; this.toKeep = new HashMap<>(); this.toDelete = new ArrayList<>(); markStatementsForUpdate(currentDocument, addStatements, deleteStatements); this.mapper = new DatamodelMapper(currentDocument.getEntityId().getSiteIri()); }