private boolean isActive( Profile profile, ProfileActivationContext context, ModelProblemCollector problems ) { boolean isActive = false; for ( ProfileActivator activator : activators ) { if ( activator.presentInConfig( profile, context, problems ) ) { isActive = true; } } for ( ProfileActivator activator : activators ) { try { if ( activator.presentInConfig( profile, context, problems ) ) { isActive &= activator.isActive( profile, context, problems ); } } catch ( RuntimeException e ) { problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) .setMessage( "Failed to determine activation for profile " + profile.getId() ) .setLocation( profile.getLocation( "" ) ) .setException( e ) ); return false; } } return isActive; }
/** * Helper method to determine if the current OS is allowed based on the injected values for family, name, version * and arch. * * @return true if the version is allowed. */ public boolean isAllowed() { return activator.isActive( createProfile(), null, null ); }
@Override public List<Profile> getActiveProfiles(Collection<Profile> profiles, ProfileActivationContext context, ModelProblemCollector problems) { List<Profile> activeProfiles = new ArrayList<Profile>(); for (Profile p : profiles) { String id = p.getId(); if (p.getId() != null && context.getActiveProfileIds().contains(id) && !context.getInactiveProfileIds().contains(id)) { activeProfiles.add(p); continue; } if (p.getActivation() != null && p.getActivation().isActiveByDefault() && !context.getInactiveProfileIds().contains(p.getId())) { activeProfiles.add(p); continue; } for (ProfileActivator activator : activators) { if (activator.isActive(p, context, problems)) { activeProfiles.add(p); break; } } } return activeProfiles; }
@Override public List<Profile> getActiveProfiles(Collection<Profile> profiles, ProfileActivationContext context, ModelProblemCollector problems) { List<Profile> activeProfiles = new ArrayList<Profile>(); for (Profile p : profiles) { String id = p.getId(); if (p.getId() != null && context.getActiveProfileIds().contains(id) && !context.getInactiveProfileIds().contains(id)) { activeProfiles.add(p); continue; } if (p.getActivation() != null && p.getActivation().isActiveByDefault() && !context.getInactiveProfileIds().contains(p.getId())) { activeProfiles.add(p); continue; } for (ProfileActivator activator : activators) { if (activator.isActive(p, context, problems)) { activeProfiles.add(p); break; } } } return activeProfiles; }
private boolean isActive( Profile profile, ProfileActivationContext context, ModelProblemCollector problems ) { boolean isActive = false; for ( ProfileActivator activator : activators ) { if ( activator.presentInConfig( profile, context, problems ) ) { isActive = true; } } for ( ProfileActivator activator : activators ) { try { if ( activator.presentInConfig( profile, context, problems ) ) { isActive &= activator.isActive( profile, context, problems ); } } catch ( RuntimeException e ) { problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) .setMessage( "Failed to determine activation for profile " + profile.getId() ) .setLocation( profile.getLocation( "" ) ) .setException( e ) ); return false; } } return isActive; }