Java File Upload Service Design

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
0
down vote

favorite












enter image description here



I am creating an application that will upload a file in the web. There are three services: login, upload and logout. All of it sends request and receives response which I put in a DTO. Model has all the logic, while view has the UI. Controller connects the model and view.



enter image description here



Above are the fields inside its respective DTO. Is there a better way to do this? As you can see, the fields are repeating, but varies whether it is on request or response.



I created two interfaces and its respective DTO implements it.



First:



public interface TransferrableKey extends TransferrableData 

public String getLogonkey();

public void setLogonkey(String logonKey);

public String getTokenkey();

public void setTokenkey(String tokenKey);



Second:



public interface TransferrableResponse extends TransferrableData 

public String getMessage();

public void setMessage(String message);

public String getResponse();

public void setResponse(String response);



UploadRequestDTO.java



public class UploadRequestDTO implements TransferrableKey 

private String logonKey;
private String tokenKey;

/**
* @return the logonkey
*/
public String getLogonkey()
return logonKey;


/**
* @param logonKey the logonkey to set
*/
public void setLogonkey(String logonKey)
this.logonKey = logonKey;


/**
* @return the tokenkey
*/
public String getTokenkey()
return tokenKey;


/**
* @param tokenKey the tokenkey to set
*/
public void setTokenkey(String tokenKey)
this.tokenKey = tokenKey;




UploadResponseDTO.java



public class UploadResponseDTO implements TransferrableData, TransferrableResponse, TransferrableKey 
private String response;
private String message;
private String logonKey;
private String tokenKey;

/**
* @return the response
*/
public String getResponse()
return response;


/**
* @param response the response to set
*/
public void setResponse(String response)
this.response = response;


/**
* @return the messages
*/
public String getMessage()
return message;


/**
* @param message the messages to set
*/
public void setMessage(String message)
this.message = message;


/**
* @return the logonkey
*/
public String getLogonkey()
return logonKey;


/**
* @param logonKey the logonkey to set
*/
public void setLogonkey(String logonKey)
this.logonKey = logonKey;


/**
* @return the tokenkey
*/
public String getTokenkey()
return tokenKey;


/**
* @param tokenKey the tokenkey to set
*/
public void setTokenkey(String tokenKey)
this.tokenKey = tokenKey;








share|improve this question





















  • Welcome! Code Review is about reviewing existing code for improvements, thus you shouldn't ask a question with no code (or non-working code) here. You can edit your question to provide the code you have already written if it's working properly. Otherwise, you should look for another site in the stack exchange.
    – Ronan Dhellemmes
    Jan 24 at 10:51










  • @RonanDhellemmes I have updated my post.
    – Cian
    Jan 24 at 11:12










  • There's still no code to review. Only classes with getters and setters and some interfaces.
    – slowy
    Jan 26 at 11:05










  • Because those getters and setters are the codes that I am requesting for review.
    – Cian
    Jan 26 at 12:08










  • If you look on the table, the fields are just repeating. My question is if there is any other way to do this, so that they are not repeatable. As for now, I created an interface for it.
    – Cian
    Jan 26 at 12:11
















up vote
0
down vote

favorite












enter image description here



I am creating an application that will upload a file in the web. There are three services: login, upload and logout. All of it sends request and receives response which I put in a DTO. Model has all the logic, while view has the UI. Controller connects the model and view.



enter image description here



Above are the fields inside its respective DTO. Is there a better way to do this? As you can see, the fields are repeating, but varies whether it is on request or response.



I created two interfaces and its respective DTO implements it.



First:



public interface TransferrableKey extends TransferrableData 

public String getLogonkey();

public void setLogonkey(String logonKey);

public String getTokenkey();

public void setTokenkey(String tokenKey);



Second:



public interface TransferrableResponse extends TransferrableData 

public String getMessage();

public void setMessage(String message);

public String getResponse();

public void setResponse(String response);



UploadRequestDTO.java



public class UploadRequestDTO implements TransferrableKey 

private String logonKey;
private String tokenKey;

/**
* @return the logonkey
*/
public String getLogonkey()
return logonKey;


/**
* @param logonKey the logonkey to set
*/
public void setLogonkey(String logonKey)
this.logonKey = logonKey;


/**
* @return the tokenkey
*/
public String getTokenkey()
return tokenKey;


/**
* @param tokenKey the tokenkey to set
*/
public void setTokenkey(String tokenKey)
this.tokenKey = tokenKey;




UploadResponseDTO.java



public class UploadResponseDTO implements TransferrableData, TransferrableResponse, TransferrableKey 
private String response;
private String message;
private String logonKey;
private String tokenKey;

/**
* @return the response
*/
public String getResponse()
return response;


/**
* @param response the response to set
*/
public void setResponse(String response)
this.response = response;


