mirror of
https://github.com/dalbodeule/snap-admin.git
synced 2025-06-08 21:38: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.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -182,6 +183,14 @@ public class SnapAdmin {
|
|||||||
return findSchemaByClassName(klass.getName());
|
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,
|
* This method processes a BeanDefinition into a DbObjectSchema object,
|
||||||
|
@ -287,7 +287,9 @@ public class DbObjectSchema {
|
|||||||
List<DbField> res = getFields().stream().filter(f -> {
|
List<DbField> res = getFields().stream().filter(f -> {
|
||||||
return f.getPrimitiveField().getAnnotation(OneToMany.class) != null
|
return f.getPrimitiveField().getAnnotation(OneToMany.class) != null
|
||||||
|| f.getPrimitiveField().getAnnotation(ManyToMany.class) != null;
|
|| f.getPrimitiveField().getAnnotation(ManyToMany.class) != null;
|
||||||
}).collect(Collectors.toList());
|
})
|
||||||
|
.filter(f -> snapAdmin.isManagedClass(f.getConnectedType()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user