1
0
mirror of https://github.com/1C-Company/v8-code-style.git synced 2025-07-01 14:24:51 +02:00

Исправления по код-ревью #1077

This commit is contained in:
Dmitriy Marmyshev
2022-08-01 14:46:59 +03:00
parent 2232919a08
commit 10945e9811
2 changed files with 8 additions and 7 deletions

View File

@ -60,7 +60,7 @@ public class InternalRightInfosService
} }
/** /**
* Gets the rights of some {@link EClass} of configuration metadata object that may has some rights. * Gets the rights of some {@link EClass} of configuration metadata object that may have some rights.
* *
* @param eClass the {@link EClass} of configuration metadata object that has some rights, cannot be {@code null}. * @param eClass the {@link EClass} of configuration metadata object that has some rights, cannot be {@code null}.
* @param context the context object of the configuration to determine platform version, cannot be {@code null}. * @param context the context object of the configuration to determine platform version, cannot be {@code null}.

View File

@ -26,9 +26,9 @@ import static com._1c.g5.v8.dt.rights.model.RightsPackage.Literals.ROLE_DESCRIPT
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -251,7 +251,7 @@ public abstract class RoleRightSetCheck
} }
else else
{ {
// add marker as closer as possible to the probleb place in the model // add marker as closer as possible to the problem place in the model
resultAceptor.addIssue(message, objectRights, OBJECT_RIGHTS__OBJECT); resultAceptor.addIssue(message, objectRights, OBJECT_RIGHTS__OBJECT);
} }
} }
@ -337,8 +337,6 @@ public abstract class RoleRightSetCheck
private Collection<MdObject> getDefaultObjectsWithRight(RoleDescription description, IProgressMonitor monitor) private Collection<MdObject> getDefaultObjectsWithRight(RoleDescription description, IProgressMonitor monitor)
{ {
Collection<MdObject> result = new LinkedList<>();
IProject project = resourceLookup.getProject(description); IProject project = resourceLookup.getProject(description);
Set<Long> objectIdForRole = getRoleTopObjects(project, description, monitor); Set<Long> objectIdForRole = getRoleTopObjects(project, description, monitor);
@ -347,6 +345,9 @@ public abstract class RoleRightSetCheck
return Collections.emptyList(); return Collections.emptyList();
} }
// return only unique objects
Map<Long, MdObject> result = new HashMap<>();
IBmEmfIndexProvider bmEmfIndexProvider = bmEmfIndexManager.getEmfIndexProvider(project); IBmEmfIndexProvider bmEmfIndexProvider = bmEmfIndexManager.getEmfIndexProvider(project);
RightsModelUtil.SUPPORTED_RIGHT_ECLASSES.stream().forEach(eClass -> { RightsModelUtil.SUPPORTED_RIGHT_ECLASSES.stream().forEach(eClass -> {
@ -371,12 +372,12 @@ public abstract class RoleRightSetCheck
if (!objectIdForRole.contains(bmObjectId)) if (!objectIdForRole.contains(bmObjectId))
{ {
result.add((MdObject)object); result.put(bmObjectId, (MdObject)object);
} }
} }
} }
}); });
return result; return result.values();
} }
private Set<Long> getRoleTopObjects(IProject project, RoleDescription description, IProgressMonitor monitor) private Set<Long> getRoleTopObjects(IProject project, RoleDescription description, IProgressMonitor monitor)