allow hivename hxxx and vmxxxx in JsonPillar

This commit is contained in:
Peter Hormanns 2022-09-06 13:22:15 +02:00
parent 139ac93193
commit 40f4429922

View File

@ -50,10 +50,18 @@ public class JsonPillarServlet extends HttpServlet {
String hiveName = "";
if (hiveFqdn != null && hiveFqdn.length() == 19 && hiveFqdn.endsWith(".hostsharing.net") && hiveFqdn.startsWith("h")) {
hiveName = hiveFqdn.substring(0, 3);
} else {
if (hiveFqdn != null && hiveFqdn.length() == 20 && hiveFqdn.endsWith(".hostsharing.net") && hiveFqdn.startsWith("h")) {
hiveName = hiveFqdn.substring(0, 4);
} else {
if (hiveFqdn != null && hiveFqdn.length() == 22 && hiveFqdn.endsWith(".hostsharing.net") && hiveFqdn.startsWith("vm")) {
hiveName = hiveFqdn.substring(0, 6);
} else {
em.close();
throw new ServletException("error in hive parameter");
}
}
}
final Query hiveQuery = em.createQuery("SELECT h FROM Hives h WHERE h.name = :hive");
hiveQuery.setParameter("hive", hiveName);
final Object hiveResult = hiveQuery.getSingleResult();