i18n support for data set labels

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@44362 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2012-12-05 10:48:21 +00:00
parent 4b8b65d023
commit 5e2b8efc17
4 changed files with 82 additions and 73 deletions

View File

@@ -0,0 +1 @@
dataset.dod5015.label=DOD 5015 Example Data

View File

@@ -84,6 +84,7 @@
<value>alfresco.module.org_alfresco_module_rm.messages.action-service</value> <value>alfresco.module.org_alfresco_module_rm.messages.action-service</value>
<value>alfresco.module.org_alfresco_module_rm.messages.audit-service</value> <value>alfresco.module.org_alfresco_module_rm.messages.audit-service</value>
<value>alfresco.module.org_alfresco_module_rm.messages.capability-service</value> <value>alfresco.module.org_alfresco_module_rm.messages.capability-service</value>
<value>alfresco.module.org_alfresco_module_rm.messages.dataset-service</value>
</list> </list>
</property> </property>
</bean> </bean>

View File

@@ -1306,7 +1306,6 @@
</bean> </bean>
<bean id="dataSetDOD5015" parent="dataSetBase"> <bean id="dataSetDOD5015" parent="dataSetBase">
<property name="label" value="DOD 5015 Example Data"/>
<property name="id" value="dod5015"/> <property name="id" value="dod5015"/>
<property name="path" value="alfresco/module/org_alfresco_module_rm/dod5015/DODExampleFilePlan.xml" /> <property name="path" value="alfresco/module/org_alfresco_module_rm/dod5015/DODExampleFilePlan.xml" />
</bean> </bean>

View File

@@ -1,90 +1,98 @@
package org.alfresco.module.org_alfresco_module_rm.dataset; package org.alfresco.module.org_alfresco_module_rm.dataset;
import org.apache.commons.lang.StringUtils;
import org.springframework.extensions.surf.util.I18NUtil;
public class DataSetBase implements DataSet public class DataSetBase implements DataSet
{ {
/** Data set service */ /** Data set service */
private DataSetService dataSetService; private DataSetService dataSetService;
/** Data set label */ /** Data set label */
private String label; private String label;
/** Data set id */ /** Data set id */
private String id; private String id;
/** Data set path */ /** Data set path */
private String path; private String path;
/** /**
* Sets the data set service * Sets the data set service
* *
* @param dataSetService the data set service * @param dataSetService the data set service
*/ */
public void setDataSetService(DataSetService dataSetService) public void setDataSetService(DataSetService dataSetService)
{ {
this.dataSetService = dataSetService; this.dataSetService = dataSetService;
} }
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSet#getLabel() * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSet#getLabel()
*/ */
public String getLabel() public String getLabel()
{ {
return this.label; String label = this.label;
} if (StringUtils.isBlank(label))
{
label = I18NUtil.getMessage("dataset." + getId() + ".label");
}
return label;
}
/** /**
* Sets the label of the data set service * Sets the label of the data set service
* *
* @param label the label * @param label the label
*/ */
public void setLabel(String label) public void setLabel(String label)
{ {
this.label = label; this.label = label;
} }
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSet#getId() * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSet#getId()
*/ */
public String getId() public String getId()
{ {
return this.id; return this.id;
} }
/** /**
* Sets the id of the data set service * Sets the id of the data set service
* *
* @param id the id * @param id the id
*/ */
public void setId(String id) public void setId(String id)
{ {
this.id = id; this.id = id;
} }
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSet#getPath() * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSet#getPath()
*/ */
public String getPath() public String getPath()
{ {
return this.path; return this.path;
} }
/** /**
* Sets the path of the data set service * Sets the path of the data set service
* *
* @param path the path * @param path the path
*/ */
public void setPath(String path) public void setPath(String path)
{ {
this.path = path; this.path = path;
} }
/** /**
* Registers the data set implementation with the data set service. * Registers the data set implementation with the data set service.
*/ */
public void register() public void register()
{ {
this.dataSetService.register(this); this.dataSetService.register(this);
} }
} }