/**
* @return the messages
*/
public String getMessage()
return message;


/**
* @param message the messages to set
*/
public void setMessage(String message)
this.message = message;


/**
* @return the logonkey
*/
public String getLogonkey()
return logonKey;


/**
* @param logonKey the logonkey to set
*/
public void setLogonkey(String logonKey)
this.logonKey = logonKey;


/**
* @return the tokenkey
*/
public String getTokenkey()
return tokenKey;


/**
* @param tokenKey the tokenkey to set
*/
public void setTokenkey(String tokenKey)
this.tokenKey = tokenKey;








share|improve this question





















  • Welcome! Code Review is about reviewing existing code for improvements, thus you shouldn't ask a question with no code (or non-working code) here. You can edit your question to provide the code you have already written if it's working properly. Otherwise, you should look for another site in the stack exchange.
    – Ronan Dhellemmes
    Jan 24 at 10:51










  • @RonanDhellemmes I have updated my post.
    – Cian
    Jan 24 at 11:12










  • There's still no code to review. Only classes with getters and setters and some interfaces.
    – slowy
    Jan 26 at 11:05










  • Because those getters and setters are the codes that I am requesting for review.
    – Cian
    Jan 26 at 12:08










  • If you look on the table, the fields are just repeating. My question is if there is any other way to do this, so that they are not repeatable. As for now, I created an interface for it.
    – Cian
    Jan 26 at 12:11












up vote
0
down vote

favorite









up vote
0
down vote

favorite











enter image description here



I am creating an application that will upload a file in the web. There are three services: login, upload and logout. All of it sends request and receives response which I put in a DTO. Model has all the logic, while view has the UI. Controller connects the model and view.



enter image description here



Above are the fields inside its respective DTO. Is there a better way to do this? As you can see, the fields are repeating, but varies whether it is on request or response.



I created two interfaces and its respective DTO implements it.



First:



public interface TransferrableKey extends TransferrableData 

public String getLogonkey();

public void setLogonkey(String logonKey);

public String getTokenkey();

public void setTokenkey(String tokenKey);



Second:



public interface TransferrableResponse extends TransferrableData 

public String getMessage();

public void setMessage(String message);

public String getResponse();

public void setResponse(String response);



UploadRequestDTO.java



public class UploadRequestDTO implements TransferrableKey 

private String logonKey;
private String tokenKey;

/**
* @return the logonkey
*/
public String getLogonkey()
return logonKey;


/**
* @param logonKey the logonkey to set
*/
public void setLogonkey(String logonKey)
this.logonKey = logonKey;


/**
* @return the tokenkey
*/
public String getTokenkey()
return tokenKey;


/**
* @param tokenKey the tokenkey to set
*/
public void setTokenkey(String tokenKey)
this.tokenKey = tokenKey;




UploadResponseDTO.java



public class UploadResponseDTO implements TransferrableData, TransferrableResponse, TransferrableKey 
private String response;
private String message;
private String logonKey;
private String tokenKey;

/**
* @return the response
*/
public String getResponse()
return response;


/**
* @param response the response to set
*/
public void setResponse(String response)
this.response = response;


/**
* @return the messages
*/
public String getMessage()
return message;


/**
* @param message the messages to set
*/
public void setMessage(String message)
this.message = message;


/**
* @return the logonkey
*/
public String getLogonkey()
return logonKey;


/**
* @param logonKey the logonkey to set
*/
public void setLogonkey(String logonKey)
this.logonKey = logonKey;


/**
* @return the tokenkey
*/
public String getTokenkey()
return tokenKey;


/**
* @param tokenKey the tokenkey to set
*/
public void setTokenkey(String tokenKey)
this.tokenKey = tokenKey;








share|improve this question













enter image description here



I am creating an application that will upload a file in the web. There are three services: login, upload and logout. All of it sends request and receives response which I put in a DTO. Model has all the logic, while view has the UI. Controller connects the model and view.



enter image description here



Above are the fields inside its respective DTO. Is there a better way to do this? As you can see, the fields are repeating, but varies whether it is on request or response.



I created two interfaces and its respective DTO implements it.



First:



public interface TransferrableKey extends TransferrableData 

public String getLogonkey();

public void setLogonkey(String logonKey);

public String getTokenkey();

public void setTokenkey(String tokenKey);



Second:



public interface TransferrableResponse extends TransferrableData 

public String getMessage();

public void setMessage(String message);

public String getResponse();

public void setResponse(String response);



UploadRequestDTO.java



public class UploadRequestDTO implements TransferrableKey 

private String logonKey;
private String tokenKey;

/**
* @return the logonkey
*/
public String getLogonkey()
return logonKey;


/**
* @param logonKey the logonkey to set
*/
public void setLogonkey(String logonKey)
this.logonKey = logonKey;


