// 1. for these packages do
String[] packages = { "publ_pages_to_languages_root", "publ_pages_to_newsletter" };
for (int i = 0; i < packages.length; i++) {
String name = packages[i];
PublicationPackage publPackage = project.getPublicationPackageByName(name);
for (PublicationSetting combination : publPackage.getPublicationSettings()) {
// 2. skip all page config
if (combination.getProjectVariantName().contains("page_config_xml")) {
continue;
}
System.out.println(" " + combination.getName());
// 3. get setting’s values
LanguageVariant lv = combination.getLanguageVariant();
ProjectVariant pv = combination.getProjectVariant();
// 4. determine new project variant
String stage = StringHelper.split(pv.getName(), "_")[0];
ProjectVariant newPv = project.getProjectVariantByName(stage + "_viewlabels_and_messages_xml");
// 5. create new setting
PublicationSetting newCombination = publPackage.addSetting(newPv, lv, pv);
// 6. further action with newCombination
} // end for combinations
} // end for packages
}