public String resolve(RequestContext context, RuleCriterion criterion) { Subject subject = context.getSubject(); if (subject == null) { String msg = "Invalid (null) Subject in request pipeline"; log.error(msg); return null; } return combinePrincipals(context, criterion, subject, criterion.getName()); }
public String resolve(RequestContext context, RuleCriterion criterion) { String value = context.getRequestParameter(criterion.getName()); if (value == null) { value = criterion.getValue(); } return value; }
/** * two objects of type RuleCriterion should be considered equal if their name and type are the same * */ public boolean equals(Object o) { if (this == o) return true; if ((o == null) || (!(o instanceof RuleCriterion))) return false; RuleCriterion r = (RuleCriterion)o; if (this.name != null) { if (!(this.name.equals(r.getName()))) return false; } else if (r.getName() != null) return false; if (this.type != null) { if (!(this.type.equals(r.getType()))) return false; } else if (r.getType() != null) return false; return true; } /* (non-Javadoc)
public String resolve(RequestContext context, RuleCriterion criterion) { String value = (String)context.getSessionAttribute(criterion.getName()); if (value == null) { value = criterion.getValue(); } return value; }
public ProfileLocatorPropertyImpl(RuleCriterion criterion, boolean isControl, boolean isNavigation, String value) { this.name = criterion.getName(); this.value = value; this.type = criterion.getType(); this.fallbackType = criterion.getFallbackType(); this.isControl = isControl; this.isNavigation = isNavigation; }
public String resolve(RequestContext context, RuleCriterion criterion) { String value = super.resolve(context, criterion); if (value != null) { return value; } Subject subject = context.getSubject(); if (subject == null) { String msg = "Invalid (null) Subject in request pipeline"; log.error(msg); return null; } return resolvePrincipals(context, criterion, subject, criterion.getName()); }
public String resolve(RequestContext context, RuleCriterion criterion) { if (context.getUserPrincipal() instanceof User) { User user = (User)context.getUserPrincipal(); if (user != null) { Map<String, String> map = user.getInfoMap(); String attribute = (String)map.get(criterion.getName()); if (attribute != null) { return attribute; } return criterion.getValue(); } } return null; }
@GET @Path("/edit/{id}/") public ProfileEditBean lookupProfile(@Context HttpServletRequest servletRequest, @Context UriInfo uriInfo, @PathParam("id") String profileId) { checkPrivilege(servletRequest, JetspeedActions.VIEW); if (StringUtils.isBlank(profileId)) { throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST).entity( new UpdateResultBean(Response.Status.BAD_REQUEST.getStatusCode(), "Profile id not specified")).build()); } ProfilingRule rule = profiler.getRule(profileId); if (rule == null) { throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST).entity( new UpdateResultBean(Response.Status.BAD_REQUEST.getStatusCode(), "Profile id not found with the specified id: " + profileId)).build()); } ProfileEditBean editBean = new ProfileEditBean(rule.getId(), rule.getTitle(), rule.getClassname()); for (RuleCriterion criterion : rule.getRuleCriteria()) { editBean.add(new ProfileCriterionBean(criterion.getName(), criterion.getValue(), criterion.getType(), criterion.getFallbackType(), criterion.getFallbackOrder())); } return editBean; }
public JSRuleCriterion(RuleCriterion c) { this.name = c.getName(); this.type = c.getType(); this.value = c.getValue(); this.fallBackOrder = c.getFallbackOrder(); this.fallBackType = c.getFallbackType(); }
public String resolve(RequestContext context, RuleCriterion criterion) { String path = null; ContentPage page = context.getPage(); if (page != null) { path = page.getId(); } else { path = context.getPath(); } if ((path == null) || path.equals("/")) { String key = this.getClass() + "." + criterion.getName(); path = (String)context.getSessionAttribute(key); if (path == null) { path = criterion.getValue(); } } return path; }
public RuleCriterionImpl(RuleCriterion master) { this.name = master.getName(); this.ruleId = master.getRuleId(); this.type = master.getType(); this.value = master.getValue(); this.fallbackOrder = master.getFallbackOrder(); this.fallbackType = master.getFallbackType(); } /**
key.append(criterion.getName()); key.append(ProfileLocator.PATH_SEPARATOR); key.append(value);