public void setProfilingRule(ProfilingRule rule) { this.profilingRule = rule; this.ruleId = rule.getId(); }
protected List<String> getProfilingRuleNames() { List<String> names = new ArrayList<>(); names.add(""); Collection<ProfilingRule> rules = profiler.getRules(); for (ProfilingRule rule : rules) { names.add(rule.getId()); } return names; }
public ProfileDataTableBean(Collection<ProfilingRule> rules) { totalRecords = rules.size(); for (ProfilingRule rule : rules) { ProfileListBean record = new ProfileListBean(rule.getId(), rule.getTitle(), rule.getClassname()); this.records.add(record); } }
protected String getProfilingRuleForUser(User user) { Collection<PrincipalRule> userRules = profiler.getRulesForPrincipal(user); for (PrincipalRule userRule : userRules) { if (userRule.getLocatorName().equals(ProfileLocator.PAGE_LOCATOR)) { return userRule.getProfilingRule().getId(); } } return ""; }
@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; }
private void exportUserPrincipalRules(JSSnapshot snapshot, Map<String,Object> settings, Logger log) throws SerializerException { // get Rules for each user for (JSPrincipal _user : snapshot.getPrincipals()) { if (JetspeedPrincipalType.USER.equals(_user.getType())) { Principal principal = _user.getPrincipal(); if (principal != null) { for (PrincipalRule p1 : pm.getRulesForPrincipal(principal)) { JSPrincipalRule pr = new JSPrincipalRule(p1.getLocatorName(), p1.getProfilingRule().getId()); _user.getRules().add(pr); } } } } }
/** * Create the Profiling Rule Wrapper * * @param p * @return */ private JSProfilingRule createProfilingRule(ProfilingRule p, boolean standard) { JSProfilingRule rule = new JSProfilingRule(); rule.setStandardRule(standard); rule.setDescription(p.getTitle()); rule.setId(p.getId()); for (RuleCriterion rc : p.getRuleCriteria()) { rule.getCriterions().add(new JSRuleCriterion(rc)); } return rule; } }
c.setType(jsr.getType()); c.setValue(jsr.getValue()); c.setRuleId(rule.getId()); return c;