use of io.fabric8.api.Profile in project fabric8 by jboss-fuse.
the class FabricManager method deleteConfigurationFile.
@Override
public void deleteConfigurationFile(String versionId, String profileId, String fileName) {
Profile profile = profileService.getRequiredProfile(versionId, profileId);
ProfileBuilder builder = ProfileBuilder.Factory.createFrom(profile);
builder.deleteFileConfiguration(fileName);
profileService.updateProfile(builder.getProfile());
}
use of io.fabric8.api.Profile in project fabric8 by jboss-fuse.
the class FabricManager method containers.
@Override
public List<Map<String, Object>> containers(List<String> fields, List<String> profileFields) {
List<Map<String, Object>> answer = new ArrayList<Map<String, Object>>();
for (Container c : fabricService.getContainers()) {
Map<String, Object> map = BeanUtils.convertContainerToMap(fabricService, c, fields);
List<Map<String, Object>> profiles = new ArrayList<Map<String, Object>>();
for (Profile p : c.getProfiles()) {
profiles.add(BeanUtils.convertProfileToMap(fabricService, p, profileFields));
}
map.put("profiles", profiles);
answer.add(map);
}
return answer;
}
use of io.fabric8.api.Profile in project fabric8 by jboss-fuse.
the class FabricManager method getConfigurationFileNames.
@Override
public List<String> getConfigurationFileNames(String versionId, String profileId) {
Version version = profileService.getVersion(versionId);
Profile profile = version.getProfile(profileId);
if (profile != null) {
ArrayList<String> fileNames = new ArrayList<>(profile.getConfigurationFileNames());
return Collections.unmodifiableList(fileNames);
} else {
return Collections.emptyList();
}
}
use of io.fabric8.api.Profile in project fabric8 by jboss-fuse.
the class FabricManager method createProfile.
@Override
public Map<String, Object> createProfile(String versionId, String profileId, List<String> parents) {
ProfileBuilder builder = ProfileBuilder.Factory.create(versionId, profileId).addParents(parents);
Profile profile = profileService.createProfile(builder.getProfile());
return getProfile(versionId, profile.getId());
}
use of io.fabric8.api.Profile in project fabric8 by jboss-fuse.
the class FabricManager method containersForProfile.
@Override
public List<Map<String, Object>> containersForProfile(String versionId, String profileId, List<String> fields, boolean checkParents) {
Version version = profileService.getVersion(versionId);
Profile profile = version != null ? version.getRequiredProfile(profileId) : null;
Set<Map<String, Object>> answer = new LinkedHashSet<Map<String, Object>>();
if (profile != null) {
for (Container c : fabricService.getContainers()) {
for (Profile p : c.getProfiles()) {
if (p.equals(profile)) {
answer.add(BeanUtils.convertContainerToMap(fabricService, c, fields));
} else if (checkParents) {
HashSet<Profile> profileIDs = new HashSet<>();
getAllParentProfiles(version, p, profileIDs);
for (Profile pprofile : profileIDs) {
if (pprofile.equals(profile)) {
answer.add(BeanUtils.convertContainerToMap(fabricService, c, fields));
break;
}
}
}
}
}
}
return new ArrayList<>(answer);
}
Aggregations