added list of active SEB Settings for version
This commit is contained in:
		
							parent
							
								
									ef3c915e21
								
							
						
					
					
						commit
						18508b8ce8
					
				
					 2 changed files with 372 additions and 5 deletions
				
			
		|  | @ -8,14 +8,13 @@ | |||
| 
 | ||||
| package ch.ethz.seb.sebserver.gui.service.examconfig.impl; | ||||
| 
 | ||||
| import java.util.Collection; | ||||
| import java.util.Collections; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.Objects; | ||||
| import java.util.*; | ||||
| import java.util.function.Function; | ||||
| import java.util.stream.Collectors; | ||||
| import java.util.stream.Stream; | ||||
| 
 | ||||
| import ch.ethz.seb.sebserver.gbl.Constants; | ||||
| import org.apache.commons.io.IOUtils; | ||||
| import org.apache.commons.lang3.StringUtils; | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
|  | @ -23,6 +22,7 @@ import org.slf4j.LoggerFactory; | |||
| import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationAttribute; | ||||
| import ch.ethz.seb.sebserver.gbl.model.sebconfig.Orientation; | ||||
| import ch.ethz.seb.sebserver.gbl.util.Utils; | ||||
| import org.springframework.core.io.ClassPathResource; | ||||
| 
 | ||||
