Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
make FileService.isNewDocument static (mikado method)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmason committed Jul 16, 2013
1 parent 6e92450 commit 447bc09
Showing 1 changed file with 5 additions and 5 deletions.
Expand Up @@ -229,7 +229,7 @@ private Response tryUploadSourceFile(String projectSlug, String iterationSlug, S
{
tempFile.get().delete();
}
return sourceUploadSuccessResponse(isNewDocument(projectSlug, iterationSlug, docId), totalChunks);
return sourceUploadSuccessResponse(isNewDocument(projectSlug, iterationSlug, docId, documentDAO), totalChunks);
}
catch (ChunkUploadException e)
{
Expand Down Expand Up @@ -417,12 +417,12 @@ private static boolean isSinglePart(DocumentFileUploadForm uploadForm)

private boolean useOfflinePo(String projectSlug, String iterationSlug, String docId)
{
return !isNewDocument(projectSlug, iterationSlug, docId) && !translationFileServiceImpl.isPoDocument(projectSlug, iterationSlug, docId);
return !isNewDocument(projectSlug, iterationSlug, docId, documentDAO) && !translationFileServiceImpl.isPoDocument(projectSlug, iterationSlug, docId);
}

private boolean isNewDocument(String projectSlug, String iterationSlug, String docId)
private static boolean isNewDocument(String projectSlug, String iterationSlug, String docId, DocumentDAO dao)
{
return documentDAO.getByProjectIterationAndDocId(projectSlug, iterationSlug, docId) == null;
return dao.getByProjectIterationAndDocId(projectSlug, iterationSlug, docId) == null;
}

private File combineToTempFile(HDocumentUpload upload) throws SQLException
Expand Down Expand Up @@ -840,7 +840,7 @@ private void checkValidTranslationUploadType(DocumentFileUploadForm uploadForm)

private void checkDocumentExists(String projectSlug, String iterationSlug, String docId, DocumentFileUploadForm uploadForm)
{
if (isNewDocument(projectSlug, iterationSlug, docId))
if (isNewDocument(projectSlug, iterationSlug, docId, documentDAO))
{
throw new ChunkUploadException(Status.NOT_FOUND,
"No document with id \"" + docId + "\" exists in project-version \"" +
Expand Down

0 comments on commit 447bc09

Please sign in to comment.