]> SALOME platform Git repositories - tools/siman.git/commitdiff
Salome HOME
Method is added to get download directory by user id.
authorrkv <rkv@opencascade.com>
Mon, 19 Nov 2012 08:10:10 +0000 (08:10 +0000)
committerrkv <rkv@opencascade.com>
Mon, 19 Nov 2012 08:10:10 +0000 (08:10 +0000)
Workspace/Siman-Common/src/org/splat/service/ScenarioServiceImpl.java
Workspace/Siman-Common/src/org/splat/service/technical/RepositoryService.java
Workspace/Siman-Common/src/org/splat/service/technical/RepositoryServiceImpl.java

index 705b534d17d9ec978a689894cac6c004bbd9137a..3e11657f1ac4414e068616a900d913b5d6dfbcc1 100644 (file)
@@ -357,6 +357,10 @@ public class ScenarioServiceImpl implements ScenarioService {
                return isOk;
        }
 
+       public void checkin(final long scenId, final long userId, final List<StepDTO> scInfo) {
+               
+       }
+       
        /**
         * {@inheritDoc}
         * 
@@ -374,14 +378,14 @@ public class ScenarioServiceImpl implements ScenarioService {
         * @see org.splat.service.ScenarioService#checkout(org.splat.dal.bo.som.Scenario, org.splat.dal.bo.kernel.User)
         */
        public boolean checkout(final Scenario aScenario, final User user) {
-               if (!getStudyService().isStaffedBy(aScenario.getOwnerStudy(), user)) {
-                       return false;
+               boolean res = 
+                       getStudyService().isStaffedBy(aScenario.getOwnerStudy(), user);
+               if (res) {
+                       aScenario.setUser(user);
+                       aScenario.setLastModificationDate(Calendar.getInstance().getTime());
+                       getScenarioDAO().update(aScenario);
                }
-
-               aScenario.setUser(user);
-               aScenario.setLastModificationDate(Calendar.getInstance().getTime());
-               getScenarioDAO().update(aScenario);
-               return true;
+               return res;
        }
 
        /**
index 3965a1a0f08dffa242547773d73926e84b70ffaf..b8a913bb29396b6ff5e2a0bcbc26f5331b187f6c 100644 (file)
@@ -14,20 +14,63 @@ import java.io.File;
 import org.splat.dal.bo.kernel.User;
 
 /**
- * @author RKV
+ * The service for working with the repository. Provides paths to download and vault directory.
  * 
+ * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
  */
 public interface RepositoryService {
 
-       public File getRepositoryIndexDirectory();
+       /**
+        * Get index directory path.
+        * 
+        * @return index directory path
+        */
+       File getRepositoryIndexDirectory();
 
-       public String getRepositoryVaultPath();
+       /**
+        * Get vault path.
+        * 
+        * @return vault path
+        */
+       String getRepositoryVaultPath();
 
-       public String getBasepath();
+       /**
+        * Get repository root path.
+        * 
+        * @return repository root path
+        */
+       String getBasepath();
 
-       public void setBasepath(String basepath);
+       /**
+        * Set repository root path.
+        * 
+        * @param basepath
+        *            repository root path
+        */
+       void setBasepath(String basepath);
 
-       public File getDownloadDirectory(User user);
+       /**
+        * Get download directory for the given user according to his name.
+        * 
+        * @param user
+        *            the user
+        * @return user download directory by user name
+        */
+       File getDownloadDirectory(final User user);
 
-       public String getTemplatePath();
+       /**
+        * Get download directory for a user according to his id.
+        * 
+        * @param userId
+        *            the user id
+        * @return user download directory by user id
+        */
+       File getDownloadDirectory(final long userId);
+
+       /**
+        * Get path to templates folder.
+        * 
+        * @return the path to templates folder
+        */
+       String getTemplatePath();
 }
index 7ad6f13c97d56ccd678cc77c42b440cd921f97c2..b1a6f8151c6a3e67ea195d9aff54ec0e70541404 100644 (file)
@@ -14,44 +14,74 @@ import java.io.File;
 import org.splat.dal.bo.kernel.User;
 
 /**
- * @author RKV
+ * The service for working with the repository. Provides paths to download and vault directory.
  * 
+ * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
  */
 public class RepositoryServiceImpl implements RepositoryService {
 
+       /**
+        * The repository root path.
+        */
        private String _basepath;
 
+       /** 
+        * {@inheritDoc}
+        * @see org.splat.service.technical.RepositoryService#getRepositoryIndexDirectory()
+        */
        public File getRepositoryIndexDirectory() {
                return new File(getBasepath() + "lucin/");
        }
 
+       /** 
+        * {@inheritDoc}
+        * @see org.splat.service.technical.RepositoryService#getRepositoryVaultPath()
+        */
        public String getRepositoryVaultPath() {
                return (getBasepath() + "vault/");
        }
 
-       public File getDownloadDirectory(User user) {
+       /** 
+        * {@inheritDoc}
+        * @see org.splat.service.technical.RepositoryService#getDownloadDirectory(org.splat.dal.bo.kernel.User)
+        */
+       public File getDownloadDirectory(final User user) {
                StringBuffer path = new StringBuffer(_basepath).append("downloads/")
                                .append(user.getUsername()).append("/");
                return new File(path.toString());
        }
 
+       /** 
+        * {@inheritDoc}
+        * @see org.splat.service.technical.RepositoryService#getDownloadDirectory(long)
+        */
+       public File getDownloadDirectory(final long userId) {
+               StringBuffer path = new StringBuffer(_basepath).append("downloads/")
+                               .append(userId).append("/");
+               return new File(path.toString());
+       }
+
+       /** 
+        * {@inheritDoc}
+        * @see org.splat.service.technical.RepositoryService#getTemplatePath()
+        */
        public String getTemplatePath() {
                return (_basepath + "templates/");
        }
 
-       /**
-        * Get the basepath.
-        * @return the basepath
+       /** 
+        * {@inheritDoc}
+        * @see org.splat.service.technical.RepositoryService#getBasepath()
         */
        public String getBasepath() {
                return _basepath;
        }
 
-       /**
-        * Set the basepath.
-        * @param basepath the basepath to set
+       /** 
+        * {@inheritDoc}
+        * @see org.splat.service.technical.RepositoryService#setBasepath(java.lang.String)
         */
-       public void setBasepath(String basepath) {
+       public void setBasepath(final String basepath) {
                _basepath = basepath;
        }
 }