-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from KPMP/KPMP-3820_Set_Error
Kpmp 3820 set error
- Loading branch information
Showing
4 changed files
with
55 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/main/java/org/kpmp/stateManager/DluPackageInventoryService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package org.kpmp.stateManager; | ||
|
||
import org.apache.commons.logging.Log; | ||
import org.apache.commons.logging.LogFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.web.client.RestTemplate; | ||
|
||
import java.util.HashMap; | ||
|
||
@Service | ||
public class DluPackageInventoryService { | ||
|
||
@Value("${data-manager.service.host}") | ||
private String dataManagerHost; | ||
@Value("${data-manager.service.endpoint}") | ||
private String dataManagerEndpoint; | ||
private RestTemplate restTemplate; | ||
|
||
private static final Log log = LogFactory.getLog(DluPackageInventoryService.class); | ||
|
||
@Autowired | ||
public DluPackageInventoryService(RestTemplate restTemplate) { | ||
this.restTemplate = restTemplate; | ||
} | ||
|
||
public String setPackageInError(String packageId) { | ||
HashMap payload = new HashMap<>(); | ||
payload.put("dlu_error", true); | ||
String retPackageId = null; | ||
String url = dataManagerHost + dataManagerEndpoint + "/package/" + packageId; | ||
try { | ||
retPackageId = restTemplate.postForObject(url, payload, String.class); | ||
} catch (Exception e) { | ||
log.error("URI: " + url + " | PKGID: " + packageId + " | MSG: Setting DMD package error"); | ||
} | ||
return retPackageId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters