@Test void deleteAttributeById() { Object attrId = "attr0"; Attribute attribute = mock(Attribute.class); EntityType entityType = mock(EntityType.class); when(dataService.findOneById(ATTRIBUTE_META_DATA, attrId, Attribute.class)) .thenReturn(attribute); when(attribute.getEntity()).thenReturn(entityType); metaDataServiceImpl.deleteAttributeById(attrId); verify(dataService).update(ENTITY_TYPE_META_DATA, entityType); verify(dataService).delete(ATTRIBUTE_META_DATA, attribute); verify(entityType).removeAttribute(attribute); }
@Transactional @Override public void deleteAttributeById(Object id) { Attribute attribute = dataService.findOneById(ATTRIBUTE_META_DATA, id, Attribute.class); if (attribute == null) { throw new UnknownEntityException(ATTRIBUTE_META_DATA, id); } EntityType entityType = attribute.getEntity(); entityType.removeAttribute(attribute); dataService.update(ENTITY_TYPE_META_DATA, entityType); dataService.delete(ATTRIBUTE_META_DATA, attribute); }
MetaDataServiceImpl implements MetaDataService { @Transactional @Override public void deleteAttributeById(Object id) { Attribute attribute = dataService.findOneById(ATTRIBUTE_META_DATA, id, Attribute.class); if (attribute == null) { throw new UnknownEntityException(ATTRIBUTE_META_DATA, id); } EntityType entityType = attribute.getEntity(); entityType.removeAttribute(attribute); dataService.update(ENTITY_TYPE_META_DATA, entityType); dataService.delete(ATTRIBUTE_META_DATA, attribute); } }
MetaDataServiceImpl implements MetaDataService { @Transactional @Override public void deleteAttributeById(Object id) { Attribute attribute = dataService.findOneById(ATTRIBUTE_META_DATA, id, Attribute.class); if (attribute == null) { throw new UnknownEntityException(ATTRIBUTE_META_DATA, id); } EntityType entityType = attribute.getEntity(); entityType.removeAttribute(attribute); dataService.update(ENTITY_TYPE_META_DATA, entityType); dataService.delete(ATTRIBUTE_META_DATA, attribute); } MetaDataServiceImpl(
      DataService dataService,
      RepositoryCollectionRegistry repoCollectionRegistry,
      SystemEntityTypeRegistry systemEntityTypeRegistry,
      EntityTypeDependencyResolver entityTypeDependencyResolver,
      PackagePersister packagePersister); }
MetaDataServiceImpl implements MetaDataService { @Transactional @Override public void deleteAttributeById(Object id) { Attribute attribute = dataService.findOneById(ATTRIBUTE_META_DATA, id, Attribute.class); if (attribute == null) { throw new UnknownEntityException(ATTRIBUTE_META_DATA, id); } EntityType entityType = attribute.getEntity(); entityType.removeAttribute(attribute); dataService.update(ENTITY_TYPE_META_DATA, entityType); dataService.delete(ATTRIBUTE_META_DATA, attribute); } MetaDataServiceImpl(
      DataService dataService,
      RepositoryCollectionRegistry repoCollectionRegistry,
      SystemEntityTypeRegistry systemEntityTypeRegistry,
      EntityTypeDependencyResolver entityTypeDependencyResolver,
      PackagePersister packagePersister); @Override Optional<Repository<Entity>> getRepository(String entityTypeId); @SuppressWarnings("unchecked") @Override Optional<Repository<E>> getRepository(
      String entityTypeId, Class<E> entityClass); @Override Optional<Repository<Entity>> getRepository(EntityType entityType); @SuppressWarnings("unchecked") @Override Optional<Repository<E>> getRepository(
      EntityType entityType, Class<E> entityClass); @Override boolean hasRepository(String entityTypeId); @Transactional @Override Repository<Entity> createRepository(EntityType entityType); @Transactional @Override Repository<E> createRepository(
      EntityType entityType, Class<E> entityClass); @Override RepositoryCollection getDefaultBackend(); @Override RepositoryCollection getBackend(String backendName); @Transactional @Override void deleteEntityType(String entityTypeId); @Transactional @Override void deleteEntityTypes(Collection<String> entityTypeIds); @Transactional @Override void deleteAttributeById(Object id); @Override RepositoryCollection getBackend(EntityType entityType); @Transactional @Override void addEntityType(EntityType entityType); @Transactional @Override void updateEntityType(EntityType entityType); @Transactional @Override void upsertEntityTypes(Collection<EntityType> entityTypes); @Transactional @Override void addAttribute(Attribute attr); @Override boolean hasEntityType(String entityTypeId); @Override Optional<EntityType> getEntityType(String entityTypeId); @Transactional @Override void addPackage(Package aPackage); @Transactional @Override void upsertPackages(Stream<Package> packages); @Override Optional<Package> getPackage(String packageId); @Override List<Package> getPackages(); @Override List<Package> getRootPackages(); @Transactional @Override void upsertTags(Collection<Tag> tags); @Override Stream<EntityType> getEntityTypes(); @Override Stream<Repository<Entity>> getRepositories(); @Override @Nonnull Iterator<RepositoryCollection> iterator(); @Override Map<String, Boolean> determineImportableEntities(
      RepositoryCollection repositoryCollection); @Override boolean isEntityTypeCompatible(EntityType newEntityType); @Override boolean hasBackend(String backendName); @Override Stream<EntityType> getConcreteChildren(EntityType entityType); @Override Stream<Attribute> getReferringAttributes(String entityTypeId); }
