SEBSERV-230 removed attributes from GUI
This commit is contained in:
		
							parent
							
								
									b42dd5e146
								
							
						
					
					
						commit
						33c915bd92
					
				
					 4 changed files with 89 additions and 63 deletions
				
			
		|  | @ -1027,7 +1027,10 @@ public class WidgetFactory { | |||
|     } | ||||
| 
 | ||||
|     public static void setARIALabel(final Widget widget, final String label) { | ||||
|         setAttribute(widget, ADD_HTML_ATTR_ARIA_LABEL, label); | ||||
|         setAttribute( | ||||
|                 widget, | ||||
|                 ADD_HTML_ATTR_ARIA_LABEL, | ||||
|                 Utils.escapeHTML_XML_EcmaScript(label)); | ||||
|     } | ||||
| 
 | ||||
|     public static void setAttribute(final Widget widget, final String name, final String value) { | ||||
|  |  | |||
|  | @ -127,6 +127,9 @@ class ConfigurationDAOBatchService { | |||
|                     .where( | ||||
|                             ConfigurationNodeRecordDynamicSqlSupport.name, | ||||
|                             isEqualTo(data.name)) | ||||
|                     .and( | ||||
|                             ConfigurationNodeRecordDynamicSqlSupport.type, | ||||
|                             SqlBuilder.isEqualTo(data.type.name())) | ||||
|                     .and( | ||||
|                             ConfigurationNodeRecordDynamicSqlSupport.institutionId, | ||||
|                             SqlBuilder.isEqualTo(data.institutionId)) | ||||
|  | @ -355,6 +358,9 @@ class ConfigurationDAOBatchService { | |||
|                     .where( | ||||
|                             ConfigurationNodeRecordDynamicSqlSupport.name, | ||||
|                             isEqualTo(copyInfo.name)) | ||||
|                     .and( | ||||
|                             ConfigurationNodeRecordDynamicSqlSupport.type, | ||||
|                             SqlBuilder.isEqualTo(copyInfo.configurationType.name())) | ||||
|                     .and( | ||||
|                             ConfigurationNodeRecordDynamicSqlSupport.institutionId, | ||||
|                             isEqualTo(institutionId)) | ||||
|  | @ -406,9 +412,9 @@ class ConfigurationDAOBatchService { | |||
| 
 | ||||
|         if (BooleanUtils.toBoolean(copyInfo.withHistory)) { | ||||
|             configs.forEach(configRec -> this.copyConfiguration( | ||||
|                             configRec.getInstitutionId(), | ||||
|                             configRec.getId(), | ||||
|                             newNodeRec.getId())); | ||||
|                     configRec.getInstitutionId(), | ||||
|                     configRec.getId(), | ||||
|                     newNodeRec.getId())); | ||||
|         } else { | ||||
|             configs | ||||
|                     .stream() | ||||
|  | @ -764,37 +770,37 @@ class ConfigurationDAOBatchService { | |||
| 
 | ||||
|         final List<ConfigurationValueRecord> templateValues = getTemplateValues(configNode); | ||||
|         templateValues.forEach(templateValue -> { | ||||
|                     final Long existingId = this.batchConfigurationValueRecordMapper | ||||
|                             .selectIdsByExample() | ||||
|                             .where( | ||||
|                                     ConfigurationValueRecordDynamicSqlSupport.configurationId, | ||||
|                                     isEqualTo(config.getId())) | ||||
|                             .and( | ||||
|                                     ConfigurationValueRecordDynamicSqlSupport.configurationAttributeId, | ||||
|                                     isEqualTo(templateValue.getConfigurationAttributeId())) | ||||
|                             .and( | ||||
|                                     ConfigurationValueRecordDynamicSqlSupport.listIndex, | ||||
|                                     isEqualTo(templateValue.getListIndex())) | ||||
|                             .build() | ||||
|                             .execute() | ||||
|                             .stream() | ||||
|                             .findFirst() | ||||
|                             .orElse(null); | ||||
|             final Long existingId = this.batchConfigurationValueRecordMapper | ||||
|                     .selectIdsByExample() | ||||
|                     .where( | ||||
|                             ConfigurationValueRecordDynamicSqlSupport.configurationId, | ||||
|                             isEqualTo(config.getId())) | ||||
|                     .and( | ||||
|                             ConfigurationValueRecordDynamicSqlSupport.configurationAttributeId, | ||||
|                             isEqualTo(templateValue.getConfigurationAttributeId())) | ||||
|                     .and( | ||||
|                             ConfigurationValueRecordDynamicSqlSupport.listIndex, | ||||
|                             isEqualTo(templateValue.getListIndex())) | ||||
|                     .build() | ||||
|                     .execute() | ||||
|                     .stream() | ||||
|                     .findFirst() | ||||
|                     .orElse(null); | ||||
| 
 | ||||
|                     final ConfigurationValueRecord valueRec = new ConfigurationValueRecord( | ||||
|                             existingId, | ||||
|                             configNode.institutionId, | ||||
|                             config.getId(), | ||||
|                             templateValue.getConfigurationAttributeId(), | ||||
|                             templateValue.getListIndex(), | ||||
|                             templateValue.getValue()); | ||||
|             final ConfigurationValueRecord valueRec = new ConfigurationValueRecord( | ||||
|                     existingId, | ||||
|                     configNode.institutionId, | ||||
|                     config.getId(), | ||||
|                     templateValue.getConfigurationAttributeId(), | ||||
|                     templateValue.getListIndex(), | ||||
|                     templateValue.getValue()); | ||||
| 
 | ||||
|                     if (existingId != null) { | ||||
|                         this.batchConfigurationValueRecordMapper.updateByPrimaryKey(valueRec); | ||||
|                     } else { | ||||
|                         this.batchConfigurationValueRecordMapper.insert(valueRec); | ||||
|                     } | ||||
|                 }); | ||||
|             if (existingId != null) { | ||||
|                 this.batchConfigurationValueRecordMapper.updateByPrimaryKey(valueRec); | ||||
|             } else { | ||||
|                 this.batchConfigurationValueRecordMapper.insert(valueRec); | ||||
|             } | ||||
|         }); | ||||
| 
 | ||||
|         this.batchSqlSessionTemplate.flushStatements(); | ||||
|     } | ||||
|  |  | |||
|  | @ -185,38 +185,22 @@ public class ConfigurationNodeDAOImpl implements ConfigurationNodeDAO { | |||
|     @Override | ||||
|     @Transactional | ||||
|     public Result<ConfigurationNode> save(final ConfigurationNode data) { | ||||
|         return Result.tryCatch(() -> { | ||||
|         return checkUniqueName(data) | ||||
|                 .map(_d -> { | ||||
| 
 | ||||
|             final Long count = this.configurationNodeRecordMapper.countByExample() | ||||
|                     .where( | ||||
|                             ConfigurationNodeRecordDynamicSqlSupport.name, | ||||
|                             isEqualTo(data.name)) | ||||
|                     .and( | ||||
|                             ConfigurationNodeRecordDynamicSqlSupport.id, | ||||
|                             isNotEqualTo(data.id)) | ||||
|                     .and( | ||||
|                             ConfigurationNodeRecordDynamicSqlSupport.institutionId, | ||||
|                             isNotEqualTo(data.institutionId)) | ||||
|                     .build() | ||||
|                     .execute(); | ||||
|                     final ConfigurationNodeRecord newRecord = new ConfigurationNodeRecord( | ||||
|                             data.id, | ||||
|                             null, | ||||
|                             null, | ||||
|                             null, | ||||
|                             data.name, | ||||
|                             data.description, | ||||
|                             null, | ||||
|                             (data.status != null) ? data.status.name() : ConfigurationStatus.CONSTRUCTION.name()); | ||||
| 
 | ||||
|             if (count != null && count > 0) { | ||||
|                 throw new FieldValidationException("name", "configurationNode:name:exists"); | ||||
|             } | ||||
| 
 | ||||
|             final ConfigurationNodeRecord newRecord = new ConfigurationNodeRecord( | ||||
|                     data.id, | ||||
|                     null, | ||||
|                     null, | ||||
|                     null, | ||||
|                     data.name, | ||||
|                     data.description, | ||||
|                     null, | ||||
|                     (data.status != null) ? data.status.name() : ConfigurationStatus.CONSTRUCTION.name()); | ||||
| 
 | ||||
|             this.configurationNodeRecordMapper.updateByPrimaryKeySelective(newRecord); | ||||
|             return this.configurationNodeRecordMapper.selectByPrimaryKey(data.id); | ||||
|         }) | ||||
|                     this.configurationNodeRecordMapper.updateByPrimaryKeySelective(newRecord); | ||||
|                     return this.configurationNodeRecordMapper.selectByPrimaryKey(data.id); | ||||
|                 }) | ||||
|                 .flatMap(ConfigurationNodeDAOImpl::toDomainModel) | ||||
|                 .onError(TransactionHandler::rollback); | ||||
|     } | ||||
|  | @ -316,6 +300,32 @@ public class ConfigurationNodeDAOImpl implements ConfigurationNodeDAO { | |||
|         }); | ||||
|     } | ||||
| 
 | ||||
