@Override public Map<String, String> getProperties() { return profile.getProperties(); }
public Map<String, String> getProfileProperties() { Map<String, String> result = new HashMap<>(profile.getProperties()); if (propertiesToRemove != null) { for (String key : propertiesToRemove) { result.remove(key); } } if (propertiesToAdd != null) result.putAll(propertiesToAdd); return result; }
private boolean satisfyMetaRequirements(IProfile p) { return satisfyMetaRequirements(p.getProperties()); }
private static void synchronizeProfileProperties(IProfileChangeRequest request, IProfile current, IProfile target) { Map<String, String> profilePropertiesToSet = new HashMap<>(target.getProperties()); for (Entry<String, String> entry : current.getProperties().entrySet()) { String key = entry.getKey(); String newValue = profilePropertiesToSet.get(key); if (newValue == null) { request.removeProfileProperty(key); } else if (newValue.equals(entry.getValue())) profilePropertiesToSet.remove(key); } for (Entry<String, String> entry : profilePropertiesToSet.entrySet()) { request.setProfileProperty(entry.getKey(), entry.getValue()); } } }
public void writeProfile(IProfile profile) { start(PROFILE_ELEMENT); attribute(ID_ATTRIBUTE, profile.getProfileId()); attribute(TIMESTAMP_ATTRIBUTE, Long.toString(profile.getTimestamp())); writeProperties(profile.getProperties()); ArrayList<IInstallableUnit> ius = new ArrayList<IInstallableUnit>(profile.query(QueryUtil.createIUAnyQuery(), null).toUnmodifiableSet()); Collections.sort(ius, new Comparator<IInstallableUnit>() { public int compare(IInstallableUnit iu1, IInstallableUnit iu2) { int IdCompare = iu1.getId().compareTo(iu2.getId()); if (IdCompare != 0) return IdCompare; return iu1.getVersion().compareTo(iu2.getVersion()); } }); writeInstallableUnits(ius.iterator(), ius.size()); writeInstallableUnitsProperties(ius.iterator(), ius.size(), profile); end(PROFILE_ELEMENT); flush(); }
public void writeProfile(IProfile profile) { start(PROFILE_ELEMENT); attribute(ID_ATTRIBUTE, profile.getProfileId()); attribute(TIMESTAMP_ATTRIBUTE, Long.toString(profile.getTimestamp())); writeProperties(profile.getProperties()); ArrayList<IInstallableUnit> ius = new ArrayList<>(profile.query(QueryUtil.createIUAnyQuery(), null).toUnmodifiableSet()); Collections.sort(ius, new Comparator<IInstallableUnit>() { @Override public int compare(IInstallableUnit iu1, IInstallableUnit iu2) { int IdCompare = iu1.getId().compareTo(iu2.getId()); if (IdCompare != 0) return IdCompare; return iu1.getVersion().compareTo(iu2.getVersion()); } }); writeInstallableUnits(ius.iterator(), ius.size()); writeInstallableUnitsProperties(ius.iterator(), ius.size(), profile); end(PROFILE_ELEMENT); flush(); }