CCM NG: Ensure that fields of type LocalizedString are never null.

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4875 8810af33-2d31-482b-a856-94f89814c4df
pull/2/head
jensp 2017-07-15 09:26:24 +00:00
parent 8c670453da
commit f94a3e409c
25 changed files with 139 additions and 60 deletions

View File

@ -95,6 +95,7 @@ public class BinaryAsset extends Asset implements Serializable {
} }
public void setDescription(final LocalizedString description) { public void setDescription(final LocalizedString description) {
Objects.requireNonNull(description);
this.description = description; this.description = description;
} }

View File

@ -23,7 +23,6 @@ import com.arsdigita.cms.ui.assets.forms.BookmarkForm;
import org.librecms.contentsection.Asset; import org.librecms.contentsection.Asset;
import java.io.Serializable; import java.io.Serializable;
import java.net.URL;
import java.util.Objects; import java.util.Objects;
import javax.persistence.AssociationOverride; import javax.persistence.AssociationOverride;
@ -85,6 +84,7 @@ public class Bookmark extends Asset implements Serializable {
} }
public void setDescription(final LocalizedString description) { public void setDescription(final LocalizedString description) {
Objects.requireNonNull(description);
this.description = description; this.description = description;
} }

View File

@ -116,6 +116,7 @@ public class LegalMetadata extends Asset implements Serializable {
} }
public void setRights(final LocalizedString rights) { public void setRights(final LocalizedString rights) {
Objects.requireNonNull(rights);
this.rights = rights; this.rights = rights;
} }

View File

@ -75,6 +75,7 @@ public class SideNote extends Asset implements Serializable {
} }
public void setText(final LocalizedString text) { public void setText(final LocalizedString text) {
Objects.requireNonNull(text);
this.text = text; this.text = text;
} }

View File

@ -387,6 +387,7 @@ public class Asset extends CcmObject {
} }
public void setTitle(final LocalizedString title) { public void setTitle(final LocalizedString title) {
Objects.requireNonNull(title);
this.title = title; this.title = title;
} }

View File

@ -192,6 +192,7 @@ public class AttachmentList implements Comparable<AttachmentList>,
} }
public void setTitle(final LocalizedString title) { public void setTitle(final LocalizedString title) {
Objects.requireNonNull(title);
this.title = title; this.title = title;
} }

View File

@ -119,6 +119,12 @@ public class ContentType extends CcmObject implements Serializable {
@JoinColumn(name = "DEFAULT_WORKFLOW") @JoinColumn(name = "DEFAULT_WORKFLOW")
private WorkflowTemplate defaultWorkflow; private WorkflowTemplate defaultWorkflow;
public ContentType() {
super();
label = new LocalizedString();
description = new LocalizedString();
}
public String getContentItemClass() { public String getContentItemClass() {
return contentItemClass; return contentItemClass;
} }
@ -140,6 +146,7 @@ public class ContentType extends CcmObject implements Serializable {
} }
public void setLabel(final LocalizedString label) { public void setLabel(final LocalizedString label) {
Objects.requireNonNull(label);
this.label = label; this.label = label;
} }
@ -148,6 +155,7 @@ public class ContentType extends CcmObject implements Serializable {
} }
public void setDescription(final LocalizedString description) { public void setDescription(final LocalizedString description) {
Objects.requireNonNull(description);
this.description = description; this.description = description;
} }

View File

@ -93,6 +93,7 @@ public class Article extends ContentItem implements Serializable {
} }
public void setText(final LocalizedString text) { public void setText(final LocalizedString text) {
Objects.requireNonNull(text);
this.text = text; this.text = text;
} }

View File

