Merge branch 'features/ui-improvements' into jenkins_with_weblogic
This commit is contained in:
@@ -18,6 +18,7 @@ import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.SortDefault;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -432,7 +433,7 @@ public class AdapterController extends OnlBaseAnnotationController {
|
||||
|
||||
@PostMapping(value = "/onl/admin/adapter/adapterMan.file", params = "cmd=LIST_IMPORT_FILE")
|
||||
public ResponseEntity<?> listImportFromFile(
|
||||
@RequestParam("file") MultipartFile file) {
|
||||
@RequestParam("file") MultipartFile file, boolean importDupliCheck) {
|
||||
|
||||
try {
|
||||
|
||||
@@ -445,7 +446,7 @@ public class AdapterController extends OnlBaseAnnotationController {
|
||||
|
||||
synchronized (obj) {
|
||||
AdapterGroupUI importedUI = service
|
||||
.importAdapterFromJson(file);
|
||||
.importAdapterFromJson(file, importDupliCheck);
|
||||
|
||||
Map<String, String> resultMap = service
|
||||
.reloadSync(importedUI);
|
||||
@@ -456,6 +457,10 @@ public class AdapterController extends OnlBaseAnnotationController {
|
||||
|
||||
}
|
||||
|
||||
} catch (IllegalStateException dupEx) {
|
||||
return ResponseEntity
|
||||
.status(HttpStatus.CONFLICT)
|
||||
.body(dupEx.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
return ResponseEntity.internalServerError()
|
||||
|
||||
+20
-5
@@ -565,7 +565,7 @@ public class AdapterManService extends OnlBaseService {
|
||||
return adapterPropLoader.findSnaAppcodeProps((String) map.get("searchPrptygroupName"));
|
||||
}
|
||||
|
||||
public AdapterGroupUI importAdapterFromJson(MultipartFile file) throws Exception {
|
||||
public AdapterGroupUI importAdapterFromJson(MultipartFile file, boolean importDupliCheck) throws Exception {
|
||||
if (file.isEmpty()) {
|
||||
throw new IOException("File is empty");
|
||||
}
|
||||
@@ -574,13 +574,28 @@ public class AdapterManService extends OnlBaseService {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.addMixIn(AdapterGroupUI.class, AdapterGroupUIMixIn.class);
|
||||
AdapterGroupUI adapterGroupUI = objectMapper.readValue(inputStream, AdapterGroupUI.class);
|
||||
|
||||
if(!adapterGroupService.existsById(adapterGroupUI.getAdptrbzwkgroupname())){
|
||||
|
||||
String adapterGrpupName = adapterGroupUI.getAdptrbzwkgroupname();
|
||||
boolean adapterGroupExists = adapterGroupService.existsById(adapterGroupUI.getAdptrbzwkgroupname());
|
||||
|
||||
if (adapterGroupExists) {
|
||||
|
||||
if (importDupliCheck) {
|
||||
throw new IllegalStateException("AdapterGroup already exists [ " + adapterGrpupName + " ]" );
|
||||
} else {
|
||||
update(adapterGroupUI);
|
||||
}
|
||||
|
||||
} else {
|
||||
insert(adapterGroupUI);
|
||||
}else{
|
||||
update(adapterGroupUI);
|
||||
}
|
||||
|
||||
// if(!adapterGroupService.existsById(adapterGroupUI.getAdptrbzwkgroupname())){
|
||||
// insert(adapterGroupUI);
|
||||
// }else{
|
||||
// update(adapterGroupUI);
|
||||
// }
|
||||
|
||||
return adapterGroupUI;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user