/**
* @return the tokenkey
*/
public String getTokenkey()
return tokenKey;


/**
* @param tokenKey the tokenkey to set
*/
public void setTokenkey(String tokenKey)
this.tokenKey = tokenKey;




UploadResponseDTO.java



public class UploadResponseDTO implements TransferrableData, TransferrableResponse, TransferrableKey 
private String response;
private String message;
private String logonKey;
private String tokenKey;

/**
* @return the response
*/
public String getResponse()
return response;


/**
* @param response the response to set
*/
public void setResponse(String response)
this.response = response;


/**
* @return the messages
*/
public String getMessage()
return message;


/**
* @param message the messages to set
*/
public void setMessage(String message)
this.message = message;


/**
* @return the logonkey
*/
public String getLogonkey()
return logonKey;


/**
* @param logonKey the logonkey to set
*/
public void setLogonkey(String logonKey)
this.logonKey = logonKey;


/**
* @return the tokenkey
*/
public String getTokenkey()
return tokenKey;


/**
* @param tokenKey the tokenkey to set
*/
public void setTokenkey(String tokenKey)
this.tokenKey = tokenKey;










share|improve this question












share|improve this question




share|improve this question








edited Jan 24 at 11:10
























asked Jan 24 at 9:16









Cian

717




717











  • Welcome! Code Review is about reviewing existing code for improvements, thus you shouldn't ask a question with no code (or non-working code) here. You can edit your question to provide the code you have already written if it's working properly. Otherwise, you should look for another site in the stack exchange.
    – Ronan Dhellemmes
    Jan 24 at 10:51










  • @RonanDhellemmes I have updated my post.
    – Cian
    Jan 24 at 11:12










  • There's still no code to review. Only classes with getters and setters and some interfaces.
    – slowy
    Jan 26 at 11:05










  • Because those getters and setters are the codes that I am requesting for review.
    – Cian
    Jan 26 at 12:08










  • If you look on the table, the fields are just repeating. My question is if there is any other way to do this, so that they are not repeatable. As for now, I created an interface for it.
    – Cian
    Jan 26 at 12:11
















  • Welcome! Code Review is about reviewing existing code for improvements, thus you shouldn't ask a question with no code (or non-working code) here. You can edit your question to provide the code you have already written if it's working properly. Otherwise, you should look for another site in the stack exchange.
    – Ronan Dhellemmes
    Jan 24 at 10:51










  • @RonanDhellemmes I have updated my post.
    – Cian
    Jan 24 at 11:12










  • There's still no code to review. Only classes with getters and setters and some interfaces.
    – slowy
    Jan 26 at 11:05










  • Because those getters and setters are the codes that I am requesting for review.
    – Cian
    Jan 26 at 12:08










  • If you look on the table, the fields are just repeating. My question is if there is any other way to do this, so that they are not repeatable. As for now, I created an interface for it.
    – Cian
    Jan 26 at 12:11















Welcome! Code Review is about reviewing existing code for improvements, thus you shouldn't ask a question with no code (or non-working code) here. You can edit your question to provide the code you have already written if it's working properly. Otherwise, you should look for another site in the stack exchange.
– Ronan Dhellemmes
Jan 24 at 10:51




Welcome! Code Review is about reviewing existing code for improvements, thus you shouldn't ask a question with no code (or non-working code) here. You can edit your question to provide the code you have already written if it's working properly. Otherwise, you should look for another site in the stack exchange.
– Ronan Dhellemmes
Jan 24 at 10:51












@RonanDhellemmes I have updated my post.
– Cian
Jan 24 at 11:12




@RonanDhellemmes I have updated my post.
– Cian
Jan 24 at 11:12












There's still no code to review. Only classes with getters and setters and some interfaces.
– slowy
Jan 26 at 11:05




There's still no code to review. Only classes with getters and setters and some interfaces.
– slowy
Jan 26 at 11:05












Because those getters and setters are the codes that I am requesting for review.
– Cian
Jan 26 at 12:08




Because those getters and setters are the codes that I am requesting for review.
– Cian
Jan 26 at 12:08












If you look on the table, the fields are just repeating. My question is if there is any other way to do this, so that they are not repeatable. As for now, I created an interface for it.
– Cian
Jan 26 at 12:11




If you look on the table, the fields are just repeating. My question is if there is any other way to do this, so that they are not repeatable. As for now, I created an interface for it.
– Cian
Jan 26 at 12:11















active

oldest

votes











Your Answer




StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
);
);
, "mathjax-editing");

StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "196"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f185858%2fjava-file-upload-service-design%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f185858%2fjava-file-upload-service-design%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

Chat program with C++ and SFML

Function to Return a JSON Like Objects Using VBA Collections and Arrays

Will my employers contract hold up in court?