return isOk;
}
+ public void checkin(final long scenId, final long userId, final List<StepDTO> scInfo) {
+
+ }
+
/**
* {@inheritDoc}
*
* @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;
}
/**
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();
}
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;
}
}