try
{
JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
PortletRegistry registry = locator.getPortletRegistry();
PortletDefinition def = registry.getPortletDefinitionByUniqueName(pdb.getUniqueName());
CloneModalWindow modalWindow = (CloneModalWindow) getPage().get("modalwindow");
RequestContext rc = ((AbstractAdminWebApplication) getApplication()).getPortalRequestContext();
final String pagePath = rc.getPortalURL().getBasePath() + clonePopupPagePath + "?portlet=" + def.getUniqueName();
modalWindow.setPageCreator(new ModalWindow.PageCreator()
{
private static final long serialVersionUID = 1L;
public Page createPage()
{
return new RedirectPage(pagePath);
}
});
((ApplicationsListHome) getPage()).setCurrentModalWindowCloseScript(modalWindow.getCloseJavacript());
target.addComponent(getPage().get("modalWindowCloseScript"));
modalWindow.show(target);
}
catch (Exception e)
{
logger.error("Failed to remove a cloned portlet, {}. {}", pdb.getUniqueName(), e);
StringResourceModel resModel = new StringResourceModel("pam.details.action.status.clonePortletFailure", this, null, new Object [] { pdb.getUniqueName(), e.getMessage() } );
feed.error(resModel.getString());
}
}
};
add(clone);
Link<String> del = new Link<String>("delete")
{
private static final long serialVersionUID = 1L;
public void onClick()
{
PortletDefinitionBean pdb = (PortletDefinitionBean) model.getObject();
FeedbackPanel feed = (FeedbackPanel) getPage().get("feedback");
try
{
JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
PortletRegistry registry = locator.getPortletRegistry();
PortletDefinition def = registry.getPortletDefinitionByUniqueName(pdb.getUniqueName());
if (def != null && def.isClone()) {
registry.removeClone(def);
DataView portletView = (DataView) getPage().get(PORTLET_TABLE);
PortletDataProvider pdp = (PortletDataProvider) portletView.getDataProvider();