protected String getPersistentLayoutNodeId(IPortletDefinitionId portletDefinitionId) { return TransientUserLayoutManagerWrapper.SUBSCRIBE_PREFIX + "." + portletDefinitionId.getStringId(); }
public PortletDefinitionImpl( IPortletType portletType, String fname, String name, String title, String applicationId, String portletName, boolean isFramework, IPortletDefinitionId Id) { Validate.notNull(portletType); Validate.notNull(name); Validate.notNull(fname); Validate.notNull(title); if (!isFramework) { Validate.notNull(applicationId); } Validate.notNull(portletName); this.internalPortletDefinitionId = Id.getLongId(); this.entityVersion = -1; this.portletPreferences = new PortletPreferencesImpl(); this.portletType = portletType; this.name = name; this.fname = fname; this.title = title; this.portletDescriptorKey = new PortletDescriptorKeyImpl(); this.portletDescriptorKey.setWebAppName(applicationId); this.portletDescriptorKey.setPortletName(portletName); this.portletDescriptorKey.setFrameworkPortlet(isFramework); }
portletDefinition.getPortletDefinitionId().getStringId())) { portletDefinition.getPortletDefinitionId().getLongId(), fname, portletDefinition.getTitle(locale.toString()),
protected long getNativePortletDefinitionId(IPortletDefinitionId portletDefinitionId) { return Long.parseLong(portletDefinitionId.getStringId()); }
@Before public void setup() throws Exception { MockitoAnnotations.initMocks(this); portletEntityCache = new PortletEntityCache(); when(portletEntityId.getStringId()).thenReturn("110_u18l1n1203_60"); when(portletDefinitionId.getLongId()).thenReturn(1010L); when(portletEntityDescriptor.getLayoutNodeId()).thenReturn("u18l1n1203"); when(portletEntityDescriptor.getPortletDefinitionId()).thenReturn(portletDefinitionId); when(portletEntityDescriptor.getPortletEntityId()).thenReturn(portletEntityId); when(portletEntityDescriptor.getUserId()).thenReturn(60); }
public PortletEntityIdImpl( IPortletDefinitionId portletDefinitionId, String layoutNodeId, int userId) { this.portletDefinitionId = portletDefinitionId; this.layoutNodeId = layoutNodeId; this.userId = userId; this.compositeIdString = PortletEntityIdStringUtils.format( portletDefinitionId.getStringId(), layoutNodeId, userId); }
/** Used to initialize fields after persistence actions. */ @PostLoad @PostPersist @PostUpdate @PostRemove private void init() { if (this.internalPortletDefinitionId != -1 && (this.portletDefinitionId == null || this.portletDefinitionId.getLongId() != this.internalPortletDefinitionId)) { this.portletDefinitionId = PortletDefinitionIdImpl.create(this.internalPortletDefinitionId); } }
@Override public EntityIdentifier getEntityIdentifier() { return new EntityIdentifier( String.valueOf(this.portletDefinitionId.getStringId()), IPortletDefinition.class); }
private PortletDefinitionBean( final MarketplacePortletDefinition mpd, final Locale locale, Boolean favorite) { this.id = mpd.getPortletDefinitionId().getLongId(); this.fname = mpd.getFName(); this.title = mpd.getTitle(locale.toString()); this.name = mpd.getName(locale.toString()); this.description = mpd.getDescription(locale.toString()); this.state = mpd.getLifecycleState().toString(); this.typeId = mpd.getType().getId(); this.averageRating = mpd.getRating(); this.ratingsCount = mpd.getUsersRated(); this.parameters = new HashMap<>(mpd.getParametersAsUnmodifiableMap()); this.keywords = mpd.getKeywords() != null ? Collections.unmodifiableList(mpd.getKeywords()) : EMPTY_KEYWORDS; this.favorite = favorite; } }
public String getId() { return pdef.getPortletDefinitionId().getStringId(); }
public String getId() { return pdef.getPortletDefinitionId().getStringId(); }
/** * Static utility method computing the permission target ID for a portlet definition. * * @param portletDefinition a portlet definition * @return String permission target ID for the portlet definition. * @throws IllegalArgumentException if portletDefinition is null * @since 4.1 */ public static String permissionTargetIdForPortletDefinition( final IPortletDefinition portletDefinition) { Validate.notNull( portletDefinition, "Cannot compute permission target ID for a null portlet definition."); final String portletPublicationId = portletDefinition.getPortletDefinitionId().getStringId(); return IPermission.PORTLET_PREFIX.concat(portletPublicationId); } }
/** * Static utility method computing the permission target ID for a portlet definition. * * @param portletDefinition a portlet definition * @return String permission target ID for the portlet definition. * @throws IllegalArgumentException if portletDefinition is null * @since 4.1 */ public static String permissionTargetIdForPortletDefinition( final IPortletDefinition portletDefinition) { Validate.notNull( portletDefinition, "Cannot compute permission target ID for a null portlet definition."); final String portletPublicationId = portletDefinition.getPortletDefinitionId().getStringId(); return IPermission.PORTLET_PREFIX.concat(portletPublicationId); } }
/** * Provides information about a single portlet in the registry. NOTE: Access to this API enpoint * requires only <code>IPermission.PORTAL_SUBSCRIBE</code> permission. */ @RequestMapping(value = "/portlet/{fname}.json", method = RequestMethod.GET) public ModelAndView getPortlet( HttpServletRequest request, HttpServletResponse response, @PathVariable String fname) throws Exception { IAuthorizationPrincipal ap = getAuthorizationPrincipal(request); IPortletDefinition portletDef = portletDefinitionRegistry.getPortletDefinitionByFname(fname); if (portletDef != null && ap.canRender(portletDef.getPortletDefinitionId().getStringId())) { LayoutPortlet portlet = new LayoutPortlet(portletDef); return new ModelAndView("json", "portlet", portlet); } else { response.setStatus(HttpServletResponse.SC_FORBIDDEN); return new ModelAndView("json"); } }
/** * Provides information about all portlets in the portlet registry. NOTE: The response is * governed by the <code>IPermission.PORTLET_MANAGER_xyz</code> series of permissions. The * actual level of permission required is based on the current lifecycle state of the portlet. */ @RequestMapping(value = "/portlets.json", method = RequestMethod.GET) public ModelAndView getManageablePortlets( HttpServletRequest request, HttpServletResponse response) throws Exception { // get a list of all channels List<IPortletDefinition> allPortlets = portletDefinitionRegistry.getAllPortletDefinitions(); IAuthorizationPrincipal ap = getAuthorizationPrincipal(request); List<PortletTuple> rslt = new ArrayList<PortletTuple>(); for (IPortletDefinition pdef : allPortlets) { if (ap.canManage(pdef.getPortletDefinitionId().getStringId())) { rslt.add(new PortletTuple(pdef)); } } return new ModelAndView("json", "portlets", rslt); }
identifiers[defIter.previousIndex()] = new EntityIdentifier( definition.getPortletDefinitionId().getStringId(), this.getType());
final String portletId = portletDefinition.getPortletDefinitionId().getStringId(); final IEntity entity = GroupService.getEntity(portletId, IPortletDefinition.class); if (entity == null) {
identifiers[defIter.previousIndex()] = new EntityIdentifier( definition.getPortletDefinitionId().getStringId(), this.getType());
final String portletId = portletDefinition.getPortletDefinitionId().getStringId(); final IEntity entity = GroupService.getEntity(portletId, IPortletDefinition.class); if (entity == null) {
@Override public Set<PortletCategory> getParentCategories(IPortletDefinition child) { String childKey = child.getPortletDefinitionId().getStringId(); IEntity childEntity = GroupService.getEntity(childKey, IPortletDefinition.class); Set<PortletCategory> parents = new HashSet<>(); for (IGroupMember gm : childEntity.getParentGroups()) { if (gm.isGroup()) { String categoryId = gm.getKey(); parents.add(getPortletCategory(categoryId)); } } return parents; }