Beispiel #1
0
 public UserDTO(GPUser user) {
   super(user);
   this.name = user.getName();
   this.username = user.getUsername();
   this.emailAddress = user.getEmailAddress();
   this.sendEmail = user.isSendEmail();
 }
 @Override
 public boolean shareProjectToUsers(
     long idSharedProject, List<Long> accountIDsProject, HttpServletRequest httpServletRequest)
     throws GeoPlatformException {
   boolean result = false;
   try {
     GPAccount account = this.sessionUtility.getLoggedAccount(httpServletRequest);
     result =
         this.geoPlatformServiceClient.updateAccountsProjectSharing(
             new PutAccountsProjectRequest(idSharedProject, accountIDsProject));
     if (result) {
       MessageDTO message = new MessageDTO();
       message.setCommands(Lists.newArrayList(GPMessageCommandType.OPEN_PROJECT));
       message.setCommandsProperties("" + idSharedProject);
       message.setCreationDate(new Date());
       message.setSenderID(account.getId());
       message.setSubject("Project Shared");
       String sharerName;
       if (account instanceof GPUser) {
         GPUser user = (GPUser) account;
         sharerName = user.getName();
       } else {
         sharerName = account.getNaturalID();
       }
       GPProject project = this.geoPlatformServiceClient.getProjectDetail(idSharedProject);
       message.setText(
           sharerName
               + " shared with you the "
               + project.getName()
               + " project. Do you want to open it?");
       message.setRecipientIDs(accountIDsProject);
       this.geoPlatformServiceClient.insertMultiMessage(message);
     }
   } catch (GPSessionTimeout timeout) {
     throw new GeoPlatformException(timeout);
   } catch (ResourceNotFoundFault | IllegalParameterFault rnf) {
     logger.error(
         "Failed to save Shared project to Accounts for Shared "
             + "Project with id: "
             + idSharedProject
             + "on SecurityService: "
             + rnf);
     throw new GeoPlatformException(rnf);
   }
   return result;
 }