View Javadoc
1   package fr.paris.lutece.plugins.appcenter.modules.sources.service;
2   
3   import java.util.ArrayList;
4   import java.util.Locale;
5   
6   import javax.inject.Inject;
7   import javax.servlet.http.HttpServletRequest;
8   
9   import com.rometools.rome.feed.rss.Source;
10  
11  import fr.paris.lutece.plugins.appcenter.business.Application;
12  import fr.paris.lutece.plugins.appcenter.business.ApplicationHome;
13  import fr.paris.lutece.plugins.appcenter.business.Demand;
14  import fr.paris.lutece.plugins.appcenter.business.DemandHome;
15  import fr.paris.lutece.plugins.appcenter.modules.sources.business.SourceUserData;
16  import fr.paris.lutece.plugins.appcenter.modules.sources.business.SourceUserDemand;
17  import fr.paris.lutece.plugins.appcenter.modules.sources.business.SourcesData;
18  import fr.paris.lutece.plugins.appcenter.modules.sources.business.SourcesDatas;
19  import fr.paris.lutece.plugins.appcenter.modules.sources.business.SourcesDemand;
20  import fr.paris.lutece.plugins.appcenter.modules.sources.web.SourcesTaskComponent;
21  import fr.paris.lutece.plugins.appcenter.service.ApplicationService;
22  import fr.paris.lutece.plugins.appcenter.service.task.AppCenterTaskFunctional;
23  import fr.paris.lutece.plugins.appcenter.service.task.AppcenterTask;
24  import fr.paris.lutece.plugins.workflowcore.business.resource.ResourceHistory;
25  import fr.paris.lutece.plugins.workflowcore.service.resource.IResourceHistoryService;
26  import fr.paris.lutece.plugins.workflowcore.service.task.SimpleTask;
27  import fr.paris.lutece.util.bean.BeanUtil;
28  import fr.paris.lutece.util.beanvalidation.BeanValidationUtil;
29  
30  public class SourcesTask extends AppcenterTask
31  {
32  
33     @Override
34      public String getTitle( Locale locale )
35      {
36          // TODO
37          return "Sources";
38      }
39  
40      @Override
41      public void processTask( int nIdResourceHistory, HttpServletRequest request, Locale locale )
42      {
43      	 AppCenterTaskFunctional<SourcesData, SourcesDatas, SourcesDemand> funct=( requestParam,  localeParam, applicationDataParam, applicationDatasParam,demandParam)-> addUsers(requestParam,applicationDataParam,demandParam);
44           super.processTask(nIdResourceHistory, request, locale, SourcesData.class, SourcesDatas.class, SourcesDemand.class,funct);
45  
46      }
47      
48      
49      
50      public void  addUsers(HttpServletRequest request, SourcesData sourcesData,SourcesDemand demand )
51      {
52      	
53      	 sourcesData.setListUserData( new ArrayList<>( ) );
54           SourceUserData userData=null;
55           for(SourceUserDemand user: demand.getListSourceUserDemand( ))
56           {
57               userData=new SourceUserData( );
58               if(request.getParameter( user.getUserName( ) )!=null)
59               {
60                   userData.setUserName( user.getUserName( ) );
61                   userData.setEmail( user.getEmail( ) );
62                   sourcesData.getListUserData( ).add( userData );
63               }
64            
65            }
66      }
67  	
68      
69      
70      
71      
72  
73  }