@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; }
for (RuleCriterion rc : rule.getRuleCriteria()) { if (beanMap.get(rc.getName()) == null) { deletes.add(rc); rule.getRuleCriteria().remove(rc); for (RuleCriterion rc : rule.getRuleCriteria()) { rulesMap.put(rc.getName(), rc); rc.setFallbackOrder(dto.getOrder()); rc.setRuleId(rule.getId()); rule.getRuleCriteria().add(rc);
if (c != null) Collection<RuleCriterion> cHelp = rule.getRuleCriteria(); if (!(existing && (cHelp.contains(c))))
/** * 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; } }