|     private Result<ConfigurationNode> checkUniqueName(final ConfigurationNode data) { | ||||
|         return Result.tryCatch(() -> { | ||||
|             final Long count = this.configurationNodeRecordMapper.countByExample() | ||||
|                     .where( | ||||
|                             ConfigurationNodeRecordDynamicSqlSupport.name, | ||||
|                             isEqualTo(data.name)) | ||||
|                     .and( | ||||
|                             ConfigurationNodeRecordDynamicSqlSupport.type, | ||||
|                             isNotEqualTo(data.type.name())) | ||||
|                     .and( | ||||
|                             ConfigurationNodeRecordDynamicSqlSupport.id, | ||||
|                             isNotEqualTo(data.id)) | ||||
|                     .and( | ||||
|                             ConfigurationNodeRecordDynamicSqlSupport.institutionId, | ||||
|                             isNotEqualTo(data.institutionId)) | ||||
|                     .build() | ||||
|                     .execute(); | ||||
| 
 | ||||
|             if (count != null && count > 0) { | ||||
|                 throw new FieldValidationException("name", "configurationNode:name:exists"); | ||||
|             } | ||||
| 
 | ||||
|             return data; | ||||
|         }); | ||||
|     } | ||||
| 
 | ||||
|     static Result<ConfigurationNode> toDomainModel(final ConfigurationNodeRecord record) { | ||||
|         return Result.tryCatch(() -> new ConfigurationNode( | ||||
|                 record.getId(), | ||||
|  |  | |||
|  | @ -0,0 +1,7 @@ | |||
| -- ----------------------------------------------------- | ||||
| -- Remove SEB Settings from GUI (and templates too) | ||||
| -- ----------------------------------------------------- | ||||
| 
 | ||||
| DELETE FROM `orientation` WHERE `config_attribute_id`='5'; | ||||
| DELETE FROM `orientation` WHERE `config_attribute_id`='6'; | ||||
| DELETE FROM `orientation` WHERE `config_attribute_id`='7'; | ||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 anhefti
						anhefti