@ -169,11 +169,21 @@ public class Event extends ContentItem implements Serializable {
)) ))
private LocalizedString cost; private LocalizedString cost;
public Event() {
text = new LocalizedString();
eventDate = new LocalizedString();
location = new LocalizedString();
mainContributor = new LocalizedString();
eventType = new LocalizedString();
cost = new LocalizedString();
}
public LocalizedString getText() { public LocalizedString getText() {
return text; return text;
} }
public void setText(final LocalizedString text) { public void setText(final LocalizedString text) {
Objects.requireNonNull(text);
this.text = text; this.text = text;
} }
@ -214,6 +224,7 @@ public class Event extends ContentItem implements Serializable {
} }
public void setEventDate(final LocalizedString eventDate) { public void setEventDate(final LocalizedString eventDate) {
Objects.requireNonNull(eventDate);
this.eventDate = eventDate; this.eventDate = eventDate;
} }
@ -222,6 +233,7 @@ public class Event extends ContentItem implements Serializable {
} }
public void setLocation(final LocalizedString location) { public void setLocation(final LocalizedString location) {
Objects.requireNonNull(location);
this.location = location; this.location = location;
} }
@ -230,6 +242,7 @@ public class Event extends ContentItem implements Serializable {
} }
public void setMainContributor(final LocalizedString mainContributor) { public void setMainContributor(final LocalizedString mainContributor) {
Objects.requireNonNull(mainContributor);
this.mainContributor = mainContributor; this.mainContributor = mainContributor;
} }
@ -238,6 +251,7 @@ public class Event extends ContentItem implements Serializable {
} }
public void setEventType(final LocalizedString eventType) { public void setEventType(final LocalizedString eventType) {
Objects.requireNonNull(eventType);
this.eventType = eventType; this.eventType = eventType;
} }
@ -254,6 +268,7 @@ public class Event extends ContentItem implements Serializable {
} }
public void setCost(final LocalizedString cost) { public void setCost(final LocalizedString cost) {
Objects.requireNonNull(cost);
this.cost = cost; this.cost = cost;
} }

View File

@ -94,6 +94,8 @@ public class MultiPartArticle extends ContentItem implements Serializable {
private List<MultiPartArticleSection> sections; private List<MultiPartArticleSection> sections;
public MultiPartArticle() { public MultiPartArticle() {
super();
summary = new LocalizedString();
this.sections = new ArrayList<>(); this.sections = new ArrayList<>();
} }
@ -102,6 +104,7 @@ public class MultiPartArticle extends ContentItem implements Serializable {
} }
public void setSummary(final LocalizedString summary) { public void setSummary(final LocalizedString summary) {
Objects.requireNonNull(summary);
this.summary = summary; this.summary = summary;
} }

View File

@ -93,6 +93,12 @@ public class MultiPartArticleSection implements Serializable {
)) ))
private LocalizedString text; private LocalizedString text;
public MultiPartArticleSection() {
super();
title = new LocalizedString();
text = new LocalizedString();
}
public long getSectionId() { public long getSectionId() {
return sectionId; return sectionId;
} }
@ -106,6 +112,7 @@ public class MultiPartArticleSection implements Serializable {
} }
public void setTitle(final LocalizedString title) { public void setTitle(final LocalizedString title) {
Objects.requireNonNull(title);
this.title = title; this.title = title;
} }
@ -130,6 +137,7 @@ public class MultiPartArticleSection implements Serializable {
} }
public void setText(final LocalizedString text) { public void setText(final LocalizedString text) {
Objects.requireNonNull(text);
this.text = text; this.text = text;
} }

View File

@ -106,11 +106,17 @@ public class News extends ContentItem implements Serializable {
@Column(name = "HOMEPAGE") @Column(name = "HOMEPAGE")
private boolean homepage; private boolean homepage;
public News() {
super();
text = new LocalizedString();
}
public LocalizedString getText() { public LocalizedString getText() {
return text; return text;
} }
public void setText(final LocalizedString text) { public void setText(final LocalizedString text) {
Objects.requireNonNull(text);
this.text = text; this.text = text;
} }

View File

@ -101,6 +101,7 @@ public class LifecycleDefinition implements Serializable {
} }
public void setLabel(final LocalizedString label) { public void setLabel(final LocalizedString label) {
Objects.requireNonNull(label);
this.label = label; this.label = label;
} }
@ -109,6 +110,7 @@ public class LifecycleDefinition implements Serializable {
} }
public void setDescription(final LocalizedString description) { public void setDescription(final LocalizedString description) {
Objects.requireNonNull(description);
this.description = description; this.description = description;
} }

View File

@ -98,6 +98,7 @@ public class PhaseDefinition implements Serializable {
} }
public void setLabel(final LocalizedString label) { public void setLabel(final LocalizedString label) {
Objects.requireNonNull(label);
this.label = label; this.label = label;
} }
@ -106,6 +107,7 @@ public class PhaseDefinition implements Serializable {
} }
public void setDescription(final LocalizedString description) { public void setDescription(final LocalizedString description) {
Objects.requireNonNull(description);
this.description = description; this.description = description;
} }

View File

@ -288,6 +288,7 @@ public class Category extends CcmObject implements Serializable, Portable {
} }
public void setTitle(final LocalizedString title) { public void setTitle(final LocalizedString title) {
Objects.requireNonNull(title);
this.title = title; this.title = title;
} }
@ -296,6 +297,7 @@ public class Category extends CcmObject implements Serializable, Portable {
} }
public void setDescription(final LocalizedString description) { public void setDescription(final LocalizedString description) {
Objects.requireNonNull(description);
this.description = description; this.description = description;
} }

View File

@ -229,6 +229,7 @@ public class Domain extends CcmObject implements Serializable {
} }
public void setTitle(final LocalizedString title) { public void setTitle(final LocalizedString title) {
Objects.requireNonNull(title);
this.title = title; this.title = title;
} }
@ -237,6 +238,7 @@ public class Domain extends CcmObject implements Serializable {
} }
public void setDescription(final LocalizedString description) { public void setDescription(final LocalizedString description) {
Objects.requireNonNull(description);
this.description = description; this.description = description;
} }

View File

@ -65,6 +65,7 @@ public class LocalizedStringSetting
@Override @Override
public void setValue(final LocalizedString value) { public void setValue(final LocalizedString value) {
Objects.requireNonNull(value);
this.value = value; this.value = value;
} }

View File

@ -115,13 +115,12 @@ public class Resource extends CcmObject implements Serializable {
childs = new ArrayList<>(); childs = new ArrayList<>();
} }
// @Column(name = "resource_type")
// private String resourceType;
public LocalizedString getTitle() { public LocalizedString getTitle() {
return title; return title;
} }
public void setTitle(final LocalizedString title) { public void setTitle(final LocalizedString title) {
Objects.requireNonNull(title);
this.title = title; this.title = title;
} }
@ -130,6 +129,7 @@ public class Resource extends CcmObject implements Serializable {
} }
public void setDescription(final LocalizedString description) { public void setDescription(final LocalizedString description) {
Objects.requireNonNull(description);
this.description = description; this.description = description;
} }

View File

@ -114,6 +114,7 @@ public class ResourceType implements Serializable {
} }
public void setDescription(final LocalizedString description) { public void setDescription(final LocalizedString description) {
Objects.requireNonNull(description);
this.description = description; this.description = description;
} }

View File

@ -65,6 +65,12 @@ public class PersistentDataQuery extends CcmObject implements Serializable {
@JoinColumn(name = "DATA_QUERY_ID")})) @JoinColumn(name = "DATA_QUERY_ID")}))
private LocalizedString description; private LocalizedString description;
public PersistentDataQuery() {
super();
name = new LocalizedString();
description = new LocalizedString();
}
public String getQueryId() { public String getQueryId() {
return queryId; return queryId;
} }
@ -78,6 +84,7 @@ public class PersistentDataQuery extends CcmObject implements Serializable {
} }
public void setName(final LocalizedString name) { public void setName(final LocalizedString name) {
Objects.requireNonNull(name);
this.name = name; this.name = name;
} }
@ -86,6 +93,7 @@ public class PersistentDataQuery extends CcmObject implements Serializable {
} }
public void setDescription(final LocalizedString description) { public void setDescription(final LocalizedString description) {
Objects.requireNonNull(description);
this.description = description; this.description = description;
} }

