View Javadoc
1   package fr.paris.lutece.plugins.appcenter.modules.sources.service;
2   
3   import java.util.Locale;
4   
5   import fr.paris.lutece.plugins.appcenter.util.AppCenterUtils;
6   import fr.paris.lutece.portal.service.i18n.I18nService;
7   import fr.paris.lutece.util.ReferenceList;
8   
9   public class SourcesUtil {
10  	
11  	public static final String MARK_REPOSITORY_TYPES = "repository_types";
12  	public static final String MARK_REPOSITORY_TYPES_MAP = "repository_types_map";
13  	   
14  	private static final String[] tabRepositoryTypes= {"site","theme","plugin","module","library"};
15  	private static  String I18n_REPOSITORY_TYPE_PREFIX="module.appcenter.sources.repositoryTypes.label.";
16  	
17  	
18  	public static ReferenceList getAllRepositoryType(Locale locale)
19  	{
20  		
21  		return getAllRepositoryType(locale,true);
22  	}
23  	public static ReferenceList getAllRepositoryType(Locale locale,boolean bWithEmptyFile)
24  	{
25  		
26  		
27  		ReferenceList referenceList=new ReferenceList();
28  		if(bWithEmptyFile)
29  		{
30  			AppCenterUtils.addEmptyItem(referenceList, locale);
31  		}
32  		
33  		for (int i = 0; i < tabRepositoryTypes.length; i++) {
34  			referenceList.addItem(tabRepositoryTypes[i],I18nService.getLocalizedString(getReferentielTypeI18nKey(tabRepositoryTypes[i]), locale));
35  		}
36  		
37  		return referenceList;
38  	
39  	}
40  	
41  
42  	
43  	
44  	
45  	public static String getReferentielTypeI18nKey(String strRefCode)
46  	{
47  		
48  		return I18n_REPOSITORY_TYPE_PREFIX+strRefCode;
49  		
50  	}
51  	
52  
53  }