Skip to content

Commit

Permalink
Fix formatting due to fmt-format-plugin update
Browse files Browse the repository at this point in the history
  • Loading branch information
dennishendriksen committed May 24, 2019
1 parent df76044 commit bced4a2
Show file tree
Hide file tree
Showing 101 changed files with 184 additions and 431 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,7 @@ private List<?> convertMref(Attribute attr, Object paramValue) {
EntityType mrefEntity = attr.getRefEntity();
Attribute mrefEntityIdAttr = mrefEntity.getIdAttribute();
value =
mrefParamValues
.stream()
mrefParamValues.stream()
.map(mrefParamValue -> toEntityValue(mrefEntityIdAttr, mrefParamValue, null))
.map(mrefIdValue -> entityManager.getReference(mrefEntity, mrefIdValue))
.collect(toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ private static Integer toAggregateThreshold(AggregateResult aggs) {
}

private static List<Object> convert(List<Object> xLabels) {
return xLabels
.stream()
return xLabels.stream()
.map(
xLabel -> {
Object value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,7 @@ public EntityCollectionBatchCreateResponseBodyV2 createEntities(

try {
final List<Entity> entities =
request
.getEntities()
.stream()
request.getEntities().stream()
.map(e -> this.restService.toEntity(meta, e))
.collect(toList());
final EntityCollectionBatchCreateResponseBodyV2 responseBody =
Expand All @@ -318,8 +316,7 @@ public EntityCollectionBatchCreateResponseBodyV2 createEntities(

// Add all entities
if (ATTRIBUTE_META_DATA.equals(entityTypeId)) {
entities
.stream()
entities.stream()
.map(attribute -> (Attribute) attribute)
.forEach(attribute -> dataService.getMeta().addAttribute(attribute));
} else {
Expand Down Expand Up @@ -434,9 +431,7 @@ public synchronized void updateEntities(

try {
List<Entity> entities =
request
.getEntities()
.stream()
request.getEntities().stream()
.map(e -> this.restService.toEntity(meta, e))
.collect(toList());

Expand Down Expand Up @@ -481,9 +476,7 @@ public synchronized void updateAttribute(
}

final List<Entity> entities =
request
.getEntities()
.stream()
request.getEntities().stream()
.filter(e -> e.size() == 2)
.map(e -> this.restService.toEntity(meta, e))
.collect(toList());
Expand Down Expand Up @@ -565,10 +558,7 @@ public String getL10nProperties(@PathVariable String namespace, @PathVariable St
public void registerMissingResourceStrings(
@PathVariable String namespace, HttpServletRequest request) {
Set<String> messageIDs =
request
.getParameterMap()
.entrySet()
.stream()
request.getParameterMap().entrySet().stream()
.map(Map.Entry::getKey)
.filter(id -> !id.equals(TIME_PARAM_NAME))
.collect(toSet());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,7 @@ public ResponseEntity deleteGroup(@PathVariable(value = "groupName") String grou
})
@ResponseBody
public List<GroupResponse> getGroups() {
return groupService
.getGroups()
.stream()
return groupService.getGroups().stream()
.filter(
group ->
userPermissionEvaluator.hasPermission(
Expand All @@ -158,9 +156,7 @@ public Collection<GroupMemberResponse> getMembers(
@PathVariable(value = "groupName") String groupName) {
checkGroupPermission(groupName, GroupPermission.VIEW_MEMBERSHIP);
Iterable<Role> roles = groupService.getGroup(groupName).getRoles();
return roleMembershipService
.getMemberships(Lists.newArrayList(roles))
.stream()
return roleMembershipService.getMemberships(Lists.newArrayList(roles)).stream()
.map(GroupMemberResponse::fromEntity)
.collect(Collectors.toList());
}
Expand Down Expand Up @@ -291,9 +287,7 @@ public Collection<RoleResponse> getGroupRoles(
@ResponseBody
@PreAuthorize("hasAnyRole('SU', 'MANAGER')")
public Collection<UserResponse> getUsers() {
return userService
.getUsers()
.stream()
return userService.getUsers().stream()
.filter(u -> !u.getUsername().equals("anonymous"))
.map(UserResponse::fromEntity)
.collect(Collectors.toList());
Expand All @@ -315,9 +309,7 @@ public Collection<Permission> getPermissions(
}

private String getManagerRoleName(GroupValue groupValue) {
return groupValue
.getRoles()
.stream()
return groupValue.getRoles().stream()
.filter(role -> role.getLabel().equals(GroupService.MANAGER))
.map(RoleValue::getName)
.findFirst()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,7 @@ public ApiResponse getRlsEntities() {
response = List.class)
public ApiResponse getSuitablePermissions(@PathVariable(value = TYPE_ID) String typeId) {
return ApiResponse.create(
permissionService
.getSuitablePermissionsForType(typeId)
.stream()
permissionService.getSuitablePermissionsForType(typeId).stream()
.map(PermissionSetUtils::getPermissionStringValue)
.collect(Collectors.toSet()));
}
Expand Down Expand Up @@ -174,9 +172,7 @@ public PagedApiResponse getAcls(
}

Set<ObjectResponse> data =
permissionService
.getObjects(typeId, page, pageSize)
.stream()
permissionService.getObjects(typeId, page, pageSize).stream()
.map(
labelledObject ->
ObjectResponse.create(labelledObject.getId(), labelledObject.getLabel()))
Expand Down Expand Up @@ -335,8 +331,7 @@ private void validateQueryParams(Integer page, Integer pageSize, boolean inherit
}

private Set<TypeResponse> convertTypes(Set<LabelledType> types) {
return types
.stream()
return types.stream()
.map(type -> TypeResponse.create(type.getId(), type.getEntityType(), type.getLabel()))
.collect(Collectors.toSet());
}
Expand All @@ -355,8 +350,7 @@ private TypePermissionsResponse convertToTypeResponse(
Set<LabelledPermission> permissions = entry.getValue();
if (!permissions.isEmpty()) {
LabelledPermission labelledObjectPermission =
permissions
.stream()
permissions.stream()
.findFirst()
.orElseThrow(() -> new IllegalStateException("Empty set of permissions"));
objectPermissions.add(
Expand All @@ -372,8 +366,7 @@ private TypePermissionsResponse convertToTypeResponse(

private Set<PermissionResponse> convertToPermissions(Set<LabelledPermission> permissions) {
LinkedHashSet<PermissionResponse> result = new LinkedHashSet();
permissions
.stream()
permissions.stream()
.map(
labelledPermission ->
PermissionResponse.create(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,7 @@ public static void setGrantedRepositoryPermissions(
String adminToken, String username, Map<String, Permission> permissions) {
if (adminToken != null) {
Map<String, String> params =
permissions
.entrySet()
.stream()
permissions.entrySet().stream()
.collect(
toMap(
entry -> "radio-" + entry.getKey(),
Expand Down Expand Up @@ -414,9 +412,7 @@ public static void setGrantedPackagePermissions(
String adminToken, String username, Map<String, Permission> permissions) {
if (adminToken != null) {
Map<String, String> params =
permissions
.entrySet()
.stream()
permissions.entrySet().stream()
.collect(
toMap(
entry -> "radio-" + entry.getKey(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ void populate(ContextRefreshedEvent event) {
private void populate(SystemEntityRegistry systemEntityRegistry) {
// sort entities by type
Multimap<EntityType, Entity> entityByTypeMap =
systemEntityRegistry
.getEntities()
.stream()
systemEntityRegistry.getEntities().stream()
.collect(toArrayListMultimap(Entity::getEntityType, Function.identity()));

// sort entity types
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ public String init(Model model) {
model.addAttribute(
"users",
Lists.newArrayList(
getUsers()
.stream()
getUsers().stream()
.filter(
user -> {
Boolean superuser = user.isSuperuser();
Expand All @@ -128,8 +127,7 @@ private List<EntityTypeRlsResponse> getEntityTypeDtos() {
getEntityTypes().filter(entityType -> !entityType.isAbstract()).collect(toList());
Collection<String> aclClasses = mutableAclClassService.getAclClassTypes();
entityTypes.sort(comparing(EntityType::getLabel));
return entityTypes
.stream()
return entityTypes.stream()
.map(
entityType -> {
boolean rlsEnabled = aclClasses.contains(EntityIdentityUtils.toType(entityType));
Expand Down Expand Up @@ -300,10 +298,7 @@ public void updateEntityClassRls(@Valid @RequestBody EntityTypeRlsRequest entity
@GetMapping("/permissionSets")
@ResponseBody
public List<PermissionSetResponse> getPermissionSets() {
return permissionRegistry
.getPermissionSets()
.entrySet()
.stream()
return permissionRegistry.getPermissionSets().entrySet().stream()
.map(entry -> PermissionSetResponse.create(entry.getKey(), entry.getValue()))
.sorted(comparing(PermissionSetResponse::getPermissions, comparingInt(List::size)))
.collect(toList());
Expand Down Expand Up @@ -366,8 +361,7 @@ private Permissions getPermissions(Sid sid, List<ObjectIdentity> objectIdentitie
Map<ObjectIdentity, Acl> aclMap =
mutableAclService.readAclsById(objectIdentities, singletonList(sid));
Set<String> ids =
objectIdentities
.stream()
objectIdentities.stream()
.map(ObjectIdentity::getIdentifier)
.map(Object::toString)
.collect(toSet());
Expand All @@ -379,8 +373,7 @@ private Multimap<String, String> getPermissions(Map<ObjectIdentity, Acl> acls, S
acls.forEach(
(objectIdentity, acl) -> {
String id = objectIdentity.getIdentifier().toString();
acl.getEntries()
.stream()
acl.getEntries().stream()
.filter(ace -> ace.getSid().equals(sid))
.map(this::getPermissionString)
.forEach(permission -> result.put(id, permission));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ public static PermissionSetResponse create(String name, List<PermissionResponse>
public static PermissionSetResponse create(
PermissionSet permissionSet, Set<Permission> permissions) {
List<PermissionResponse> permissionsGranted =
permissions
.stream()
permissions.stream()
.map(PermissionResponse::create)
.sorted(comparing(PermissionResponse::getType))
.collect(toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,7 @@ private boolean isInDefaultPackage(String entityTypeId, Set<String> packages) {

/** @return sorted map of writable packages ids to package path label */
private Map<String, String> getPackageSelection(List<Package> packages) {
return packages
.stream()
return packages.stream()
.filter(this::isReadablePackage)
.sorted(comparing(this::getPackagePathLabel))
.collect(toLinkedMap(Package::getId, this::getPackagePathLabel));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ public String handleRequest(HttpServletRequest request, BindingResult result, Wi
// The entities that can not be imported. If even one entity can not be imported,
// everything fails
List<String> entitiesNotImportable =
entitiesImportable
.entrySet()
.stream()
entitiesImportable.entrySet().stream()
.filter(entity -> !entity.getValue())
.map(Map.Entry::getKey)
.collect(toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,14 @@ private List<Entity> findAllBatch(List<Object> batch) {
String entityId = getEntityType().getId();
EntityType entityType = getEntityType();
List<Object> missingIds =
batch
.stream()
batch.stream()
.filter(id -> !l1Cache.get(entityId, id, entityType).isPresent())
.collect(toList());

Map<Object, Entity> missingEntities =
delegate().findAll(missingIds.stream()).collect(toMap(Entity::getIdValue, e -> e));

return batch
.stream()
return batch.stream()
.map(
id ->
l1Cache
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,7 @@ public Entity get(Repository<Entity> repository, Object id) {
*/
public List<Entity> getBatch(Repository<Entity> repository, Iterable<Object> ids) {
try {
return getEntityCache(repository)
.getAll(ids)
.values()
.stream()
return getEntityCache(repository).getAll(ids).values().stream()
.filter(Optional::isPresent)
.map(Optional::get)
.map(e -> entityHydration.hydrate(e, repository.getEntityType()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ public void putDeletion(EntityKey entityKey) {
* @param entityType the id of the entity whose entries are to be evicted
*/
public void evictAll(EntityType entityType) {
cache
.asMap()
.keySet()
.stream()
cache.asMap().keySet().stream()
.filter(e -> e.getEntityTypeId().equals(entityType.getId()))
.forEach(cache::invalidate);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public void testFindAllQueriesInBatches() {
List<Object> queried =
((Stream<Object>) invocation.getArguments()[0]).collect(toList());
return Lists.transform(
queried, id -> lotsOfEntities.get(Integer.parseInt(id.toString())))
queried, id -> lotsOfEntities.get(Integer.parseInt(id.toString())))
.stream();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,7 @@ public void hydrateTest() {
assertTrue(EntityUtils.equals(actualHydratedEntity, hydratedEntity));
// check that it has retrieved references of type TypeTestRef
assertTrue(
entityTypeArgumentCaptor
.getAllValues()
.stream()
entityTypeArgumentCaptor.getAllValues().stream()
.allMatch(emd -> emd.getId().equals("TypeTestRefDynamic")));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,7 @@ private void convertIdtoLabelLabels(
// Get entities for ids
// Use Iterables.transform to work around List<String> to Iterable<Object> cast error
Stream<Object> idLabelsWithoutNull =
idLabels
.stream()
idLabels.stream()
.filter(Objects::nonNull)
.map(
untypedIdLabel ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ private Client tryCreateClient(RetryContext retryContext) throws InterruptedExce
}

private InetSocketTransportAddress[] createInetTransportAddresses() {
return inetAddresses
.stream()
return inetAddresses.stream()
.map(InetSocketTransportAddress::new)
.toArray(InetSocketTransportAddress[]::new);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -767,8 +767,7 @@ private QueryBuilder nestedQueryBuilder(
}

private String getQueryFieldName(List<Attribute> attributePath) {
return attributePath
.stream()
return attributePath.stream()
.map(this::getQueryFieldName)
.collect(joining(ATTRIBUTE_SEPARATOR));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ public ExcelSheetWriter createWritable(
public ExcelSheetWriter createWritable(String entityTypeId, List<String> attributeNames) {
List<Attribute> attributes =
attributeNames != null
? attributeNames
.stream()
? attributeNames.stream()
.map(attrName -> attributeFactory.create().setName(attrName))
.collect(Collectors.toList())
: null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ public void close() throws IOException {
public ExcelSheetWriter createWritable(String entityTypeId, List<String> attributeNames) {
List<Attribute> attributes =
attributeNames != null
? attributeNames
.stream()
? attributeNames.stream()
.map(attrName -> attrMetaFactory.create().setName(attrName))
.collect(Collectors.toList())
: null;
Expand Down
Loading

0 comments on commit bced4a2

Please sign in to comment.