Removed warning

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@68246 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2014-04-29 09:32:44 +00:00
parent fde0de1010
commit 0dd217525a

View File

@@ -42,6 +42,7 @@ import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.repository.TemplateService; import org.alfresco.service.cmr.repository.TemplateService;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.alfresco.util.UrlUtil; import org.alfresco.util.UrlUtil;
import org.apache.commons.lang.StringUtils;
import org.springframework.extensions.surf.util.I18NUtil; import org.springframework.extensions.surf.util.I18NUtil;
/** /**
@@ -54,14 +55,14 @@ public class DeclarativeReportGenerator extends BaseReportGenerator
{ {
/** message lookups */ /** message lookups */
protected static final String MSG_REPORT = "report.default"; protected static final String MSG_REPORT = "report.default";
/** template lookup root */ /** template lookup root */
protected static final NodeRef TEMPLATE_ROOT = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_report_templates"); protected static final NodeRef TEMPLATE_ROOT = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_report_templates");
/** model keys */ /** model keys */
protected static final String KEY_NODE = "node"; protected static final String KEY_NODE = "node";
protected static final String KEY_CHILDREN = "children"; protected static final String KEY_CHILDREN = "children";
/** applicable reported upon types */ /** applicable reported upon types */
protected Set<QName> applicableTypes; protected Set<QName> applicableTypes;
@@ -82,10 +83,10 @@ public class DeclarativeReportGenerator extends BaseReportGenerator
/** node service */ /** node service */
protected NodeService nodeService; protected NodeService nodeService;
/** dictionary service */ /** dictionary service */
protected DictionaryService dictionaryService; protected DictionaryService dictionaryService;
/** sys admin params */ /** sys admin params */
protected SysAdminParams sysAdminParams; protected SysAdminParams sysAdminParams;
@@ -96,7 +97,7 @@ public class DeclarativeReportGenerator extends BaseReportGenerator
{ {
this.applicableTypes = applicableTypes; this.applicableTypes = applicableTypes;
} }
/** /**
* @param mimetypeService mimetype service * @param mimetypeService mimetype service
*/ */
@@ -136,7 +137,7 @@ public class DeclarativeReportGenerator extends BaseReportGenerator
{ {
this.nodeService = nodeService; this.nodeService = nodeService;
} }
/** /**
* @param dictionaryService dictionary service * @param dictionaryService dictionary service
*/ */
@@ -160,7 +161,7 @@ public class DeclarativeReportGenerator extends BaseReportGenerator
{ {
this.sysAdminParams = sysAdminParams; this.sysAdminParams = sysAdminParams;
} }
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.report.generator.BaseReportGenerator#generateReportName(org.alfresco.service.cmr.repository.NodeRef) * @see org.alfresco.module.org_alfresco_module_rm.report.generator.BaseReportGenerator#generateReportName(org.alfresco.service.cmr.repository.NodeRef)
*/ */
@@ -169,37 +170,37 @@ public class DeclarativeReportGenerator extends BaseReportGenerator
{ {
// get the file extension based on the mimetype // get the file extension based on the mimetype
String extension = mimetypeService.getExtension(mimetype); String extension = mimetypeService.getExtension(mimetype);
// get the name of the reported updon node ref // get the name of the reported updon node ref
String name = (String)nodeService.getProperty(reportedUponNodeRef, ContentModel.PROP_NAME); String name = (String)nodeService.getProperty(reportedUponNodeRef, ContentModel.PROP_NAME);
// build default report name // build default report name
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.append(getReportDisplayLabel()); builder.append(getReportDisplayLabel());
if (name != null & !name.isEmpty()) if (StringUtils.isNotBlank(name))
{ {
builder.append(" - ").append(name); builder.append(" - ").append(name);
} }
builder.append(".").append(extension); builder.append(".").append(extension);
return builder.toString(); return builder.toString();
} }
/** /**
* Helper method to get the report types display label * Helper method to get the report types display label
* *
* @return {@link String} report type display label * @return {@link String} report type display label
*/ */
private String getReportDisplayLabel() private String getReportDisplayLabel()
{ {
String result = I18NUtil.getMessage(MSG_REPORT); String result = I18NUtil.getMessage(MSG_REPORT);
TypeDefinition typeDef = dictionaryService.getType(reportType); TypeDefinition typeDef = dictionaryService.getType(reportType);
if (typeDef != null) if (typeDef != null)
{ {
result = typeDef.getTitle(new StaticMessageLookup()); result = typeDef.getTitle(new StaticMessageLookup());
} }
return result; return result;
} }
@@ -230,7 +231,7 @@ public class DeclarativeReportGenerator extends BaseReportGenerator
/** /**
* Create template model. * Create template model.
* *
* @param templateNodeRef * @param templateNodeRef
* @param reportedUponNodeRef * @param reportedUponNodeRef
* @param properties * @param properties
@@ -318,7 +319,7 @@ public class DeclarativeReportGenerator extends BaseReportGenerator
{ {
boolean isTypeApplicable = false; boolean isTypeApplicable = false;
QName type = nodeService.getType(reportedUponNodeRef); QName type = nodeService.getType(reportedUponNodeRef);
for (QName applicableType : applicableTypes) for (QName applicableType : applicableTypes)
{ {
if (dictionaryService.isSubClass(type, applicableType)) if (dictionaryService.isSubClass(type, applicableType))
@@ -327,11 +328,11 @@ public class DeclarativeReportGenerator extends BaseReportGenerator
break; break;
} }
} }
if (!isTypeApplicable) if (!isTypeApplicable)
{ {
// throw an exception // throw an exception
throw new AlfrescoRuntimeException("Can't generate report, because the provided reported upon node reference is type " + type.toString() + throw new AlfrescoRuntimeException("Can't generate report, because the provided reported upon node reference is type " + type.toString() +
" which is not an applicable type for a " + reportType.toString() + " report."); " which is not an applicable type for a " + reportType.toString() + " report.");
} }
} }