public List<String> getParentIds() { return delegate.getParentIds(); }
public List<String> getParentIds() { return delegate.getParentIds(); }
boolean isCircularRelationship(Profile a, Profile b){ boolean result = false; List<String> aParents = a.getParentIds(); List<String> bParents = b.getParentIds(); if(a.getParentIds().contains(b.getId()) && b.getParentIds().contains(a.getId())){ result = true; } return result; }
private String getLastModified() { StringBuilder sb = new StringBuilder(); sb.append(self.getProfileHash()); for (String parentId : self.getParentIds()) { Profile parent = version.getRequiredProfile(parentId); sb.append("-").append(parent.getProfileHash()); } return sb.toString(); } }
private static void recursiveAddProfiles(Version version, Set<String> result, List<String> profiles) { for (String profileId : profiles) { result.add(profileId); Profile profile = version.getRequiredProfile(profileId); List<String> parents = profile.getParentIds(); recursiveAddProfiles(version, result, parents); } }
private static void recursiveAddProfiles(Version version, Set<String> result, List<String> profiles) { for (String profileId : profiles) { result.add(profileId); Profile profile = version.getRequiredProfile(profileId); List<String> parents = profile.getParentIds(); recursiveAddProfiles(version, result, parents); } }
/** * Returns a set of profiles that are parents or grandparents, or ... of a given profile * @param version * @param profile * @param parentProfiles * @return */ private void getAllParentProfiles(Version version, Profile profile, Set<Profile> parentProfiles) { for (String parentProfileId : profile.getParentIds()) { Profile pprofile = version.getProfile(parentProfileId); if (pprofile != null) { parentProfiles.add(pprofile); getAllParentProfiles(version, pprofile, parentProfiles); } } }
public static Map<String, Object> convertProfileToMap(FabricService fabricService, Profile profile, List<String> fields) { Map<String, Object> answer = new TreeMap<String, Object>(); for (String field : fields) { if (field.equalsIgnoreCase("configurations") || field.equalsIgnoreCase("fileConfigurations")) { answer.put(field, fetchConfigurations(profile)); } else if (field.equalsIgnoreCase("configurationFileNames")) { answer.put(field, fetchConfigurationFileNames(profile)); } else if (field.equalsIgnoreCase("childIds")) { answer.put(field, fetchChildIds(fabricService, profile)); } else if (field.equalsIgnoreCase("containers") || field.equalsIgnoreCase("associatedContainers")) { answer.put(field, fetchContainers(fabricService, profile)); } else if (field.equalsIgnoreCase("containerCount")) { answer.put(field, fetchContainerCount(fabricService, profile)); } else if (field.equalsIgnoreCase("parentIds") || field.equalsIgnoreCase("parents")) { answer.put(field, profile.getParentIds()); } else if (field.equalsIgnoreCase("class") || field.equalsIgnoreCase("string") || field.equalsIgnoreCase("abstractProfile") || field.equalsIgnoreCase("attributes")) { // ignore... } else { addProperty(profile, field, answer); } } return answer; }
for (String parentId : profile.getParentIds()) { loadProfile(version.getRequiredProfile(parentId), queries);
public static List<String> fetchChildIds(FabricService fabricService, Profile self) { List<String> ids = new ArrayList<String>(); ProfileService profileService = fabricService.adapt(ProfileService.class); for (Profile p : profileService.getRequiredVersion(self.getVersion()).getProfiles()) { for (String parentId : p.getParentIds()) { if (parentId.equals(self.getId())) { ids.add(p.getId()); break; } } } return ids; }
private void fillParentProfiles(Profile profile, List<Profile> profiles) { if (!profiles.contains(profile)) { List<Profile> circularRelationship = new ArrayList<>(); for (String parentId : profile.getParentIds()) { if (version.hasProfile(parentId)){ Profile parent = version.getRequiredProfile(parentId); if (parent != null){ if ( !isCircularRelationship(profile, parent)){ fillParentProfiles(parent, profiles); } else { circularRelationship.add(parent); } } } else { LOGGER.error("Tried to load a profile[{}] not present in this version[{}]", parentId, version); } } profiles.add(profile); for(Profile p: circularRelationship){ fillParentProfiles(p, profiles); } } }
for (String parentId : profile.getParentIds()) { loadProfile(version.getRequiredProfile(parentId), queries);
String version = profile.getVersion(); dto.setVersion(version); List<String> parentIds = profile.getParentIds(); if (parentIds.size() > 0) { dto.setParentProfile(parentIds.get(0));
for (String parentId : profile.getParentIds()) {
for (String parentId : profile.getParentIds()) { Profile parent = getProfileFromCache(profile.getVersion(), parentId); IllegalStateAssertion.assertNotNull(parent, "Parent profile does not exist: " + parentId);
String iconProfileId = profileId; if (isNullOrEmpty(relativeIcon)) { List<String> parentIds = profile.getParentIds(); if (parentIds != null && !parentIds.isEmpty()) { for (String parentId : parentIds) {
protected void printProfiles(ProfileService profileService, List<Profile> profiles, PrintStream out) { TablePrinter table = new TablePrinter(); table.columns("id", "# containers", "parents"); for (Profile profile : profiles) { String versionId = profile.getVersion(); String profileId = profile.getId(); // skip profiles that do not exists (they may have been deleted) if (profileService.hasProfile(versionId, profileId) && (hidden || !profile.isHidden())) { int active = fabricService.getAssociatedContainers(versionId, profileId).length; String parents = Strings.join(profile.getParentIds(), " "); table.row(profileId, activeContainerCountText(active), parents); } } table.print(); }
List<String> parentProfiles = Lists.mutableList(profile.getParentIds()); List<String> bundles = Lists.mutableList(profile.getBundles()); List<String> features = Lists.mutableList(profile.getFeatures());
public ProfileDTO(Profile profile) { this.id = profile.getId(); this.version = profile.getVersion(); this.profileHash = profile.getProfileHash(); this.parents = profile.getParentIds(); this.overlay = profile.isOverlay(); this.abstractProfile = profile.isAbstract(); this.locked = profile.isLocked(); this.hidden = profile.isHidden(); this.attributes = profile.getAttributes(); this.bundles = profile.getBundles(); this.features = profile.getFeatures(); this.repositories = profile.getRepositories(); this.fabs = profile.getFabs(); this.overrides = profile.getOverrides(); String versionId = profile.getVersion(); String profileId = profile.getId(); this.configurations = profile.getConfigurationFileNames(); }
public ProfileDTO(Profile profile) { this.id = profile.getId(); this.version = profile.getVersion(); this.profileHash = profile.getProfileHash(); this.parents = profile.getParentIds(); this.overlay = profile.isOverlay(); this.abstractProfile = profile.isAbstract(); this.locked = profile.isLocked(); this.hidden = profile.isHidden(); this.attributes = profile.getAttributes(); this.bundles = profile.getBundles(); this.features = profile.getFeatures(); this.repositories = profile.getRepositories(); this.fabs = profile.getFabs(); this.overrides = profile.getOverrides(); String versionId = profile.getVersion(); String profileId = profile.getId(); this.configurations = profile.getConfigurationFileNames(); }