* Renamed LocalizedString#addValue to LocalizedString#putValue

* Edit Steps for Multipart Article Part III
pull/10/head
Jens Pelzetter 2021-12-16 20:17:23 +01:00
parent 43943e1c46
commit b3008e5f04
94 changed files with 840 additions and 272 deletions

View File

@ -156,7 +156,7 @@ public abstract class AbstractAssetFormController<T extends Asset> implements
if (data.containsKey(TITLE)) {
final String title = (String) data.get(TITLE);
asset.getTitle().addValue(selectedLocale, title);
asset.getTitle().putValue(selectedLocale, title);
}
updateAssetProperties(asset, selectedLocale, data);

View File

@ -74,7 +74,7 @@ public abstract class AbstractBinaryAssetFormController<T extends BinaryAsset>
final Map<String, Object> data) {
if (data.containsKey(DESCRIPTION)) {
asset.getDescription().addValue(selectedLocale,
asset.getDescription().putValue(selectedLocale,
(String) data.get(DESCRIPTION));
}

View File

@ -132,7 +132,7 @@ public abstract class AbstractBookmarkForm<T extends Bookmark>
final PageState state) {
bookmark
.getDescription()
.addValue(getSelectedLocale(state),
.putValue(getSelectedLocale(state),
(String) description.getValue(state));
bookmark.setUrl((String) url.getValue(state));

View File

@ -63,7 +63,7 @@ public abstract class AbstractBookmarkFormController<T extends Bookmark>
if (data.containsKey(DESCRIPTION)) {
asset.getDescription().addValue(selectedLocale,
asset.getDescription().putValue(selectedLocale,
(String) data.get(DESCRIPTION));
}

View File

@ -70,7 +70,7 @@ public class LegalMetadataFormController
}
if (data.containsKey(RIGHTS)) {
asset.getRights().addValue(selectedLocale,
asset.getRights().putValue(selectedLocale,
(String) data.get(RIGHTS));
}

View File

@ -59,7 +59,7 @@ public class SideNoteFormController
if (data.containsKey(TEXT)) {
final String value = (String) data.get(TEXT);
asset.getText().addValue(selectedLocale, value);
asset.getText().putValue(selectedLocale, value);
}
}

View File

@ -238,8 +238,8 @@ public abstract class BasicPageForm extends BasicItemForm {
final Locale selectedLocale = SelectedLanguageUtil
.selectedLocale(state, selectedLanguageParam);
item.getName().addValue(selectedLocale, (String) data.get(NAME));
item.getTitle().addValue(selectedLocale, (String) data.get(TITLE));
item.getName().putValue(selectedLocale, (String) data.get(NAME));
item.getTitle().putValue(selectedLocale, (String) data.get(TITLE));
if (!CMSConfig.getConfig().isHideLaunchDate()) {
item.setLaunchDate((Date) data.get(LAUNCH_DATE));
}

View File

@ -264,8 +264,8 @@ public class PageCreateForm
locale);
}
// item.getName().addValue(locale, (String) data.get(NAME));
item.getTitle().addValue(locale, (String) data.get(TITLE));
// item.getName().putValue(locale, (String) data.get(NAME));
item.getTitle().putValue(locale, (String) data.get(TITLE));
final ContentItemRepository itemRepo = cdiUtil
.findBean(ContentItemRepository.class);

View File

@ -178,7 +178,7 @@ public class ArticlePropertyForm extends GenericArticlePropertyForm
article
.getDescription()
.addValue(selectedLocale, (String) data.get(LEAD));
.putValue(selectedLocale, (String) data.get(LEAD));
final ContentItemRepository itemRepo = CdiUtil
.createCdiUtil()

View File

@ -120,7 +120,7 @@ public class ArticleTextBody extends TextBody {
final Locale selectedLocale = SelectedLanguageUtil
.selectedLocale(state, selectedLanguageParam);
article.getText().addValue(selectedLocale, text);
article.getText().putValue(selectedLocale, text);
final ContentItemRepository itemRepo = CdiUtil
.createCdiUtil()

View File

@ -355,11 +355,11 @@ class RelatedInfoListForm
attachmentList.setName((String) nameField.getValue(state));
attachmentList
.getTitle()
.addValue(getSelectedLocale(state),
.putValue(getSelectedLocale(state),
(String) titleField.getValue(state));
attachmentList
.getDescription()
.addValue(getSelectedLocale(state),
.putValue(getSelectedLocale(state),
(String) descriptionArea.getValue(state));
controller.saveAttachmentList(attachmentList);

View File

@ -300,7 +300,7 @@ class RelatedInfoStepController {
final RelatedLink link = new RelatedLink();
link.setTargetItem(targetItem);
final Locale selectedLocale = new Locale(selectedLanguage);
link.getTitle().addValue(selectedLocale, title);
link.getTitle().putValue(selectedLocale, title);
final AttachmentList list = attachmentListManager
.getAttachmentList(attachmentList.getListId())

View File

@ -555,31 +555,31 @@ public class EventPropertyForm
item.setEndDate(endDateTime);
//date_description
if (!eventConfig.isHideDateDescription()) {
item.getEventDate().addValue(selectedLocale,
item.getEventDate().putValue(selectedLocale,
(String) data.get(EVENT_DATE));
}
if (!eventConfig.isHideMainContributor()) {
item
.getMainContributor()
.addValue(selectedLocale,
.putValue(selectedLocale,
(String) data.get(MAIN_CONTRIBUTOR));
}
if (!eventConfig.isHideEventType()) {
item
.getEventType()
.addValue(selectedLocale,
.putValue(selectedLocale,
(String) data.get(EVENT_TYPE));
}
if (!eventConfig.isHideLinkToMap()) {
item.setMapLink((String) data.get(MAP_LINK));
}
item.getLocation().addValue(selectedLocale,
item.getLocation().putValue(selectedLocale,
(String) data.get(LOCATION));
item.getDescription().addValue(selectedLocale,
item.getDescription().putValue(selectedLocale,
(String) data.get(LEAD));
if (!eventConfig.isHideCost()) {
item.getCost().addValue(selectedLocale,
item.getCost().putValue(selectedLocale,
(String) data.get(COST));
}

View File

@ -117,7 +117,7 @@ public class EventTextBody extends TextBody {
final Locale selectedLocale = SelectedLanguageUtil
.selectedLocale(state, selectedLanguageParam);
event.getText().addValue(selectedLocale, text);
event.getText().putValue(selectedLocale, text);
final ContentItemRepository itemRepo = CdiUtil
.createCdiUtil()
.findBean(ContentItemRepository.class);

View File

@ -160,13 +160,13 @@ public class MultiPartArticleCreateForm
section,
folder,
locale);
article.getTitle().addValue(locale, (String) data.get(TITLE));
article.getTitle().putValue(locale, (String) data.get(TITLE));
if (!CMSConfig.getConfig().isHideLaunchDate()) {
article.setLaunchDate((Date) data.get(LAUNCH_DATE));
}
article
.getSummary()
.addValue(locale, (String) data.get(SUMMARY));
.putValue(locale, (String) data.get(SUMMARY));
workflowSection.applyWorkflow(state, article);

View File

@ -267,14 +267,14 @@ public abstract class MultiPartArticleForm
final Locale selectedLocale = SelectedLanguageUtil
.selectedLocale(state, selectedLanguageParam);
article.getName().addValue(selectedLocale,
article.getName().putValue(selectedLocale,
(String) data.get(NAME));
article.getTitle().addValue(selectedLocale,
article.getTitle().putValue(selectedLocale,
(String) data.get(TITLE));
if (!CMSConfig.getConfig().isHideLaunchDate()) {
article.setLaunchDate((Date) data.get(LAUNCH_DATE));
}
article.getSummary().addValue(selectedLocale,
article.getSummary().putValue(selectedLocale,
(String) data.get(SUMMARY));
}

View File

@ -201,8 +201,8 @@ class MultiPartArticleSectionStepController {
)
)
);
update.getTitle().addValue(locale, title);
update.getText().addValue(locale, title);
update.getTitle().putValue(locale, title);
update.getText().putValue(locale, title);
update.setPageBreak(pageBreak);
}

View File

@ -171,7 +171,7 @@ public class SectionEditForm extends Form {
final Locale selectedLocale = SelectedLanguageUtil
.selectedLocale(state, selectedLanguageParam);
section.getTitle().addValue(selectedLocale, (String) data.get(TITLE));
section.getTitle().putValue(selectedLocale, (String) data.get(TITLE));
return section;
}
@ -288,7 +288,7 @@ public class SectionEditForm extends Form {
section = selectedSectionModel.getSelectedSection(state);
}
// section.getTitle().addValue(selectedLocale,
// section.getTitle().putValue(selectedLocale,
// (String) data.get(TITLE));
final Object[] pageBreakVal = (Object[]) data.get(PAGE_BREAK);
final boolean pageBreak;
@ -307,14 +307,14 @@ public class SectionEditForm extends Form {
} else {
text = (String) data.get(TEXT);
}
// section.getText().addValue(selectedLocale, text);
// section.getText().putValue(selectedLocale, text);
// sectionRepo.save(section);
if (selectedSectionModel.getSelectedKey(state) == null) {
section.getTitle().addValue(selectedLocale,
section.getTitle().putValue(selectedLocale,
(String) data.get(TITLE));
section.setPageBreak(pageBreak);
section.getText().addValue(selectedLocale, text);
section.getText().putValue(selectedLocale, text);
controller.addSection(article, section);
} else {

View File

@ -90,7 +90,7 @@ public class NewsController {
)
);
news.getText().addValue(forLocale, text);
news.getText().putValue(forLocale, text);
itemRepo.save(news);
}
@ -114,7 +114,7 @@ public class NewsController {
);
update.setReleaseDate(releaseDate);
update.getDescription().addValue(locale, description);
update.getDescription().putValue(locale, description);
itemRepo.save(update);
}

View File

@ -106,7 +106,7 @@ class AddUseContextForm extends BaseForm {
final String rootName = (String) m_rootName.getValue(state);
final LocalizedString rootDescription = new LocalizedString();
rootDescription.addValue(config.getDefaultLocale(), (String) m_rootDescription.getValue(state));
rootDescription.putValue(config.getDefaultLocale(), (String) m_rootDescription.getValue(state));
Category root = new Category();
root.setName(rootName);

View File

@ -79,7 +79,7 @@ class CategoryController {
final Category category = new Category();
category.setName(name);
final LocalizedString localizedDescription = new LocalizedString();
localizedDescription.addValue(kernelConfig.getDefaultLocale(),
localizedDescription.putValue(kernelConfig.getDefaultLocale(),
description);
category.setDescription(localizedDescription);
category.setAbstractCategory(isAbstract);

View File

@ -131,7 +131,7 @@ final class CategoryEditForm extends BaseCategoryForm {
final LocalizedString localizedDescription
= new LocalizedString();
localizedDescription
.addValue(config.getDefaultLocale(),
.putValue(config.getDefaultLocale(),
(String) getDescriptionArea().getValue(state));
category.setDescription(localizedDescription);

View File

@ -137,8 +137,8 @@ public class CategoryLocalizationAddForm extends CategoryLocalizationForm {
if (permissionChecker.isPermitted(
AdminPrivileges.ADMINISTER_CATEGORIES, category)) {
category.getTitle().addValue(locale, title);
category.getDescription().addValue(locale, description);
category.getTitle().putValue(locale, title);
category.getDescription().putValue(locale, description);
// category.setEnabled(isEnabled.equals("yes"));
categoryRepository.save(category);

View File

@ -120,8 +120,8 @@ public class CategoryLocalizationEditForm extends CategoryLocalizationForm {
if (permissionChecker.isPermitted(AdminPrivileges.ADMINISTER_CATEGORIES, category)) {
final Locale locale = new Locale((String) m_locale.getValue(state));
category.getTitle().addValue(locale, (String) m_title.getValue(state));
category.getDescription().addValue(locale, (String) m_description.getValue(state));
category.getTitle().putValue(locale, (String) m_title.getValue(state));
category.getDescription().putValue(locale, (String) m_description.getValue(state));
// category.setName((String) m_url.getValue(state));
// category.setEnabled("yes".equals(m_isEnabled.getValue(state)));
categoryRepository.save(category);

View File

@ -96,7 +96,7 @@ public class FolderCreateForm extends FolderForm {
KernelConfig.class);
final Folder folder = folderManager.createFolder(name, parent);
folder.getTitle().addValue(kernelConfig.getDefaultLocale(), title);
folder.getTitle().putValue(kernelConfig.getDefaultLocale(), title);
folderRepo.save(folder);
}

View File

@ -386,7 +386,7 @@ public abstract class FolderForm extends Form implements FormInitListener,
folder.setName(name);
folder.setDisplayName(name);
folder.getTitle().addValue(kernelConfig.getDefaultLocale(), label);
folder.getTitle().putValue(kernelConfig.getDefaultLocale(), label);
final CategoryRepository categoryRepo = cdiUtil.findBean(
CategoryRepository.class);

View File

@ -180,8 +180,8 @@ class LifecycleAdminPaneController {
final LifecycleDefinition definition = new LifecycleDefinition();
definition.getLabel().addValue(defaultLocale, name);
definition.getDescription().addValue(defaultLocale, description);
definition.getLabel().putValue(defaultLocale, name);
definition.getDescription().putValue(defaultLocale, description);
lifecycleDefRepo.save(definition);
sectionManager.addLifecycleDefinitionToContentSection(definition,
@ -220,12 +220,12 @@ class LifecycleAdminPaneController {
final Locale defaultLocale = kernelConfig.getDefaultLocale();
if (!lifecycleDefinition.getLabel().getValue(defaultLocale).equals(name)) {
lifecycleDefinition.getLabel().addValue(defaultLocale, name);
lifecycleDefinition.getLabel().putValue(defaultLocale, name);
}
if (!lifecycleDefinition.getDescription().getValue(defaultLocale)
.equals(description)) {
lifecycleDefinition.getDescription().addValue(defaultLocale,
lifecycleDefinition.getDescription().putValue(defaultLocale,
description);
}
@ -306,8 +306,8 @@ class LifecycleAdminPaneController {
final PhaseDefinition phaseDefinition = new PhaseDefinition();
lifecycleDefinition.addPhaseDefinition(phaseDefinition);
phaseDefinition.getLabel().addValue(defaultLocale, label);
phaseDefinition.getDescription().addValue(defaultLocale, description);
phaseDefinition.getLabel().putValue(defaultLocale, label);
phaseDefinition.getDescription().putValue(defaultLocale, description);
int delay = delayDays * 24 * 60 * 60;
delay += delayHours * 60 * 60;
delay += delayMinutes * 60;
@ -350,8 +350,8 @@ class LifecycleAdminPaneController {
.findConfiguration(KernelConfig.class);
final Locale defaultLocale = kernelConfig.getDefaultLocale();
phaseDefinition.getLabel().addValue(defaultLocale, label);
phaseDefinition.getDescription().addValue(defaultLocale, description);
phaseDefinition.getLabel().putValue(defaultLocale, label);
phaseDefinition.getDescription().putValue(defaultLocale, description);
int delay = delayDays * 24 * 60 * 60;
delay += delayHours * 60 * 60;
delay += delayMinutes * 60;

View File

@ -234,7 +234,7 @@ class RoleAdminPaneController {
final Locale defaultLocale = kernelConfig.getDefaultLocale();
roleToSave.setName(roleName);
roleToSave.getDescription().addValue(defaultLocale, roleDescription);
roleToSave.getDescription().putValue(defaultLocale, roleDescription);
roleRepo.save(roleToSave);
@ -333,7 +333,7 @@ class RoleAdminPaneController {
final Role role = new Role();
role.setName(name);
role.getDescription().addValue(defaultLocale, description);
role.getDescription().putValue(defaultLocale, description);
roleRepo.save(role);

View File

@ -282,8 +282,8 @@ public class EditType extends CMSForm
}
// final KernelConfig kernelConfig = KernelConfig.getConfig();
// type.get().getLabel().addValue(kernelConfig.getDefaultLocale(), label);
// type.get().getDescription().addValue(kernelConfig.getDefaultLocale(),
// type.get().getLabel().putValue(kernelConfig.getDefaultLocale(), label);
// type.get().getDescription().putValue(kernelConfig.getDefaultLocale(),
// description);
typeRepo.save(type.get());

View File

@ -214,8 +214,8 @@ public class WorkflowAdminPaneController {
final Workflow workflowTemplate = new Workflow();
workflowTemplate.setAbstractWorkflow(true);
workflowTemplate.getName().addValue(defaultLocale, name);
workflowTemplate.getDescription().addValue(defaultLocale, desc);
workflowTemplate.getName().putValue(defaultLocale, name);
workflowTemplate.getDescription().putValue(defaultLocale, desc);
workflowRepo.save(workflowTemplate);
@ -255,8 +255,8 @@ public class WorkflowAdminPaneController {
workflow.getWorkflowId())));
final CmsTask task = new CmsTask();
task.getLabel().addValue(defaultLocale, name);
task.getDescription().addValue(defaultLocale, desc);
task.getLabel().putValue(defaultLocale, name);
task.getDescription().putValue(defaultLocale, desc);
task.setTaskType(type);
// task.setActive(true);
@ -285,8 +285,8 @@ public class WorkflowAdminPaneController {
.orElseThrow(() -> new IllegalArgumentException(String.format(
"No Task with ID %d in the database. Where did that ID come from?",
task.getTaskId())));
theTask.getLabel().addValue(defaultLocale, name);
theTask.getDescription().addValue(defaultLocale, desc);
theTask.getLabel().putValue(defaultLocale, name);
theTask.getDescription().putValue(defaultLocale, desc);
theTask.setTaskType(type);
taskRepo.save(theTask);

View File

@ -68,9 +68,9 @@ class WorkflowEditForm extends BaseWorkflowForm {
KernelConfig.class);
final Locale defaultLocale = kernelConfig.getDefaultLocale();
workflow.getName().addValue(defaultLocale,
workflow.getName().putValue(defaultLocale,
(String) m_title.getValue(state));
workflow.getDescription().addValue(
workflow.getDescription().putValue(
defaultLocale,
(String) m_description.getValue(state));

View File

@ -246,7 +246,7 @@ public class AssetL10NManager {
value = findValue(localizedString);
}
localizedString.addValue(locale, value);
localizedString.putValue(locale, value);
}
private String findValue(final LocalizedString localizedStr) {

View File

@ -117,7 +117,7 @@ public class AssetManager {
}
asset.setDisplayName(name);
asset.getTitle().addValue(locale, title);
asset.getTitle().putValue(locale, title);
assetRepo.save(asset);
categoryManager.addObjectToCategory(asset,
@ -318,7 +318,7 @@ public class AssetManager {
}
source.getAvailableLocales().forEach(
locale -> target.addValue(locale,
locale -> target.putValue(locale,
source.getValue(locale)));
} else if (propType != null
&& propType.isAssignableFrom(Asset.class)) {

View File

@ -231,7 +231,7 @@ public class AttachmentListL10NManager {
value = findValue(localizedString);
}
localizedString.addValue(locale, value);
localizedString.putValue(locale, value);
}
private String findValue(final LocalizedString localizedStr) {

View File

@ -281,7 +281,7 @@ public class ContentItemL10NManager {
value = findValue(localizedString);
}
localizedString.addValue(locale, value);
localizedString.putValue(locale, value);
}
private String findValue(final LocalizedString localizedStr) {

View File

@ -326,7 +326,7 @@ public class ContentItemManager {
}
item.setDisplayName(name);
item.getName().addValue(locale, name);
item.getName().putValue(locale, name);
item.setVersion(ContentItemVersion.DRAFT);
item.setContentType(contentType.get());
@ -813,7 +813,7 @@ public class ContentItemManager {
private void copyLocalizedString(final LocalizedString source,
final LocalizedString target) {
for (final Locale locale : source.getAvailableLocales()) {
target.addValue(locale, source.getValue(locale));
target.putValue(locale, source.getValue(locale));
}
}

View File

@ -125,12 +125,12 @@ public class ContentSectionManager {
section.setLabel(name);
section.setDisplayName(name);
section.setPrimaryUrl(name);
section.getTitle().addValue(defautLocale, name);
section.getTitle().putValue(defautLocale, name);
final Folder rootFolder = new Folder();
rootFolder.setName(String.format("%s_root", name));
rootFolder.setType(FolderType.DOCUMENTS_FOLDER);
rootFolder.getTitle().addValue(defautLocale, rootFolder.getName());
rootFolder.getTitle().putValue(defautLocale, rootFolder.getName());
rootFolder.setDisplayName(rootFolder.getName());
rootFolder.setUuid(UUID.randomUUID().toString());
rootFolder.setUniqueId(rootFolder.getUuid());
@ -140,7 +140,7 @@ public class ContentSectionManager {
final Folder rootAssetFolder = new Folder();
rootAssetFolder.setName(String.format("%s_assets", name));
rootAssetFolder.setType(FolderType.ASSETS_FOLDER);
rootAssetFolder.getTitle().addValue(defautLocale,
rootAssetFolder.getTitle().putValue(defautLocale,
rootAssetFolder.getName());
rootAssetFolder.setDisplayName(rootAssetFolder.getName());
rootAssetFolder.setUuid(UUID.randomUUID().toString());

View File

@ -128,13 +128,13 @@ public class ContentSectionSetup extends AbstractCcmApplicationSetup {
rootFolder.setUuid(UUID.randomUUID().toString());
rootFolder.setUniqueId(rootFolder.getUuid());
rootFolder.setName(String.format("%s_" + ROOT, sectionName));
rootFolder.getTitle().addValue(new Locale("en"), "/");
rootFolder.getTitle().putValue(new Locale("en"), "/");
rootFolder.setType(FolderType.DOCUMENTS_FOLDER);
rootFolder.setSection(section);
final Folder rootAssetFolder = new Folder();
rootAssetFolder.setName(String.format("%s_" + ASSETS, sectionName));
rootAssetFolder.getTitle().addValue(new Locale("en"), "/");
rootAssetFolder.getTitle().putValue(new Locale("en"), "/");
rootAssetFolder.setUuid(UUID.randomUUID().toString());
rootAssetFolder.setUniqueId(rootAssetFolder.getUuid());
rootAssetFolder.setType(FolderType.ASSETS_FOLDER);
@ -269,12 +269,12 @@ public class ContentSectionSetup extends AbstractCcmApplicationSetup {
final LifecycleDefinition lifecycleDefinition = new LifecycleDefinition();
lifecycleDefinition.setUuid(UUID.randomUUID().toString());
lifecycleDefinition.getLabel().addValue(Locale.ENGLISH, "Standard");
lifecycleDefinition.getLabel().putValue(Locale.ENGLISH, "Standard");
final Workflow workflow = new Workflow();
workflow.setUuid(UUID.randomUUID().toString());
workflow.setAbstractWorkflow(true);
workflow.getName().addValue(Locale.ENGLISH, "Standard");
workflow.getName().putValue(Locale.ENGLISH, "Standard");
section.addLifecycleDefinition(lifecycleDefinition);

View File

@ -190,7 +190,7 @@ public class FolderManager {
final Folder folder = new Folder();
folder.setName(name);
folder.setDisplayName(name);
folder.getTitle().addValue(kernelConfig.getDefaultLocale(), name);
folder.getTitle().putValue(kernelConfig.getDefaultLocale(), name);
folder.setSection(parent.getSection());
folder.setType(parent.getType());
folderRepo.save(folder);
@ -301,7 +301,7 @@ public class FolderManager {
final KernelConfig kernelConfig = confManager.
findConfiguration(
KernelConfig.class);
movingFolder.getTitle().addValue(
movingFolder.getTitle().putValue(
kernelConfig.getDefaultLocale(), name);
}
categoryManager.addSubCategoryToCategory(movingFolder,

View File

@ -370,7 +370,7 @@ public class CategoriesController {
if (result.isSuccessful()) {
final Category category = result.getResult();
final Locale locale = new Locale(localeParam);
category.getTitle().addValue(locale, value);
category.getTitle().putValue(locale, value);
categoryRepo.save(category);
return String.format(
@ -447,7 +447,7 @@ public class CategoriesController {
if (result.isSuccessful()) {
final Category category = result.getResult();
final Locale locale = new Locale(localeParam);
category.getTitle().addValue(locale, value);
category.getTitle().putValue(locale, value);
categoryRepo.save(category);
return String.format(
@ -598,7 +598,7 @@ public class CategoriesController {
if (result.isSuccessful()) {
final Category category = result.getResult();
final Locale locale = new Locale(localeParam);
category.getDescription().addValue(locale, value);
category.getDescription().putValue(locale, value);
categoryRepo.save(category);
return String.format(
@ -677,7 +677,7 @@ public class CategoriesController {
if (result.isSuccessful()) {
final Category category = result.getResult();
final Locale locale = new Locale(localeParam);
category.getDescription().addValue(locale, value);
category.getDescription().putValue(locale, value);
categoryRepo.save(category);
return String.format(

View File

@ -309,7 +309,7 @@ public class ConfigurationContactEntryKeysController {
}
final ContactEntryKey contactEntryKey = contactEntryKeyResult.get();
contactEntryKey.getLabel().addValue(new Locale(localeParam), value);
contactEntryKey.getLabel().putValue(new Locale(localeParam), value);
contactEntryKeyRepo.save(contactEntryKey);
return String.format(
@ -351,7 +351,7 @@ public class ConfigurationContactEntryKeysController {
}
final ContactEntryKey contactEntryKey = contactEntryKeyResult.get();
contactEntryKey.getLabel().addValue(new Locale(localeParam), value);
contactEntryKey.getLabel().putValue(new Locale(localeParam), value);
contactEntryKeyRepo.save(contactEntryKey);
return String.format(

View File

@ -312,7 +312,7 @@ public class ConfigurationLifecyclesController {
final LifecycleDefinition definition = new LifecycleDefinition();
definition
.getLabel()
.addValue(globalizationHelper.getNegotiatedLocale(), label);
.putValue(globalizationHelper.getNegotiatedLocale(), label);
definitionRepo.save(definition);
sectionManager.addLifecycleDefinitionToContentSection(
definition, section
@ -416,7 +416,7 @@ public class ConfigurationLifecyclesController {
);
}
final LifecycleDefinition definition = definitionResult.get();
definition.getLabel().addValue(new Locale(localeParam), value);
definition.getLabel().putValue(new Locale(localeParam), value);
definitionRepo.save(definition);
return String.format(
@ -469,7 +469,7 @@ public class ConfigurationLifecyclesController {
);
}
final LifecycleDefinition definition = definitionResult.get();
definition.getLabel().addValue(new Locale(localeParam), value);
definition.getLabel().putValue(new Locale(localeParam), value);
definitionRepo.save(definition);
return String.format(
@ -573,7 +573,7 @@ public class ConfigurationLifecyclesController {
);
}
final LifecycleDefinition definition = definitionResult.get();
definition.getDescription().addValue(new Locale(localeParam), value);
definition.getDescription().putValue(new Locale(localeParam), value);
definitionRepo.save(definition);
return String.format(
@ -626,7 +626,7 @@ public class ConfigurationLifecyclesController {
);
}
final LifecycleDefinition definition = definitionResult.get();
definition.getDescription().addValue(new Locale(localeParam), value);
definition.getDescription().putValue(new Locale(localeParam), value);
definitionRepo.save(definition);
return String.format(
@ -757,7 +757,7 @@ public class ConfigurationLifecyclesController {
phaseDefinition
.getLabel()
.addValue(globalizationHelper.getNegotiatedLocale(), label);
.putValue(globalizationHelper.getNegotiatedLocale(), label);
phaseDefinititionRepo.save(phaseDefinition);
lifecycleManager.addPhaseDefinition(definition, phaseDefinition);
@ -1100,7 +1100,7 @@ public class ConfigurationLifecyclesController {
);
}
final PhaseDefinition phaseDefinition = phaseDefinitionResult.get();
phaseDefinition.getLabel().addValue(new Locale(localeParam), value);
phaseDefinition.getLabel().putValue(new Locale(localeParam), value);
phaseDefinititionRepo.save(phaseDefinition);
return String.format(
@ -1166,7 +1166,7 @@ public class ConfigurationLifecyclesController {
);
}
final PhaseDefinition phaseDefinition = phaseDefinitionResult.get();
phaseDefinition.getLabel().addValue(new Locale(localeParam), value);
phaseDefinition.getLabel().putValue(new Locale(localeParam), value);
phaseDefinititionRepo.save(phaseDefinition);
return String.format(
@ -1298,7 +1298,7 @@ public class ConfigurationLifecyclesController {
);
}
final PhaseDefinition phaseDefinition = phaseDefinitionResult.get();
phaseDefinition.getDescription().addValue(
phaseDefinition.getDescription().putValue(
new Locale(localeParam), value
);
phaseDefinititionRepo.save(phaseDefinition);
@ -1368,7 +1368,7 @@ public class ConfigurationLifecyclesController {
);
}
final PhaseDefinition phaseDefinition = phaseDefinitionResult.get();
phaseDefinition.getDescription().addValue(
phaseDefinition.getDescription().putValue(
new Locale(localeParam), value
);
phaseDefinititionRepo.save(phaseDefinition);

View File

@ -560,7 +560,7 @@ public class ConfigurationRolesController {
final Role role = result.get();
final Locale locale = new Locale(localeParam);
role.getDescription().addValue(locale, value);
role.getDescription().putValue(locale, value);
roleRepo.save(role);
return String.format(
@ -617,7 +617,7 @@ public class ConfigurationRolesController {
final Role role = result.get();
final Locale locale = new Locale(localeParam);
role.getDescription().addValue(locale, value);
role.getDescription().putValue(locale, value);
roleRepo.save(role);
return String.format(

View File

@ -329,7 +329,7 @@ public class ConfigurationWorkflowController {
final Workflow template = new Workflow();
template.setAbstractWorkflow(true);
template.getName().addValue(
template.getName().putValue(
globalizationHelper.getNegotiatedLocale(), label
);
workflowRepo.save(template);
@ -429,7 +429,7 @@ public class ConfigurationWorkflowController {
return showWorkflowTemplateNotFound(section, workflowIdentiferParam);
}
final Workflow workflow = workflowResult.get();
workflow.getName().addValue(new Locale(localeParam), value);
workflow.getName().putValue(new Locale(localeParam), value);
workflowRepo.save(workflow);
return String.format(
@ -480,7 +480,7 @@ public class ConfigurationWorkflowController {
return showWorkflowTemplateNotFound(section, workflowIdentiferParam);
}
final Workflow workflow = workflowResult.get();
workflow.getName().addValue(new Locale(localeParam), value);
workflow.getName().putValue(new Locale(localeParam), value);
workflowRepo.save(workflow);
return String.format(
@ -581,7 +581,7 @@ public class ConfigurationWorkflowController {
return showWorkflowTemplateNotFound(section, workflowIdentiferParam);
}
final Workflow workflow = workflowResult.get();
workflow.getDescription().addValue(new Locale(localeParam), value);
workflow.getDescription().putValue(new Locale(localeParam), value);
workflowRepo.save(workflow);
return String.format(
@ -632,7 +632,7 @@ public class ConfigurationWorkflowController {
return showWorkflowTemplateNotFound(section, workflowIdentiferParam);
}
final Workflow workflow = workflowResult.get();
workflow.getDescription().addValue(new Locale(localeParam), value);
workflow.getDescription().putValue(new Locale(localeParam), value);
workflowRepo.save(workflow);
return String.format(
@ -932,7 +932,7 @@ public class ConfigurationWorkflowController {
}
final Workflow workflow = workflowResult.get();
final AssignableTask task = new AssignableTask();
task.getLabel().addValue(
task.getLabel().putValue(
globalizationHelper.getNegotiatedLocale(), label
);
@ -1066,7 +1066,7 @@ public class ConfigurationWorkflowController {
);
}
final Task task = taskResult.get();
task.getLabel().addValue(new Locale(localeParam), value);
task.getLabel().putValue(new Locale(localeParam), value);
taskRepo.save(task);
return String.format(
@ -1129,7 +1129,7 @@ public class ConfigurationWorkflowController {
);
}
final Task task = taskResult.get();
task.getLabel().addValue(new Locale(localeParam), value);
task.getLabel().putValue(new Locale(localeParam), value);
taskRepo.save(task);
return String.format(
@ -1254,7 +1254,7 @@ public class ConfigurationWorkflowController {
);
}
final Task task = taskResult.get();
task.getDescription().addValue(new Locale(localeParam), value);
task.getDescription().putValue(new Locale(localeParam), value);
taskRepo.save(task);
return String.format(
@ -1318,7 +1318,7 @@ public class ConfigurationWorkflowController {
);
}
final Task task = taskResult.get();
task.getDescription().addValue(new Locale(localeParam), value);
task.getDescription().putValue(new Locale(localeParam), value);
taskRepo.save(task);
return String.format(

View File

@ -424,8 +424,8 @@ public class DocumentFolderController {
Article.class,
Locale.ENGLISH
);
article.getTitle().addValue(Locale.ENGLISH, "Article 1");
article.getTitle().addValue(Locale.GERMAN, "Artikel 1");
article.getTitle().putValue(Locale.ENGLISH, "Article 1");
article.getTitle().putValue(Locale.GERMAN, "Artikel 1");
itemRepo.save(article);
final Folder folder2a = folderManager.createFolder(
@ -439,10 +439,10 @@ public class DocumentFolderController {
Article.class,
Locale.ENGLISH
);
article2.getTitle().addValue(
article2.getTitle().putValue(
Locale.ENGLISH, "Article in Folder 2"
);
article2.getTitle().addValue(
article2.getTitle().putValue(
Locale.GERMAN, "Artikel in Ordner 2"
);

View File

@ -88,7 +88,7 @@ public abstract class AbstractBookmarkCreateStep<T extends Bookmark> extends Abs
bookmark.setUrl(url);
bookmark
.getDescription()
.addValue(new Locale(getInitialLocale()), bookmarkDescription);
.putValue(new Locale(getInitialLocale()), bookmarkDescription);
assetRepository.save(bookmark);
return String.format(

View File

@ -435,7 +435,7 @@ public abstract class AbstractMvcAssetEditStep implements MvcAssetEditStep {
if (assetPermissionsChecker.canEditAsset(getAsset())) {
final Locale locale = new Locale(localeParam);
getAsset().getTitle().addValue(locale, value);
getAsset().getTitle().putValue(locale, value);
assetRepo.save(getAsset());
return buildRedirectPathForStep();
@ -469,7 +469,7 @@ public abstract class AbstractMvcAssetEditStep implements MvcAssetEditStep {
if (assetPermissionsChecker.canEditAsset(getAsset())) {
final Locale locale = new Locale(localeParam);
getAsset().getTitle().addValue(locale, value);
getAsset().getTitle().putValue(locale, value);
assetRepo.save(getAsset());
return buildRedirectPathForStep();

View File

@ -84,7 +84,7 @@ public class AudioAssetCreateStep extends AbstractMvcAssetCreateStep<AudioAsset>
.filter(value -> value.length > 0)
.map(value -> value[0])
.orElse("");
asset.getDescription().addValue(
asset.getDescription().putValue(
new Locale(getInitialLocale()), description
);

View File

@ -251,7 +251,7 @@ public class AudioAssetEditStep extends AbstractMvcAssetEditStep {
if (assetPermissionsChecker.canEditAsset(getAsset())) {
final Locale locale = new Locale(localeParam);
final AudioAsset asset = getAudioAsset();
asset.getDescription().addValue(locale, value);
asset.getDescription().putValue(locale, value);
assetRepo.save(asset);
@ -287,7 +287,7 @@ public class AudioAssetEditStep extends AbstractMvcAssetEditStep {
if (assetPermissionsChecker.canEditAsset(getAsset())) {
final Locale locale = new Locale(localeParam);
final AudioAsset asset = getAudioAsset();
asset.getDescription().addValue(locale, value);
asset.getDescription().putValue(locale, value);
assetRepo.save(asset);

View File

@ -214,7 +214,7 @@ public class BookmarkEditStep extends AbstractMvcAssetEditStep {
if (assetPermissionsChecker.canEditAsset(getAsset())) {
final Locale locale = new Locale(localeParam);
final Bookmark bookmark = getBookmark();
bookmark.getDescription().addValue(locale, value);
bookmark.getDescription().putValue(locale, value);
assetRepository.save(bookmark);
@ -250,7 +250,7 @@ public class BookmarkEditStep extends AbstractMvcAssetEditStep {
if (assetPermissionsChecker.canEditAsset(getAsset())) {
final Locale locale = new Locale(localeParam);
final Bookmark bookmark = getBookmark();
bookmark.getDescription().addValue(locale, value);
bookmark.getDescription().putValue(locale, value);
assetRepository.save(bookmark);

View File

@ -84,7 +84,7 @@ public class FileAssetCreateStep extends AbstractMvcAssetCreateStep<FileAsset> {
.filter(value -> value.length > 0)
.map(value -> value[0])
.orElse("");
asset.getDescription().addValue(
asset.getDescription().putValue(
new Locale(getInitialLocale()), fileDescription
);

View File

@ -226,7 +226,7 @@ public class FileAssetEditStep extends AbstractMvcAssetEditStep {
if (assetPermissionsChecker.canEditAsset(getAsset())) {
final Locale locale = new Locale(localeParam);
final FileAsset fileAsset = getFileAsset();
fileAsset.getDescription().addValue(locale, value);
fileAsset.getDescription().putValue(locale, value);
assetRepo.save(fileAsset);
@ -262,7 +262,7 @@ public class FileAssetEditStep extends AbstractMvcAssetEditStep {
if (assetPermissionsChecker.canEditAsset(getAsset())) {
final Locale locale = new Locale(localeParam);
final FileAsset fileAsset = getFileAsset();
fileAsset.getDescription().addValue(locale, value);
fileAsset.getDescription().putValue(locale, value);
assetRepo.save(fileAsset);

View File

@ -84,7 +84,7 @@ public class ImageCreateStep extends AbstractMvcAssetCreateStep<Image> {
.filter(value -> value.length > 0)
.map(value -> value[0])
.orElse("");
image.getDescription().addValue(
image.getDescription().putValue(
new Locale(getInitialLocale()), description
);

View File

@ -253,7 +253,7 @@ public class ImageEditStep extends AbstractMvcAssetEditStep {
if (assetPermissionsChecker.canEditAsset(getAsset())) {
final Locale locale = new Locale(localeParam);
final Image image = getImage();
image.getDescription().addValue(locale, value);
image.getDescription().putValue(locale, value);
assetRepo.save(image);
@ -289,7 +289,7 @@ public class ImageEditStep extends AbstractMvcAssetEditStep {
if (assetPermissionsChecker.canEditAsset(getAsset())) {
final Locale locale = new Locale(localeParam);
final Image image = getImage();
image.getDescription().addValue(locale, value);
image.getDescription().putValue(locale, value);
assetRepo.save(image);

View File

@ -109,7 +109,7 @@ public class LegalMetadataCreateStep
asset.setCreator(creator);
asset.setPublisher(publisher);
asset.getRights().addValue(new Locale(getInitialLocale()), rights);
asset.getRights().putValue(new Locale(getInitialLocale()), rights);
asset.setRightsHolder(rightsHolder);
return String.format(

View File

@ -222,7 +222,7 @@ public class LegalMetadataEditStep extends AbstractMvcAssetEditStep {
if (assetPermissionsChecker.canEditAsset(getAsset())) {
final Locale locale = new Locale(localeParam);
final LegalMetadata legalMetadata = (LegalMetadata) getAsset();
legalMetadata.getRights().addValue(locale, value);
legalMetadata.getRights().putValue(locale, value);
assetRepo.save(legalMetadata);
@ -258,7 +258,7 @@ public class LegalMetadataEditStep extends AbstractMvcAssetEditStep {
if (assetPermissionsChecker.canEditAsset(getAsset())) {
final Locale locale = new Locale(localeParam);
final LegalMetadata legalMetadata = (LegalMetadata) getAsset();
legalMetadata.getRights().addValue(locale, value);
legalMetadata.getRights().putValue(locale, value);
assetRepo.save(legalMetadata);

View File

@ -92,7 +92,7 @@ public class SideNoteCreateStep extends AbstractMvcAssetCreateStep<SideNote> {
.filter(value -> value.length > 0)
.map(value -> value[0])
.orElse("");
sideNote.getText().addValue(new Locale(getInitialLocale()), text);
sideNote.getText().putValue(new Locale(getInitialLocale()), text);
assetRepo.save(sideNote);
return String.format(

View File

@ -195,7 +195,7 @@ public class SideNoteEditStep extends AbstractMvcAssetEditStep {
if (assetPermissionsChecker.canEditAsset(getAsset())) {
final Locale locale = new Locale(localeParam);
getSideNote().getText().addValue(locale, "");
getSideNote().getText().putValue(locale, "");
assetRepo.save(getSideNote());
return buildRedirectPathForStep();
@ -229,7 +229,7 @@ public class SideNoteEditStep extends AbstractMvcAssetEditStep {
if (assetPermissionsChecker.canEditAsset(getAsset())) {
final Locale locale = new Locale(localeParam);
getSideNote().getText().addValue(locale, value);
getSideNote().getText().putValue(locale, value);
assetRepo.save(getSideNote());
return buildRedirectPathForStep();

View File

@ -85,7 +85,7 @@ public class VideoAssetCreateStep extends AbstractMvcAssetCreateStep<VideoAsset>
.filter(value -> value.length > 0)
.map(value -> value[0])
.orElse("");
asset.getDescription().addValue(
asset.getDescription().putValue(
new Locale(getInitialLocale()), fileDescription
);

View File

@ -250,7 +250,7 @@ public class VideoAssetEditStep extends AbstractMvcAssetEditStep {
if (assetPermissionsChecker.canEditAsset(getAsset())) {
final Locale locale = new Locale(localeParam);
final VideoAsset asset = getVideoAsset();
asset.getDescription().addValue(locale, value);
asset.getDescription().putValue(locale, value);
assetRepo.save(asset);
@ -286,7 +286,7 @@ public class VideoAssetEditStep extends AbstractMvcAssetEditStep {
if (assetPermissionsChecker.canEditAsset(getAsset())) {
final Locale locale = new Locale(localeParam);
final VideoAsset asset = getVideoAsset();
asset.getDescription().addValue(locale, value);
asset.getDescription().putValue(locale, value);
assetRepo.save(asset);

View File

@ -269,10 +269,10 @@ public class MediaStep extends AbstractMvcAuthoringStep {
final AttachmentList list = listManager.createAttachmentList(
document, String.join("", MEDIA_LIST_PREFIX, name)
);
list.getTitle().addValue(
list.getTitle().putValue(
globalizationHelper.getNegotiatedLocale(), title
);
list.getDescription().addValue(
list.getDescription().putValue(
globalizationHelper.getNegotiatedLocale(), description
);
listRepo.save(list);
@ -551,7 +551,7 @@ public class MediaStep extends AbstractMvcAuthoringStep {
}
final AttachmentList list = listResult.get();
list.getTitle().addValue(new Locale(localeParam), value);
list.getTitle().putValue(new Locale(localeParam), value);
listRepo.save(list);
return buildRedirectPathForStep(
@ -611,7 +611,7 @@ public class MediaStep extends AbstractMvcAuthoringStep {
}
final AttachmentList list = listResult.get();
list.getTitle().addValue(new Locale(localeParam), value);
list.getTitle().putValue(new Locale(localeParam), value);
listRepo.save(list);
return buildRedirectPathForStep(
@ -729,7 +729,7 @@ public class MediaStep extends AbstractMvcAuthoringStep {
}
final AttachmentList list = listResult.get();
list.getDescription().addValue(new Locale(localeParam), value);
list.getDescription().putValue(new Locale(localeParam), value);
listRepo.save(list);
return buildRedirectPathForStep(
@ -790,7 +790,7 @@ public class MediaStep extends AbstractMvcAuthoringStep {
}
final AttachmentList list = listResult.get();
list.getDescription().addValue(new Locale(localeParam), value);
list.getDescription().putValue(new Locale(localeParam), value);
listRepo.save(list);
return buildRedirectPathForStep(

View File

@ -290,10 +290,10 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
final AttachmentList list = listManager.createAttachmentList(
document, name
);
list.getTitle().addValue(
list.getTitle().putValue(
globalizationHelper.getNegotiatedLocale(), title
);
list.getDescription().addValue(
list.getDescription().putValue(
globalizationHelper.getNegotiatedLocale(), description
);
listRepo.save(list);
@ -572,7 +572,7 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
}
final AttachmentList list = listResult.get();
list.getTitle().addValue(new Locale(localeParam), value);
list.getTitle().putValue(new Locale(localeParam), value);
listRepo.save(list);
return buildRedirectPathForStep(
@ -632,7 +632,7 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
}
final AttachmentList list = listResult.get();
list.getTitle().addValue(new Locale(localeParam), value);
list.getTitle().putValue(new Locale(localeParam), value);
listRepo.save(list);
return buildRedirectPathForStep(
@ -750,7 +750,7 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
}
final AttachmentList list = listResult.get();
list.getDescription().addValue(new Locale(localeParam), value);
list.getDescription().putValue(new Locale(localeParam), value);
listRepo.save(list);
return buildRedirectPathForStep(
@ -811,7 +811,7 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
}
final AttachmentList list = listResult.get();
list.getDescription().addValue(new Locale(localeParam), value);
list.getDescription().putValue(new Locale(localeParam), value);
listRepo.save(list);
return buildRedirectPathForStep(
@ -1086,7 +1086,7 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
// return "org/librecms/ui/contentsection/documents/target-item-not-found.xhtml";
// }
final RelatedLink relatedLink = new RelatedLink();
relatedLink.getTitle().addValue(
relatedLink.getTitle().putValue(
globalizationHelper.getNegotiatedLocale(), title
);
relatedLink.setDisplayName(
@ -1559,7 +1559,7 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
final RelatedLink link = linkResult.get();
final Locale locale = new Locale(localeParam);
link.getTitle().addValue(locale, value);
link.getTitle().putValue(locale, value);
assetRepo.save(link);
return buildRedirectPathForStep(
@ -1646,7 +1646,7 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
final RelatedLink link = linkResult.get();
final Locale locale = new Locale(localeParam);
link.getTitle().addValue(locale, value);
link.getTitle().putValue(locale, value);
assetRepo.save(link);
return buildRedirectPathForStep(

View File

@ -274,8 +274,8 @@ public class MvcArticleCreateStep
locale
);
article.getTitle().addValue(locale, title);
article.getDescription().addValue(locale, summary);
article.getTitle().putValue(locale, title);
article.getDescription().putValue(locale, summary);
itemRepo.save(article);
return String.format(

View File

@ -349,7 +349,7 @@ public class MvcArticlePropertiesStep extends AbstractMvcAuthoringStep {
if (itemPermissionChecker.canEditItem(getDocument())) {
final Locale locale = new Locale(localeParam);
getDocument().getTitle().addValue(locale, value);
getDocument().getTitle().putValue(locale, value);
itemRepo.save(getDocument());
return buildRedirectPathForStep();
@ -394,7 +394,7 @@ public class MvcArticlePropertiesStep extends AbstractMvcAuthoringStep {
if (itemPermissionChecker.canEditItem(getDocument())) {
final Locale locale = new Locale(localeParam);
getDocument().getTitle().addValue(locale, value);
getDocument().getTitle().putValue(locale, value);
itemRepo.save(getDocument());
return buildRedirectPathForStep();
@ -483,7 +483,7 @@ public class MvcArticlePropertiesStep extends AbstractMvcAuthoringStep {
if (itemPermissionChecker.canEditItem(getDocument())) {
final Locale locale = new Locale(localeParam);
getDocument().getDescription().addValue(locale, value);
getDocument().getDescription().putValue(locale, value);
itemRepo.save(getDocument());
return buildRedirectPathForStep();
@ -527,7 +527,7 @@ public class MvcArticlePropertiesStep extends AbstractMvcAuthoringStep {
if (itemPermissionChecker.canEditItem(getDocument())) {
final Locale locale = new Locale(localeParam);
getDocument().getDescription().addValue(locale, value);
getDocument().getDescription().putValue(locale, value);
itemRepo.save(getDocument());
return buildRedirectPathForStep();

View File

@ -201,7 +201,7 @@ public class MvcArticleTextBodyStep extends AbstractMvcAuthoringStep {
);
}
final Locale locale = new Locale(localeParam);
getArticle().getText().addValue(locale, value);
getArticle().getText().putValue(locale, value);
itemRepo.save(getArticle());
return buildRedirectPathForStep();
@ -310,7 +310,7 @@ public class MvcArticleTextBodyStep extends AbstractMvcAuthoringStep {
if (itemPermissionChecker.canEditItem(getArticle())) {
final Locale locale = new Locale(localeParam);
getArticle().getText().addValue(locale, value);
getArticle().getText().putValue(locale, value);
itemRepo.save(getArticle());
return buildRedirectPathForStep();

View File

@ -0,0 +1,132 @@
/*
* Copyright (C) 2021 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.librecms.ui.contenttypes.mpa;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
@Named("CmsMpaSectionModel")
public class MpaSectionModel {
private long sectionId;
private boolean pageBreak;
private int rank;
private String selectedLocale;
private Map<String, String> titleValues;
private List<String> unusedTitleLocales;
private Map<String, String> textValues;
private Map<String, String> truncatedTextValues;
private List<String> unusedTextLocales;
public long getSectionId() {
return sectionId;
}
protected void setSectionId(final long sectionId) {
this.sectionId = sectionId;
}
public boolean isPageBreak() {
return pageBreak;
}
protected void setPageBreak(final boolean pageBreak) {
this.pageBreak = pageBreak;
}
public int getRank() {
return rank;
}
protected void setRank(int rank) {
this.rank = rank;
}
public String getSelectedLocale() {
return selectedLocale;
}
protected void setSelectedLocale(final String selectedLocale) {
this.selectedLocale = selectedLocale;
}
public Map<String, String> getTitleValues() {
return Collections.unmodifiableMap(titleValues);
}
protected void setTitleValues(final Map<String, String> titleValues) {
this.titleValues = new HashMap<>(titleValues);
}
public List<String> getUnusedTitleLocales() {
return Collections.unmodifiableList(unusedTitleLocales);
}
protected void setUnusedTitleLocales(final List<String> unusedTitleLocales) {
this.unusedTitleLocales = new ArrayList<>(unusedTitleLocales);
}
public Map<String, String> getTextValues() {
return Collections.unmodifiableMap(textValues);
}
protected void setTextValues(final Map<String, String> textValues) {
this.textValues = new HashMap<>(textValues);
}
public Map<String, String> getTruncatedTextValues() {
return Collections.unmodifiableMap(truncatedTextValues);
}
protected void setTruncatedTextValues(
final Map<String, String> truncatedTextValues
) {
this.truncatedTextValues = new HashMap<>(truncatedTextValues);
}
public List<String> getUnusedTextLocales() {
return Collections.unmodifiableList(unusedTextLocales);
}
protected void setUnusedTextLocales(
final List<String> unusedTextLocales
) {
this.unusedTextLocales = new ArrayList<>(unusedTextLocales);
}
}

View File

@ -273,8 +273,8 @@ public class MvcMpaCreateStep
locale
);
article.getTitle().addValue(locale, title);
article.getDescription().addValue(locale, summary);
article.getTitle().putValue(locale, title);
article.getDescription().putValue(locale, summary);
itemRepo.save(article);
return String.format(

View File

@ -285,7 +285,7 @@ public class MvcMpaPropertiesStep extends AbstractMvcAuthoringStep {
if (itemPermissionChecker.canEditItem(getDocument())) {
final Locale locale = new Locale(localeParam);
getDocument().getTitle().addValue(locale, value);
getDocument().getTitle().putValue(locale, value);
itemRepo.save(getDocument());
return buildRedirectPathForStep();
@ -331,7 +331,7 @@ public class MvcMpaPropertiesStep extends AbstractMvcAuthoringStep {
if (itemPermissionChecker.canEditItem(getDocument())) {
final Locale locale = new Locale(localeParam);
getDocument().getTitle().addValue(locale, value);
getDocument().getTitle().putValue(locale, value);
itemRepo.save(getDocument());
return buildRedirectPathForStep();
@ -418,7 +418,7 @@ public class MvcMpaPropertiesStep extends AbstractMvcAuthoringStep {
if (itemPermissionChecker.canEditItem(getDocument())) {
final Locale locale = new Locale(localeParam);
getDocument().getDescription().addValue(locale, value);
getDocument().getDescription().putValue(locale, value);
itemRepo.save(getDocument());
return buildRedirectPathForStep();
@ -462,7 +462,7 @@ public class MvcMpaPropertiesStep extends AbstractMvcAuthoringStep {
if (itemPermissionChecker.canEditItem(getDocument())) {
final Locale locale = new Locale(localeParam);
getDocument().getDescription().addValue(locale, value);
getDocument().getDescription().putValue(locale, value);
itemRepo.save(getDocument());
return buildRedirectPathForStep();

View File

@ -23,6 +23,7 @@ import org.libreccm.l10n.GlobalizationHelper;
import org.librecms.contenttypes.MultiPartArticle;
import org.librecms.contenttypes.MultiPartArticleSection;
import org.librecms.contenttypes.MultiPartArticleSectionManager;
import org.librecms.contenttypes.MultiPartArticleSectionRepository;
import org.librecms.ui.contentsections.ContentSectionNotFoundException;
import org.librecms.ui.contentsections.ItemPermissionChecker;
import org.librecms.ui.contentsections.documents.AbstractMvcAuthoringStep;
@ -33,8 +34,10 @@ import org.librecms.ui.contentsections.documents.MvcAuthoringSteps;
import java.util.Comparator;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import javax.enterprise.context.RequestScoped;
@ -80,12 +83,18 @@ public class MvcMpaSectionsStep extends AbstractMvcAuthoringStep {
@Inject
private MultiPartArticleSectionManager sectionManager;
@Inject
private MultiPartArticleSectionRepository sectionRepo;
@Inject
private Models models;
@Inject
private MpaSectionsStepModel mpaSectionsStepModel;
@Inject
private MpaSectionModel mpaSectionModel;
@Override
public Class<MvcMpaSectionsStep> getStepClass() {
return MvcMpaSectionsStep.class;
@ -180,8 +189,8 @@ public class MvcMpaSectionsStep extends AbstractMvcAuthoringStep {
final Locale initialLocale = new Locale(initialLocaleParam);
section.getText().addValue(initialLocale, text);
section.getTitle().addValue(initialLocale, title);
section.getText().putValue(initialLocale, text);
section.getTitle().putValue(initialLocale, title);
sectionManager.addSectionToMultiPartArticle(section, getMpa());
@ -215,25 +224,15 @@ public class MvcMpaSectionsStep extends AbstractMvcAuthoringStep {
}
if (itemPermissionChecker.canEditItem(getMpa())) {
if (!sectionIdParam.matches("[0-9]*")) {
models.put("invalidSectionId", true);
return showStep(sectionIdentifier, documentPath);
}
final long sectionId = Long.parseLong(sectionIdParam);
final Optional<MultiPartArticleSection> result
= getMpa()
.getSections()
.stream()
.filter(section -> section.getSectionId() == sectionId)
.findAny();
final Optional<MultiPartArticleSection> result = findSection(
sectionIdParam
);
if (!result.isPresent()) {
models.put("sectionNotFound", true);
return showStep(sectionIdentifier, documentPath);
return showSectionNotFound(
sectionIdentifier,
documentPath,
sectionIdParam);
}
final MultiPartArticleSection sectionToRemove = result.get();
sectionManager.removeSectionFromMultiPartArticle(
@ -261,8 +260,13 @@ public class MvcMpaSectionsStep extends AbstractMvcAuthoringStep {
@PathParam("sectionId")
final String sectionIdParam
) {
// ToDo
throw new UnsupportedOperationException();
return initSectionModel(
sectionIdentifier,
documentPath,
sectionIdParam,
"org/librecms/ui/contenttypes/mpa/mpa-section.xhtml"
);
}
@POST
@ -276,27 +280,17 @@ public class MvcMpaSectionsStep extends AbstractMvcAuthoringStep {
@PathParam("sectionId")
final String sectionIdParam,
@FormParam("locale")
final String localeParam
final String localeParam,
@FormParam("value")
final String value
) {
// ToDo
throw new UnsupportedOperationException();
}
@GET
@Path("/{sectionId}/title/@edit/{locale}")
@Transactional(Transactional.TxType.REQUIRED)
public String editTitleValue(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("sectionId")
final String sectionIdParam,
@PathParam("locale")
final String localeParam
) {
// ToDo
throw new UnsupportedOperationException();
return editTitleValue(
sectionIdentifier,
documentPath,
sectionIdParam,
localeParam,
value
);
}
@POST
@ -314,8 +308,38 @@ public class MvcMpaSectionsStep extends AbstractMvcAuthoringStep {
@FormParam("value")
final String value
) {
// ToDo
throw new UnsupportedOperationException();
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getMpa())) {
final Optional<MultiPartArticleSection> result = findSection(
sectionIdParam
);
if (!result.isPresent()) {
return showSectionNotFound(
sectionIdentifier,
documentPath,
sectionIdParam);
}
final MultiPartArticleSection section = result.get();
final Locale locale = new Locale(localeParam);
section.getTitle().putValue(locale, value);
sectionRepo.save(section);
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getMpa(),
mpaMessageBundle.getMessage("mpa.edit.denied")
);
}
}
@POST
@ -331,8 +355,38 @@ public class MvcMpaSectionsStep extends AbstractMvcAuthoringStep {
@FormParam("locale")
final String localeParam
) {
// ToDo
throw new UnsupportedOperationException();
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getMpa())) {
final Optional<MultiPartArticleSection> result = findSection(
sectionIdParam
);
if (!result.isPresent()) {
return showSectionNotFound(
sectionIdentifier,
documentPath,
sectionIdParam);
}
final MultiPartArticleSection section = result.get();
final Locale locale = new Locale(localeParam);
section.getTitle().removeValue(locale);
sectionRepo.save(section);
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getMpa(),
mpaMessageBundle.getMessage("mpa.edit.denied")
);
}
}
@POST
@ -348,8 +402,46 @@ public class MvcMpaSectionsStep extends AbstractMvcAuthoringStep {
@FormParam("locale")
final String localeParam
) {
// ToDo
throw new UnsupportedOperationException();
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getMpa())) {
final Optional<MultiPartArticleSection> result = findSection(
sectionIdParam
);
if (!result.isPresent()) {
return showSectionNotFound(
sectionIdentifier,
documentPath,
sectionIdParam);
}
final MultiPartArticleSection section = result.get();
final String value;
if (section.getText().getAvailableLocales().isEmpty()) {
value = "";
} else {
value = globalizationHelper.getValueFromLocalizedString(
section.getText()
);
}
final Locale locale = new Locale(localeParam);
section.getText().putValue(locale, value);
sectionRepo.save(section);
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getMpa(),
mpaMessageBundle.getMessage("mpa.edit.denied")
);
}
}
@GET
@ -365,8 +457,14 @@ public class MvcMpaSectionsStep extends AbstractMvcAuthoringStep {
@PathParam("locale")
final String localeParam
) {
// ToDo
throw new UnsupportedOperationException();
mpaSectionModel.setSelectedLocale(localeParam);
return initSectionModel(
sectionIdentifier,
documentPath,
sectionIdParam,
"org/librecms/ui/contenttypes/mpa/mpa-section-text.xhtml"
);
}
@POST
@ -384,8 +482,38 @@ public class MvcMpaSectionsStep extends AbstractMvcAuthoringStep {
@FormParam("value")
final String value
) {
// ToDo
throw new UnsupportedOperationException();
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getMpa())) {
final Optional<MultiPartArticleSection> result = findSection(
sectionIdParam
);
if (!result.isPresent()) {
return showSectionNotFound(
sectionIdentifier,
documentPath,
sectionIdParam);
}
final MultiPartArticleSection section = result.get();
final Locale locale = new Locale(localeParam);
section.getText().putValue(locale, value);
sectionRepo.save(section);
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getMpa(),
mpaMessageBundle.getMessage("mpa.edit.denied")
);
}
}
@POST
@ -401,8 +529,38 @@ public class MvcMpaSectionsStep extends AbstractMvcAuthoringStep {
@FormParam("locale")
final String localeParam
) {
// ToDo
throw new UnsupportedOperationException();
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getMpa())) {
final Optional<MultiPartArticleSection> result = findSection(
sectionIdParam
);
if (!result.isPresent()) {
return showSectionNotFound(
sectionIdentifier,
documentPath,
sectionIdParam);
}
final MultiPartArticleSection section = result.get();
final Locale locale = new Locale(localeParam);
section.getText().removeValue(locale);
sectionRepo.save(section);
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getMpa(),
mpaMessageBundle.getMessage("mpa.edit.denied")
);
}
}
@POST
@ -417,8 +575,37 @@ public class MvcMpaSectionsStep extends AbstractMvcAuthoringStep {
final String sectionIdParam,
@FormParam("pageBreak") final String pageBreakParam
) {
// ToDo
throw new UnsupportedOperationException();
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getMpa())) {
final Optional<MultiPartArticleSection> result = findSection(
sectionIdParam
);
if (!result.isPresent()) {
return showSectionNotFound(
sectionIdentifier,
documentPath,
sectionIdParam);
}
final MultiPartArticleSection section = result.get();
section.setPageBreak(Boolean.parseBoolean(pageBreakParam));
sectionRepo.save(section);
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getMpa(),
mpaMessageBundle.getMessage("mpa.edit.denied")
);
}
}
@Override
@ -430,7 +617,15 @@ public class MvcMpaSectionsStep extends AbstractMvcAuthoringStep {
mpaSectionsStepModel.setCanEdit(
itemPermissionChecker.canEditItem(getMpa())
);
// ToDo Set sections in model
mpaSectionsStepModel
.setRows(
getMpa()
.getSections()
.stream()
.map(this::buildMpaSectionsTableRow)
.sorted()
.collect(Collectors.toList())
);
}
}
@ -468,4 +663,136 @@ public class MvcMpaSectionsStep extends AbstractMvcAuthoringStep {
return row;
}
private Optional<MultiPartArticleSection> findSection(
final String sectionIdParam
) {
if (!sectionIdParam.matches("[0-9]*")) {
models.put("invalidSectionId", true);
return Optional.empty();
}
final long sectionId = Long.parseLong(sectionIdParam);
return getMpa()
.getSections()
.stream()
.filter(section -> section.getSectionId() == sectionId)
.findAny();
}
private String initSectionModel(
final String sectionIdentifier,
final String documentPath,
final String sectionIdParam,
final String showView
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getMpa())) {
final Optional<MultiPartArticleSection> result = findSection(
sectionIdParam
);
if (!result.isPresent()) {
return showSectionNotFound(
sectionIdentifier,
documentPath,
sectionIdParam);
}
final MultiPartArticleSection section = result.get();
mpaSectionModel.setPageBreak(section.isPageBreak());
mpaSectionModel.setRank(section.getRank());
mpaSectionModel.setSectionId(section.getSectionId());
mpaSectionModel.setTextValues(
section
.getText()
.getValues()
.entrySet()
.stream()
.collect(
Collectors.toMap(
entry -> entry.getKey().toString(),
Map.Entry::getValue
)
)
);
mpaSectionModel.setTitleValues(
section
.getTitle()
.getValues()
.entrySet()
.stream()
.collect(
Collectors.toMap(
entry -> entry.getKey().toString(),
Map.Entry::getValue
)
)
);
mpaSectionModel
.setTruncatedTextValues(
section
.getText()
.getValues()
.entrySet()
.stream()
.collect(
Collectors.toMap(
entry -> entry.getKey().toString(),
entry -> String.format(
"%s....",
StringUtils.truncate(entry.getValue(), 97)
)
)
)
);
final Set<Locale> textLocales = section
.getText()
.getAvailableLocales();
mpaSectionModel.setUnusedTextLocales(
globalizationHelper
.getAvailableLocales()
.stream()
.filter(locale -> !textLocales.contains(locale))
.map(Locale::toString)
.collect(Collectors.toList())
);
final Set<Locale> titleLocales = section
.getTitle()
.getAvailableLocales();
mpaSectionModel.setUnusedTitleLocales(
globalizationHelper
.getAvailableLocales()
.stream()
.filter(locale -> !titleLocales.contains(locale))
.map(Locale::toString)
.collect(Collectors.toList())
);
return showView;
} else {
return documentUi.showAccessDenied(
getContentSection(),
getMpa(),
mpaMessageBundle.getMessage("mpa.edit.denied")
);
}
}
private String showSectionNotFound(
final String sectionIdentifier,
final String documentPath,
final String sectionIdParam
) {
models.put("sectionNotFound", true);
models.put("sectionId", sectionIdParam);
return showStep(sectionIdentifier, documentPath);
}
}

View File

@ -0,0 +1,83 @@
<!DOCTYPE html [<!ENTITY times '&#215;'>]>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/contentsection.xhtml">
<ui:define name="main">
<div class="container">
<h1>#{CmsMpaMessageBundle['createform.title']}</h1>
<c:forEach items="#{CmsMpaCreateStep.messages.entrySet}"
var="message">
<div class="alert alert-#{message.key}"
role="alert">
#{message.value}
</div>
</c:forEach>
<form action="#{mvc.basePath}/#{CmsMpaCreateStep.contentSectionLabel}/documents/#{CmsMpaCreateStep.folderPath}@create/#{CmsMpaCreateStep.documentType}"
method="post">
<bootstrap:formGroupText
help="#{CmsMpaMessageBundle['createform.name.help']}"
inputId="name"
label="#{CmsMpaMessageBundle['createform.name.label']}"
name="name"
pattern="^([a-zA-Z0-9_-]*)$"
required="true"
/>
<bootstrap:formGroupSelect
help="#{CmsMpaMessageBundle['createform.initial_locale.help']}"
inputId="locale"
label="#{CmsMpaMessageBundle['createform.initial_locale.label']}"
name="locale"
options="#{CmsMpaCreateStep.availableLocales}"
required="true"
selectedOptions="#{[CmsMpaCreateStep.initialLocale]}"
/>
<bootstrap:formGroupText
help="#{CmsMpaMessageBundle['createform.title.help']}"
inputId="title"
label="#{CmsMpaMessageBundle['createform.title.label']}"
name="title"
required="true"
/>
<bootstrap:formGroupTextarea
cols="80"
help="#{CmsMpaMessageBundle['createform.summary.help']}"
inputId="summary"
label="#{CmsMpaMessageBundle['createform.summary.label']}"
name="summary"
required="true"
rows="16"
/>
<bootstrap:formGroupSelect
help="#{CmsMpaMessageBundle['createform.workflow.help']}"
inputId="workflow"
label="#{CmsMpaMessageBundle['createform.workflow.label']}"
name="workflow"
options="#{CmsMpaCreateStep.availableWorkflows}"
selectedOptions="#{[CmsMpaCreateStep.selectedWorkflow]}"
/>
<a class="btn btn-warning"
href="#{mvc.basePath}/#{CmsMpaCreateStep.contentSectionLabel}/documentfolders/#{CmsMpaCreateStep.folderPath}">
#{CmsMpaMessageBundle['createform.cancel']}
</a>
<button class="btn btn-success"
type="submit">
#{CmsMpaMessageBundle['createform.submit']}
</button>
</form>
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -12,3 +12,16 @@ createstep.workflow.none_selected=The selected workflow is not available.
createstep.workflow.error.not_available=The selected workflow is not available.
mpa.edit.denied=You have not been granted the required permissions to edit the article.
authoringsteps.sections.description=Manage the sections of a multipart article.
createform.title=Create a new Multipart Article
createform.name.help=The name of the article. Only the letters a to z, A to Z, numbers, and dash and the underscore are permitted.
createform.name.label=Name
createform.initial_locale.help=The initial language of the article. Localizable values provided in this form will be added to the article for this language.
createform.initial_locale.label=Initial Locale
createform.title.help=The title of the article.
createform.title.label=Title
createform.summary.help=A short summary of the article.
createform.summary.label=Summary
createform.workflow.help=The workflow to use for the article.
createform.workflow.label=Workflow
createform.cancel=Cancel
createform.submit=Create Article

View File

@ -12,3 +12,16 @@ createstep.workflow.none_selected=Der ausgew\u00e4hlte Arbeitsablauf ist nicht v
createstep.workflow.error.not_available=Der ausgew\u00e4hlte Arbeitsablauf ist nicht verf\u00fcgbar.
mpa.edit.denied=Ihnen wurden nicht die erforderlichen Berechtigungen erteilt, um diesen Artikel zu bearbeiten.
authoringsteps.sections.description=Die Sektionen eines mehrteiligen Artikels verwalten.
createform.title=Einen neuen mehrteiligen Artikel erstellen
createform.name.help=Der Name des Artikels. Darf nur die Buchstaben A bis Z und a bis z, Zahlen, den Bindestrich und den Unterstrich enthalten.
createform.name.label=Name
createform.initial_locale.help=Die initiale Sprache des Artikels. Lokaliserbare Eigenschaften, die in diesem Formualar angegeben werden, werden f\u00fcr diese Sprache dem Artikel hinzugef\u00fcgt.
createform.initial_locale.label=Initiale Sprache
createform.title.help=Der Titel des Artikels.
createform.title.label=Titel
createform.summary.help=Eine kurze Zusammenfassung des Artikels.
createform.summary.label=Zusammenfassung
createform.workflow.help=Der f\u00fcr den Artikel zu verwendende Arbeitsablauf.
createform.workflow.label=Arbeitsablauf
createform.cancel=Abbrechen
createform.submit=Artikel anlegen

View File

@ -187,7 +187,7 @@ public class AssetManagerIT {
file.setDisplayName("datasheet.pdf");
file.setFileName("datasheet.pdf");
file.setMimeType(new MimeType("application/pdf"));
file.getTitle().addValue(Locale.ENGLISH, "datasheet.pdf");
file.getTitle().putValue(Locale.ENGLISH, "datasheet.pdf");
assetRepo.save(file);
assetManager.shareAsset(file, folder);

View File

@ -1006,9 +1006,9 @@ public class ContentItemManagerIT {
final Optional<ContentItem> item = itemRepo.findById(10200L);
assertThat(item.isPresent(), is(true));
item.get().getName().addValue(Locale.ENGLISH, "article2-edited");
item.get().getName().putValue(Locale.ENGLISH, "article2-edited");
item.get().getTitle()
.addValue(Locale.ENGLISH, "Article has been edited");
.putValue(Locale.ENGLISH, "Article has been edited");
itemRepo.save(item.get());
final Optional<ContentItem> draft = itemRepo.findById(10200L);

View File

@ -406,8 +406,8 @@ public class ContentItemRepositoryIT {
assertThat(item.isPresent(), is(true));
item.get().getName().addValue(Locale.ENGLISH, "first-article");
item.get().getTitle().addValue(Locale.ENGLISH, "First Article");
item.get().getName().putValue(Locale.ENGLISH, "first-article");
item.get().getTitle().putValue(Locale.ENGLISH, "First Article");
itemRepo.save(item.get());
}

View File

@ -213,17 +213,17 @@ public class ContentSectionManagerIT {
final Locale defaultLocale = new Locale(kernelConfig
.getDefaultLanguage());
section.getTitle().addValue(defaultLocale, "content");
section.getTitle().putValue(defaultLocale, "content");
repository.save(section);
section.getRootDocumentsFolder().setName("content_root");
section.getRootDocumentsFolder().setDisplayName("content_root");
section.getRootDocumentsFolder().getTitle().addValue(
section.getRootDocumentsFolder().getTitle().putValue(
defaultLocale, "content_root");
section.getRootAssetsFolder().setName("content_assets");
section.getRootAssetsFolder().setDisplayName("content_assets");
section.getRootAssetsFolder().getTitle().addValue(
section.getRootAssetsFolder().getTitle().putValue(
defaultLocale, "content_assets");
categoryRepo.save(section.getRootDocumentsFolder());

View File

@ -161,7 +161,7 @@ public class CategoryDescriptionForm extends Form {
final String titleData = e.getFormData().getString(
LOCALIZED_CATEGORY_DESC);
selectedCategory.getDescription().addValue(selectedLocale,
selectedCategory.getDescription().putValue(selectedLocale,
titleData);
categoryRepository.save(selectedCategory);
}

View File

@ -155,7 +155,7 @@ public class CategoryTitleForm extends Form {
final String titleData = e.getFormData().getString(
LOCALIZED_CATEGORY_TITLE);
selectedCategory.getTitle().addValue(selectedLocale, titleData);
selectedCategory.getTitle().putValue(selectedLocale, titleData);
categoryRepository.save(selectedCategory);
}

View File

@ -159,7 +159,7 @@ class DomainDescriptionForm extends Form {
final String titleData = e.getFormData().getString(
LOCALIZED_DOMAIN_DESC);
selectedDomain.getDescription().addValue(selectedLocale,
selectedDomain.getDescription().putValue(selectedLocale,
titleData);
domainRepository.save(selectedDomain);
}

View File

@ -157,7 +157,7 @@ class DomainTitleForm extends Form {
final String titleData = e.getFormData().getString(
LOCALIZED_DOMAIN_TITLE);
selectedDomain.getTitle().addValue(selectedLocale, titleData);
selectedDomain.getTitle().putValue(selectedLocale, titleData);
domainRepository.save(selectedDomain);
}

View File

@ -556,7 +556,7 @@ public class SettingEditorLocalizedString extends BoxPanel {
final Locale locale = new Locale(data.getString(
LOCALE_SELECT));
final String valueData = data.getString(VALUE);
localizedStr.addValue(locale, valueData);
localizedStr.putValue(locale, valueData);
confManager.saveConfiguration(config);
}

View File

@ -358,8 +358,8 @@ class PageModelForm extends Form {
pageModel.setName(nameValue);
pageModel.getTitle().addValue(defaultLocale, titleValue);
pageModel.getDescription().addValue(defaultLocale, descValue);
pageModel.getTitle().putValue(defaultLocale, titleValue);
pageModel.getDescription().putValue(defaultLocale, descValue);
pageModel.setApplication(application);

View File

@ -60,8 +60,8 @@ public final class ExampleConfiguration {
new String[]{"en", "de"}));
public ExampleConfiguration() {
title.addValue(Locale.GERMAN, "Dies ist ein Test");
title.addValue(Locale.ENGLISH, "This is a test");
title.putValue(Locale.GERMAN, "Dies ist ein Test");
title.putValue(Locale.ENGLISH, "This is a test");
}
public boolean isEnabled() {

View File

@ -139,7 +139,7 @@ public class LocalizedString implements Serializable {
* @param locale The locale of the provided value.
* @param value The localised value for the provided locale.
*/
public void addValue(final Locale locale, final String value) {
public void putValue(final Locale locale, final String value) {
values.put(locale, value);
}

View File

@ -211,7 +211,7 @@ class ConfigurationLoader {
confName, settingName, token);
continue;
}
l10nSetting.getValue().addValue(new Locale(parts[0]), parts[1]);
l10nSetting.getValue().putValue(new Locale(parts[0]), parts[1]);
}
setting = l10nSetting;
} else if (Long.class.getName().equals(settingType)

View File

@ -300,12 +300,12 @@ public class PageModelManager {
for (Map.Entry<Locale, String> entry : draftModel.getTitle().getValues()
.entrySet()) {
liveModel.getTitle().addValue(entry.getKey(), entry.getValue());
liveModel.getTitle().putValue(entry.getKey(), entry.getValue());
}
for (Map.Entry<Locale, String> entry : draftModel.getDescription()
.getValues().entrySet()) {
liveModel.getDescription().addValue(entry.getKey(),
liveModel.getDescription().putValue(entry.getKey(),
entry.getValue());
}

View File

@ -229,13 +229,13 @@ public class PageModels {
pageModel = pageModelManager.createPageModel(pageModelName, app);
}
if (pageModelData.containsKey("title")) {
pageModel.getTitle().addValue(kernelConfig.getDefaultLocale(),
pageModel.getTitle().putValue(kernelConfig.getDefaultLocale(),
pageModelData.getString("title"));
}
if (pageModelData.containsKey("description")) {
pageModel
.getDescription()
.addValue(kernelConfig.getDefaultLocale(),
.putValue(kernelConfig.getDefaultLocale(),
pageModelData.getString("description"));
}

View File

@ -55,14 +55,14 @@ public final class EmailTemplates {
public EmailTemplates() {
emailVerificationSubject = new LocalizedStringSetting();
emailVerificationSubject.setValue(new LocalizedString());
emailVerificationSubject.getValue().addValue(
emailVerificationSubject.getValue().putValue(
Locale.ENGLISH, "Email verification");
emailVerificationSubject.getValue().addValue(
emailVerificationSubject.getValue().putValue(
Locale.GERMAN, "Prüfung ihrer E-Mail-Adresse");
emailVerificationMail = new LocalizedStringSetting();
emailVerificationMail.setValue(new LocalizedString());
emailVerificationMail.getValue().addValue(
emailVerificationMail.getValue().putValue(
Locale.ENGLISH,
"Please follow the following link to finish the email verfication "
+ "process:\n"
@ -80,7 +80,7 @@ public final class EmailTemplates {
+ "\n"
+ "Please be aware that your verification token expires "
+ "at ${expires_date}.");
emailVerificationMail.getValue().addValue(
emailVerificationMail.getValue().putValue(
Locale.GERMAN,
"Bitte folgen Sie dem folgenden Link, um die Überprüfung ihrer E-"
+ "Mail-Adresse abzuschließen:\n"
@ -101,14 +101,14 @@ public final class EmailTemplates {
passwordRecoverSubject = new LocalizedStringSetting();
passwordRecoverSubject.setValue(new LocalizedString());
passwordRecoverSubject.getValue().addValue(
passwordRecoverSubject.getValue().putValue(
Locale.ENGLISH, "Information regarding your password");
passwordRecoverSubject.getValue().addValue(
passwordRecoverSubject.getValue().putValue(
Locale.GERMAN, "Zurücksetzen ihres Passwortes");
passwordRecoverMail = new LocalizedStringSetting();
passwordRecoverMail.setValue(new LocalizedString());
passwordRecoverMail.getValue().addValue(
passwordRecoverMail.getValue().putValue(
Locale.ENGLISH,
"Please follow the following link to complete the password recover "
+ "process:\n"
@ -124,7 +124,7 @@ public final class EmailTemplates {
+ "\n"
+ "Please be aware that you must complete the process until "
+ "${expires_date}.");
passwordRecoverMail.getValue().addValue(
passwordRecoverMail.getValue().putValue(
Locale.GERMAN,
"Bitte folgen Sie dem folgenden Link um ein neues Passwort "
+ "einzugeben:\n"
@ -145,14 +145,14 @@ public final class EmailTemplates {
accountActivationSubject = new LocalizedStringSetting();
accountActivationSubject.setValue(new LocalizedString());
accountActivationSubject.getValue().addValue(
accountActivationSubject.getValue().putValue(
Locale.ENGLISH, "Activate your account");
accountActivationSubject.getValue().addValue(
accountActivationSubject.getValue().putValue(
Locale.GERMAN, "Aktivieren Sie Ihr Benutzerkonto");
accountActivationMail = new LocalizedStringSetting();
accountActivationMail.setValue(new LocalizedString());
accountActivationMail.getValue().addValue(
accountActivationMail.getValue().putValue(
Locale.ENGLISH,
"Please follow the following link to enable your new account:\n"
+ "\n"
@ -168,7 +168,7 @@ public final class EmailTemplates {
+ "\n"
+ "Please be aware that you must activate your account before "
+ "${expires_date}.");
accountActivationMail.getValue().addValue(
accountActivationMail.getValue().putValue(
Locale.GERMAN,
"Bitte folgen Sie den folgendem Link, um ihr Benutzerkonto zu "
+ "aktivieren:\n"

View File

@ -418,7 +418,7 @@ public class CategoriesController {
final Category category = result.get();
final Locale locale = new Locale(localeParam);
category.getTitle().addValue(locale, value);
category.getTitle().putValue(locale, value);
categoryRepository.save(category);
return String.format(
"redirect:categorymanager/categories/ID-%d",
@ -476,7 +476,7 @@ public class CategoriesController {
final Category category = result.get();
final Locale locale = new Locale(localeParam);
category.getTitle().addValue(locale, value);
category.getTitle().putValue(locale, value);
categoryRepository.save(category);
return String.format(
"redirect:categorymanager/categories/ID-%d",
@ -591,7 +591,7 @@ public class CategoriesController {
final Category category = result.get();
final Locale locale = new Locale(localeParam);
category.getDescription().addValue(locale, value);
category.getDescription().putValue(locale, value);
categoryRepository.save(category);
return String.format(
"redirect:categorymanager/categories/ID-%d",
@ -650,7 +650,7 @@ public class CategoriesController {
final Category category = result.get();
final Locale locale = new Locale(localeParam);
category.getDescription().addValue(locale, value);
category.getDescription().putValue(locale, value);
categoryRepository.save(category);
return String.format(
"redirect:categorymanager/categories/ID-%d",

View File

@ -324,7 +324,7 @@ public class CategorySystemsController {
final Domain domain = result.get();
final Locale locale = new Locale(localeParam);
domain.getTitle().addValue(locale, value);
domain.getTitle().putValue(locale, value);
domainRepository.save(domain);
return String.format(
"redirect:categorymanager/categorysystems/ID-%d/details",
@ -389,7 +389,7 @@ public class CategorySystemsController {
final Domain domain = result.get();
final Locale locale = new Locale(localeParam);
domain.getTitle().addValue(locale, value);
domain.getTitle().putValue(locale, value);
domainRepository.save(domain);
return String.format(
"redirect:categorymanager/categorysystems/ID-%d/details",
@ -522,7 +522,7 @@ public class CategorySystemsController {
final Domain domain = result.get();
final Locale locale = new Locale(localeParam);
domain.getDescription().addValue(locale, value);
domain.getDescription().putValue(locale, value);
domainRepository.save(domain);
return String.format(
"redirect:categorymanager/categorysystems/ID-%d/details",
@ -589,7 +589,7 @@ public class CategorySystemsController {
final Domain domain = result.get();
final Locale locale = new Locale(localeParam);
domain.getDescription().addValue(locale, value);
domain.getDescription().putValue(locale, value);
domainRepository.save(domain);
return String.format(
"redirect:categorymanager/categorysystems/ID-%d/details",

View File

@ -466,7 +466,7 @@ public class SettingsController {
}
final Locale locale = new Locale(tokens[0]);
final String localeValue = tokens[1].trim();
value.addValue(locale, localeValue);
value.putValue(locale, localeValue);
}
return updateSetting(
configurationClassName,

View File

@ -146,14 +146,14 @@ public class WorkflowManager implements Serializable {
template
.getName()
.getValues()
.forEach((locale, str) -> name.addValue(locale, str));
.forEach((locale, str) -> name.putValue(locale, str));
workflow.setName(name);
final LocalizedString description = new LocalizedString();
template
.getDescription()
.getValues()
.forEach((locale, str) -> description.addValue(locale, str));
.forEach((locale, str) -> description.putValue(locale, str));
workflow.setDescription(description);
workflowRepo.save(workflow);
@ -259,7 +259,7 @@ public class WorkflowManager implements Serializable {
localized
.getValues()
.forEach((locale, str) -> copy.addValue(locale, str));
.forEach((locale, str) -> copy.putValue(locale, str));
writeMethod.invoke(task, copy);
} else {

View File

@ -59,12 +59,12 @@ public class ResourceEntityTest extends EqualsVerifier {
final Resource resource1 = new Resource();
final LocalizedString title1 = new LocalizedString();
title1.addValue(Locale.ENGLISH, "Resource 1");
title1.putValue(Locale.ENGLISH, "Resource 1");
resource1.setTitle(title1);
final Resource resource2 = new Resource();
final LocalizedString title2 = new LocalizedString();
title2.addValue(Locale.ENGLISH, "Resource 2");
title2.putValue(Locale.ENGLISH, "Resource 2");
resource2.setTitle(title2);
final CcmObject ccmObject1 = new CcmObject();

View File

@ -89,10 +89,10 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
ccmObject1.setDisplayName("Object 2");
final AssignableTask task1 = new AssignableTask();
task1.getLabel().addValue(Locale.ENGLISH, "Task 1");
task1.getLabel().putValue(Locale.ENGLISH, "Task 1");
final AssignableTask task2 = new AssignableTask();
task2.getLabel().addValue(Locale.ENGLISH, "Task 2");
task2.getLabel().putValue(Locale.ENGLISH, "Task 2");
verifier
.withPrefabValues(Group.class, group1, group2)