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); } }
@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; }