@Test void testGetOwnAttributeByIdUnknownAttribute() { EntityType entityType = new EntityType(mock(Entity.class)); assertThrows( UnknownAttributeException.class, () -> entityType.getOwnAttributeById("UnknownAttributeIdentifier")); }
public Attribute getOwnAttributeById(String attributeIdentifier) { return getCachedOwnAttrs().values().stream() .filter(attribute -> attribute.getIdentifier().equals(attributeIdentifier)) .findFirst() .orElseThrow(() -> new UnknownAttributeException(this, attributeIdentifier)); }
EntityType extends StaticEntity implements Labeled { public Attribute getOwnAttributeById(String attributeIdentifier) { return getCachedOwnAttrs().values().stream() .filter(attribute -> attribute.getIdentifier().equals(attributeIdentifier)) .findFirst() .orElseThrow(() -> new UnknownAttributeException(this, attributeIdentifier)); } }
EntityType extends StaticEntity implements Labeled { public Attribute getOwnAttributeById(String attributeIdentifier) { return getCachedOwnAttrs().values().stream() .filter(attribute -> attribute.getIdentifier().equals(attributeIdentifier)) .findFirst() .orElseThrow(() -> new UnknownAttributeException(this, attributeIdentifier)); } EntityType(Entity entity); protected  EntityType();  EntityType(EntityType entityType);  EntityType(String entityId, EntityType entityType); }
EntityType extends StaticEntity implements Labeled { public Attribute getOwnAttributeById(String attributeIdentifier) { return getCachedOwnAttrs().values().stream() .filter(attribute -> attribute.getIdentifier().equals(attributeIdentifier)) .findFirst() .orElseThrow(() -> new UnknownAttributeException(this, attributeIdentifier)); } EntityType(Entity entity); protected  EntityType();  EntityType(EntityType entityType);  EntityType(String entityId, EntityType entityType); static EntityType newInstance(EntityType entityType); static EntityType newInstance(
      EntityType entityType, AttributeCopyMode attrCopyMode, AttributeFactory attrFactory); static Map<String, Attribute> deepCopyAttributes(
      EntityType entityType, EntityType entityTypeCopy, AttributeFactory attrFactory); @Override Iterable<String> getAttributeNames(); String getId(); EntityType setId(String id); String getLabel(); String getLabel(String languageCode); EntityType setLabel(String label); EntityType setLabel(String languageCode, String label); @Nullable @CheckForNull String getDescription(); @Nullable @CheckForNull String getDescription(String languageCode); EntityType setDescription(String description); EntityType setDescription(String languageCode, String description); String getBackend(); EntityType setBackend(String backend); @Nullable @CheckForNull Package getPackage(); EntityType setPackage(Package pack); Attribute getIdAttribute(); Attribute getOwnIdAttribute(); Attribute getLabelAttribute(); Attribute getLabelAttribute(String langCode); Attribute getOwnLabelAttribute(); Attribute getOwnLabelAttribute(String languageCode); Attribute getLookupAttribute(String lookupAttrName); Iterable<Attribute> getLookupAttributes(); Iterable<Attribute> getOwnLookupAttributes(); boolean isAbstract(); EntityType setAbstract(boolean isAbstract); @Nullable @CheckForNull EntityType getExtends(); EntityType setExtends(EntityType extend); Iterable<Attribute> getOwnAttributes(); EntityType setOwnAllAttributes(Iterable<Attribute> attrs); Iterable<Attribute> getAttributes(); Iterable<Attribute> getAtomicAttributes(); Iterable<Attribute> getAllAttributes(); Iterable<Attribute> getOwnAllAttributes(); Attribute getAttribute(String attrName); Attribute getAttributeByName(String attributeName); Attribute getOwnAttributeById(String attributeIdentifier); EntityType addAttribute(Attribute attr, AttributeRole... attrTypes); void addAttributes(Iterable<Attribute> attrs); boolean hasAttributeWithExpression(); void removeAttribute(Attribute attr); Iterable<Tag> getTags(); EntityType setTags(Iterable<Tag> tags); @SuppressWarnings("unused") void addTag(Tag tag); void removeTag(Tag tag); void setIndexingDepth(int indexingDepth); int getIndexingDepth(); Iterable<Attribute> getOwnAtomicAttributes(); boolean hasBidirectionalAttributes(); boolean hasMappedByAttributes(); Stream<Attribute> getOwnMappedByAttributes(); Stream<Attribute> getMappedByAttributes(); boolean hasInversedByAttributes(); Stream<Attribute> getInversedByAttributes(); @Override void set(String attributeName, Object value); @Override String toString(); }
