mirror of
https://github.com/dalbodeule/snap-admin.git
synced 2025-06-08 13:28:21 +00:00
Fixed #38
This commit is contained in:
parent
6eacecdef3
commit
32751552d4
@ -26,6 +26,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
@ -182,6 +183,14 @@ public class SnapAdmin {
|
||||
return findSchemaByClassName(klass.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this class is managed by SnapAdmin
|
||||
*/
|
||||
public boolean isManagedClass(Class<?> klass) {
|
||||
Optional<DbObjectSchema> hasSchema =
|
||||
schemas.stream().filter(s -> s.getClassName().equals(klass.getName())).findFirst();
|
||||
return hasSchema.isPresent();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method processes a BeanDefinition into a DbObjectSchema object,
|
||||
|
@ -287,7 +287,9 @@ public class DbObjectSchema {
|
||||
List<DbField> res = getFields().stream().filter(f -> {
|
||||
return f.getPrimitiveField().getAnnotation(OneToMany.class) != null
|
||||
|| f.getPrimitiveField().getAnnotation(ManyToMany.class) != null;
|
||||
}).collect(Collectors.toList());
|
||||
})
|
||||
.filter(f -> snapAdmin.isManagedClass(f.getConnectedType()))
|
||||
.collect(Collectors.toList());
|
||||
return res;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user