@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Identifier)) { return false; } Identifier other = (Identifier) obj; if (id == null) { if (other.getId() != null) { return false; } } else if (!id.equals(other.getId())) { return false; } if (type == null) { if (other.getType() != null) { return false; } } else if (!type.equals(other.getType())) { return false; } return true; } }
private void validateChild(Identifier child, TimelineEntityType thisType) { TimelineEntityType childType = TimelineEntityType.valueOf(child.getType()); if (!thisType.isChild(childType)) { throw new IllegalArgumentException( child.getType() + " is not the acceptable child of " + this.getType()); } } }
Assert.assertEquals(flow2.getType(), app1.getParent().getType()); Assert.assertEquals(flow2.getId(), app1.getParent().getId()); app1.addInfo(ApplicationEntity.PARENT_INFO_KEY, "invalid parent object"); Assert.assertEquals(1, app1.getChildren().size()); Assert.assertEquals( appAttempt.getType(), app1.getChildren().iterator().next().getType()); Assert.assertEquals( appAttempt.getId(), app1.getChildren().iterator().next().getId());
public void setParent(Identifier parent) { validateParent(parent.getType()); addInfo(PARENT_INFO_KEY, parent); }