Fixed major issues reported by sonar (Static Variable Name)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@65398 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2014-03-22 16:03:14 +00:00
parent 166ece8ebb
commit 8732f1cc5b
3 changed files with 19 additions and 19 deletions

View File

@@ -30,31 +30,31 @@ import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException; import org.quartz.JobExecutionException;
/** /**
* Base records management job implementation. * Base records management job implementation.
* <p> * <p>
* Delegates job execution and ensures locking * Delegates job execution and ensures locking
* is enforced. * is enforced.
* *
* @author Roy Wetherall * @author Roy Wetherall
*/ */
public class RecordsManagementJob implements Job public class RecordsManagementJob implements Job
{ {
private static long DEFAULT_TIME = 30000L; private static final long DEFAULT_TIME = 30000L;
private JobLockService jobLockService; private JobLockService jobLockService;
private RecordsManagementJobExecuter jobExecuter; private RecordsManagementJobExecuter jobExecuter;
private String jobName; private String jobName;
private QName getLockQName() private QName getLockQName()
{ {
return QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, jobName); return QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, jobName);
} }
/** /**
* Attempts to get the lock. If the lock couldn't be taken, then <tt>null</tt> is returned. * Attempts to get the lock. If the lock couldn't be taken, then <tt>null</tt> is returned.
* *
* @return Returns the lock token or <tt>null</tt> * @return Returns the lock token or <tt>null</tt>
*/ */
private String getLock() private String getLock()
@@ -68,7 +68,7 @@ public class RecordsManagementJob implements Job
return null; return null;
} }
} }
@Override @Override
public void execute(JobExecutionContext context) throws JobExecutionException public void execute(JobExecutionContext context) throws JobExecutionException
{ {
@@ -78,29 +78,29 @@ public class RecordsManagementJob implements Job
{ {
throw new AlfrescoRuntimeException("Job lock service has not been specified."); throw new AlfrescoRuntimeException("Job lock service has not been specified.");
} }
// get the job executer // get the job executer
jobExecuter = (RecordsManagementJobExecuter)context.getJobDetail().getJobDataMap().get("jobExecuter"); jobExecuter = (RecordsManagementJobExecuter)context.getJobDetail().getJobDataMap().get("jobExecuter");
if (jobExecuter == null) if (jobExecuter == null)
{ {
throw new AlfrescoRuntimeException("Job executer has not been specified."); throw new AlfrescoRuntimeException("Job executer has not been specified.");
} }
// get the job name // get the job name
jobName = (String)context.getJobDetail().getJobDataMap().get("jobName"); jobName = (String)context.getJobDetail().getJobDataMap().get("jobName");
if (jobName == null) if (jobName == null)
{ {
throw new AlfrescoRuntimeException("Job name has not been specified."); throw new AlfrescoRuntimeException("Job name has not been specified.");
} }
AuthenticationUtil.runAs(new RunAsWork<Void>() AuthenticationUtil.runAs(new RunAsWork<Void>()
{ {
public Void doWork() throws Exception public Void doWork() throws Exception
{ {
// try and get the lock // try and get the lock
String lockToken = getLock(); String lockToken = getLock();
if (lockToken != null) if (lockToken != null)
{ {
try try
{ {
// do work // do work
@@ -111,8 +111,8 @@ public class RecordsManagementJob implements Job
jobLockService.releaseLock(lockToken, getLockQName()); jobLockService.releaseLock(lockToken, getLockQName());
} }
} }
// return // return
return null; return null;
} }
}, AuthenticationUtil.getSystemUserName()); }, AuthenticationUtil.getSystemUserName());

View File

@@ -41,7 +41,7 @@ import org.springframework.beans.factory.BeanNameAware;
public class RMv2ModelPatch extends ModulePatchComponent public class RMv2ModelPatch extends ModulePatchComponent
implements BeanNameAware, RecordsManagementModel, DOD5015Model implements BeanNameAware, RecordsManagementModel, DOD5015Model
{ {
private static long BATCH_SIZE = 100000L; private static final long BATCH_SIZE = 100000L;
private PatchDAO patchDAO; private PatchDAO patchDAO;
private NodeDAO nodeDAO; private NodeDAO nodeDAO;

View File

@@ -40,7 +40,7 @@ public class RMv22DODModelSeparationModulePatch extends AbstractModulePatch
implements RecordsManagementModel implements RecordsManagementModel
{ {
/** query batch size */ /** query batch size */
private static long BATCH_SIZE = 100000L; private static final long BATCH_SIZE = 100000L;
/** QName DAO */ /** QName DAO */
private QNameDAO qnameDAO; private QNameDAO qnameDAO;