Skip to content

Commit 1c8e8a2

Browse files
committed
Formatting and many fields removed from Movie class
1 parent 283a02a commit 1c8e8a2

File tree

5 files changed

+20
-213
lines changed

5 files changed

+20
-213
lines changed

RestEasy Example/src/main/java/com/baeldung/model/Movie.java

Lines changed: 17 additions & 171 deletions
Original file line numberDiff line numberDiff line change
@@ -5,195 +5,33 @@
55
import javax.xml.bind.annotation.XmlType;
66

77
@XmlAccessorType(XmlAccessType.FIELD)
8-
@XmlType(name = "movie", propOrder = { "actors", "awards", "country", "director", "genre", "imdbId", "imdbRating", "imdbVotes", "language", "metascore", "plot", "poster", "rated", "released", "response", "runtime", "title", "type", "writer", "year" })
8+
@XmlType(name = "movie", propOrder = { "imdbId", "title" })
99
public class Movie {
1010

11-
protected String actors;
12-
protected String awards;
13-
protected String country;
14-
protected String director;
15-
protected String genre;
1611
protected String imdbId;
17-
protected String imdbRating;
18-
protected String imdbVotes;
19-
protected String language;
20-
protected String metascore;
21-
protected String plot;
22-
protected String poster;
23-
protected String rated;
24-
protected String released;
25-
protected String response;
26-
protected String runtime;
2712
protected String title;
28-
protected String type;
29-
protected String writer;
30-
protected String year;
3113

32-
public String getActors() {
33-
return actors;
14+
public Movie(String imdbId, String title) {
15+
this.imdbId = imdbId;
16+
this.title = title;
3417
}
3518

36-
public void setActors(String value) {
37-
this.actors = value;
38-
}
39-
40-
public String getAwards() {
41-
return awards;
42-
}
43-
44-
public void setAwards(String value) {
45-
this.awards = value;
46-
}
47-
48-
public String getCountry() {
49-
return country;
50-
}
51-
52-
public void setCountry(String value) {
53-
this.country = value;
54-
}
55-
56-
public String getDirector() {
57-
return director;
58-
}
59-
60-
public void setDirector(String value) {
61-
this.director = value;
62-
}
63-
64-
public String getGenre() {
65-
return genre;
66-
}
67-
68-
public void setGenre(String value) {
69-
this.genre = value;
70-
}
19+
public Movie() {}
7120

7221
public String getImdbId() {
7322
return imdbId;
7423
}
7524

76-
public void setImdbId(String value) {
77-
this.imdbId = value;
78-
}
79-
80-
public String getImdbRating() {
81-
return imdbRating;
82-
}
83-
84-
public void setImdbRating(String value) {
85-
this.imdbRating = value;
86-
}
87-
88-
public String getImdbVotes() {
89-
return imdbVotes;
90-
}
91-
92-
public void setImdbVotes(String value) {
93-
this.imdbVotes = value;
94-
}
95-
96-
public String getLanguage() {
97-
return language;
98-
}
99-
100-
public void setLanguage(String value) {
101-
this.language = value;
102-
}
103-
104-
public String getMetascore() {
105-
return metascore;
106-
}
107-
108-
public void setMetascore(String value) {
109-
this.metascore = value;
110-
}
111-
112-
public String getPlot() {
113-
return plot;
114-
}
115-
116-
public void setPlot(String value) {
117-
this.plot = value;
118-
}
119-
120-
public String getPoster() {
121-
return poster;
122-
}
123-
124-
public void setPoster(String value) {
125-
this.poster = value;
126-
}
127-
128-
public String getRated() {
129-
return rated;
130-
}
131-
132-
public void setRated(String value) {
133-
this.rated = value;
134-
}
135-
136-
public String getReleased() {
137-
return released;
138-
}
139-
140-
public void setReleased(String value) {
141-
this.released = value;
142-
}
143-
144-
public String getResponse() {
145-
return response;
146-
}
147-
148-
public void setResponse(String value) {
149-
this.response = value;
150-
}
151-
152-
public String getRuntime() {
153-
return runtime;
154-
}
155-
156-
public void setRuntime(String value) {
157-
this.runtime = value;
25+
public void setImdbId(String imdbId) {
26+
this.imdbId = imdbId;
15827
}
15928

16029
public String getTitle() {
16130
return title;
16231
}
16332

164-
public void setTitle(String value) {
165-
this.title = value;
166-
}
167-
168-
public String getType() {
169-
return type;
170-
}
171-
172-
public void setType(String value) {
173-
this.type = value;
174-
}
175-
176-
public String getWriter() {
177-
return writer;
178-
}
179-
180-
public void setWriter(String value) {
181-
this.writer = value;
182-
}
183-
184-
public String getYear() {
185-
return year;
186-
}
187-
188-
public void setYear(String value) {
189-
this.year = value;
190-
}
191-
192-
@Override
193-
public String toString() {
194-
return "Movie{" + "actors='" + actors + '\'' + ", awards='" + awards + '\'' + ", country='" + country + '\'' + ", director='" + director + '\'' + ", genre='" + genre + '\'' + ", imdbId='" + imdbId + '\'' + ", imdbRating='" + imdbRating + '\''
195-
+ ", imdbVotes='" + imdbVotes + '\'' + ", language='" + language + '\'' + ", metascore='" + metascore + '\'' + ", poster='" + poster + '\'' + ", rated='" + rated + '\'' + ", released='" + released + '\'' + ", response='" + response + '\''
196-
+ ", runtime='" + runtime + '\'' + ", title='" + title + '\'' + ", type='" + type + '\'' + ", writer='" + writer + '\'' + ", year='" + year + '\'' + '}';
33+
public void setTitle(String title) {
34+
this.title = title;
19735
}
19836

19937
@Override
@@ -217,4 +55,12 @@ public int hashCode() {
21755
result = 31 * result + (title != null ? title.hashCode() : 0);
21856
return result;
21957
}
58+
59+
@Override
60+
public String toString() {
61+
return "Movie{" +
62+
"imdbId='" + imdbId + '\'' +
63+
", title='" + title + '\'' +
64+
'}';
65+
}
22066
}

RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@
33
<exclude-subsystems>
44
<subsystem name="resteasy" />
55
</exclude-subsystems>
6-
76
<exclusions>
87
<module name="javaee.api" />
98
<module name="javax.ws.rs.api" />
109
<module name="org.jboss.resteasy.resteasy-jaxrs" />
1110
</exclusions>
12-
1311
<local-last value="true" />
1412
</deployment>
15-
1613
</jboss-deployment-structure>

RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public void testUpdateMovie() {
130130

131131
Response moviesResponse = simple.addMovie(batmanMovie);
132132
moviesResponse.close();
133-
batmanMovie.setImdbVotes("300,000");
133+
batmanMovie.setTitle("Batman Begins");
134134
moviesResponse = simple.updateMovie(batmanMovie);
135135

136136
if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) {
Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,4 @@
11
{
22
"title": "Batman",
3-
"year": "1989",
4-
"rated": "PG-13",
5-
"released": "23 Jun 1989",
6-
"runtime": "126 min",
7-
"genre": "Action, Adventure",
8-
"director": "Tim Burton",
9-
"writer": "Bob Kane (Batman characters), Sam Hamm (story), Sam Hamm (screenplay), Warren Skaaren (screenplay)",
10-
"actors": "Michael Keaton, Jack Nicholson, Kim Basinger, Robert Wuhl",
11-
"plot": "The Dark Knight of Gotham City begins his war on crime with his first major enemy being the clownishly homicidal Joker.",
12-
"language": "English, French",
13-
"country": "USA, UK",
14-
"awards": "Won 1 Oscar. Another 9 wins & 22 nominations.",
15-
"poster": "http://ia.media-imdb.com/images/M/MV5BMTYwNjAyODIyMF5BMl5BanBnXkFtZTYwNDMwMDk2._V1_SX300.jpg",
16-
"metascore": "66",
17-
"imdbRating": "7.6",
18-
"imdbVotes": "256,000",
19-
"imdbId": "tt0096895",
20-
"type": "movie",
21-
"response": "True"
3+
"imdbId": "tt0096895"
224
}
Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,4 @@
11
{
22
"title": "Transformers",
3-
"year": "2007",
4-
"rated": "PG-13",
5-
"released": "03 Jul 2007",
6-
"runtime": "144 min",
7-
"genre": "Action, Adventure, Sci-Fi",
8-
"director": "Michael Bay",
9-
"writer": "Roberto Orci (screenplay), Alex Kurtzman (screenplay), John Rogers (story), Roberto Orci (story), Alex Kurtzman (story)",
10-
"actors": "Shia LaBeouf, Megan Fox, Josh Duhamel, Tyrese Gibson",
11-
"plot": "A long time ago, far away on the planet of Cybertron, a war is being waged between the noble Autobots (led by the wise Optimus Prime) and the devious Decepticons (commanded by the dreaded Megatron) for control over the Allspark, a mystical talisman that would grant unlimited power to whoever possesses it. The Autobots managed to smuggle the Allspark off the planet, but Megatron blasts off in search of it. He eventually tracks it to the planet of Earth (circa 1850), but his reckless desire for power sends him right into the Arctic Ocean, and the sheer cold forces him into a paralyzed state. His body is later found by Captain Archibald Witwicky, but before going into a comatose state Megatron uses the last of his energy to engrave into the Captain's glasses a map showing the location of the Allspark, and to send a transmission to Cybertron. Megatron is then carried away aboard the Captain's ship. A century later, Captain Witwicky's grandson Sam Witwicky (nicknamed Spike by his friends) buys his first car. To his shock, he discovers it to be Bumblebee, an Autobot in disguise who is to protect Spike, who possesses the Captain's glasses and the map engraved on them. But Bumblebee is not the only Transformer to have arrived on Earth - in the desert of Qatar, the Decepticons Blackout and Scorponok attack a U.S. military base, causing the Pentagon to send their special Sector Seven agents to capture all \"specimens of this alien race.\" Spike and his girlfriend Mikaela find themselves in the midst of a grand battle between the Autobots and the Decepticons, stretching from Hoover Dam all the way to Los Angeles. Meanwhile, deep inside Hoover Dam, the cryogenically stored body of Megatron awakens.",
12-
"language": "English, Spanish",
13-
"country": "USA",
14-
"awards": "Nominated for 3 Oscars. Another 18 wins & 40 nominations.",
15-
"poster": "http://ia.media-imdb.com/images/M/MV5BMTQwNjU5MzUzNl5BMl5BanBnXkFtZTYwMzc1MTI3._V1_SX300.jpg",
16-
"metascore": "61",
17-
"imdbRating": "7.1",
18-
"imdbVotes": "492,225",
19-
"imdbId": "tt0418279",
20-
"type": "movie",
21-
"response": "True"
3+
"imdbId": "tt0418279"
224
}

0 commit comments

Comments
 (0)