private GadgetId getGadgetId(final PortletConfiguration portletConfiguration) { return GadgetId.valueOf(portletConfiguration.getId().toString()); } };
private GenericValue getGenericValue(final PortletConfiguration pc) { return delegator.findById(TABLE, pc.getId()); }
@Override @Nonnull public List<Long> load(@Nonnull final Long portletPageId) { List<PortletConfiguration> configs = delegateStore.getByPortalPage(portletPageId); if (configs != null) { List<Long> ownedSearchRequestIds = new ArrayList<Long>(configs.size()); for (final PortletConfiguration config : configs) { ownedSearchRequestIds.add(config.getId()); } return ImmutableList.copyOf(ownedSearchRequestIds); } else { return ImmutableList.of(); } } }
private void removeDashboardItemProperties(final PortletConfiguration portletConfiguration) { if (isLocalDashboardItemWithoutReplacementUri(portletConfiguration.getOpenSocialSpecUri(), portletConfiguration.getCompleteModuleKey())) { removeLocalDashboardItemPreferences(portletConfiguration.getId()); } else { removeOpenSocialGadgetPreferences(portletConfiguration.getId()); } }
@Override public void saveLegacyPortletConfiguration(final PortletConfiguration portletConfiguration) { notNull("portletConfiguration", portletConfiguration); //check the PC exists! final Long id = portletConfiguration.getId(); final PortletConfiguration pc = portletConfigurationManager.getByPortletId(id); if (pc != null) { portletConfigurationManager.store(portletConfiguration); } else { throw new IllegalStateException("Trying to update portletConfiguration that doesn't exist with id '" + id + "'."); } }
LOG.info("Upgrading portletconfig with id '" + pc.getId() + "'"); PropertySet portletPropertySet = propertySetFactory.buildNoncachingPropertySet(OfbizPortletConfigurationStore.TABLE, pc.getId()); Map<String, String> prefs = labelPortletUpgradeTask.convertUserPrefs(portletPropertySet); pc.getId(), pc.getDashboardPageId(), null,
public void delete(final PortletConfiguration pc) { notNull("pc", pc); notNull("pc.id", pc.getId()); final GenericValue gv = getGenericValue(pc); if (gv != null) { removePropertySet(gv); delegator.removeValue(gv); removeDashboardItemProperties(pc); } }
/** * Copy the passed portlet configuration. * * @param portletConfiguration the portlet configuration to copy. * @return the new deeply copied portlet configuration. The underlying property set is cloned into a new memory * property set. */ private PortletConfiguration copyConfiguration(final PortletConfiguration portletConfiguration) { if (portletConfiguration != null) { return new PortletConfigurationImpl(portletConfiguration.getId(), portletConfiguration.getDashboardPageId(), portletConfiguration.getColumn(), portletConfiguration.getRow(), portletConfiguration.getOpenSocialSpecUri(), portletConfiguration.getColor(), portletConfiguration.getUserPrefs(), portletConfiguration.getCompleteModuleKey()); } else { return null; } }
portletConfigurationStore.addDashboardItem(toAdd.getDashboardPageId(), toAdd.getId(), toAdd.getColumn(), toAdd.getRow(), toAdd.getOpenSocialSpecUri(), toAdd.getColor(), toAdd.getUserPrefs(), toAdd.getCompleteModuleKey());
public void visit(final AddGadgetChange addGadgetChange) { final DashboardState.ColumnIndex column = addGadgetChange.getColumnIndex(); final Iterable<DashboardItemState> dashboardItems = updateDashboardState.getDashboardColumns().getItemsInColumn(column); final DashboardItemState newItemState = addGadgetChange.getDashboardItemState(); final Long portalPageId = toLong(updateDashboardState.getId()); final PortletConfiguration pc = toPortletConfiguration(newItemState, portalPageId, column.index(), addGadgetChange.getRowIndex()); portletConfigurationStore.addDashboardItem(pc.getDashboardPageId(), pc.getId(), pc.getColumn(), pc.getRow(), pc.getOpenSocialSpecUri(), pc.getColor(), pc.getUserPrefs(), pc.getCompleteModuleKey()); moveDashboardItemsOnePositionDown(dashboardItems, addGadgetChange.getRowIndex() + 1, column.index()); }