Fixed minors
This commit is contained in:
parent
ec432d122a
commit
40b2648060
|
@ -85,8 +85,31 @@ public interface BaseQuery<T> {
|
|||
* @author bbr
|
||||
*/
|
||||
enum SortDirection {
|
||||
ASCENDING,
|
||||
DESCENDING
|
||||
ASCENDING("ASC"),
|
||||
DESCENDING("DESC");
|
||||
|
||||
private final String sortDirection;
|
||||
|
||||
SortDirection(String sortDirection) {
|
||||
this.sortDirection = sortDirection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return sortDirection;
|
||||
}
|
||||
}
|
||||
|
||||
default String[] toUpperCopy(String... source) {
|
||||
if (source == null || source.length == 0) {
|
||||
return null;
|
||||
} else {
|
||||
String[] target = new String[source.length];
|
||||
for (int i = 0; i < source.length; i++) {
|
||||
target[i] = source[i].toUpperCase();
|
||||
}
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -463,10 +463,7 @@ public class ClassificationQueryImpl implements ClassificationQuery {
|
|||
}
|
||||
|
||||
private ClassificationQuery addOrderCriteria(String columnName, SortDirection sortDirection) {
|
||||
String orderByDirection = " ASC";
|
||||
if (sortDirection != null && SortDirection.DESCENDING.equals(sortDirection)) {
|
||||
orderByDirection = " DESC";
|
||||
}
|
||||
String orderByDirection = " " + (sortDirection == null ? SortDirection.ASCENDING.toString() : sortDirection.toString());
|
||||
orderBy.add(columnName + orderByDirection);
|
||||
orderColumns.add(columnName);
|
||||
return this;
|
||||
|
@ -620,14 +617,6 @@ public class ClassificationQueryImpl implements ClassificationQuery {
|
|||
return orderColumns;
|
||||
}
|
||||
|
||||
private String[] toUpperCopy(String... source) {
|
||||
String[] target = new String[source.length];
|
||||
for (int i = 0; i < source.length; i++) {
|
||||
target[i] = source[i].toUpperCase();
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
|
|
@ -211,10 +211,7 @@ public class ObjectReferenceQueryImpl implements ObjectReferenceQuery {
|
|||
}
|
||||
|
||||
private ObjectReferenceQuery addOrderCriteria(String colName, SortDirection sortDirection) {
|
||||
String orderByDirection = " ASC";
|
||||
if (sortDirection != null && SortDirection.DESCENDING.equals(sortDirection)) {
|
||||
orderByDirection = " DESC";
|
||||
}
|
||||
String orderByDirection = " " + (sortDirection == null ? SortDirection.ASCENDING.toString() : sortDirection.toString());
|
||||
orderBy.add(colName + orderByDirection);
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -1448,23 +1448,12 @@ public class TaskQueryImpl implements TaskQuery {
|
|||
}
|
||||
|
||||
private TaskQuery addOrderCriteria(String columnName, SortDirection sortDirection) {
|
||||
String orderByDirection = " ASC";
|
||||
if (sortDirection != null && SortDirection.DESCENDING.equals(sortDirection)) {
|
||||
orderByDirection = " DESC";
|
||||
}
|
||||
String orderByDirection = " " + (sortDirection == null ? SortDirection.ASCENDING.toString() : sortDirection.toString());
|
||||
orderBy.add(columnName + orderByDirection);
|
||||
orderColumns.add(columnName);
|
||||
return this;
|
||||
}
|
||||
|
||||
private String[] toUpperCopy(String... source) {
|
||||
String[] target = new String[source.length];
|
||||
for (int i = 0; i < source.length; i++) {
|
||||
target[i] = source[i].toUpperCase();
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
|
|
@ -250,27 +250,12 @@ public class WorkbasketAccessItemExtendedQueryImpl implements
|
|||
}
|
||||
|
||||
private WorkbasketAccessItemExtendedQuery addOrderCriteria(String colName, SortDirection sortDirection) {
|
||||
String orderByDirection = " ASC";
|
||||
if (sortDirection != null && SortDirection.DESCENDING.equals(sortDirection)) {
|
||||
orderByDirection = " DESC";
|
||||
}
|
||||
String orderByDirection = " " + (sortDirection == null ? SortDirection.ASCENDING.toString() : sortDirection.toString());
|
||||
orderBy.add(colName + orderByDirection);
|
||||
orderColumns.add(colName);
|
||||
return this;
|
||||
}
|
||||
|
||||
static String[] toUpperCopy(String... source) {
|
||||
if (source == null || source.length == 0) {
|
||||
return null;
|
||||
} else {
|
||||
String[] target = new String[source.length];
|
||||
for (int i = 0; i < source.length; i++) {
|
||||
target[i] = source[i].toUpperCase();
|
||||
}
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
|
|
@ -174,10 +174,7 @@ public class WorkbasketAccessItemQueryImpl implements WorkbasketAccessItemQuery
|
|||
}
|
||||
|
||||
private WorkbasketAccessItemQuery addOrderCriteria(String colName, SortDirection sortDirection) {
|
||||
String orderByDirection = " ASC";
|
||||
if (sortDirection != null && SortDirection.DESCENDING.equals(sortDirection)) {
|
||||
orderByDirection = " DESC";
|
||||
}
|
||||
String orderByDirection = " " + (sortDirection == null ? SortDirection.ASCENDING.toString() : sortDirection.toString());
|
||||
orderBy.add(colName + orderByDirection);
|
||||
orderColumns.add(colName);
|
||||
return this;
|
||||
|
|
|
@ -752,23 +752,8 @@ public class WorkbasketQueryImpl implements WorkbasketQuery {
|
|||
}
|
||||
}
|
||||
|
||||
static String[] toUpperCopy(String... source) {
|
||||
if (source == null || source.length == 0) {
|
||||
return null;
|
||||
} else {
|
||||
String[] target = new String[source.length];
|
||||
for (int i = 0; i < source.length; i++) {
|
||||
target[i] = source[i].toUpperCase();
|
||||
}
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
||||
private WorkbasketQuery addOrderCriteria(String colName, SortDirection sortDirection) {
|
||||
String orderByDirection = " ASC";
|
||||
if (sortDirection != null && SortDirection.DESCENDING.equals(sortDirection)) {
|
||||
orderByDirection = " DESC";
|
||||
}
|
||||
String orderByDirection = " " + (sortDirection == null ? SortDirection.ASCENDING.toString() : sortDirection.toString());
|
||||
orderBy.add(colName + orderByDirection);
|
||||
orderColumns.add(colName);
|
||||
return this;
|
||||
|
|
|
@ -23,9 +23,6 @@ import pro.taskana.security.WithAccessId;
|
|||
@RunWith(JAASRunner.class)
|
||||
public class QueryWorkbasketAccessItemsExtendedAccTest extends AbstractAccTest {
|
||||
|
||||
private static SortDirection asc = SortDirection.ASCENDING;
|
||||
private static SortDirection desc = SortDirection.DESCENDING;
|
||||
|
||||
public QueryWorkbasketAccessItemsExtendedAccTest() {
|
||||
super();
|
||||
}
|
||||
|
|
|
@ -86,11 +86,7 @@ public class LdapCacheTestImpl implements LdapCache {
|
|||
group3.add(group);
|
||||
break;
|
||||
}
|
||||
if (groupNumber != 3) {
|
||||
groupNumber++;
|
||||
} else {
|
||||
groupNumber = 0;
|
||||
}
|
||||
groupNumber = (groupNumber + 1) % 4;
|
||||
}
|
||||
|
||||
int countUser = 0;
|
||||
|
@ -111,11 +107,7 @@ public class LdapCacheTestImpl implements LdapCache {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (countUser != 3) {
|
||||
countUser++;
|
||||
} else {
|
||||
countUser = 0;
|
||||
}
|
||||
groupNumber = (groupNumber + 1) % 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ import org.springframework.web.client.RestTemplate;
|
|||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import pro.taskana.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.ldap.LdapCacheTestImpl;
|
||||
import pro.taskana.rest.resource.AccessIdResource;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import pro.taskana.rest.resource.WorkbasketAccesItemExtendedResource;
|
|||
import pro.taskana.rest.resource.assembler.WorkbasketAccessItemExtendedAssembler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -147,7 +147,7 @@ public class WorkbasketAccessItemController extends AbstractPagingController {
|
|||
private String[] extractVerticalBarSeparatedFields(List<String> searchFor) {
|
||||
List<String> values = new ArrayList<>();
|
||||
if (searchFor != null) {
|
||||
searchFor.forEach(item -> values.addAll(Arrays.asList(item.split("\\|"))));
|
||||
searchFor.forEach(item -> Collections.addAll(values, item.split("\\|")));
|
||||
}
|
||||
return values.toArray(new String[0]);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public abstract class AbstractRessourcesAssembler {
|
|||
original = getBuilderForOriginalUri();
|
||||
}
|
||||
|
||||
protected UriComponentsBuilder getBuilderForOriginalUri() {
|
||||
protected static UriComponentsBuilder getBuilderForOriginalUri() {
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
|
||||
.getRequest();
|
||||
UriComponentsBuilder baseUri = ServletUriComponentsBuilder.fromServletMapping(request)
|
||||
|
|
|
@ -1,24 +1,18 @@
|
|||
package pro.taskana.rest.resource.assembler;
|
||||
|
||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.hateoas.Link;
|
||||
import org.springframework.hateoas.PagedResources;
|
||||
import org.springframework.hateoas.PagedResources.PageMetadata;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
import pro.taskana.ClassificationSummary;
|
||||
import pro.taskana.rest.ClassificationController;
|
||||
import pro.taskana.rest.resource.ClassificationSummaryResource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
||||
import static pro.taskana.rest.resource.assembler.AbstractRessourcesAssembler.getBuilderForOriginalUri;
|
||||
|
||||
/**
|
||||
* @author HH
|
||||
*/
|
||||
|
@ -59,18 +53,4 @@ public class ClassificationSummaryResourcesAssembler {
|
|||
return pagedResources;
|
||||
}
|
||||
|
||||
private UriComponentsBuilder getBuilderForOriginalUri() {
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
|
||||
.getRequest();
|
||||
UriComponentsBuilder baseUri = ServletUriComponentsBuilder.fromServletMapping(request)
|
||||
.path(request.getRequestURI());
|
||||
for (Map.Entry<String, String[]> entry : request.getParameterMap().entrySet()) {
|
||||
for (String value : entry.getValue()) {
|
||||
baseUri.queryParam(entry.getKey(), value);
|
||||
}
|
||||
}
|
||||
UriComponentsBuilder original = baseUri;
|
||||
return original;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,17 +5,14 @@ import org.springframework.hateoas.Link;
|
|||
import org.springframework.hateoas.PagedResources;
|
||||
import org.springframework.hateoas.mvc.ResourceAssemblerSupport;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
import pro.taskana.WorkbasketAccessItemExtended;
|
||||
import pro.taskana.rest.WorkbasketAccessItemController;
|
||||
import pro.taskana.rest.resource.WorkbasketAccesItemExtendedResource;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static pro.taskana.rest.resource.assembler.AbstractRessourcesAssembler.getBuilderForOriginalUri;
|
||||
|
||||
/**
|
||||
* Transforms {@link WorkbasketAccessItemExtended} to its resource counterpart {@link WorkbasketAccesItemExtendedResource} and vice versa.
|
||||
|
@ -71,18 +68,4 @@ public class WorkbasketAccessItemExtendedAssembler extends ResourceAssemblerSupp
|
|||
return pagedResources;
|
||||
}
|
||||
|
||||
private UriComponentsBuilder getBuilderForOriginalUri() {
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
|
||||
.getRequest();
|
||||
UriComponentsBuilder baseUri = ServletUriComponentsBuilder.fromServletMapping(request)
|
||||
.path(request.getRequestURI());
|
||||
for (Map.Entry<String, String[]> entry : request.getParameterMap().entrySet()) {
|
||||
for (String value : entry.getValue()) {
|
||||
baseUri.queryParam(entry.getKey(), value);
|
||||
}
|
||||
}
|
||||
UriComponentsBuilder original = baseUri;
|
||||
return original;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,24 +1,18 @@
|
|||
package pro.taskana.rest.resource.assembler;
|
||||
|
||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.hateoas.Link;
|
||||
import org.springframework.hateoas.PagedResources;
|
||||
import org.springframework.hateoas.PagedResources.PageMetadata;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
import pro.taskana.WorkbasketSummary;
|
||||
import pro.taskana.rest.WorkbasketController;
|
||||
import pro.taskana.rest.resource.WorkbasketSummaryResource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
||||
import static pro.taskana.rest.resource.assembler.AbstractRessourcesAssembler.getBuilderForOriginalUri;
|
||||
|
||||
/**
|
||||
* @author HH
|
||||
*/
|
||||
|
@ -58,18 +52,4 @@ public class WorkbasketSummaryResourcesAssembler {
|
|||
return pagedResources;
|
||||
}
|
||||
|
||||
private UriComponentsBuilder getBuilderForOriginalUri() {
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
|
||||
.getRequest();
|
||||
UriComponentsBuilder baseUri = ServletUriComponentsBuilder.fromServletMapping(request)
|
||||
.path(request.getRequestURI());
|
||||
for (Map.Entry<String, String[]> entry : request.getParameterMap().entrySet()) {
|
||||
for (String value : entry.getValue()) {
|
||||
baseUri.queryParam(entry.getKey(), value);
|
||||
}
|
||||
}
|
||||
UriComponentsBuilder original = baseUri;
|
||||
return original;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<div class="pull-right btn-group">
|
||||
<button *ngIf="AccessItemsForm" type="button" (click)="revokeAccess()" class="btn btn-default" data-toggle="tooltip" title="Revoke access">
|
||||
<button *ngIf="AccessItemsForm" type="button" class="btn btn-default" data-toggle="tooltip" title="Revoke access">
|
||||
<span class="glyphicon glyphicon-remove red" aria-hidden="true"></span>
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
@ -138,10 +138,6 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
|
|||
|
||||
}
|
||||
|
||||
revokeAccess() {
|
||||
|
||||
}
|
||||
|
||||
private unSubscribe(subscription: Subscription): void {
|
||||
if (subscription) { subscription.unsubscribe(); }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue