mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Fixed major bugs (Avoid commented-out lines of code) reported in Sonar
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@74411 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -182,7 +182,6 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
||||
@SuppressWarnings("unused")
|
||||
public List<RecordsManagementAction> getDispositionActions(NodeRef nodeRef)
|
||||
{
|
||||
//String userName = AuthenticationUtil.getFullyAuthenticatedUser();
|
||||
List<RecordsManagementAction> result = new ArrayList<RecordsManagementAction>(this.rmActions.size());
|
||||
|
||||
for (RecordsManagementAction action : this.rmActions.values())
|
||||
|
@@ -258,96 +258,6 @@ public class BroadcastDispositionActionDefinitionUpdateAction extends RMActionEx
|
||||
nodeService.setProperty(nextAction.getNodeRef(), PROP_DISPOSITION_AS_OF, newAsOfDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Persists any changes made to the events on the given disposition action
|
||||
* definition on the given next action.
|
||||
*
|
||||
* @param dispositionActionDef The disposition action definition node
|
||||
* @param nextAction The next disposition action
|
||||
*/
|
||||
// @SuppressWarnings("unchecked")
|
||||
// private void persistEventChanges(NodeRef dispositionActionDef, DispositionAction nextAction)
|
||||
// {
|
||||
// // go through the current events on the next action and remove any that are not present any more
|
||||
// List<String> stepEvents = (List<String>) nodeService.getProperty(dispositionActionDef, PROP_DISPOSITION_EVENT);
|
||||
// List<EventCompletionDetails> eventsList = nextAction.getEventCompletionDetails();
|
||||
// List<String> nextActionEvents = new ArrayList<String>(eventsList.size());
|
||||
// for (EventCompletionDetails event : eventsList)
|
||||
// {
|
||||
// // take note of the event names present on the next action
|
||||
// String eventName = event.getEventName();
|
||||
// nextActionEvents.add(eventName);
|
||||
//
|
||||
// // if the event has been removed delete from next action
|
||||
// if (stepEvents != null && !stepEvents.contains(event.getEventName()))
|
||||
// {
|
||||
// // remove the child association representing the event
|
||||
// nodeService.removeChild(nextAction.getNodeRef(), event.getNodeRef());
|
||||
//
|
||||
// if (logger.isDebugEnabled())
|
||||
// {
|
||||
// logger.debug("Removed '" + eventName + "' from next action '" + nextAction.getName() +
|
||||
// "' (" + nextAction.getNodeRef() + ")");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // go through the disposition action definition step events and add any new ones
|
||||
// if (stepEvents != null)
|
||||
// {
|
||||
// for (String eventName : stepEvents)
|
||||
// {
|
||||
// if (!nextActionEvents.contains(eventName))
|
||||
// {
|
||||
// createEvent(recordsManagementEventService.getEvent(eventName), nextAction.getNodeRef());
|
||||
//
|
||||
// if (logger.isDebugEnabled())
|
||||
// {
|
||||
// logger.debug("Added '" + eventName + "' to next action '" + nextAction.getName() +
|
||||
// "' (" + nextAction.getNodeRef() + ")");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // NOTE: eventsList contains all the events that have been updated!
|
||||
// // TODO: manually update the search properties for the parent node!
|
||||
//
|
||||
// // finally since events may have changed re-calculate the events eligible flag
|
||||
// boolean eligible = updateEventEligible(nextAction);
|
||||
//
|
||||
// if (logger.isDebugEnabled())
|
||||
// {
|
||||
// logger.debug("Set events eligible flag to '" + eligible + "' for next action '" + nextAction.getName() +
|
||||
// "' (" + nextAction.getNodeRef() + ")");
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Creates the given records management event for the given 'next action'.
|
||||
// *
|
||||
// * @param event The event to create
|
||||
// * @param nextActionNodeRef The next action node
|
||||
// * @return The created event NodeRef
|
||||
// */
|
||||
// protected NodeRef createEvent(RecordsManagementEvent event, NodeRef nextActionNodeRef)
|
||||
// {
|
||||
// NodeRef eventNodeRef = null;
|
||||
//
|
||||
// Map<QName, Serializable> eventProps = new HashMap<QName, Serializable>(7);
|
||||
// eventProps.put(PROP_EVENT_EXECUTION_NAME, event.getName());
|
||||
// // TODO display label
|
||||
// RecordsManagementEventType eventType = recordsManagementEventService.getEventType(event.getType());
|
||||
// eventProps.put(PROP_EVENT_EXECUTION_AUTOMATIC, eventType.isAutomaticEvent());
|
||||
// eventProps.put(PROP_EVENT_EXECUTION_COMPLETE, false);
|
||||
//
|
||||
// // Create the event execution object
|
||||
// this.nodeService.createNode(nextActionNodeRef, ASSOC_EVENT_EXECUTIONS,
|
||||
// ASSOC_EVENT_EXECUTIONS, TYPE_EVENT_EXECUTION, eventProps);
|
||||
//
|
||||
// return eventNodeRef;
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected void addParameterDefinitions(List<ParameterDefinition> paramList)
|
||||
{
|
||||
|
@@ -1167,9 +1167,6 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
|
||||
|
||||
if (assocDef.isChild())
|
||||
{
|
||||
// TODO: Ask for a more efficient method such as
|
||||
// nodeService.removeChildAssociation(fromNode, toNode, chRef.getTypeQName(), null);
|
||||
|
||||
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
||||
{
|
||||
@Override
|
||||
@@ -1307,7 +1304,6 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
|
||||
if (existsLabel(compoundID))
|
||||
{
|
||||
return null;
|
||||
//throw new IllegalArgumentException(I18NUtil.getMessage(MSG_REF_LABEL_IN_USE, compoundID));
|
||||
}
|
||||
|
||||
// defaults to RM_CUSTOM_URI
|
||||
@@ -1448,13 +1444,6 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public void addCustomConstraintDefinition(QName constraintName, String description, Map<String, Object> parameters)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
*/
|
||||
|
||||
public void changeCustomConstraintValues(QName constraintName, List<String> newAllowedValues)
|
||||
{
|
||||
ParameterCheck.mandatory("constraintName", constraintName);
|
||||
|
@@ -446,18 +446,6 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
||||
maxSize = Integer.valueOf(maxSize + returnedObject.getResultSetMetaData().getSearchParameters().getSkipCount());
|
||||
}
|
||||
|
||||
// int maxChecks = maxPermissionChecks;
|
||||
// if (returnedObject.getResultSetMetaData().getSearchParameters().getMaxPermissionChecks() >= 0)
|
||||
// {
|
||||
// maxChecks = returnedObject.getResultSetMetaData().getSearchParameters().getMaxPermissionChecks();
|
||||
// }
|
||||
|
||||
// long maxCheckTime = maxPermissionCheckTimeMillis;
|
||||
// if (returnedObject.getResultSetMetaData().getSearchParameters().getMaxPermissionCheckTimeMillis() >= 0)
|
||||
// {
|
||||
// maxCheckTime = returnedObject.getResultSetMetaData().getSearchParameters().getMaxPermissionCheckTimeMillis();
|
||||
// }
|
||||
|
||||
if (supportedDefinitions.size() == 0)
|
||||
{
|
||||
if (maxSize == null)
|
||||
@@ -505,15 +493,6 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
||||
for (int i = 0; i < returnedObject.length(); i++)
|
||||
{
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
// if (i >= maxChecks || (currentTimeMillis - startTimeMillis) > maxCheckTime)
|
||||
// {
|
||||
// filteringResultSet.setResultSetMetaData(
|
||||
// new SimpleResultSetMetaData(
|
||||
// LimitBy.NUMBER_OF_PERMISSION_EVALUATIONS,
|
||||
// PermissionEvaluationMode.EAGER,
|
||||
// returnedObject.getResultSetMetaData().getSearchParameters()));
|
||||
// break;
|
||||
// }
|
||||
|
||||
// All permission checks must pass
|
||||
inclusionMask.set(i, true);
|
||||
|
@@ -383,11 +383,6 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
||||
}
|
||||
}
|
||||
|
||||
//if (! found)
|
||||
//{
|
||||
//throw new AlfrescoRuntimeException("Constraint does not exist (or is not used): "+conStr);
|
||||
//}
|
||||
|
||||
if (allowedValues != null)
|
||||
{
|
||||
if (logger.isInfoEnabled())
|
||||
|
@@ -44,7 +44,6 @@ import org.springframework.extensions.surf.util.I18NUtil;
|
||||
*/
|
||||
public class RMListOfValuesConstraint extends ListOfValuesConstraint
|
||||
{
|
||||
//private static final String ERR_NO_VALUES = "d_dictionary.constraint.list_of_values.no_values";
|
||||
private static final String ERR_NON_STRING = "d_dictionary.constraint.string_length.non_string";
|
||||
private static final String ERR_INVALID_VALUE = "d_dictionary.constraint.list_of_values.invalid_value";
|
||||
private static final String LOV_CONSTRAINT_VALUE = "listconstraint";
|
||||
|
@@ -75,7 +75,6 @@ public class DispositionActionDefinitionImpl implements DispositionActionDefinit
|
||||
*/
|
||||
public DispositionActionDefinitionImpl(RecordsManagementEventService recordsManagementEventService, RecordsManagementActionService recordsManagementActionService, NodeService nodeService, NodeRef nodeRef, int index)
|
||||
{
|
||||
//this.services = services;
|
||||
this.recordsManagementEventService = recordsManagementEventService;
|
||||
this.recordsManagementActionService = recordsManagementActionService;
|
||||
this.nodeService = nodeService;
|
||||
|
@@ -49,7 +49,6 @@ public class FreezeServiceImpl extends ServiceBaseImpl
|
||||
RecordsManagementModel
|
||||
{
|
||||
/** I18N */
|
||||
//private static final String MSG_FREEZE_ONLY_RECORDS_FOLDERS = "rm.action.freeze-only-records-folders";
|
||||
private static final String MSG_HOLD_NAME = "rm.hold.name";
|
||||
|
||||
/** File Plan Service */
|
||||
|
@@ -105,7 +105,6 @@ public class RecordFolderType extends AbstractDisposableItem
|
||||
{
|
||||
if (!oldChildAssocRef.getParentRef().equals(newChildAssocRef.getParentRef()))
|
||||
{
|
||||
//final NodeRef oldNodeRef = oldChildAssocRef.getChildRef();
|
||||
final NodeRef newNodeRef = newChildAssocRef.getChildRef();
|
||||
|
||||
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>()
|
||||
@@ -127,7 +126,7 @@ public class RecordFolderType extends AbstractDisposableItem
|
||||
// Re-initiate the records in the new folder.
|
||||
recordService.file(record);
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
}, AuthenticationUtil.getSystemUserName());
|
||||
|
@@ -34,17 +34,17 @@ import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||
|
||||
/**
|
||||
* RM saved searches GET web script
|
||||
*
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
*/
|
||||
public class RMSavedSearchesGet extends DeclarativeWebScript
|
||||
{
|
||||
/** Records management search service */
|
||||
protected RecordsManagementSearchService recordsManagementSearchService;
|
||||
|
||||
|
||||
/** Site service */
|
||||
protected SiteService siteService;
|
||||
|
||||
|
||||
/**
|
||||
* @param recordsManagementSearchService records management search service
|
||||
*/
|
||||
@@ -52,7 +52,7 @@ public class RMSavedSearchesGet extends DeclarativeWebScript
|
||||
{
|
||||
this.recordsManagementSearchService = recordsManagementSearchService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param siteService site service
|
||||
*/
|
||||
@@ -60,7 +60,7 @@ public class RMSavedSearchesGet extends DeclarativeWebScript
|
||||
{
|
||||
this.siteService = siteService;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache)
|
||||
*/
|
||||
@@ -71,7 +71,7 @@ public class RMSavedSearchesGet extends DeclarativeWebScript
|
||||
Map<String, Object> model = new HashMap<String, Object>(13);
|
||||
|
||||
// Get the site id and confirm it is valid
|
||||
Map<String, String> templateVars = req.getServiceMatch().getTemplateVars();
|
||||
Map<String, String> templateVars = req.getServiceMatch().getTemplateVars();
|
||||
String siteId = templateVars.get("site");
|
||||
if (siteId == null || siteId.length() == 0)
|
||||
{
|
||||
@@ -81,15 +81,7 @@ public class RMSavedSearchesGet extends DeclarativeWebScript
|
||||
{
|
||||
throw new WebScriptException(Status.STATUS_NOT_FOUND, "Site not found.");
|
||||
}
|
||||
|
||||
// TODO determine whether this is still relevant
|
||||
// String isPublicString = req.getParameter("p");
|
||||
// boolean isPublic = false;
|
||||
// if (isPublicString != null && isPublicString.length() != 0)
|
||||
// {
|
||||
// isPublic = Boolean.parseBoolean(isPublicString);
|
||||
// }
|
||||
|
||||
|
||||
// Get the saved search details
|
||||
List<SavedSearchDetails> details = recordsManagementSearchService.getSavedSearches(siteId);
|
||||
List<Item> items = new ArrayList<Item>();
|
||||
@@ -100,15 +92,15 @@ public class RMSavedSearchesGet extends DeclarativeWebScript
|
||||
String query = savedSearchDetails.getCompatibility().getQuery();
|
||||
String params = savedSearchDetails.getCompatibility().getParams();
|
||||
String sort = savedSearchDetails.getCompatibility().getSort();
|
||||
|
||||
|
||||
Item item = new Item(name, description, query, params, sort);
|
||||
items.add(item);
|
||||
}
|
||||
|
||||
|
||||
model.put("savedSearches", items);
|
||||
return model;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Item class to contain information about items being placed in model.
|
||||
*/
|
||||
@@ -119,7 +111,7 @@ public class RMSavedSearchesGet extends DeclarativeWebScript
|
||||
private String query;
|
||||
private String params;
|
||||
private String sort;
|
||||
|
||||
|
||||
public Item(String name, String description, String query, String params, String sort)
|
||||
{
|
||||
this.name = name;
|
||||
@@ -128,27 +120,27 @@ public class RMSavedSearchesGet extends DeclarativeWebScript
|
||||
this.params = params;
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
|
||||
public String getQuery()
|
||||
{
|
||||
return query;
|
||||
}
|
||||
|
||||
|
||||
public String getParams()
|
||||
{
|
||||
return params;
|
||||
}
|
||||
|
||||
|
||||
public String getSort()
|
||||
{
|
||||
return sort;
|
||||
|
@@ -94,16 +94,6 @@ public class RMSavedSearchesPost extends DeclarativeWebScript
|
||||
throw new WebScriptException(Status.STATUS_NOT_FOUND, "Site not found.");
|
||||
}
|
||||
|
||||
// Example format of posted Saved Search JSON:
|
||||
// {
|
||||
// "name": "search name",
|
||||
// "description": "the search description",
|
||||
// "query": "the complete search query string",
|
||||
// "public": boolean,
|
||||
// "params": "terms=keywords:xyz&undeclared=true",
|
||||
// "sort": "cm:name/asc"
|
||||
//}
|
||||
|
||||
try
|
||||
{
|
||||
// Parse the JSON passed in the request
|
||||
|
@@ -52,21 +52,6 @@ public class RequestInfoNotifier implements TaskListener
|
||||
// Assign the task to the initiator
|
||||
String initiator = RequestInfoUtils.getInitiator(delegateTask);
|
||||
delegateTask.setAssignee(initiator);
|
||||
|
||||
// FIXME: Is sending an email required?
|
||||
// At the moment we do not use email templates
|
||||
/*
|
||||
// Create the context and send an email to the initiator
|
||||
NotificationContext notificationContext = new NotificationContext();
|
||||
notificationContext.setAsyncNotification(true);
|
||||
notificationContext.setIgnoreNotificationFailure(true);
|
||||
notificationContext.addTo(initiator);
|
||||
notificationContext.setSubject(getEmailSubject(recordName));
|
||||
notificationContext.setBody(getEmailBody(recordName));
|
||||
|
||||
// Send the email
|
||||
RequestInfoUtils.getServiceRegistry().getNotificationService().sendNotification(EMailNotificationProvider.NAME, notificationContext);
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,40 +69,4 @@ public class RequestInfoNotifier implements TaskListener
|
||||
sb.append("'");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method for building the email subject
|
||||
*
|
||||
* @param recordName The name of the record
|
||||
* @return Returns the email subject
|
||||
*/
|
||||
// private String getEmailSubject(String recordName)
|
||||
// {
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// sb.append(I18NUtil.getMessage("activitiReviewPooled.workflow.email.subject"));
|
||||
// sb.append(" '");
|
||||
// sb.append(recordName);
|
||||
// sb.append("'");
|
||||
// return sb.toString();
|
||||
// }
|
||||
|
||||
/**
|
||||
* Helper method for building the email body
|
||||
*
|
||||
* @param recordName The name of the record
|
||||
* @return Returns the email body
|
||||
*/
|
||||
// private String getEmailBody(String recordName)
|
||||
// {
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// sb.append(I18NUtil.getMessage("activitiReviewPooled.workflow.email.body1"));
|
||||
// sb.append(" '");
|
||||
// sb.append(AuthenticationUtil.getFullyAuthenticatedUser());
|
||||
// sb.append("' ");
|
||||
// sb.append(I18NUtil.getMessage("activitiReviewPooled.workflow.email.body2"));
|
||||
// sb.append(" '");
|
||||
// sb.append(recordName);
|
||||
// sb.append("'.");
|
||||
// return sb.toString();
|
||||
// }
|
||||
}
|
||||
|
Reference in New Issue
Block a user