throws AccessDenied, InconsistentParameters, InvalidHandle, InvalidRegistration, InvalidUserCategory,
MissingParameters, ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
{
WSRP2ExceptionFactory.throwOperationFailedIfValueIsMissing(clonePortlet, "ClonePortlet");
PortletContext portletContext = clonePortlet.getPortletContext();
WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(portletContext, "PortletContext", "ClonePortlet");
Registration registration = producer.getRegistrationOrFailIfInvalid(clonePortlet.getRegistrationContext());
UserContext userContext = clonePortlet.getUserContext();
checkUserAuthorization(userContext);
org.gatein.pc.api.PortletContext portalPC = WSRPUtils.convertToPortalPortletContext(portletContext);
try
{
RegistrationLocal.setRegistration(registration);
org.gatein.pc.api.PortletContext response = producer.getPortletInvoker().createClone(PortletStateType.OPAQUE, portalPC);
return WSRPUtils.convertToWSRPPortletContext(response);
}
catch (NoSuchPortletException e)
{
throw WSRP2ExceptionFactory.throwWSException(InvalidHandle.class, "Failed to create clone for portlet '" + portletContext.getPortletHandle(), e);
}
catch (InvalidPortletIdException e)
{
throw WSRP2ExceptionFactory.throwWSException(InconsistentParameters.class, "Failed to create clone for portlet '" + portletContext.getPortletHandle(), e);
}
catch (PortletInvokerException e)
{
throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class, "Failed to create clone for portlet '" + portletContext.getPortletHandle(), e);
}
finally
{
RegistrationLocal.setRegistration(null);
}