public Group getGroup(String name) { return model.getGroupByName(name); } }
public WroModel create() { return new WroModel(); }
/** * @param resource * the {@link Resource} to search in all available groups. * @return t collection of group names containing provided resource. If the resource is not availalbe, an empty * collection will be returned. * @deprecated use {@link WroModelInspector#getGroupNamesContainingResource(String)} */ @Deprecated public Collection<String> getGroupNamesContainingResource(final String resourceUri) { return new WroModelInspector(this).getGroupNamesContainingResource(resourceUri); }
/** * Merge master model with another model. This is useful for supporting model imports. * * @param master master modele where we put imported model * @param importedModel model to import. */ protected void merge(WroModel master, WroModel importedModel) { Validate.notNull(importedModel, "imported model cannot be null!"); LOG.debug("merging importedModel: {}", importedModel); for (final String groupName : new WroModelInspector(importedModel).getGroupNames()) { if (!new WroModelInspector(master).getGroupNames().contains(groupName)) { // si les deux modeles contiennent le meme groupe, on garde celui du master final Group importedGroup = new WroModelInspector(importedModel).getGroupByName(groupName); master.addGroup(importedGroup); } } }
private List<String> getAllModelGroupNames() { return new WroModelInspector(getModel()).getGroupNames(); }
/** * This implementation would be simpler if java would have closures :). * * @return a comma separated list of group names. */ public String getGroupNamesAsString() { return String.format("%s", StringUtils.join(getGroupNames(), ", ")); }
/** * @return the set of all resources from all the groups of the model (no particular order). */ public Collection<Resource> getAllResources() { return collectResources(new ArrayList<Resource>()); }
/** * @param groups * the groups to set */ public final WroModel setGroups(final Collection<Group> groups) { notNull(groups, "groups cannot be null!"); LOG.debug("setGroups: {}", groups); identifyDuplicateGroupNames(groups); this.groups = new HashSet<Group>(groups); return this; }
/** * Merge this model with another model. This is useful for supporting model imports. * * @param importedModel model to import. */ public void merge(final WroModel importedModel) { Validate.notNull(importedModel, "imported model cannot be null!"); LOG.debug("merging importedModel: {}", importedModel); for (final String groupName : new WroModelInspector(importedModel).getGroupNames()) { if (new WroModelInspector(this).getGroupNames().contains(groupName)) { throw new WroRuntimeException("Duplicate group name detected: " + groupName); } final Group importedGroup = new WroModelInspector(importedModel).getGroupByName(groupName); addGroup(importedGroup); } }
private List<String> getAllModelGroupNames() { return new WroModelInspector(getModel()).getGroupNames(); }
public WroModel create() { return new WroModel(); }
/** * This implementation would be simpler if java would have closures :). * * @return a comma separated list of group names. */ public String getGroupNamesAsString() { return String.format("%s", StringUtils.join(getGroupNames(), ", ")); }
/** * @return the set of all unique resources from all the groups of the model (no particular order). */ public Collection<Resource> getAllUniqueResources() { return collectResources(new HashSet<Resource>()); }
/** * @param groups * the groups to set */ public final WroModel setGroups(final Collection<Group> groups) { notNull(groups, "groups cannot be null!"); LOG.debug("setGroups: {}", groups); identifyDuplicateGroupNames(groups); this.groups = new HashSet<Group>(groups); return this; }
/** * Merge this model with another model. This is useful for supporting model imports. * * @param importedModel model to import. */ public void merge(final WroModel importedModel) { Validate.notNull(importedModel, "imported model cannot be null!"); LOG.debug("merging importedModel: {}", importedModel); for (final String groupName : new WroModelInspector(importedModel).getGroupNames()) { if (new WroModelInspector(this).getGroupNames().contains(groupName)) { throw new WroRuntimeException("Duplicate group name detected: " + groupName); } final Group importedGroup = new WroModelInspector(importedModel).getGroupByName(groupName); addGroup(importedGroup); } }
/** * @return a {@link BaseWroManagerFactory} which uses an empty model. */ public static BaseWroManagerFactory simpleManagerFactory() { return new BaseWroManagerFactory().setModelFactory(simpleModelFactory(new WroModel())); }
/** * @return the set of all unique resources from all the groups of the model (no particular order). */ public Collection<Resource> getAllUniqueResources() { return collectResources(new HashSet<Resource>()); }
/** * @return a {@link BaseWroManagerFactory} which uses an empty model. */ public static BaseWroManagerFactory simpleManagerFactory() { return new BaseWroManagerFactory().setModelFactory(simpleModelFactory(new WroModel())); }
/** * @return the set of all resources from all the groups of the model (no particular order). */ public Collection<Resource> getAllResources() { return collectResources(new ArrayList<Resource>()); }