@Test void testSetDefaultLookupAttributesIdEqualsLabel() { Attribute label = mock(Attribute.class); when(label.getName()).thenReturn("id"); Attribute id = mock(Attribute.class); when(id.getName()).thenReturn("id"); when(id.isVisible()).thenReturn(true); EntityType entityType = mock(EntityType.class); when(entityType.getOwnLabelAttribute()).thenReturn(label); when(entityType.getOwnIdAttribute()).thenReturn(id); intermediateParseResults.setDefaultLookupAttributes(entityType, 9); verify(id).setLookupAttributeIndex(9); verify(label, times(0)).setLookupAttributeIndex(any()); }
public static void setDefaultLookupAttributes(EntityType entityType, int lookupAttributeIndex) { Attribute ownIdAttr = entityType.getOwnIdAttribute(); if (ownIdAttr != null && ownIdAttr.isVisible()) { ownIdAttr.setLookupAttributeIndex(lookupAttributeIndex); lookupAttributeIndex++; } Attribute ownLabelAttr = entityType.getOwnLabelAttribute(); if (ownLabelAttr != null && ownIdAttr != null && !ownIdAttr.getName().equals(ownLabelAttr.getName())) { ownLabelAttr.setLookupAttributeIndex(lookupAttributeIndex); } }
IntermediateParseResults { public static void setDefaultLookupAttributes(EntityType entityType, int lookupAttributeIndex) { Attribute ownIdAttr = entityType.getOwnIdAttribute(); if (ownIdAttr != null && ownIdAttr.isVisible()) { ownIdAttr.setLookupAttributeIndex(lookupAttributeIndex); lookupAttributeIndex++; } Attribute ownLabelAttr = entityType.getOwnLabelAttribute(); if (ownLabelAttr != null && ownIdAttr != null && !ownIdAttr.getName().equals(ownLabelAttr.getName())) { ownLabelAttr.setLookupAttributeIndex(lookupAttributeIndex); } } }
IntermediateParseResults { public static void setDefaultLookupAttributes(EntityType entityType, int lookupAttributeIndex) { Attribute ownIdAttr = entityType.getOwnIdAttribute(); if (ownIdAttr != null && ownIdAttr.isVisible()) { ownIdAttr.setLookupAttributeIndex(lookupAttributeIndex); lookupAttributeIndex++; } Attribute ownLabelAttr = entityType.getOwnLabelAttribute(); if (ownLabelAttr != null && ownIdAttr != null && !ownIdAttr.getName().equals(ownLabelAttr.getName())) { ownLabelAttr.setLookupAttributeIndex(lookupAttributeIndex); } } IntermediateParseResults(EntityTypeFactory entityTypeFactory); }
IntermediateParseResults { public static void setDefaultLookupAttributes(EntityType entityType, int lookupAttributeIndex) { Attribute ownIdAttr = entityType.getOwnIdAttribute(); if (ownIdAttr != null && ownIdAttr.isVisible()) { ownIdAttr.setLookupAttributeIndex(lookupAttributeIndex); lookupAttributeIndex++; } Attribute ownLabelAttr = entityType.getOwnLabelAttribute(); if (ownLabelAttr != null && ownIdAttr != null && !ownIdAttr.getName().equals(ownLabelAttr.getName())) { ownLabelAttr.setLookupAttributeIndex(lookupAttributeIndex); } } IntermediateParseResults(EntityTypeFactory entityTypeFactory); void addTag(String identifier, Tag tag); boolean hasTag(String identifier); Tag getTag(String tagIdentifier); Package getPackage(String name); void addAttributes(String entityTypeId, List<EmxAttribute> emxAttrs); static void setDefaultLookupAttributes(EntityType entityType, int lookupAttributeIndex); EntityType addEntityType(String fullyQualifiedName); EntityType getEntityType(String name); void addLanguage(Language language); void addL10nString(L10nString l10nString); boolean hasEntityType(String name); boolean hasPackage(String name); void addPackage(String name, Package p); ImmutableMap<String, EntityType> getEntityMap(); ImmutableList<EntityType> getEntityTypes(); ImmutableMap<String, Package> getPackages(); ImmutableMap<String, Tag> getTags(); ImmutableMap<String, Language> getLanguages(); ImmutableMap<String, L10nString> getL10nStrings(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
IntermediateParseResults { public static void setDefaultLookupAttributes(EntityType entityType, int lookupAttributeIndex) { Attribute ownIdAttr = entityType.getOwnIdAttribute(); if (ownIdAttr != null && ownIdAttr.isVisible()) { ownIdAttr.setLookupAttributeIndex(lookupAttributeIndex); lookupAttributeIndex++; } Attribute ownLabelAttr = entityType.getOwnLabelAttribute(); if (ownLabelAttr != null && ownIdAttr != null && !ownIdAttr.getName().equals(ownLabelAttr.getName())) { ownLabelAttr.setLookupAttributeIndex(lookupAttributeIndex); } } IntermediateParseResults(EntityTypeFactory entityTypeFactory); void addTag(String identifier, Tag tag); boolean hasTag(String identifier); Tag getTag(String tagIdentifier); Package getPackage(String name); void addAttributes(String entityTypeId, List<EmxAttribute> emxAttrs); static void setDefaultLookupAttributes(EntityType entityType, int lookupAttributeIndex); EntityType addEntityType(String fullyQualifiedName); EntityType getEntityType(String name); void addLanguage(Language language); void addL10nString(L10nString l10nString); boolean hasEntityType(String name); boolean hasPackage(String name); void addPackage(String name, Package p); ImmutableMap<String, EntityType> getEntityMap(); ImmutableList<EntityType> getEntityTypes(); ImmutableMap<String, Package> getPackages(); ImmutableMap<String, Tag> getTags(); ImmutableMap<String, Language> getLanguages(); ImmutableMap<String, L10nString> getL10nStrings(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }