Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge pull request #559 from zanata/fix-home-content-config
Browse files Browse the repository at this point in the history
Prevent access failure when editing home content or help content.
  • Loading branch information
davidmason committed Aug 18, 2014
2 parents c383a99 + ce99e7e commit 0799143
Showing 1 changed file with 9 additions and 17 deletions.
Expand Up @@ -89,10 +89,14 @@ public class ServerConfigurationBean implements Serializable {
private String fromEmailAddr;
private PropertyWithKey<String> fromEmailAddrProperty = new PropertyWithKey<String>("fromEmailAddr", KEY_EMAIL_FROM_ADDRESS);

private String homeContent;
@Getter
@Setter
private String homeContent = "";
private PropertyWithKey<String> homeContentProperty = new PropertyWithKey<String>("homeContent", KEY_HOME_CONTENT);

private String helpContent;
@Getter
@Setter
private String helpContent = "";
private PropertyWithKey<String> helpContentProperty = new PropertyWithKey<String>("helpContent", KEY_HELP_CONTENT);

@Getter
Expand Down Expand Up @@ -149,23 +153,11 @@ public class ServerConfigurationBean implements Serializable {
new PropertyWithKey<String>("termsOfUseUrl", KEY_TERMS_CONDITIONS_URL),
new PropertyWithKey<String>("maxConcurrentRequestsPerApiKey", KEY_MAX_CONCURRENT_REQ_PER_API_KEY),
new PropertyWithKey<String>("maxActiveRequestsPerApiKey", KEY_MAX_ACTIVE_REQ_PER_API_KEY),
new PropertyWithKey<String>("maxFilesPerUpload", KEY_MAX_FILES_PER_UPLOAD)
new PropertyWithKey<String>("maxFilesPerUpload", KEY_MAX_FILES_PER_UPLOAD),
homeContentProperty,
helpContentProperty
);

public String getHomeContent() {
HApplicationConfiguration var =
applicationConfigurationDAO
.findByKey(homeContentProperty.getKey());
return var != null ? var.getValue() : "";
}

public String getHelpContent() {
HApplicationConfiguration var =
applicationConfigurationDAO
.findByKey(helpContentProperty.getKey());
return var != null ? var.getValue() : "";
}

public String updateHomeContent() {
persistPropertyToDatabase(homeContentProperty);
applicationConfigurationDAO.flush();
Expand Down

0 comments on commit 0799143

Please sign in to comment.