Coding standards and consistency sweep across new services code in remote-api project.

Covers spacing, trailing {, @since tags, tabs and copyright headers.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@30216 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2011-09-03 21:52:43 +00:00
parent 6a98ee59eb
commit 7efdd5aa2f
80 changed files with 1389 additions and 1389 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -35,6 +35,10 @@ import org.springframework.extensions.webscripts.DeclarativeWebScript;
import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptRequest;
/**
* @author Brian
* @since 4.0
*/
public class AuthCallbackWebScript extends DeclarativeWebScript
{
private final static Log log = LogFactory.getLog(AuthCallbackWebScript.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -33,6 +33,10 @@ import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptException;
import org.springframework.extensions.webscripts.WebScriptRequest;
/**
* @author Brian
* @since 4.0
*/
public class AuthFormGetWebScript extends DeclarativeWebScript
{
private ChannelService channelService;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -26,6 +26,10 @@ import org.alfresco.service.cmr.publishing.channels.Channel;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.util.UrlUtil;
/**
* @author Brian
* @since 4.0
*/
public class ChannelAuthHelper
{
private String basePath = "/proxy/alfresco/api/publishing/channels/";

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -35,7 +35,6 @@ import org.springframework.extensions.webscripts.WebScriptResponse;
/**
* @author Nick Smith
* @since 4.0
*
*/
public class ChannelPut extends AbstractWebScript
{
@@ -54,7 +53,7 @@ public class ChannelPut extends AbstractWebScript
Map<String, String> params = req.getServiceMatch().getTemplateVars();
String channelId = URLDecoder.decode(params.get(CHANNEL_ID));
Channel channel = channelService.getChannelById(channelId);
if(channel == null)
if (channel == null)
{
String msg = "No channel found for ID: " + channelId;
throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, msg);
@@ -69,7 +68,7 @@ public class ChannelPut extends AbstractWebScript
}
parser.updateChannel(channel, content, channelService);
}
catch(Exception e)
catch (Exception e)
{
String msg = "Failed to Rename Channel: " + channelId + ". POST body: " + content;
throw new WebScriptException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg, e);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -32,6 +32,10 @@ import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptException;
import org.springframework.extensions.webscripts.WebScriptRequest;
/**
* @author Brian
* @since 4.0
*/
public class ChannelReauthWebScript extends DeclarativeWebScript
{
private ChannelService channelService;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -33,6 +33,10 @@ import org.springframework.extensions.webscripts.WebScriptRequest;
import org.springframework.extensions.webscripts.WebScriptResponse;
import org.springframework.util.FileCopyUtils;
/**
* @author Brian
* @since 4.0
*/
public class ChannelTypeIconGetWebScript extends AbstractWebScript
{
private ChannelService channelService;
@@ -85,5 +89,4 @@ public class ChannelTypeIconGetWebScript extends AbstractWebScript
FileCopyUtils.copy(in, out);
in.close();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -33,7 +33,6 @@ import org.springframework.extensions.webscripts.WebScriptRequest;
/**
* @author Nick Smith
* @since 4.0
*
*/
public class ChannelTypesGet extends DeclarativeWebScript
{

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -31,6 +31,10 @@ import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptRequest;
import org.springframework.extensions.webscripts.WebScriptResponse;
/**
* @author Brian
* @since 4.0
*/
public class ChannelsDeleteWebScript extends AbstractWebScript
{
private ChannelService channelService;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -40,7 +40,6 @@ import org.springframework.extensions.webscripts.WebScriptRequest;
/**
* @author Nick Smith
* @since 4.0
*
*/
public class ChannelsGet extends DeclarativeWebScript
{

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -28,6 +28,10 @@ import org.springframework.extensions.webscripts.DeclarativeWebScript;
import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptRequest;
/**
* @author Brian
* @since 4.0
*/
public class ChannelsPostWebScript extends DeclarativeWebScript
{
private ChannelService channelService;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -37,7 +37,6 @@ import org.springframework.extensions.webscripts.WebScriptRequest;
/**
* @author Nick Smith
* @since 4.0
*
*/
public class PUblishingEventsGet extends PublishingWebScript
{
@@ -49,7 +48,7 @@ public class PUblishingEventsGet extends PublishingWebScript
{
Map<String, String> params = req.getServiceMatch().getTemplateVars();
NodeRef node = WebScriptUtil.getNodeRef(params);
if(node == null)
if (node == null)
{
String msg = "A valid NodeRef must be specified!";
throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, msg);
@@ -60,7 +59,7 @@ public class PUblishingEventsGet extends PublishingWebScript
List<Map<String, Object>> model = builder.buildPublishingEventsForNode(events, node, channelService);
return WebScriptUtil.createBaseModel(model);
}
catch(Exception e)
catch (Exception e)
{
String msg = "Failed to query for publishing events for node: " + node;
throw new WebScriptException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg, e);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -42,14 +42,12 @@ import org.json.JSONTokener;
/**
* @author Nick Smith
* @since 4.0
*
*/
public class PublishingJsonParser implements PublishingWebScriptConstants
{
public JSONObject getJson(String jsonStr) throws JSONException
{
if(jsonStr!=null && jsonStr.isEmpty()==false)
if (jsonStr != null && jsonStr.isEmpty() == false)
{
return new JSONObject(new JSONTokener(jsonStr));
}
@@ -60,7 +58,7 @@ public class PublishingJsonParser implements PublishingWebScriptConstants
{
JSONObject json = getJson(jsonStr);
String newName = json.optString(NAME);
if(newName != null && newName.isEmpty() == false)
if (newName != null && newName.isEmpty() == false)
{
channelService.renameChannel(channel, newName);
}
@@ -82,7 +80,7 @@ public class PublishingJsonParser implements PublishingWebScriptConstants
public PublishingDetails setStatusUpdate(PublishingDetails details, JSONObject json)
{
if(json != null)
if (json != null)
{
details.setStatusMessage(json.optString(MESSAGE));
String nodeStr = json.optString(NODE_REF);
@@ -103,7 +101,7 @@ public class PublishingJsonParser implements PublishingWebScriptConstants
private List<String> toStrings(JSONArray json)
{
if(json == null || json.length() == 0)
if (json == null || json.length() == 0)
{
return Collections.emptyList();
}
@@ -114,5 +112,4 @@ public class PublishingJsonParser implements PublishingWebScriptConstants
}
return results;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -46,7 +46,6 @@ import org.springframework.extensions.surf.util.URLEncoder;
/**
* @author Nick Smith
* @since 4.0
*
*/
public class PublishingModelBuilder implements PublishingWebScriptConstants
{
@@ -87,7 +86,7 @@ public class PublishingModelBuilder implements PublishingWebScriptConstants
String channelId = event.getChannelId();
Channel channel = channelService.getChannelById(channelId);
if(channel!= null)
if (channel!= null)
{
model.put(CHANNEL, buildChannel(channel));
}
@@ -224,16 +223,15 @@ public class PublishingModelBuilder implements PublishingWebScriptConstants
NodeSnapshot snapshot = entry.getSnapshot();
model.put(NODEREF, entry.getNodeRef().toString());
String version = snapshot.getVersion();
if(version!=null && version.isEmpty()==false)
if (version != null && version.isEmpty() == false)
{
model.put(VERSION, version);
}
String name = (String) snapshot.getProperties().get(ContentModel.PROP_NAME);
if(name != null && name.isEmpty() == false)
if (name != null && name.isEmpty() == false)
{
model.put(NAME, name);
}
return model;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -33,7 +33,6 @@ import org.springframework.extensions.webscripts.WebScriptRequest;
/**
* @author Nick Smith
* @since 4.0
*
*/
public class PublishingQueuePost extends PublishingWebScript
{
@@ -47,7 +46,7 @@ public class PublishingQueuePost extends PublishingWebScript
try
{
content = WebScriptUtil.getContent(req);
if(content == null || content.isEmpty())
if (content == null || content.isEmpty())
{
throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, "No publishing event was posted!");
}
@@ -56,15 +55,14 @@ public class PublishingQueuePost extends PublishingWebScript
Map<String, Object> eventModel = builder.buildPublishingEvent(event, channelService);
return WebScriptUtil.createBaseModel(eventModel);
}
catch(WebScriptException we)
catch (WebScriptException we)
{
throw we;
}
catch(Exception e)
catch (Exception e)
{
String msg = "Failed to schedule publishing event. POST body: " + content;
throw new WebScriptException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg, e);
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -118,7 +118,6 @@ import org.springframework.extensions.webscripts.TestWebScriptServer.Response;
/**
* @author Nick Smith
* @since 4.0
*
*/
public class PublishingRestApiTest extends BaseWebScriptTest
{
@@ -481,7 +480,7 @@ public class PublishingRestApiTest extends BaseWebScriptTest
for (int i = 0; i < data.length(); i++)
{
JSONObject json = data.optJSONObject(i);
if(typeId.equals(json.optString(ID)))
if (typeId.equals(json.optString(ID)))
{
checkChannelType(json, type);
return;
@@ -504,7 +503,7 @@ public class PublishingRestApiTest extends BaseWebScriptTest
for (int i = 0; i < data.length(); i++)
{
JSONObject json = data.optJSONObject(i);
if(eventId.equals(json.optString(ID)))
if (eventId.equals(json.optString(ID)))
{
PublishingEvent event = publishingService.getPublishingEvent(eventId);
checkJsonEvent(event, json);
@@ -555,7 +554,7 @@ public class PublishingRestApiTest extends BaseWebScriptTest
for (int i = 0; i < jsonArray.length(); i++)
{
JSONObject json = jsonArray.getJSONObject(i);
if(nodeId.equals(json.getString(NODE_REF)))
if (nodeId.equals(json.getString(NODE_REF)))
{
checkNode(entry, json);
return;
@@ -568,12 +567,12 @@ public class PublishingRestApiTest extends BaseWebScriptTest
{
NodeSnapshot snapshot = entry.getSnapshot();
String version = snapshot.getVersion();
if(version != null && version.isEmpty() == false)
if (version != null && version.isEmpty() == false)
{
assertEquals(version, json.getString(VERSION));
}
String name = (String) snapshot.getProperties().get(ContentModel.PROP_NAME);
if(name != null && name.isEmpty() == false)
if (name != null && name.isEmpty() == false)
{
assertEquals(name, json.getString(NAME));
}
@@ -602,7 +601,7 @@ public class PublishingRestApiTest extends BaseWebScriptTest
json.put(CHANNEL_ID, publishChannel.getId());
json.put(COMMENT, comment);
Collection<String> publishNodes = Collections.singleton(node.toString());
if(publish)
if (publish)
{
json.put(PUBLISH_NODES, publishNodes);
}
@@ -610,7 +609,7 @@ public class PublishingRestApiTest extends BaseWebScriptTest
{
json.put(UNPUBLISH_NODES, publishNodes);
}
if(statusMessage != null)
if (statusMessage != null)
{
json.put(STATUS_UPDATE, buildStatusUpdate(statusMessage, node, statusChannels));
}
@@ -649,7 +648,7 @@ public class PublishingRestApiTest extends BaseWebScriptTest
{
JSONObject jsonChannel = json.getJSONObject(i);
String name = jsonChannel.getString(NAME);
if(channel.getName().equals(name))
if (channel.getName().equals(name))
{
checkChannel(jsonChannel, channel);
return;
@@ -719,7 +718,7 @@ public class PublishingRestApiTest extends BaseWebScriptTest
{
for (int i = 0; i < json.length(); i++)
{
if(string.equals(json.getString(i)))
if (string.equals(json.getString(i)))
{
return;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -27,7 +27,6 @@ import org.springframework.extensions.webscripts.DeclarativeWebScript;
/**
* @author Nick Smith
* @since 4.0
*
*/
public abstract class PublishingWebScript extends DeclarativeWebScript
{

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -22,7 +22,6 @@ package org.alfresco.repo.web.scripts.publishing;
/**
* @author Nick Smith
* @since 4.0
*
*/
public interface PublishingWebScriptConstants
{
@@ -74,5 +73,4 @@ public interface PublishingWebScriptConstants
public static final String URL_LENGTH = "urlLength";
public static final String PUBLISHING_CHANNELS = "publishChannels";
public static final String STATUS_UPDATE_CHANNELS = "statusUpdateChannels";
}