EntityType extends StaticEntity implements Labeled { public Attribute getOwnAttributeById(String attributeIdentifier) { return getCachedOwnAttrs().values().stream() .filter(attribute -> attribute.getIdentifier().equals(attributeIdentifier)) .findFirst() .orElseThrow(() -> new UnknownAttributeException(this, attributeIdentifier)); } EntityType(Entity entity); protected  EntityType();  EntityType(EntityType entityType);  EntityType(String entityId, EntityType entityType); static EntityType newInstance(EntityType entityType); static EntityType newInstance(
      EntityType entityType, AttributeCopyMode attrCopyMode, AttributeFactory attrFactory); static Map<String, Attribute> deepCopyAttributes(
      EntityType entityType, EntityType entityTypeCopy, AttributeFactory attrFactory); @Override Iterable<String> getAttributeNames(); String getId(); EntityType setId(String id); String getLabel(); String getLabel(String languageCode); EntityType setLabel(String label); EntityType setLabel(String languageCode, String label); @Nullable @CheckForNull String getDescription(); @Nullable @CheckForNull String getDescription(String languageCode); EntityType setDescription(String description); EntityType setDescription(String languageCode, String description); String getBackend(); EntityType setBackend(String backend); @Nullable @CheckForNull Package getPackage(); EntityType setPackage(Package pack); Attribute getIdAttribute(); Attribute getOwnIdAttribute(); Attribute getLabelAttribute(); Attribute getLabelAttribute(String langCode); Attribute getOwnLabelAttribute(); Attribute getOwnLabelAttribute(String languageCode); Attribute getLookupAttribute(String lookupAttrName); Iterable<Attribute> getLookupAttributes(); Iterable<Attribute> getOwnLookupAttributes(); boolean isAbstract(); EntityType setAbstract(boolean isAbstract); @Nullable @CheckForNull EntityType getExtends(); EntityType setExtends(EntityType extend); Iterable<Attribute> getOwnAttributes(); EntityType setOwnAllAttributes(Iterable<Attribute> attrs); Iterable<Attribute> getAttributes(); Iterable<Attribute> getAtomicAttributes(); Iterable<Attribute> getAllAttributes(); Iterable<Attribute> getOwnAllAttributes(); Attribute getAttribute(String attrName); Attribute getAttributeByName(String attributeName); Attribute getOwnAttributeById(String attributeIdentifier); EntityType addAttribute(Attribute attr, AttributeRole... attrTypes); void addAttributes(Iterable<Attribute> attrs); boolean hasAttributeWithExpression(); void removeAttribute(Attribute attr); Iterable<Tag> getTags(); EntityType setTags(Iterable<Tag> tags); @SuppressWarnings("unused") void addTag(Tag tag); void removeTag(Tag tag); void setIndexingDepth(int indexingDepth); int getIndexingDepth(); Iterable<Attribute> getOwnAtomicAttributes(); boolean hasBidirectionalAttributes(); boolean hasMappedByAttributes(); Stream<Attribute> getOwnMappedByAttributes(); Stream<Attribute> getMappedByAttributes(); boolean hasInversedByAttributes(); Stream<Attribute> getInversedByAttributes(); @Override void set(String attributeName, Object value); @Override String toString();  }