com.base.Http.Server.Responses.Team.ListStaredMessagesResponse   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
dl 0
loc 39
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
getTeam 0 13 ?
A getResponse(Request,Response) 0 4 1
A ListStaredMessagesResponse(String) 0 3 1
A getTeam() 0 13 2
A ListStaredMessagesResponse() 0 ? 1
1
package com.base.Http.Server.Responses.Team;
2
3
import com.base.Http.Request.Request;
4
import com.base.Http.Response.Response;
5
import com.base.Http.Server.Responses.BaseResponse;
6
import com.base.Models.Message;
7
8
import java.util.ArrayList;
9
import java.util.List;
10
11
public class ListStaredMessagesResponse extends BaseResponse {
12
13
    public static String VALID_TEAM_SLUG = "twitter";
14
    public static String VALID_CONTENT = "Let's Meet...";
15
    public static String VALID_MESSAGE_SLUG = "elmy4c4S-5-3btL7Sf";
16
    public static String VALID_SENDER_TYPE = "Base\\\\Models\\\\User";
17
    public static String VALID_SENDER_ID = "";
18
    public static String VALID_TYPE = "text";
19
20
    public static int VALID_ID = 1;
21
22
    public ListStaredMessagesResponse() {
23
        super();
24
    }
25
26
    public ListStaredMessagesResponse(String teamSlug) {
27
        super();
28
        VALID_TEAM_SLUG = teamSlug;
29
    }
30
31
    @Override
32
    public Response getResponse(Request request, Response response) {
33
        return response.setStatusCode(200)
34
                .setBody(generateResponseBody(getTeam()));
35
    }
36
37
    public List<Message> getTeam() {
38
        List<Message> messages = new ArrayList<>();
39
        for (int i = 1; i <= 3; i++) {
40
            messages.add((Message) new Message().setContent("")
41
                    .setThread_id(ListStaredMessagesResponse.VALID_TEAM_SLUG.concat("" + i))
42
                    .setContent(ListStaredMessagesResponse.VALID_CONTENT)
43
                    .setSlug(ListStaredMessagesResponse.VALID_MESSAGE_SLUG.concat("" + i))
44
                    .setSender_id(ListStaredMessagesResponse.VALID_SENDER_ID.concat("" + i))
45
                    .setSender_type(ListStaredMessagesResponse.VALID_SENDER_TYPE)
46
                    .setType(ListStaredMessagesResponse.VALID_TYPE)
47
                    .setId(VALID_ID + i));
48
        }
49
        return messages;
50
    }
51
}
52
53