sort pacs and users

This commit is contained in:
Peter Hormanns 2021-08-13 19:14:10 +02:00
parent c8dc4469cd
commit f44fe4a00f
2 changed files with 9 additions and 3 deletions

View File

@ -235,7 +235,7 @@ public class PacProcessorFactory implements EntityProcessorFactory {
}
private Processor createSetQuotaProc(Pac pac) {
int quota = 128;
int quota = 1024;
Set<PacComponent> pacComponents = pac.getPacComponents();
for (PacComponent pacComponent : pacComponents) {
BaseComponent baseComponent = pacComponent.getBaseComponent();
@ -247,7 +247,7 @@ public class PacProcessorFactory implements EntityProcessorFactory {
int blocksSoft = ((Double) (quota * QuotaLimit.BLOCK_QUOTA_FACTOR)).intValue();
int blocksHard = ((Double) (quota * QuotaLimit.BLOCK_LIMIT_FACTOR)).intValue();
int inodesSoft = ((Double) (quota * QuotaLimit.FILE_QUOTA_FACTOR)).intValue();
int inodesHard = ((Double) (quota * QuotaLimit.FILE_QUOTA_FACTOR)).intValue();
int inodesHard = ((Double) (quota * QuotaLimit.FILE_LIMIT_FACTOR)).intValue();
return new ShellProcessor("setquota -g " + pac.getName() + " "
+ blocksSoft + " " + blocksHard + " "
+ inodesSoft + " " + inodesHard + " "

View File

@ -7,6 +7,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import javax.persistence.EntityManager;
import javax.persistence.Query;
@ -58,7 +59,7 @@ public class JsonPillarServlet extends HttpServlet {
final Object hiveResult = hiveQuery.getSingleResult();
final Hive hive = (Hive) hiveResult;
final Map<String, Boolean> dnsZones = new HashMap<>();
final Query pacsQuery = em.createQuery("SELECT p FROM Pacs p WHERE p.hive.name = :hive AND p.basepac.name = 'PAC/WEB'");
final Query pacsQuery = em.createQuery("SELECT p FROM Pacs p WHERE p.hive.name = :hive AND p.basepac.name = 'PAC/WEB' ORDER BY p.name");
pacsQuery.setParameter("hive", hiveName);
final List<?> pacsResult = pacsQuery.getResultList();
resp.setContentType("text/plain");
@ -114,7 +115,12 @@ public class JsonPillarServlet extends HttpServlet {
writer.println(" , \"users\": [");
boolean firstLoopUsers = true;
final Set<UnixUser> users = pac.getUnixUser();
final TreeMap<String, UnixUser> sortedUsersMap = new TreeMap<>();
for (UnixUser user: users) {
sortedUsersMap.put(user.getName(), user);
}
for (String nextName: sortedUsersMap.keySet()) {
final UnixUser user = sortedUsersMap.get(nextName);
if (firstLoopUsers) {
firstLoopUsers = false;
writer.println(" {");