MetaDataServiceImpl implements MetaDataService { @Transactional @Override public void deleteAttributeById(Object id) { Attribute attribute = dataService.findOneById(ATTRIBUTE_META_DATA, id, Attribute.class); if (attribute == null) { throw new UnknownEntityException(ATTRIBUTE_META_DATA, id); } EntityType entityType = attribute.getEntity(); entityType.removeAttribute(attribute); dataService.update(ENTITY_TYPE_META_DATA, entityType); dataService.delete(ATTRIBUTE_META_DATA, attribute); } MetaDataServiceImpl(
      DataService dataService,
      RepositoryCollectionRegistry repoCollectionRegistry,
      SystemEntityTypeRegistry systemEntityTypeRegistry,
      EntityTypeDependencyResolver entityTypeDependencyResolver,
      PackagePersister packagePersister); @Override Optional<Repository<Entity>> getRepository(String entityTypeId); @SuppressWarnings("unchecked") @Override Optional<Repository<E>> getRepository(
      String entityTypeId, Class<E> entityClass); @Override Optional<Repository<Entity>> getRepository(EntityType entityType); @SuppressWarnings("unchecked") @Override Optional<Repository<E>> getRepository(
      EntityType entityType, Class<E> entityClass); @Override boolean hasRepository(String entityTypeId); @Transactional @Override Repository<Entity> createRepository(EntityType entityType); @Transactional @Override Repository<E> createRepository(
      EntityType entityType, Class<E> entityClass); @Override RepositoryCollection getDefaultBackend(); @Override RepositoryCollection getBackend(String backendName); @Transactional @Override void deleteEntityType(String entityTypeId); @Transactional @Override void deleteEntityTypes(Collection<String> entityTypeIds); @Transactional @Override void deleteAttributeById(Object id); @Override RepositoryCollection getBackend(EntityType entityType); @Transactional @Override void addEntityType(EntityType entityType); @Transactional @Override void updateEntityType(EntityType entityType); @Transactional @Override void upsertEntityTypes(Collection<EntityType> entityTypes); @Transactional @Override void addAttribute(Attribute attr); @Override boolean hasEntityType(String entityTypeId); @Override Optional<EntityType> getEntityType(String entityTypeId); @Transactional @Override void addPackage(Package aPackage); @Transactional @Override void upsertPackages(Stream<Package> packages); @Override Optional<Package> getPackage(String packageId); @Override List<Package> getPackages(); @Override List<Package> getRootPackages(); @Transactional @Override void upsertTags(Collection<Tag> tags); @Override Stream<EntityType> getEntityTypes(); @Override Stream<Repository<Entity>> getRepositories(); @Override @Nonnull Iterator<RepositoryCollection> iterator(); @Override Map<String, Boolean> determineImportableEntities(
      RepositoryCollection repositoryCollection); @Override boolean isEntityTypeCompatible(EntityType newEntityType); @Override boolean hasBackend(String backendName); @Override Stream<EntityType> getConcreteChildren(EntityType entityType); @Override Stream<Attribute> getReferringAttributes(String entityTypeId);  }