mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fixed major issues reported by sonar (If Stmts Must Use Braces)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@63501 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -285,8 +285,10 @@ public class BroadcastDispositionActionDefinitionUpdateAction extends RMActionEx
|
||||
nodeService.removeChild(nextAction.getNodeRef(), event.getNodeRef());
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Removed '" + eventName + "' from next action '" + nextAction.getName() +
|
||||
"' (" + nextAction.getNodeRef() + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -49,34 +49,36 @@ public class OpenRecordFolderAction extends RMActionExecuterAbstractBase
|
||||
@Override
|
||||
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
|
||||
{
|
||||
if (nodeService.exists(actionedUponNodeRef) == true &&
|
||||
freezeService.isFrozen(actionedUponNodeRef) == false)
|
||||
{
|
||||
// TODO move re-open logic into a service method
|
||||
// TODO check that the user in question has the correct permission to re-open a records folder
|
||||
if (nodeService.exists(actionedUponNodeRef) == true &&
|
||||
freezeService.isFrozen(actionedUponNodeRef) == false)
|
||||
{
|
||||
// TODO move re-open logic into a service method
|
||||
// TODO check that the user in question has the correct permission to re-open a records folder
|
||||
|
||||
if (recordService.isRecord(actionedUponNodeRef))
|
||||
{
|
||||
ChildAssociationRef assocRef = nodeService.getPrimaryParent(actionedUponNodeRef);
|
||||
if (assocRef != null)
|
||||
{
|
||||
actionedUponNodeRef = assocRef.getParentRef();
|
||||
}
|
||||
}
|
||||
if (recordService.isRecord(actionedUponNodeRef))
|
||||
{
|
||||
ChildAssociationRef assocRef = nodeService.getPrimaryParent(actionedUponNodeRef);
|
||||
if (assocRef != null)
|
||||
{
|
||||
actionedUponNodeRef = assocRef.getParentRef();
|
||||
}
|
||||
}
|
||||
|
||||
if (recordFolderService.isRecordFolder(actionedUponNodeRef) == true)
|
||||
{
|
||||
Boolean isClosed = (Boolean) nodeService.getProperty(actionedUponNodeRef, PROP_IS_CLOSED);
|
||||
if (Boolean.TRUE.equals(isClosed) == true)
|
||||
{
|
||||
nodeService.setProperty(actionedUponNodeRef, PROP_IS_CLOSED, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (logger.isWarnEnabled())
|
||||
logger.warn(I18NUtil.getMessage(MSG_NO_OPEN_RECORD_FOLDER, actionedUponNodeRef.toString()));
|
||||
}
|
||||
}
|
||||
if (recordFolderService.isRecordFolder(actionedUponNodeRef) == true)
|
||||
{
|
||||
Boolean isClosed = (Boolean) nodeService.getProperty(actionedUponNodeRef, PROP_IS_CLOSED);
|
||||
if (Boolean.TRUE.equals(isClosed) == true)
|
||||
{
|
||||
nodeService.setProperty(actionedUponNodeRef, PROP_IS_CLOSED, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (logger.isWarnEnabled())
|
||||
{
|
||||
logger.warn(I18NUtil.getMessage(MSG_NO_OPEN_RECORD_FOLDER, actionedUponNodeRef.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -844,7 +844,10 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
|
||||
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PROP_EXIST, propQName));
|
||||
}
|
||||
|
||||
if (newName == null) return propQName;
|
||||
if (newName == null)
|
||||
{
|
||||
return propQName;
|
||||
}
|
||||
|
||||
QName newPropQName = getQNameForClientId(newName);
|
||||
if (newPropQName != null)
|
||||
@@ -888,7 +891,10 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
|
||||
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PROP_EXIST, propQName));
|
||||
}
|
||||
|
||||
if (newLabel == null) return propQName;
|
||||
if (newLabel == null)
|
||||
{
|
||||
return propQName;
|
||||
}
|
||||
|
||||
NodeRef modelRef = getCustomModelRef(propQName.getNamespaceURI());
|
||||
M2Model deserializedModel = readCustomContentModel(modelRef);
|
||||
@@ -1619,7 +1625,10 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
|
||||
{
|
||||
try
|
||||
{
|
||||
if (contentIn != null) contentIn.close();
|
||||
if (contentIn != null)
|
||||
{
|
||||
contentIn.close();
|
||||
}
|
||||
}
|
||||
catch (IOException ignored)
|
||||
{
|
||||
|
@@ -277,19 +277,29 @@ public abstract class AbstractCapability extends RMSecurityCommon
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final AbstractCapability other = (AbstractCapability) obj;
|
||||
if (getName() == null)
|
||||
{
|
||||
if (other.getName() != null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (!getName().equals(other.getName()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -84,11 +84,17 @@ public class CustomMapping
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final CustomMapping other = (CustomMapping) obj;
|
||||
|
||||
|
@@ -301,7 +301,10 @@ public class RecordsManagementEventServiceImpl implements RecordsManagementEvent
|
||||
|
||||
String eventDisplayLabel = eventJSON.getString("eventDisplayLabel");
|
||||
String translated = I18NUtil.getMessage(eventDisplayLabel);
|
||||
if (translated!=null ) eventDisplayLabel = translated;
|
||||
if (translated != null)
|
||||
{
|
||||
eventDisplayLabel = translated;
|
||||
}
|
||||
|
||||
|
||||
// Check that the eventType is valid
|
||||
|
@@ -385,6 +385,8 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Set 'rma:recordLevelDisposition' field to be protected as record folders or records are present");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -332,7 +332,9 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
|
||||
nodeService.addAspect(nodeRef, ASPECT_RM_SEARCH , null);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Added search aspect to node: " + nodeRef);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
@@ -179,7 +179,10 @@ public class FilePlanComponentAspect extends BaseBehaviourBean
|
||||
String expectedScriptName = shortPrefix + "_" + localName + ".js";
|
||||
|
||||
NodeRef nextElement = nodeService.getChildByName(scriptsFolderNodeRef, ContentModel.ASSOC_CONTAINS, expectedScriptName);
|
||||
if (nextElement != null) result.add(nextElement);
|
||||
if (nextElement != null)
|
||||
{
|
||||
result.add(nextElement);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@@ -307,7 +307,9 @@ public class RecordFolderServiceImpl extends ServiceBaseImpl
|
||||
else
|
||||
{
|
||||
if (logger.isWarnEnabled())
|
||||
{
|
||||
logger.warn(I18NUtil.getMessage(MSG_CLOSE_RECORD_FOLDER_NOT_FOLDER, nodeRef.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -491,7 +491,10 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
||||
String name = getShortRoleName(groupShortName, rmRootNode);
|
||||
String displayLabel = authorityService.getAuthorityDisplayName(roleAuthority);
|
||||
String translated = I18NUtil.getMessage(displayLabel);
|
||||
if (translated!=null ) displayLabel = translated;
|
||||
if (translated != null)
|
||||
{
|
||||
displayLabel = translated;
|
||||
}
|
||||
Set<Capability> capabilities = getCapabilitiesImpl(rmRootNode, roleAuthority);
|
||||
|
||||
Role role = new Role(name, displayLabel, capabilities, roleAuthority, groupShortName);
|
||||
@@ -534,7 +537,10 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
||||
String name = getShortRoleName(groupShortName, rmRootNode);
|
||||
String displayLabel = authorityService.getAuthorityDisplayName(roleAuthority);
|
||||
String translated = I18NUtil.getMessage(displayLabel);
|
||||
if (translated!=null ) displayLabel = translated;
|
||||
if (translated != null)
|
||||
{
|
||||
displayLabel = translated;
|
||||
}
|
||||
Set<Capability> capabilities = getCapabilitiesImpl(rmRootNode, roleAuthority);
|
||||
|
||||
Role role = new Role(name, displayLabel, capabilities, roleAuthority, groupShortName);
|
||||
|
@@ -175,7 +175,10 @@ public class ApplyDodCertModelFixesGet extends DeclarativeWebScript
|
||||
{
|
||||
try
|
||||
{
|
||||
if (contentIn != null) contentIn.close();
|
||||
if (contentIn != null)
|
||||
{
|
||||
contentIn.close();
|
||||
}
|
||||
}
|
||||
catch (IOException ignored)
|
||||
{
|
||||
|
@@ -111,7 +111,10 @@ public class ApplyFixMob1573Get extends DeclarativeWebScript
|
||||
{
|
||||
try
|
||||
{
|
||||
if (contentIn != null) contentIn.close();
|
||||
if (contentIn != null)
|
||||
{
|
||||
contentIn.close();
|
||||
}
|
||||
}
|
||||
catch (IOException ignored)
|
||||
{
|
||||
|
@@ -62,7 +62,9 @@ public class AuditLogGet extends BaseAuditRetrievalWebScript
|
||||
auditTrail = this.rmAuditService.getAuditTrailFile(parseQueryParameters(req), parseReportFormat(req));
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Streaming audit trail from file: " + auditTrail.getAbsolutePath());
|
||||
}
|
||||
|
||||
boolean attach = false;
|
||||
String attachFileName = null;
|
||||
@@ -73,7 +75,9 @@ public class AuditLogGet extends BaseAuditRetrievalWebScript
|
||||
attachFileName = auditTrail.getName();
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Exporting audit trail using file name: " + attachFileName);
|
||||
}
|
||||
}
|
||||
|
||||
// stream the file back to the client
|
||||
|
@@ -103,14 +103,18 @@ public class AuditLogPost extends BaseAuditRetrievalWebScript
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Filing audit trail as record in record folder: " + destination);
|
||||
}
|
||||
|
||||
// parse the other parameters and get a file containing the audit trail
|
||||
NodeRef record = this.rmAuditService.fileAuditTrailAsRecord(parseQueryParameters(req),
|
||||
destination, parseReportFormat(req));
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Filed audit trail as new record: " + record);
|
||||
}
|
||||
|
||||
// return success flag and record noderef as JSON
|
||||
JSONObject responseJSON = new JSONObject();
|
||||
|
@@ -152,13 +152,17 @@ public class BaseAuditRetrievalWebScript extends StreamContent
|
||||
{
|
||||
// log a warning
|
||||
if (logger.isWarnEnabled())
|
||||
{
|
||||
logger.warn("Failed to parse JSON parameters for audit query: " + ioe.getMessage());
|
||||
}
|
||||
}
|
||||
catch (JSONException je)
|
||||
{
|
||||
// log a warning
|
||||
if (logger.isWarnEnabled())
|
||||
{
|
||||
logger.warn("Failed to parse JSON parameters for audit query: " + je.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -185,7 +189,9 @@ public class BaseAuditRetrievalWebScript extends StreamContent
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
if (logger.isWarnEnabled())
|
||||
{
|
||||
logger.warn("Ignoring size parameter as '" + size + "' is not a number!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,7 +205,9 @@ public class BaseAuditRetrievalWebScript extends StreamContent
|
||||
catch (ParseException pe)
|
||||
{
|
||||
if (logger.isWarnEnabled())
|
||||
{
|
||||
logger.warn("Ignoring from parameter as '" + from + "' does not conform to the date pattern: " + DATE_PATTERN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,7 +221,9 @@ public class BaseAuditRetrievalWebScript extends StreamContent
|
||||
catch (ParseException pe)
|
||||
{
|
||||
if (logger.isWarnEnabled())
|
||||
{
|
||||
logger.warn("Ignoring to parameter as '" + to + "' does not conform to the date pattern: " + DATE_PATTERN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -89,7 +89,9 @@ public abstract class BaseTransferWebScript extends StreamACP
|
||||
NodeRef filePlan = new NodeRef(new StoreRef(storeType, storeId), nodeId);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Retrieving transfer '" + transferId + "' from file plan: " + filePlan);
|
||||
}
|
||||
|
||||
// ensure the file plan exists
|
||||
if (!this.nodeService.exists(filePlan))
|
||||
|
@@ -158,7 +158,9 @@ public class ExportPost extends StreamACP
|
||||
if (tempACPFile != null)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Deleting temporary archive: " + tempACPFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
tempACPFile.delete();
|
||||
}
|
||||
|
@@ -206,7 +206,9 @@ public class ImportPost extends DeclarativeWebScript
|
||||
FileCopyUtils.copy(acpContent.getInputStream(), fos); // NOTE: this method closes both streams
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Importing uploaded ACP (" + acpFile.getAbsolutePath() + ") into " + nodeRef);
|
||||
}
|
||||
|
||||
// setup the import handler
|
||||
final ACPImportPackageHandler importHandler = new ACPImportPackageHandler(acpFile, "UTF-8");
|
||||
|
@@ -170,7 +170,9 @@ public class TransferReportPost extends BaseTransferWebScript
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Filing transfer report as record in record folder: " + destination);
|
||||
}
|
||||
|
||||
// generate the report (will be in JSON format)
|
||||
report = generateHTMLTransferReport(transferNode);
|
||||
@@ -179,7 +181,9 @@ public class TransferReportPost extends BaseTransferWebScript
|
||||
NodeRef record = fileTransferReport(report, destination);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Filed transfer report as new record: " + record);
|
||||
}
|
||||
|
||||
// return success flag and record noderef as JSON
|
||||
JSONObject responseJSON = new JSONObject();
|
||||
|
@@ -145,7 +145,10 @@ public class SavedSearchDetails extends ReportDetails
|
||||
{
|
||||
description = search.getString(DESCRIPTION);
|
||||
String translated = I18NUtil.getMessage(description);
|
||||
if (translated!=null ) description = translated;
|
||||
if (translated != null)
|
||||
{
|
||||
description = translated;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the query
|
||||
|
Reference in New Issue
Block a user