protected void importWSRPConsumerPortlet( PortletDataContext portletDataContext, WSRPConsumer wsrpConsumer, Element wsrpConsumerPortletElement, WSRPConsumerPortlet wsrpConsumerPortlet) throws Exception { try { WSRPConsumerPortlet importedWSRPConsumerPortlet = WSRPConsumerPortletLocalServiceUtil.getWSRPConsumerPortlet(wsrpConsumerPortlet.getUuid()); importedWSRPConsumerPortlet.setWsrpConsumerId(wsrpConsumer.getWsrpConsumerId()); importedWSRPConsumerPortlet.setName(wsrpConsumerPortlet.getName()); importedWSRPConsumerPortlet.setPortletHandle(wsrpConsumerPortlet.getPortletHandle()); WSRPConsumerPortletLocalServiceUtil.updateWSRPConsumerPortlet( importedWSRPConsumerPortlet, false); } catch (NoSuchConsumerPortletException nscpe) { ServiceContext serviceContext = portletDataContext.createServiceContext( wsrpConsumerPortletElement, wsrpConsumerPortlet, _NAMESPACE); serviceContext.setUuid(wsrpConsumerPortlet.getUuid()); WSRPConsumerPortletLocalServiceUtil.addWSRPConsumerPortlet( wsrpConsumer.getUuid(), wsrpConsumerPortlet.getName(), wsrpConsumerPortlet.getPortletHandle(), null, serviceContext); } }
protected void exportWSRPConsumer( PortletDataContext portletDataContext, Element wsrpConsumersElement, WSRPConsumer wsrpConsumer) throws Exception { String path = getWSRPConsumerPath(portletDataContext, wsrpConsumer); if (!portletDataContext.isPathNotProcessed(path)) { return; } Element wsrpConsumerElement = wsrpConsumersElement.addElement("wsrp-consumer"); portletDataContext.addClassedModel(wsrpConsumerElement, path, wsrpConsumer, _NAMESPACE); if (portletDataContext.getBooleanParameter(_NAMESPACE, "wsrp-consumer-portlets")) { List<WSRPConsumerPortlet> wsrpConsumerPortlets = WSRPConsumerPortletLocalServiceUtil.getWSRPConsumerPortlets( wsrpConsumer.getWsrpConsumerId(), QueryUtil.ALL_POS, QueryUtil.ALL_POS); Element wsrpConsumerPortletsElement = wsrpConsumerElement.addElement("wsrp-consumer-portlets"); for (WSRPConsumerPortlet wsrpConsumerPortlet : wsrpConsumerPortlets) { exportWSRPConsumerPortlet( portletDataContext, wsrpConsumerPortletsElement, wsrpConsumerPortlet); } } }