- Timestamp:
- 04/18/12 15:27:13 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ether_megapoli/trunk/web/src/com/ether/ControllerBackoffice.java
r476 r482 21 21 22 22 import javax.mail.MessagingException; 23 import java.io.File; 23 24 import java.security.DigestException; 24 25 import java.security.NoSuchAlgorithmException; … … 462 463 } 463 464 464 @ControllerMethod( )465 public voidremoveJeu( @NotNull @ParamName(ParameterConstants.PARAMETER_ID) final Integer jeuId )465 @ControllerMethod(jsonResult = true) 466 public JSONObject removeJeu( @NotNull @ParamName(ParameterConstants.PARAMETER_ID) final Integer jeuId ) 466 467 throws WebException 467 468 { … … 469 470 { 470 471 getEtherService().removeJeuById( jeuId ); 472 473 final JSONObject result = new JSONObject(); 474 result.put( "success", "Dataset removed : " ); 475 return result; 471 476 } 472 477 catch( ServiceException e ) … … 482 487 try 483 488 { 489 final JSONObject result = new JSONObject(); 490 484 491 final Jeu jeu = getEtherService().getJeuById( jeuId ); 492 if( null == jeu.getCategorie() || null == jeu.getCategorie().getCategorieNom() ) 493 throw new WebException( WebException.WebCode.JEU_NOT_CORRECT, "ERROR to move jeu to download directory to upload directory" + jeu ); 494 485 495 final String downloadDirectory = (String) getServletContext().getAttribute( "accessDir" ); 486 final String uploadDirectory = (String) getServletContext().getAttribute( "uploadDir" ); 487 final boolean success = getEtherService().moveFilesFromDownloadToUpload( jeu, downloadDirectory, uploadDirectory ); 488 489 final JSONObject result = new JSONObject(); 490 result.put( "success", success ); 496 final String downloadFilesPath = downloadDirectory + File.separatorChar + jeu.getCategorie().getCategorieNom() + File.separatorChar + jeu.getJeuNom(); 497 498 if( !( new File( downloadFilesPath ) ).exists() ) 499 throw new WebException( WebException.WebCode.DOWNLOAD_DIRECTORY_DOESNOT_EXISTS, "The download directory doesn't exists ! No move available" + jeu, WebException.getExceptionThrowable() ); 500 501 else 502 { 503 final String uploadDirectory = (String) getServletContext().getAttribute( "uploadDir" ); 504 final String uploadFilesPath = uploadDirectory + File.separatorChar + jeu.getCategorie().getCategorieNom() + File.separatorChar + jeu.getJeuNom(); 505 506 final boolean success = EtherHelper.moveFiles( downloadFilesPath, uploadFilesPath ); 507 508 if( success ) 509 result.put( "success", "All files moved !" ); 510 else 511 throw new WebException( WebException.WebCode.JEU_NOT_CORRECT, "ERROR to move jeu to download directory to upload directory" + jeu ); 512 } 491 513 return result; 492 514 }
Note: See TracChangeset
for help on using the changeset viewer.