View Javadoc
1   package fr.paris.lutece.plugins.appcenter.modules.support.business;
2   
3   import com.fasterxml.jackson.annotation.JsonIgnore;
4   import fr.paris.lutece.plugins.appcenter.business.Application;
5   import fr.paris.lutece.plugins.appcenter.business.ApplicationHome;
6   
7   import org.hibernate.validator.constraints.NotEmpty;
8   
9   import fr.paris.lutece.plugins.appcenter.business.Demand;
10  import fr.paris.lutece.plugins.appcenter.service.ApplicationService;
11  import fr.paris.lutece.plugins.appcenter.web.Constants;
12  import fr.paris.lutece.portal.service.i18n.I18nService;
13  import fr.paris.lutece.portal.service.template.AppTemplateService;
14  import fr.paris.lutece.portal.service.util.AppLogService;
15  import java.io.IOException;
16  import java.util.HashMap;
17  import java.util.Map;
18  import java.util.List;
19  
20  /**
21   * 
22   * SupportDemand
23   *
24   */
25  public class SupportDemand extends Demand
26  {
27  
28      /**
29      * 
30      */
31      private static final long serialVersionUID = -1360289488188596187L;
32      public static final String ID_DEMAND_TYPE = "support";
33      public static final String DEMAND_TYPE = "support";
34  
35      private static final String TEMPLATE_SOURCES_DEMAND_INFOS = "skin/plugins/appcenter/modules/support/support_demand_infos.html";
36  
37   
38      @NotEmpty( message = "#i18n{module.appcenter.support.validation.questionSupport.notEmpty}" )
39      private String _strQuestionSupport;
40      private List<UploadFile> _listFilesSupport;
41      
42  
43  
44      /**
45       * Get the question for lutece support
46       * @return the question for lutece support
47       */
48      public String getQuestionSupport( ) 
49      {
50              return _strQuestionSupport;
51      }
52  
53      /**
54       * Set the question for lutece support
55       * @param strQuestionSupport
56       */
57      public void setQuestionSupport(String _strQuestionSupport) 
58      {
59              this._strQuestionSupport = _strQuestionSupport;
60      }
61  
62      /**
63       * get the list of files linked to the question for lutece support
64       * @return the list of files linked to the question for lutece support
65       */
66      public List<UploadFile> getListFilesSupport( ) 
67      {
68              return _listFilesSupport;
69      }
70  
71      /**
72       * set the list of files linked to the question for lutece support
73       * @param _listFilesSupport
74       */
75      public void setListFilesSupport(List<UploadFile> _listFilesSupport) 
76      {
77              this._listFilesSupport = _listFilesSupport;
78      }
79  
80     
81      
82      
83      /**
84       * {@inheritDoc}
85       */
86      @Override
87      public String getComplementaryInfos( )
88      {
89          Map<String, Object> model = new HashMap<>( );
90          model.put( MARK_DEMAND, this );
91          
92          if ( this.getIdApplicationData(  ) != null )
93          {
94              Application application = ApplicationHome.findByPrimaryKey( this.getIdApplication( ) );
95              
96              try
97              {
98                  SupportData../../../../../../../fr/paris/lutece/plugins/appcenter/modules/support/business/SupportData.html#SupportData">SupportData data = (SupportData) ApplicationService.loadApplicationDataById(this.getIdApplicationData(), application, SupportsData.class );
99                  model.put( Constants.MARK_DATA, data );
100             }
101             catch( IOException e )
102             {
103                AppLogService.error( e );
104             }
105         }
106         
107         return AppTemplateService.getTemplate( TEMPLATE_SOURCES_DEMAND_INFOS, I18nService.getDefaultLocale( ), model ).getHtml( );
108     }
109 
110     /**
111      * Get the demand type id
112      * 
113      * @return the demand type id
114      */
115     @JsonIgnore
116     @Override
117     public String getIdDemandType( )
118     {
119         return ID_DEMAND_TYPE;
120     }
121 
122     /**
123      * Get the demand type id
124      * 
125      * @return the demand type id
126      */
127     @JsonIgnore
128     @Override
129     public String getDemandType( )
130     {
131         return DEMAND_TYPE;
132     }
133 
134     @JsonIgnore
135     @Override
136     public boolean isDependingOfEnvironment()
137     {
138         return false;
139     }
140 
141 }