use of com.liferay.faces.bridge.model.internal.UploadedFileBridgeImpl in project liferay-faces-bridge-impl by liferay.
the class ContextMapFactoryImpl method getUploadedFileMap.
@Override
public Map<String, List<UploadedFile>> getUploadedFileMap(PortletRequest portletRequest) {
Map<String, List<UploadedFile>> bridgeUploadedFileMap = Collections.emptyMap();
MultiPartFormData multiPartFormData = (MultiPartFormData) portletRequest.getAttribute(MULTIPART_FORM_DATA_FQCN);
if (multiPartFormData != null) {
Map<String, List<com.liferay.faces.util.model.UploadedFile>> uploadedFileMap = multiPartFormData.getUploadedFileMap();
if (uploadedFileMap != null) {
PortletSession portletSession = portletRequest.getPortletSession(true);
PortletContext portletContext = portletSession.getPortletContext();
Map<String, Object> applicationScopeMap = getApplicationScopeMap(portletContext, true);
ExternalContext externalContext = new ExternalContextProductImpl(applicationScopeMap);
ProductFactory productFactory = (ProductFactory) FactoryExtensionFinder.getFactory(externalContext, ProductFactory.class);
Product PRIMEFACES = productFactory.getProductInfo(Product.Name.PRIMEFACES);
boolean primeFacesDetected = PRIMEFACES.isDetected();
int primeFacesMajorVersion = PRIMEFACES.getMajorVersion();
bridgeUploadedFileMap = new HashMap<String, List<UploadedFile>>(uploadedFileMap.size());
Set<Map.Entry<String, List<com.liferay.faces.util.model.UploadedFile>>> entrySet = uploadedFileMap.entrySet();
for (Map.Entry<String, List<com.liferay.faces.util.model.UploadedFile>> mapEntry : entrySet) {
List<com.liferay.faces.util.model.UploadedFile> uploadedFileList = mapEntry.getValue();
if (uploadedFileList != null) {
List<UploadedFile> bridgeUploadedFileList = new ArrayList<UploadedFile>(uploadedFileList.size());
for (com.liferay.faces.util.model.UploadedFile uploadedFile : uploadedFileList) {
bridgeUploadedFileList.add(new UploadedFileBridgeImpl(uploadedFile, primeFacesDetected, primeFacesMajorVersion));
}
bridgeUploadedFileMap.put(mapEntry.getKey(), bridgeUploadedFileList);
}
}
}
}
return bridgeUploadedFileMap;
}
Aggregations