-
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.
- Loading branch information
Showing
83 changed files
with
42,198 additions
and
504 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/main/java/gov/onc/xdrtesttool/controllers/MessageLogController.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,34 @@ | ||
package gov.onc.xdrtesttool.controllers; | ||
|
||
import gov.onc.xdrtesttool.entities.MessageLog; | ||
import gov.onc.xdrtesttool.services.MessageLogService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Created by Brian on 3/9/2017. | ||
*/ | ||
@RestController | ||
public class MessageLogController { | ||
private MessageLogService messageLogService; | ||
|
||
@Autowired | ||
public MessageLogController(MessageLogService messageLogService) { | ||
this.messageLogService = messageLogService; | ||
} | ||
|
||
@RequestMapping(value = "/getlogsbyfromaddress", method = RequestMethod.GET) | ||
public List<MessageLog> getLogsByFromAddress(@RequestParam(value = "fromAddress") String fromAddress){ | ||
return messageLogService.getLogsByFromAddress(fromAddress); | ||
} | ||
|
||
@RequestMapping(value = "/getlogsbyipaddress", method = RequestMethod.GET) | ||
public List<MessageLog> getLogsByIpAddress(@RequestParam(value = "ipAddress") String ipAddress){ | ||
return messageLogService.getLogsByIpAddress(ipAddress); | ||
} | ||
} |
85 changes: 85 additions & 0 deletions
85
src/main/java/gov/onc/xdrtesttool/entities/MessageLog.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,85 @@ | ||
package gov.onc.xdrtesttool.entities; | ||
|
||
import javax.persistence.*; | ||
import java.util.Date; | ||
|
||
/** | ||
* Created by Brian on 3/9/2017. | ||
*/ | ||
@Entity | ||
@Table(name = "MESSAGELOG") | ||
public class MessageLog { | ||
@Id | ||
@Column(name = "ID") | ||
@GeneratedValue(strategy = GenerationType.AUTO) | ||
private long id; | ||
@Column(name = "REQUEST", columnDefinition = "CLOB") | ||
private String request; | ||
@Column(name = "RESPONSE", columnDefinition = "CLOB") | ||
private String response; | ||
@Column(name = "IP_ADDRESS") | ||
private String ipAddress; | ||
@Column(name = "FROM_ADDRESS") | ||
private String fromAddress; | ||
@Column(name = "DATE_LOGGED") | ||
private String dateLogged; | ||
@Version | ||
@Column(name = "CREATED") | ||
private Date created; | ||
|
||
public String getIpAddress() { | ||
return ipAddress; | ||
} | ||
|
||
public void setIpAddress(String ipAddress) { | ||
this.ipAddress = ipAddress; | ||
} | ||
|
||
public String getFromAddress() { | ||
return fromAddress; | ||
} | ||
|
||
public void setFromAddress(String fromAddress) { | ||
this.fromAddress = fromAddress; | ||
} | ||
|
||
public long getId() { | ||
return id; | ||
} | ||
|
||
public void setId(long id) { | ||
this.id = id; | ||
} | ||
|
||
public String getRequest() { | ||
return request; | ||
} | ||
|
||
public void setRequest(String request) { | ||
this.request = request; | ||
} | ||
|
||
public String getResponse() { | ||
return response; | ||
} | ||
|
||
public void setResponse(String response) { | ||
this.response = response; | ||
} | ||
|
||
public String getDateLogged() { | ||
return dateLogged.toString(); | ||
} | ||
|
||
public void setDateLogged(String dateLogged) { | ||
this.dateLogged = dateLogged; | ||
} | ||
|
||
public Date getCreated() { | ||
return created; | ||
} | ||
|
||
public void setCreated(Date created) { | ||
this.created = created; | ||
} | ||
} |
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
16 changes: 16 additions & 0 deletions
16
src/main/java/gov/onc/xdrtesttool/repositories/MessageLogRepository.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,16 @@ | ||
package gov.onc.xdrtesttool.repositories; | ||
|
||
import gov.onc.xdrtesttool.entities.MessageLog; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Created by Brian on 3/9/2017. | ||
*/ | ||
@Repository | ||
public interface MessageLogRepository extends JpaRepository<MessageLog, Long>{ | ||
List<MessageLog>findByIpAddressOrderByCreatedDesc(String ipAddress); | ||
List<MessageLog>findByFromAddressOrderByCreatedDesc(String fromAddress); | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/gov/onc/xdrtesttool/services/MessageLogService.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,34 @@ | ||
package gov.onc.xdrtesttool.services; | ||
|
||
import gov.onc.xdrtesttool.entities.MessageLog; | ||
import gov.onc.xdrtesttool.repositories.MessageLogRepository; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Created by Brian on 3/9/2017. | ||
*/ | ||
@Service | ||
public class MessageLogService { | ||
private MessageLogRepository messageLogRepository; | ||
|
||
@Autowired | ||
public MessageLogService(MessageLogRepository messageLogRepository) { | ||
this.messageLogRepository = messageLogRepository; | ||
} | ||
|
||
public MessageLog saveLog(MessageLog messageLog){ | ||
return messageLogRepository.save(messageLog); | ||
} | ||
|
||
public List<MessageLog> getLogsByFromAddress(String fromAddress){ | ||
return messageLogRepository.findByFromAddressOrderByCreatedDesc(fromAddress); | ||
} | ||
|
||
public List<MessageLog> getLogsByIpAddress(String ipAddress) { | ||
return messageLogRepository.findByIpAddressOrderByCreatedDesc(ipAddress); | ||
} | ||
|
||
} |
Oops, something went wrong.