| public class AttributeMapping { | ||||
| 
 | ||||
|  | @ -48,10 +48,28 @@ public class AttributeMapping { | |||
|         Objects.requireNonNull(attributes); | ||||
|         Objects.requireNonNull(orientations); | ||||
| 
 | ||||
|         Set<Long> _config_attrs_ids = null; | ||||
|         try { | ||||
|             final ClassPathResource configFileResource = new ClassPathResource("config/examConfigAttrVersionTable"); | ||||
|             final String ids_comma_separated = IOUtils.toString(configFileResource.getInputStream()); | ||||
|             final String[] split = StringUtils.split(ids_comma_separated, Constants.LIST_SEPARATOR_CHAR); | ||||
|             _config_attrs_ids = Arrays.stream(split).map(s -> { | ||||
|                 try { | ||||
|                     return Long.valueOf(s.trim()); | ||||
|                 } catch (Exception e) { | ||||
|                     return 0L; | ||||
|                 } | ||||
|             }).collect(Collectors.toSet()); | ||||
|         } catch (final Exception e) { | ||||
|             log.error("Failed to get exam config attribute version infos: ", e); | ||||
|         } | ||||
| 
 | ||||
|         final Set<Long> config_attrs_ids = _config_attrs_ids; | ||||
|         this.templateId = templateId; | ||||
| 
 | ||||
|         this.orientationAttributeMapping = Utils.immutableMapOf(orientations | ||||
|                 .stream() | ||||
|                 .filter(o -> config_attrs_ids == null || config_attrs_ids.contains(o.attributeId)) | ||||
|                 .collect(Collectors.toMap( | ||||
|                         o -> o.attributeId, | ||||
|                         Function.identity()))); | ||||
|  | @ -72,6 +90,7 @@ public class AttributeMapping { | |||
| 
 | ||||
|         this.orientationAttributeNameMapping = Utils.immutableMapOf(orientations | ||||
|                 .stream() | ||||
|                 .filter(o -> this.attributeIdMapping.containsKey(o.attributeId)) | ||||
|                 .collect(Collectors.toMap( | ||||
|                         o -> this.attributeIdMapping.get(o.attributeId).name, | ||||
|                         Function.identity()))); | ||||
|  |  | |||
							
								
								
									
										348
									
								
								src/main/resources/config/examConfigAttrVersionTable
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										348
									
								
								src/main/resources/config/examConfigAttrVersionTable
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,348 @@ | |||
| 1, | ||||
| 2, | ||||
| 3, | ||||
| 4, | ||||
| 5, | ||||
| 6, | ||||
| 7, | ||||
| 8, | ||||
| 9, | ||||
| 10, | ||||
| 11, | ||||
| 12, | ||||
| 13, | ||||
| 14, | ||||
| 15, | ||||
| 16, | ||||
| 17, | ||||
| 18, | ||||
| 19, | ||||
| 20, | ||||
| 21, | ||||
| 22, | ||||
| 23, | ||||
| 24, | ||||
| 25, | ||||
| 26, | ||||
| 27, | ||||
| 28, | ||||
| 29, | ||||
| 30, | ||||
| 31, | ||||
| 32, | ||||
| 33, | ||||
| 34, | ||||
| 35, | ||||
| 36, | ||||
| 37, | ||||
| 38, | ||||
| 39, | ||||
| 40, | ||||
| 41, | ||||
| 42, | ||||
| 43, | ||||
| 44, | ||||
| 45, | ||||
| 46, | ||||
| 47, | ||||
| 48, | ||||
| 49, | ||||
| 50, | ||||
| 51, | ||||
| 52, | ||||
| 53, | ||||
| 54, | ||||
| 55, | ||||
| 56, | ||||
| 57, | ||||
| 58, | ||||
| 59, | ||||
| 60, | ||||
| 61, | ||||
| 62, | ||||
| 63, | ||||
| 64, | ||||
| 65, | ||||
| 66, | ||||
| 67, | ||||
| 68, | ||||
| 69, | ||||
| 70, | ||||
| 71, | ||||
| 72, | ||||
| 73, | ||||
| 91, | ||||
| 92, | ||||
| 93, | ||||
| 200, | ||||
| 201, | ||||
| 202, | ||||
| 210, | ||||
| 220, | ||||
| 300, | ||||
| 301, | ||||
| 302, | ||||
| 303, | ||||
| 304, | ||||
| 305, | ||||
| 306, | ||||
| 307, | ||||
| 308, | ||||
| 309, | ||||
| 310, | ||||
| 311, | ||||
| 312, | ||||
| 313, | ||||
| 314, | ||||
| 315, | ||||
| 316, | ||||
| 317, | ||||
| 318, | ||||
| 319, | ||||
| 320, | ||||
| 321, | ||||
| 322, | ||||
| 400, | ||||
| 401, | ||||
| 402, | ||||
| 403, | ||||
| 404, | ||||
| 405, | ||||
| 406, | ||||
| 407, | ||||
| 408, | ||||
| 500, | ||||
| 501, | ||||
| 502, | ||||
| 503, | ||||
| 504, | ||||
| 505, | ||||
| 506, | ||||
| 507, | ||||
| 508, | ||||
| 509, | ||||
| 510, | ||||
| 511, | ||||
| 512, | ||||
| 513, | ||||
| 514, | ||||
| 515, | ||||
| 516, | ||||
| 517, | ||||
| 518, | ||||
| 519, | ||||
| 520, | ||||
| 800, | ||||
| 801, | ||||
| 802, | ||||
| 803, | ||||
| 804, | ||||
| 805, | ||||
| 806, | ||||
| 807, | ||||
| 808, | ||||
| 809, | ||||
| 810, | ||||
| 812, | ||||
| 813, | ||||
| 900, | ||||
| 901, | ||||
| 902, | ||||
| 903, | ||||
| 904, | ||||
| 905, | ||||
| 906, | ||||
| 907, | ||||
| 908, | ||||
| 909, | ||||
| 910, | ||||
| 911, | ||||
| 912, | ||||
| 913, | ||||
| 914, | ||||
| 915, | ||||
| 917, | ||||
| 918, | ||||
| 919, | ||||
| 920, | ||||
| 921, | ||||
| 922, | ||||
| 923, | ||||
| 924, | ||||
| 925, | ||||
| 926, | ||||
| 927, | ||||
| 928, | ||||
| 929, | ||||
| 930, | ||||
| 931, | ||||
| 932, | ||||
| 933, | ||||
| 940, | ||||
| 941, | ||||
| 942, | ||||
| 943, | ||||
| 944, | ||||
| 945, | ||||
| 946, | ||||
| 947, | ||||
| 948, | ||||
| 950, | ||||
| 951, | ||||
| 952, | ||||
| 953, | ||||
| 960, | ||||
| 961, | ||||
| 970, | ||||
| 971, | ||||
| 972, | ||||
| 973, | ||||
| 974, | ||||
| 975, | ||||
| 1000, | ||||
| 1001, | ||||
| 1100, | ||||
| 1101, | ||||
| 1102, | ||||
| 1103, | ||||
| 1104, | ||||
| 1105, | ||||
| 1106, | ||||
| 1107, | ||||
| 1108, | ||||
| 1109, | ||||
| 1110, | ||||
| 1111, | ||||
| 1112, | ||||
| 1113, | ||||
| 1114, | ||||
| 1115, | ||||
| 1116, | ||||
| 1120, | ||||
| 1121, | ||||
| 1122, | ||||
| 1123, | ||||
| 1124, | ||||
| 1125, | ||||
| 1126, | ||||
| 1127, | ||||
| 1128, | ||||
| 1129, | ||||
| 1130, | ||||
| 1131, | ||||
| 1132, | ||||
| 1133, | ||||
| 1500, | ||||
| 1501, | ||||
| 1502, | ||||
| 1503, | ||||
| 1504, | ||||
| 1505, | ||||
| 1506, | ||||
| 1507, | ||||
| 1508, | ||||
| 1509, | ||||
| 1510, | ||||
| 1511, | ||||
| 1512, | ||||
| 1513, | ||||
| 1514, | ||||
| 1515, | ||||
| 1516, | ||||
| 1530, | ||||
| 1531, | ||||
| 1532, | ||||
| 1533, | ||||
| 1550, | ||||
| 1551, | ||||
| 1552, | ||||
| 1553, | ||||
| 1554, | ||||
| 1555, | ||||
| 1556, | ||||
| 1557, | ||||
| 1558, | ||||
| 1559, | ||||
| 1560, | ||||
| 1561, | ||||
| 1562, | ||||
| 1563, | ||||
| 1564, | ||||
| 1565, | ||||
| 1566, | ||||
| 1567, | ||||
| 1568, | ||||
| 1569, | ||||
| 1570, | ||||
| 1571, | ||||
| 1572, | ||||
| 1573, | ||||
| 1574, | ||||
| 1575, | ||||
| 1576, | ||||
| 1578, | ||||
| 74, | ||||
| 75, | ||||
| 76, | ||||
| 77, | ||||
| 78, | ||||
| 79, | ||||
| 81, | ||||
| 82, | ||||
| 85, | ||||
| 86, | ||||
| 87, | ||||
| 88, | ||||
| 89, | ||||
| 90, | ||||
| 94, | ||||
| 95, | ||||
| 96, | ||||
| 97, | ||||
| 98, | ||||
| 99, | ||||
| 100, | ||||
| 101, | ||||
| 102, | ||||
| 1577, | ||||
| 203, | ||||
| 204, | ||||
| 205, | ||||
| 206, | ||||
| 221, | ||||
| 222, | ||||
| 223, | ||||
| 231, | ||||
| 233, | ||||
| 234, | ||||
| 235, | ||||
| 236, | ||||
| 237, | ||||
| 238, | ||||
| 239, | ||||
| 240, | ||||
| 241, | ||||
| 242, | ||||
| 243, | ||||
| 244, | ||||
| 245, | ||||
| 246, | ||||
| 247, | ||||
| 248, | ||||
| 249, | ||||
| 250, | ||||
| 251, | ||||
| 252, | ||||
| 253, | ||||
| 254, | ||||
| 255, | ||||
| 256, | ||||
| 257, | ||||
| 258, | ||||
| 259, | ||||
| 260, | ||||
| 261, | ||||
| 262, | ||||
| 263, | ||||
| 264, | ||||
| 265 | ||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 anhefti
						anhefti