@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Plugin)) { return false; } if (!super.equals(o)) { return false; } Plugin plugin = (Plugin) o; if (path != null ? !path.equals(plugin.path) : plugin.path != null) { return false; } return true; }
public boolean canDelete(Activity activity) { if (PluginType.PERSPECTIVE.equals(activity.getType()) || PluginType.PERSPECTIVE_LAYOUT.equals(activity.getType())) { Resource ref = new ResourceRef(activity.getName(), ActivityResourceType.PERSPECTIVE); return authorizationManager.authorize(ref, PerspectiveAction.DELETE, user); } return true; } }
@Override public int hashCode() { int result = super.hashCode(); result = ~~result; result = 31 * result + (path != null ? path.hashCode() : 0); result = ~~result; return result; } }
private boolean thereIsAlreadyAPluginWithSameName(Activity item, Map<String, Activity> activities) { final Activity activity = activities.get(item.getName()); return activity != null && activity instanceof Plugin; }
classified.get(screenPluginResourceType).add(new Activity(screenId, PluginType.SCREEN)); classified.get(perspectiveLayoutPluginResourceType).add(new Activity(perspectiveId, PluginType.PERSPECTIVE)); classified.get(editorPluginResourceType).add(new Activity(editorId, PluginType.EDITOR)); classified.get(splashPluginResourceType).add(new Activity(splashId, PluginType.SPLASH)); classified.get(screenPluginResourceType).add(new Activity(beanDef.getName(), PluginType.SCREEN)); classified.get(perspectiveLayoutPluginResourceType).add(new Activity(beanDef.getName(), PluginType.PERSPECTIVE)); classified.get(editorPluginResourceType).add(new Activity(beanDef.getName(), PluginType.EDITOR)); classified.get(splashPluginResourceType).add(new Activity(beanDef.getName(), PluginType.SPLASH));
private boolean thereIsAlreadyAPluginWithSameName(Activity item, Map<String, Activity> activities) { final Activity activity = activities.get(item.getName()); return activity != null && activity instanceof Plugin; }
classified.get(screenPluginResourceType).add(new Activity(screenId, PluginType.SCREEN)); classified.get(perspectiveLayoutPluginResourceType).add(new Activity(perspectiveId, PluginType.PERSPECTIVE)); classified.get(editorPluginResourceType).add(new Activity(editorId, PluginType.EDITOR)); classified.get(splashPluginResourceType).add(new Activity(splashId, PluginType.SPLASH)); classified.get(screenPluginResourceType).add(new Activity(beanDef.getName(), PluginType.SCREEN)); classified.get(perspectiveLayoutPluginResourceType).add(new Activity(beanDef.getName(), PluginType.PERSPECTIVE)); classified.get(editorPluginResourceType).add(new Activity(beanDef.getName(), PluginType.EDITOR)); classified.get(splashPluginResourceType).add(new Activity(beanDef.getName(), PluginType.SPLASH));
public boolean canRead(Activity activity) { if (PluginType.PERSPECTIVE.equals(activity.getType()) || PluginType.PERSPECTIVE_LAYOUT.equals(activity.getType())) { Resource ref = new ResourceRef(activity.getName(), ActivityResourceType.PERSPECTIVE); return authorizationManager.authorize(ref, PerspectiveAction.READ, user); } return true; }
private Widget makeItemNavLink(final Activity activity) { if (!pluginController.canRead(activity)) { return null; } final Widget nav; if (activity instanceof Plugin) { nav = new LinkedGroupItem() {{ setText(activity.getName()); getElement().getStyle().setProperty("textDecoration", "underline"); addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { placeManager.goTo(new PathPlaceRequest(((Plugin) activity).getPath()).addParameter("name", activity.getName())); } }); }}; } else { nav = new ListGroupItem() {{ setText(activity.getName()); }}; } pluginRef.put(activity.getName(), nav); return pluginRef.get(activity.getName()); }
public boolean canUpdate(Activity activity) { if (PluginType.PERSPECTIVE.equals(activity.getType()) || PluginType.PERSPECTIVE_LAYOUT.equals(activity.getType())) { Resource ref = new ResourceRef(activity.getName(), ActivityResourceType.PERSPECTIVE); return authorizationManager.authorize(ref, PerspectiveAction.UPDATE, user); } return true; }
private Widget makeItemNavLink(final Activity activity) { if (!pluginController.canRead(activity)) { return null; } final Widget nav; if (activity instanceof Plugin) { nav = new LinkedGroupItem() {{ setText(activity.getName()); getElement().getStyle().setProperty("textDecoration", "underline"); addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { placeManager.goTo(new PathPlaceRequest(((Plugin) activity).getPath()).addParameter("name", activity.getName())); } }); }}; } else { nav = new ListGroupItem() {{ setText(activity.getName()); }}; } pluginRef.put(activity.getName(), nav); return pluginRef.get(activity.getName()); }
public boolean canRead(Activity activity) { if (PluginType.PERSPECTIVE.equals(activity.getType()) || PluginType.PERSPECTIVE_LAYOUT.equals(activity.getType())) { Resource ref = new ResourceRef(activity.getName(), ActivityResourceType.PERSPECTIVE); return authorizationManager.authorize(ref, PerspectiveAction.READ, user); } return true; }
@Override public void callback(final Collection<Plugin> plugins) { Set<Activity> activities = pluginsInfo.getAllPlugins(plugins); for (Activity activity : activities) { if (activity.getName().equalsIgnoreCase(nameWithoutExtension)) { callback.onFailure(ValidationErrorReason.DUPLICATED_NAME.name()); return; } } callback.onSuccess(); } }).listPlugins();
public boolean canDelete(Activity activity) { if (PluginType.PERSPECTIVE.equals(activity.getType()) || PluginType.PERSPECTIVE_LAYOUT.equals(activity.getType())) { Resource ref = new ResourceRef(activity.getName(), ActivityResourceType.PERSPECTIVE); return authorizationManager.authorize(ref, PerspectiveAction.DELETE, user); } return true; } }
@Override public void callback(final Collection<Plugin> plugins) { Set<Activity> activities = pluginsInfo.getAllPlugins(plugins); for (Activity activity : activities) { if (activity.getName().equalsIgnoreCase(nameWithoutExtension)) { callback.onFailure(ValidationErrorReason.DUPLICATED_NAME.name()); return; } } callback.onSuccess(); } }).listPlugins();
public boolean canUpdate(Activity activity) { if (PluginType.PERSPECTIVE.equals(activity.getType()) || PluginType.PERSPECTIVE_LAYOUT.equals(activity.getType())) { Resource ref = new ResourceRef(activity.getName(), ActivityResourceType.PERSPECTIVE); return authorizationManager.authorize(ref, PerspectiveAction.UPDATE, user); } return true; }
if (!thereIsAlreadyAPluginWithSameName(item, activities)) { activities.put(item.getName(), item);
if (!thereIsAlreadyAPluginWithSameName(item, activities)) { activities.put(item.getName(), item);