api add logs
This commit is contained in:
@@ -21,6 +21,8 @@ import java.io.IOException;
|
||||
|
||||
import org.maxkey.entity.Organizations;
|
||||
import org.maxkey.persistence.service.OrganizationsService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@@ -36,7 +38,8 @@ import org.springframework.web.util.UriComponentsBuilder;
|
||||
@Controller
|
||||
@RequestMapping(value={"/api/idm/Organization"})
|
||||
public class RestOrganizationController {
|
||||
|
||||
final static Logger _logger = LoggerFactory.getLogger(RestOrganizationController.class);
|
||||
|
||||
@Autowired
|
||||
OrganizationsService organizationsService;
|
||||
|
||||
@@ -53,6 +56,7 @@ public class RestOrganizationController {
|
||||
public Organizations create(@RequestBody Organizations org,
|
||||
@RequestParam(required = false) String attributes,
|
||||
UriComponentsBuilder builder) throws IOException {
|
||||
_logger.debug("Organizations content {} , attributes {}", org , attributes);
|
||||
Organizations loadOrg = organizationsService.get(org.getId());
|
||||
if(loadOrg == null) {
|
||||
organizationsService.insert(org);
|
||||
@@ -68,6 +72,7 @@ public class RestOrganizationController {
|
||||
@RequestBody Organizations org,
|
||||
@RequestParam(required = false) String attributes)
|
||||
throws IOException {
|
||||
_logger.debug("Organizations id {} , content {} , attributes {}", id , org , attributes);
|
||||
Organizations loadOrg = organizationsService.get(id);
|
||||
if(loadOrg == null) {
|
||||
organizationsService.insert(org);
|
||||
@@ -81,6 +86,7 @@ public class RestOrganizationController {
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public void delete(@PathVariable final String id) {
|
||||
_logger.debug("Organizations id {} ", id );
|
||||
organizationsService.remove(id);
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ import java.io.IOException;
|
||||
import org.maxkey.entity.ChangePassword;
|
||||
import org.maxkey.entity.UserInfo;
|
||||
import org.maxkey.persistence.service.UserInfoService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -38,7 +40,9 @@ import org.springframework.web.util.UriComponentsBuilder;
|
||||
@Controller
|
||||
@RequestMapping(value={"/api/idm/Users"})
|
||||
public class RestUserInfoController {
|
||||
|
||||
|
||||
final static Logger _logger = LoggerFactory.getLogger(RestUserInfoController.class);
|
||||
|
||||
@Autowired
|
||||
@Qualifier("userInfoService")
|
||||
private UserInfoService userInfoService;
|
||||
@@ -59,6 +63,7 @@ public class RestUserInfoController {
|
||||
public UserInfo create(@RequestBody UserInfo userInfo,
|
||||
@RequestParam(required = false) String attributes,
|
||||
UriComponentsBuilder builder) throws IOException {
|
||||
_logger.debug("UserInfo content {} , attributes {}", userInfo , attributes);
|
||||
UserInfo loadUserInfo = userInfoService.findByUsername(userInfo.getUsername());
|
||||
if(loadUserInfo != null) {
|
||||
userInfoService.update(userInfo);
|
||||
@@ -74,7 +79,10 @@ public class RestUserInfoController {
|
||||
@RequestParam(required = true) String username,
|
||||
@RequestParam(required = true) String password,
|
||||
UriComponentsBuilder builder) throws IOException {
|
||||
UserInfo loadUserInfo = userInfoService.findByUsername(username);
|
||||
|
||||
_logger.debug("UserInfo username {} , password {}", username , password);
|
||||
|
||||
UserInfo loadUserInfo = userInfoService.findByUsername(username);
|
||||
if(loadUserInfo != null) {
|
||||
ChangePassword changePassword = new ChangePassword(loadUserInfo);
|
||||
changePassword.setPassword(password);
|
||||
@@ -90,6 +98,7 @@ public class RestUserInfoController {
|
||||
@RequestBody UserInfo userInfo,
|
||||
@RequestParam(required = false) String attributes)
|
||||
throws IOException {
|
||||
_logger.debug("UserInfo content {} , attributes {}", userInfo , attributes);
|
||||
UserInfo loadUserInfo = userInfoService.findByUsername(userInfo.getUsername());
|
||||
if(loadUserInfo != null) {
|
||||
userInfoService.update(userInfo);
|
||||
@@ -102,6 +111,7 @@ public class RestUserInfoController {
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public void delete(@PathVariable final String id) {
|
||||
_logger.debug("UserInfo id {} ", id );
|
||||
userInfoService.logicDelete(id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user