/** * Remove all exclusive objects that are in the one group from the other * * @param objects * the object from which objects will be removed * @param sourceObjects * the source of the exclusive group objects */ public static void removeGroups ( final Collection<? extends EObject> objects, final Collection<? extends EObject> sourceObjects ) { removeGroups ( objects, makeGroupIds ( sourceObjects ) ); }
/** * Return an aggregated map of group violations * <p> * This method actually calls {@link #aggregateGroups(EList)} and only * returns groups with a size greater than 1. * </p> * * @param objects * the objects to validate * @return the map of group violations */ public static Map<String, Set<EObject>> validate ( final EList<? extends EObject> objects ) { final Map<String, Set<EObject>> map = aggregateGroups ( objects ); final Map<String, Set<EObject>> result = new HashMap<> (); for ( final Map.Entry<String, Set<EObject>> entry : map.entrySet () ) { if ( entry.getValue ().size () > 1 ) { result.put ( entry.getKey (), entry.getValue () ); } } return result; }
final EAnnotation annotation = findAnnotation ( obj ); if ( annotation == null )
public static Collection<ApplicationModule> makeModules ( final org.eclipse.scada.configuration.infrastructure.World world, final org.eclipse.scada.configuration.infrastructure.EquinoxBase app, final EquinoxApplication implApp ) { final Collection<ApplicationModule> result = new LinkedList<> (); // process application configurations result.addAll ( EcoreUtil.copyAll ( world.getApplicationConfigurations () ) ); ExclusiveGroups.removeGroups ( result, app.getConfigurations () ); result.addAll ( EcoreUtil.copyAll ( app.getConfigurations () ) ); final List<Module> modules = new ArrayList<> (); // process infrastructure configuration final org.eclipse.scada.configuration.infrastructure.ApplicationConfiguration cfg = app.getConfiguration (); // TODO: add a default configuration if ( cfg != null ) { // add configurations ExclusiveGroups.removeGroups ( result, cfg.getConfigurations () ); result.addAll ( EcoreUtil.copyAll ( cfg.getConfigurations () ) ); // process modules modules.addAll ( cfg.getModules () ); } // process direct modules ExclusiveGroups.removeGroups ( result, app.getModules () ); modules.addAll ( app.getModules () ); processModules ( app, implApp, result, modules ); // final check is done in the target model return result; // we don't copy here, since the module handlers might have created actual objects }
/** * Make a set of group ids present in the object collection * * @param objects * the objects to check * @return the group set, never <code>null</code> */ public static Set<String> makeGroupIds ( final Collection<? extends EObject> objects ) { final Set<String> result = new HashSet<> (); for ( final EObject obj : objects ) { final EAnnotation annotation = findAnnotation ( obj ); if ( annotation == null ) { continue; } final String groupId = annotation.getDetails ().get ( VALUE_GROUP_ID ); if ( groupId == null ) { continue; } result.add ( groupId ); } return result; }
/** * Remove all exclusive objects that are in the one group from the other * * @param objects * the object from which objects will be removed * @param sourceObjects * the source of the exclusive group objects */ public static void removeGroups ( final Collection<? extends EObject> objects, final Collection<? extends EObject> sourceObjects ) { removeGroups ( objects, makeGroupIds ( sourceObjects ) ); }
final EAnnotation annotation = findAnnotation ( obj ); if ( annotation == null )
/** * Return an aggregated map of group violations * <p> * This method actually calls {@link #aggregateGroups(EList)} and only * returns groups with a size greater than 1. * </p> * * @param objects * the objects to validate * @return the map of group violations */ public static Map<String, Set<EObject>> validate ( final EList<? extends EObject> objects ) { final Map<String, Set<EObject>> map = aggregateGroups ( objects ); final Map<String, Set<EObject>> result = new HashMap<> (); for ( final Map.Entry<String, Set<EObject>> entry : map.entrySet () ) { if ( entry.getValue ().size () > 1 ) { result.put ( entry.getKey (), entry.getValue () ); } } return result; }
final EAnnotation annotation = findAnnotation ( obj ); if ( annotation == null )
final EAnnotation annotation = findAnnotation ( obj ); if ( annotation == null )
/** * Make a set of group ids present in the object collection * * @param objects * the objects to check * @return the group set, never <code>null</code> */ public static Set<String> makeGroupIds ( final Collection<? extends EObject> objects ) { final Set<String> result = new HashSet<> (); for ( final EObject obj : objects ) { final EAnnotation annotation = findAnnotation ( obj ); if ( annotation == null ) { continue; } final String groupId = annotation.getDetails ().get ( VALUE_GROUP_ID ); if ( groupId == null ) { continue; } result.add ( groupId ); } return result; }