{
RegistrationLocal.setRegistration(registration);
byte[] importContext = importPortlets.getImportContext();
Lifetime lifeTime = importPortlets.getLifetime();
List<ImportedPortlet> importedPortlets = new ArrayList<ImportedPortlet>();
Map<String, ImportPortletsFailed> failedPortletsMap = new HashMap<String, ImportPortletsFailed>();
ExportContext exportContext;
try
{
exportContext = producer.getExportManager().createExportContext(importContext);
}
catch (Exception e)
{
throw WSRPExceptionFactory.createWSException(OperationFailed.class, "Invalid ImportContext.", e);
}
for (ImportPortlet importPortlet : importPortletList)
{
try
{
byte[] portletData = importPortlet.getExportData();
ExportPortletData exportPortletData;
if (lifeTime != null)
{
long currentTime = toLongDate(lifeTime.getCurrentTime());
long terminationTime = toLongDate(lifeTime.getTerminationTime());
long refreshDuration = lifeTime.getRefreshDuration().getTimeInMillis(lifeTime.getCurrentTime().toGregorianCalendar());
exportPortletData = producer.getExportManager().createExportPortletData(exportContext, currentTime, terminationTime, refreshDuration, portletData);
}
else
{
exportPortletData = producer.getExportManager().createExportPortletData(exportContext, -1, -1, -1, portletData);