@JsonView(JsonViews.Admin.class) @Override public Collection<? extends GrantedAuthority> getAuthorities() { Set<String> roles = this.getRoles(); if (roles == null) { return Collections.emptyList(); } Set<GrantedAuthority> authorities = new HashSet<GrantedAuthority>(); for (String role : roles) { authorities.add(new SimpleGrantedAuthority(role)); } return authorities; }
@Override public void propertyField(JFieldVar field, JDefinedClass clazz, String propertyName, JsonNode propertyNode) { field.annotate(JsonProperty.class).param("value", propertyName); if (field.type().erasure().equals(field.type().owner().ref(Set.class))) { field.annotate(JsonDeserialize.class).param("as", LinkedHashSet.class); } if (propertyNode.has("javaJsonView")) { field.annotate(JsonView.class).param( "value", field.type().owner().ref(propertyNode.get("javaJsonView").asText())); } }
public String findDeserializablePropertyName(AnnotatedField paramAnnotatedField) { JsonProperty localJsonProperty = (JsonProperty)paramAnnotatedField.getAnnotation(JsonProperty.class); if (localJsonProperty != null) return localJsonProperty.value(); if ((paramAnnotatedField.hasAnnotation(JsonDeserialize.class)) || (paramAnnotatedField.hasAnnotation(JsonView.class))) return ""; return null; }
public String findGettablePropertyName(AnnotatedMethod paramAnnotatedMethod) { JsonProperty localJsonProperty = (JsonProperty)paramAnnotatedMethod.getAnnotation(JsonProperty.class); if (localJsonProperty != null) return localJsonProperty.value(); JsonGetter localJsonGetter = (JsonGetter)paramAnnotatedMethod.getAnnotation(JsonGetter.class); if (localJsonGetter != null) return localJsonGetter.value(); if ((paramAnnotatedMethod.hasAnnotation(JsonSerialize.class)) || (paramAnnotatedMethod.hasAnnotation(JsonView.class))) return ""; return null; }
public String findSerializablePropertyName(AnnotatedField paramAnnotatedField) { JsonProperty localJsonProperty = (JsonProperty)paramAnnotatedField.getAnnotation(JsonProperty.class); if (localJsonProperty != null) return localJsonProperty.value(); if ((paramAnnotatedField.hasAnnotation(JsonSerialize.class)) || (paramAnnotatedField.hasAnnotation(JsonView.class))) return ""; return null; }
public Class<?>[] findSerializationViews(Annotated paramAnnotated) { JsonView localJsonView = (JsonView)paramAnnotated.getAnnotation(JsonView.class); if (localJsonView == null) return null; return localJsonView.value(); }
public String findSettablePropertyName(AnnotatedMethod paramAnnotatedMethod) { JsonProperty localJsonProperty = (JsonProperty)paramAnnotatedMethod.getAnnotation(JsonProperty.class); if (localJsonProperty != null) return localJsonProperty.value(); JsonSetter localJsonSetter = (JsonSetter)paramAnnotatedMethod.getAnnotation(JsonSetter.class); if (localJsonSetter != null) return localJsonSetter.value(); if ((paramAnnotatedMethod.hasAnnotation(JsonDeserialize.class)) || (paramAnnotatedMethod.hasAnnotation(JsonView.class))) return ""; return null; }
public String findDeserializablePropertyName(AnnotatedField paramAnnotatedField) { JsonProperty localJsonProperty = (JsonProperty)paramAnnotatedField.getAnnotation(JsonProperty.class); if (localJsonProperty != null) return localJsonProperty.value(); if ((paramAnnotatedField.hasAnnotation(JsonDeserialize.class)) || (paramAnnotatedField.hasAnnotation(JsonView.class)) || (paramAnnotatedField.hasAnnotation(JsonBackReference.class)) || (paramAnnotatedField.hasAnnotation(JsonManagedReference.class))) return ""; return null; }
public String findSettablePropertyName(AnnotatedMethod paramAnnotatedMethod) { JsonProperty localJsonProperty = (JsonProperty)paramAnnotatedMethod.getAnnotation(JsonProperty.class); if (localJsonProperty != null) return localJsonProperty.value(); JsonSetter localJsonSetter = (JsonSetter)paramAnnotatedMethod.getAnnotation(JsonSetter.class); if (localJsonSetter != null) return localJsonSetter.value(); if ((paramAnnotatedMethod.hasAnnotation(JsonDeserialize.class)) || (paramAnnotatedMethod.hasAnnotation(JsonView.class)) || (paramAnnotatedMethod.hasAnnotation(JsonBackReference.class)) || (paramAnnotatedMethod.hasAnnotation(JsonManagedReference.class))) return ""; return null; }
/** * @return Status 201 on success. */ @POST @Path("/create") @Produces(MediaType.APPLICATION_JSON) @JsonView(EntityView.class) public Response create( @QueryParam("indexingOn") @DefaultValue("true") Boolean indexingOn, @QueryParam("count") @DefaultValue("3") Integer count );
/** * @return Status 200 on success. */ @GET @Path("/pages") @Produces(MediaType.APPLICATION_JSON) @JsonView(EntityView.class) public Response findUsers( @QueryParam("page") @DefaultValue("0") Integer page, @QueryParam("page.size") @DefaultValue("10") Integer pageSize, @QueryParam("pages") @DefaultValue("1") Integer pages );
@JsonView(JsonViews.Publisher.class) public Long getId() { return this.id; }
@JsonView(JsonViews.User.class) public Date getDate() { return this.date; }
@JsonView(JsonViews.User.class) public String getTitle() { return title; }
@JsonView(JsonViews.User.class) public String getDescription() { return this.description; }
@JsonView(JsonViews.User.class) public Long getCounter() { return counter; }
/** * @return the exceptionMessage */ @JsonView(DevelopmentView.class) public String getExceptionMessage() { return exceptionMessage; }
@JsonView(IssueView.Update.class) public String getValue() { return value; }
@JsonView(IssueView.Update.class) @Override public String getKey() { return super.getKey(); }
@JsonView(IssueView.Update.class) public boolean isSubtask() { return subtask; }
@JsonView(IssueView.Create.class) public String getKey() { return super.getKey(); }
@JsonView(IssueView.Create.class) public String getId() { return super.getId(); }
@JsonView(IssueView.Filtered.class) @Override public Date getCreated() { return null; }
@JsonView(IssueView.Read.class) public String getExpand() { return expand; }
@JsonView(IssueView.Read.class) public URL getSelf() { return self; }
@JsonView(IssueView.Filtered.class) abstract public String getPath();
@JsonView(IssueView.Filtered.class) public String getSelfPath() { return getPath() + "/" + getId(); }
@XmlJavaTypeAdapter(JiraDateStringAdapter.class) @JsonView(IssueView.Read.class) public Date getCreated() { return created; }