View File

@ -73,11 +73,18 @@ public class ProcessListener extends CcmObject implements Serializable {
@Column(name = "PROCESS_LISTENER_ORDER") @Column(name = "PROCESS_LISTENER_ORDER")
private long order; private long order;
public ProcessListener() {
super();
name = new LocalizedString();
description = new LocalizedString();
}
public LocalizedString getName() { public LocalizedString getName() {
return name; return name;
} }
public void setName(final LocalizedString name) { public void setName(final LocalizedString name) {
Objects.requireNonNull(name);
this.name = name; this.name = name;
} }
@ -86,6 +93,7 @@ public class ProcessListener extends CcmObject implements Serializable {
} }
public void setDescription(final LocalizedString description) { public void setDescription(final LocalizedString description) {
Objects.requireNonNull(description);
this.description = description; this.description = description;
} }

View File

@ -247,6 +247,7 @@ public class PageModel implements Serializable {
} }
protected void setTitle(final LocalizedString title) { protected void setTitle(final LocalizedString title) {
Objects.requireNonNull(title);
this.title = title; this.title = title;
} }
@ -255,6 +256,7 @@ public class PageModel implements Serializable {
} }
protected void setDescription(final LocalizedString description) { protected void setDescription(final LocalizedString description) {
Objects.requireNonNull(description);
this.description = description; this.description = description;
} }

View File

@ -286,14 +286,15 @@ public class Role implements Serializable, Portable {
assignedTasks.remove(taskAssignment); assignedTasks.remove(taskAssignment);
} }
public void setDescription(final LocalizedString description) {
this.description = description;
}
public LocalizedString getDescription() { public LocalizedString getDescription() {
return this.description; return this.description;
} }
public void setDescription(final LocalizedString description) {
Objects.requireNonNull(description);
this.description = description;
}
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 7; int hash = 7;

View File

@ -230,6 +230,7 @@ public class Task implements Identifiable, Serializable {
} }
public void setLabel(final LocalizedString label) { public void setLabel(final LocalizedString label) {
Objects.requireNonNull(label);
this.label = label; this.label = label;
} }
@ -238,6 +239,7 @@ public class Task implements Identifiable, Serializable {
} }
public void setDescription(final LocalizedString description) { public void setDescription(final LocalizedString description) {
Objects.requireNonNull(description);
this.description = description; this.description = description;
} }

View File

@ -112,7 +112,7 @@ public class Workflow implements Identifiable, Serializable, Portable {
schema = DB_SCHEMA, schema = DB_SCHEMA,
joinColumns = { joinColumns = {
@JoinColumn(name = "WORKFLOW_ID")})) @JoinColumn(name = "WORKFLOW_ID")}))
private LocalizedString name; private LocalizedString name = new LocalizedString();
/** /**
* Description of the workflow. * Description of the workflow.
@ -125,7 +125,7 @@ public class Workflow implements Identifiable, Serializable, Portable {
joinColumns = { joinColumns = {
@JoinColumn(name = "WORKFLOW_ID") @JoinColumn(name = "WORKFLOW_ID")
})) }))
private LocalizedString description; private LocalizedString description = new LocalizedString();
/** /**
* The current state of the workflow. * The current state of the workflow.
@ -201,6 +201,7 @@ public class Workflow implements Identifiable, Serializable, Portable {
} }
public void setName(final LocalizedString name) { public void setName(final LocalizedString name) {
Objects.requireNonNull(name);
this.name = name; this.name = name;
} }
@ -209,6 +210,7 @@ public class Workflow implements Identifiable, Serializable, Portable {
} }
public void setDescription(final LocalizedString description) { public void setDescription(final LocalizedString description) {
Objects.requireNonNull(description);
this.description = description; this.description = description;
} }