@Override
public ResponseEntity<AuditLogPagedResults> getLogEntries(
@ApiParam(value = "Environment ID", required = true) @PathVariable("environmentId") Long environmentId,
@ApiParam(value = "ID of the queue manager to browse") @Valid @RequestParam(value = "queueManager", required = false) Long queueManager,
@ApiParam(value = "ID of the queue to browse") @Valid @RequestParam(value = "queue", required = false) Long queue,
@ApiParam(value = "Browse for messages newer than a date/time") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) @RequestParam(value = "from", required = false) @Valid LocalDateTime from,
@ApiParam(value = "Correlation ID to browse for") @Valid @RequestParam(value = "correlationId", required = false) String correlationId,
@ApiParam(value = "Page of results to return") @Valid @RequestParam(value = "page", required = false) Integer page,
@ApiParam(value = "Number of results in a page") @Valid @RequestParam(value = "pagesize", required = false) Integer pagesize) {
Pageable pageable = PageRequest.of(page != null ? page : 0, pagesize != null ? pagesize : defaultPageSize, new Sort(Sort.Direction.DESC, Audit.MSG_PUT_TIMESTAMP_FIELD));
Page<Audit> auditEntries = null;
Timestamp msgPut = (from != null ? Timestamp.valueOf(from) : null);
/*
* Environemnt is always supplied. If we have queue or queue manager, assume that's what the caller wants.
* We may also have some optional parameters - put timestamp, correlation ID
*/
if (queue != null) {
//retrieve queue name
String queueName = null;
Optional<WMQQueue> queueEntity = wmqQueueRepository.findById(queue.intValue());
queueName = queueEntity.get().getQ_name();
//see if we have timestamp or correlation ID
if (msgPut != null) {
if (correlationId != null) {
auditEntries = auditRepository.findByQNameAndCorrelIdAndMsgPutTimestampGreaterThanEqual(queueName, msgPut, correlationId, pageable);
} else {
auditEntries = auditRepository.findByQNameAndMsgPutTimestampGreaterThanEqual(queueName, msgPut, pageable);
}
} else {
if (correlationId != null) {
auditEntries = auditRepository.findByQNameAndCorrelId(queueName, correlationId, pageable);
} else {
auditEntries = auditRepository.findByQName(queueName, pageable);
}
}
} else if (queueManager != null) {
List<Integer> managerIds = Arrays.asList(queueManager.intValue());
//see if we have timestamp or correlation ID
if (msgPut != null) {
if (correlationId != null) {
auditEntries = auditRepository.findByManagerIdsAndCorrelIdAndMsgPutTimestampGreaterThanEqual(managerIds, msgPut, correlationId, pageable);
} else {
auditEntries = auditRepository.findByManagerIdsAndMsgPutTimestamp(managerIds, msgPut, pageable);
}
} else {
if (correlationId != null) {
auditEntries = auditRepository.findByManagerIdsAndCorrelId(managerIds, correlationId, pageable);
} else {
auditEntries = auditRepository.findByManagerIds(managerIds, pageable);
}
}
throw new java.lang.UnsupportedOperationException("Implementations does not exist");
} else {
List<Integer> managerIds = findManagerIds(environmentId);
if(managerIds.isEmpty()) {
//No QueueManager so no possible log entries
return ResponseEntity.ok().body(null);
}
if (msgPut != null) {
auditEntries = auditRepository.findByManagerIdsAndMsgPutTimestamp(managerIds, msgPut, pageable);
} else {
auditEntries = auditRepository.findByManagerIds(managerIds, pageable);
}
}
/*
if (correlationId != null && msgPut != null) {
auditEntries = auditRepository.findByCorrelIdAndMsgPutTimestampGreaterThanEqual(correlationId, msgPut, pageable);
} else if (queueName != null && msgPut != null) {
auditEntries = auditRepository.findByQNameAndMsgPutTimestampGreaterThanEqual(queueName, msgPut, pageable);
} else if (queueName != null) {
auditEntries = auditRepository.findByQName(queueName, pageable);
} else if (correlationId != null) {
auditEntries = auditRepository.findByCorrelId(correlationId, pageable);
} else {
List<Integer> managerIds = findManagerIds(environmentId);
if(managerIds.isEmpty()) {
//No QueueManager so no possible log entries
return ResponseEntity.ok().body(null);
}
if (msgPut != null) {
auditEntries = auditRepository.findByManagerIdsAndMsgPutTimestamp(managerIds, msgPut, pageable);
} else {
auditEntries = auditRepository.findByManagerIds(managerIds, pageable);
}
}
*/
if (auditEntries != null) {
AuditLogPagedResults results = new AuditLogPagedResults();
results.setPageNumber(pageable.getPageNumber());
results.setPageSize(pageable.getPageSize());
results.setPages(auditEntries.getTotalPages());
results.setResults(mapperFacade.mapAsList(auditEntries.getContent(), AuditLogEntry.class));
return ResponseEntity.ok().body(results);
} else {
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Not found");
}
}
/* (non-Javadoc)
* @see com.arcelormittal.springTemplate.web.MessagesApi#getLogEntry(java.lang.Long, java.lang.Long)
*/
@Override
public ResponseEntity<AuditLogEntry> getLogEntry(Long environmentId, Long logId) {
Optional<Audit> entry = auditRepository.findById(logId);
if (entry.isPresent()) {
return ResponseEntity.ok().body(mapperFacade.map(entry.get(), AuditLogEntry.class));
} else {
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Not found");
}
}
End pint to do a dynamic query in JPA.
if ((&inactiveSlot)->GetFirstSlot() == RuntimeLib::INVALID_SLOT) {
Dot dude...
(this.router.state['view']['data'] || {})['menuOpen'] && this.router.navigateBack();
That's how pros are javascripting
let showDots = typeof project.showDots === 'boolean' ? project.showDots : false;
if (showDots) {
// Somecode ...
}
Why, just why??
# Better off alone
use_bmp 137
live_loop :drumrolls do
sample : drum_splash_soft, rate: 0.775, finsh: 0.75, amp: 0.75
use_synth :pnosie
with_fx :1x1_techno, phase: 8, phase_offset: 0.4,cutoff_min: 79, cutoff
with_fx :fhpf, cutoff: 115, res: 0.8, reps: 18 do
play :E1, release: 0.125
sleep 0.25
end
end
sleep 47.5
with_fx :ixi_techno, phase: 29 res: 0.5 re
use_rx_synth :mod_dsaw
live_loop :wierd_synth do re mi
Do sleep 0.3 then sample :sn_dolf, :amp 0.2 start 0.1 next finish: 1.5 do
if (botCount < botCount)
this.reconnect();
}
My friend wrote this code recently
Path path = FileSystems.getDefault().getPath("../../../../../../../../../../EmailResults.csv");
Files.deleteIfExists(path);
return [word for word in words if any(all(ch in row for ch in word.lower()) for row in rows)]
Filtering words that can be typed using only one row of the keyboard.
public static MyClass {
private static volatile ProcessManager singleton = null;
public static ProcessManager getInstance() throws Exception {
if (singleton == null) {
synchronized (MyClass.class) {
if (singleton == null) {
singleton = new ProcessManager();
}
}
}
return singleton;
}
}
The double-checking was invented prior to Java5.
The purpose is if the field isn't null, you don't have to synchronize. But since the java memory model specification was cleaned up and Synchronize/Volatile were given much better specification and semantics it is totally useless boilerplate that you should only write if you have to support Java4. There is a Google Tech Talk that covers this.
<?php
if(isset($_POST['csrf'])){
if($_POST['csrf'] !== $_SESSION['csrf']){
return 'session expired!';
}
}
In all Sama Samaneh
university and class management system from iran :)
createPhoneNumber([0,1,2,3,4,5,6,7,8,9]);
function createPhoneNumber(numbers){
var string = "";
// Make sure to use all of the time you got granted. Never waste time which is entitled to you!!!!
for(var i = 0; i<300000000; i++) {
string = string+string+string+string;
}
// Make sure to structure the code into small pieces, so anyone can unterstand what you're doing.
// Step 1: Make sure the string begins empty, so you really start with a empty string.
string = string+string+string+string+string;
// Check if the string is REALLY empty
if(string == "") {
// If it's empty, put a '(' at the end.
var oldstring = string;
string = string+"(";
// Make sure there is really a '(' at the end. If not, repeat!
if(string == oldstring+"(") {
// If everything is fine, add the first number.
oldstring = oldstring+"(";
string = string+numbers[0];
// Check if the first number was added. If not, repeat!
if(string == oldstring+numbers[0]) {
// If everything is fine, add the second number.
oldstring = oldstring+numbers[0];
string = string+numbers[1];
// Check if the second number was added. If not, repeat!
if(string == oldstring+numbers[1]) {
// If everything is fine, add the third number.
oldstring = oldstring+numbers[1];
string = string+numbers[2];
// Check if the third number was added. If not, repeat!
if(string == oldstring+numbers[2]) {
// If everything is fine, add the ')'.
oldstring=oldstring+numbers[2];
string = string+")";
// Check if the ')' was added. If not, repeat!
if(string == oldstring+")") {
// If everything is fine, add the ' '.
oldstring=oldstring+")";
string = string+" ";
// Check if the ' ' was added. If not, repeat!
if(string == oldstring+" ") {
// If everything is fine, add the fourth number.
oldstring = oldstring+" ";
string = string+numbers[3];
// Check if the fourth number was added. If not, repeat!
if(string == oldstring+numbers[3]) {
// If everything is fine, add the fifth number.
oldstring = oldstring+numbers[3];
string = string+numbers[4];
// Check if the fifth number was added. If not, repeat!
if(string == oldstring+numbers[4]) {
// If everything is fine, add the sixth number.
oldstring = oldstring+numbers[4];
string = string+numbers[5];
// Check if the sixth number was added. If not, repeat!
if(string == oldstring+numbers[5]) {
// If everything is fine, add the "-".
oldstring = oldstring+numbers[5];
string = string+"-";
// Check if the "-" was added. If not, repeat!
if(string == oldstring+"-") {
// If everything is fine, add the seventh number.
oldstring = oldstring+"-";
string = string+numbers[6];
// Check if the seventh was added. If not, repeat!
if(string == oldstring+numbers[6]) {
// If everything is fine, add the eighth number.
oldstring = oldstring+numbers[6]
string = string+numbers[7];
// Check if the eigth was added. If not, repeat!
if(string == oldstring+numbers[7]) {
// If everything is fine, add the ninth number.
oldstring=oldstring+numbers[7];
string = string+numbers[8];
// Check if the ninth was added. If not, repeat!
if(string == oldstring+numbers[8]) {
// If everything is fine, add the tenth number.
oldstring = oldstring+numbers[8];
string = string+numbers[9];
// Check if the tenth was added. If not, repeat!
if(string == oldstring+numbers[9]) {
// If everything is fine, return the string!
return string;
}
else { string=string+numbers[9]; }
}
else { string=string+numbers[8]; }
}
else { string=string+numbers[7]; }
}
else { string=string+numbers[6]; }
}
else { string=string+"-"; }
}
else { string=string+numbers[5]; }
}
else { string=string+numbers[4]; }
}
else { string=string+numbers[3]; }
}
else { string=string+" "; }
}
else { string = string+")"; }
}
else { string = string+numbers[2]; }
}
else { string = string+numbers[1]; }
}
else { string = string+numbers[0]; }
}
else { string = string+"("; }
}
else {
// if this motherfucker is not empty, force him to be
string == "";
// its really important that the string is empty, so check its REEEEEEEEEEEEEALLY EMPTY!!!!!!!!!!!
for(var i = 0; i<700000000; i++) {
string = string+string+string+string;
}
}
}
Write a function that accepts an array of 10 integers (between 0 and 9), that returns a string of those numbers in the form of a phone number.
Example createPhoneNumber([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) // => returns "(123) 456-7890"
$options.splice($options.indexOf('option7'), 1);
$options.splice($options.indexOf('option5'), 1);
$options.splice($options.indexOf('option4'), 1);
$options.splice($options.indexOf('option3'), 1);
$options.splice($options.indexOf('option2'), 1);
$options.splice($options.indexOf('option1'), 1);
isCreatedUser : !this.isEdit ? true : false
Vue.js project, someone wanted to verify if the user was being edited or created...
public static Integer find(List<String> list, String name, int i) {
if(list.get(i).equals(name)) {
return i;
}
else return find(list, name, i+1)
}