From ff686134c8abd72923724832619ccdf9b3e814a0 Mon Sep 17 00:00:00 2001 From: rkv Date: Thu, 29 Nov 2012 12:02:54 +0000 Subject: [PATCH] File id is added to the checked out info. --- .../splat/service/ScenarioServiceImpl.java | 11 +++--- .../org/splat/service/dto/DocumentDTO.java | 6 ++-- .../src/org/splat/service/dto/FileDTO.java | 33 +++++++++++++++-- .../splat/service/TestScenarioService.java | 2 +- Workspace/Siman-Common/testng_checkout.xml | 35 +++++++++++++++++++ 5 files changed, 76 insertions(+), 11 deletions(-) create mode 100644 Workspace/Siman-Common/testng_checkout.xml diff --git a/Workspace/Siman-Common/src/org/splat/service/ScenarioServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/ScenarioServiceImpl.java index 1ebc962..70714a6 100644 --- a/Workspace/Siman-Common/src/org/splat/service/ScenarioServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/ScenarioServiceImpl.java @@ -242,12 +242,13 @@ public class ScenarioServiceImpl implements ScenarioService { } else { processing = "file-download"; } - docDTO.addFile(tag.value().getFile().getRelativePath(), aState, - processing, false); + File aFile = tag.value().getFile(); + docDTO.addFile(aFile.getIndex(), aFile.getRelativePath(), + aState, processing, false); // Process all exported files for (Relation rel : tag.value().getRelations( ConvertsRelation.class)) { - File aFile = ((ConvertsRelation) rel).getTo(); + aFile = ((ConvertsRelation) rel).getTo(); fileFormat = aFile.getFormat(); doImport = getProjectSettings().doImport(docType, fileFormat); @@ -256,8 +257,8 @@ public class ScenarioServiceImpl implements ScenarioService { } else { processing = "file-download"; } - docDTO.addFile(aFile.getRelativePath(), aState, processing, - false); + docDTO.addFile(aFile.getIndex(), aFile.getRelativePath(), + aState, processing, false); } } } diff --git a/Workspace/Siman-Common/src/org/splat/service/dto/DocumentDTO.java b/Workspace/Siman-Common/src/org/splat/service/dto/DocumentDTO.java index 7e7f4c3..29d6fdb 100644 --- a/Workspace/Siman-Common/src/org/splat/service/dto/DocumentDTO.java +++ b/Workspace/Siman-Common/src/org/splat/service/dto/DocumentDTO.java @@ -100,6 +100,8 @@ public class DocumentDTO { /** * Add a new file DTO. * + * @param id + * file persistent id * @param relativePath * relative file path * @param state @@ -110,9 +112,9 @@ public class DocumentDTO { * true if the file is result * @return the added file DTO */ - public FileDTO addFile(final String relativePath, final char state, + public FileDTO addFile(final long id, final String relativePath, final char state, final String processing, final boolean isResult) { - FileDTO fileDTO = new FileDTO(relativePath, state, processing, isResult); + FileDTO fileDTO = new FileDTO(id, relativePath, state, processing, isResult); _files.add(fileDTO); return fileDTO; } diff --git a/Workspace/Siman-Common/src/org/splat/service/dto/FileDTO.java b/Workspace/Siman-Common/src/org/splat/service/dto/FileDTO.java index 99405b6..4a679ca 100644 --- a/Workspace/Siman-Common/src/org/splat/service/dto/FileDTO.java +++ b/Workspace/Siman-Common/src/org/splat/service/dto/FileDTO.java @@ -15,6 +15,10 @@ package org.splat.service.dto; */ public class FileDTO { + /** + * File persistent id. + */ + private Long _id; /** * True if the file is a result file for a document. */ @@ -35,6 +39,8 @@ public class FileDTO { /** * Constructor with initialization. * + * @param id + * file persistent id * @param relativePath * relative file path * @param state @@ -44,14 +50,15 @@ public class FileDTO { * @param isResult * true if the file is result */ - public FileDTO(final String relativePath, final char state, + public FileDTO(final long id, final String relativePath, final char state, final String processing, final boolean isResult) { + _id = id; _path = relativePath; _state = state; _processing = processing; _isResult = isResult; } - + /** * Constructor with partial initialization. * @@ -156,10 +163,30 @@ public class FileDTO { fstate = "file-outdated"; } buf.append(indent).append(ftype).append(" file: ").append(getPath()) - .append('\n').append(indent).append( + .append('\n').append(indent).append(" File ID: ").append( + getId()).append('\n').append(indent).append( " Automatic processing: ").append(getProcessing()) .append('\n').append(indent).append(" State: ").append( fstate).append('\n'); return buf.toString(); } + + /** + * Get the id. + * + * @return the id + */ + public Long getId() { + return _id; + } + + /** + * Set the id. + * + * @param id + * the id to set + */ + public void setId(final Long id) { + _id = id; + } } diff --git a/Workspace/Siman-Common/src/test/splat/service/TestScenarioService.java b/Workspace/Siman-Common/src/test/splat/service/TestScenarioService.java index 3670fa2..d064e2f 100644 --- a/Workspace/Siman-Common/src/test/splat/service/TestScenarioService.java +++ b/Workspace/Siman-Common/src/test/splat/service/TestScenarioService.java @@ -151,7 +151,7 @@ public class TestScenarioService extends BaseTest { * @throws SQLException * if scenario creation is failed */ - @Test + @Test(groups = { "checkout", "sevice", "functional", "business" }) public void testGetScenarioInfo() throws InvalidPropertyException, MissedPropertyException, MultiplyDefinedException, IOException, SQLException { diff --git a/Workspace/Siman-Common/testng_checkout.xml b/Workspace/Siman-Common/testng_checkout.xml new file mode 100644 index 0000000..9a3dd6f --- /dev/null +++ b/Workspace/Siman-Common/testng_checkout.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + -- 2.39.2