Update controller, config, security
Clean code
This commit is contained in:
parent
f5faf50737
commit
3603fef63a
@ -9,70 +9,56 @@ import java.text.SimpleDateFormat;
|
||||
* @author Roberto
|
||||
*/
|
||||
public class Constants {
|
||||
|
||||
public static final String JASAMEDIKA = "SkFTQU1FRElLQQ==";
|
||||
|
||||
public static final String APP_VERSION = "APP_VERSION";
|
||||
|
||||
|
||||
public static final String AUTH_HEADER_NAME = "X-AUTH-TOKEN";
|
||||
|
||||
//for example
|
||||
|
||||
public static final String IDR = "IDR";
|
||||
|
||||
public static final String RP = "RP";
|
||||
|
||||
|
||||
public static final String COMMA = ",";
|
||||
|
||||
public static final DecimalFormat ONE_COMA_FORMAT = new DecimalFormat("#.#");
|
||||
public static final DecimalFormat TWO_COMA_FORMAT = new DecimalFormat(
|
||||
"#.##");
|
||||
|
||||
public static final DecimalFormat MONEY_FORMAT_WITHOUT_COMMA = new DecimalFormat(
|
||||
"###,###");
|
||||
public static final DecimalFormat TWO_COMA_FORMAT = new DecimalFormat("#.##");
|
||||
|
||||
public static final DecimalFormat MONEY_FORMAT_WITHOUT_COMMA = new DecimalFormat("###,###");
|
||||
|
||||
public static final class DateFormat {
|
||||
public static final SimpleDateFormat yyyyMMdd = new SimpleDateFormat(
|
||||
"yyyyMMdd");
|
||||
public static final SimpleDateFormat dd_MMM_yyyy = new SimpleDateFormat(
|
||||
"dd MMM yyyy");
|
||||
public static final SimpleDateFormat yyyy_MM_dd_HH_mm_ss = new SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm:ss");
|
||||
public static final SimpleDateFormat yyyy_MM_dd_T_HH_mm_ss = new SimpleDateFormat(
|
||||
"yyyy-MM-dd'T'HH:mm:ss");
|
||||
public static final SimpleDateFormat yyyyMMdd_HH_mm_ss = new SimpleDateFormat(
|
||||
"yyyyMMdd HH:mm:ss");
|
||||
public static final SimpleDateFormat yyyyMMdd = new SimpleDateFormat("yyyyMMdd");
|
||||
public static final SimpleDateFormat dd_MMM_yyyy = new SimpleDateFormat("dd MMM yyyy");
|
||||
public static final SimpleDateFormat yyyy_MM_dd_HH_mm_ss = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
public static final SimpleDateFormat yyyy_MM_dd_T_HH_mm_ss = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
||||
public static final SimpleDateFormat yyyyMMdd_HH_mm_ss = new SimpleDateFormat("yyyyMMdd HH:mm:ss");
|
||||
}
|
||||
|
||||
/* message */
|
||||
public static final class MessageInfo {
|
||||
public static final String INFO_MESSAGE = "INFO_MESSAGE";
|
||||
public static final String WARNING_MESSAGE = "WARNING_MESSAGE";
|
||||
public static final String ERROR_MESSAGE = "ERROR_MESSAGE";
|
||||
public static final String EXCEPTION_MESSAGE = "EXCEPTION_MESSAGE";
|
||||
|
||||
}
|
||||
|
||||
/* locale id (indonesia / default) and en (english) */
|
||||
|
||||
public static final class Locale {
|
||||
public static final String INA = "ina";
|
||||
public static final String EN = "en";
|
||||
|
||||
}
|
||||
//Update perubahan di sini, harus disamakan dengan package yang ada di jasamedika-bussiness
|
||||
//com.jasamedika.medifirst2000.logging.hibernate.async
|
||||
|
||||
public static final class HttpHeader {
|
||||
public static final String SUPERVISING = "Supervising";
|
||||
public static final String MODULE = "Module";
|
||||
public static final String FORM = "Form";
|
||||
public static final String ACTION = "Action";
|
||||
|
||||
public static final String URL_FORM = "AlamatUrlForm"; // syamsu
|
||||
public static final String KD_RUANGAN = "KdRuangan"; // syamsu
|
||||
public static final String KD_RUANGAN_T = "KdRuanganT"; // syamsu
|
||||
public static final String KD_RUANGAN_A = "KdRuanganA"; // syamsu
|
||||
public static final String TGL_KIRIM = "tglKirim"; // syamsu
|
||||
// public static final String RUANGAN_TUJUAN = "ruanganTujuan"; // syamsu
|
||||
// public static final String ID_RUANGAN_TUJUAN_ALT = "ruanganTujuanAlt"; // syamsu
|
||||
public static final String KD_USER = "KdUser"; // syamsu
|
||||
|
||||
|
||||
public static final String URL_FORM = "AlamatUrlForm";
|
||||
public static final String KD_RUANGAN = "KdRuangan";
|
||||
public static final String KD_RUANGAN_T = "KdRuanganT";
|
||||
public static final String KD_RUANGAN_A = "KdRuanganA";
|
||||
public static final String TGL_KIRIM = "tglKirim";
|
||||
public static final String KD_USER = "KdUser";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -7,9 +7,15 @@ package com.jasamedika.medifirst2000.constants;
|
||||
* @author Roberto
|
||||
*/
|
||||
public final class MessageResource {
|
||||
|
||||
public static final String LABEL_SUCCESS = "label.success";
|
||||
|
||||
public static final String LABEL_ERROR = "label.error";
|
||||
|
||||
public static final String LABEL_TRY_AGAIN = "label.try_again";
|
||||
|
||||
public static final String LABEL_SUCCESS_CREATED = "label.success.created";
|
||||
|
||||
public static final String LABEL_SUCCESS_OK = "label.success.ok";
|
||||
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@ import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
* @author Roberto
|
||||
*/
|
||||
public interface IRestPageController<V extends BaseModelVO> {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param page
|
||||
@ -36,4 +37,5 @@ public interface IRestPageController<V extends BaseModelVO> {
|
||||
@RequestParam(value = "limit", required = false) Integer limit,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "id") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir);
|
||||
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
* @author Roberto
|
||||
*/
|
||||
public interface RestPageController<V extends BaseVO> {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param page
|
||||
@ -34,4 +35,5 @@ public interface RestPageController<V extends BaseVO> {
|
||||
@RequestParam(value = "limit", required = false) Integer limit,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "id") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir);
|
||||
|
||||
}
|
||||
|
||||
@ -22,6 +22,7 @@ import java.io.IOException;
|
||||
* @author Roberto
|
||||
*/
|
||||
public class StatelessAuthenticationFilter extends GenericFilterBean {
|
||||
|
||||
private final TokenAuthenticationService authenticationService;
|
||||
|
||||
public StatelessAuthenticationFilter(TokenAuthenticationService authenticationService) {
|
||||
|
||||
@ -15,6 +15,7 @@ import com.jasamedika.medifirst2000.security.service.UserService;
|
||||
public class TokenHandler {
|
||||
|
||||
private final String secret;
|
||||
|
||||
private final UserService userService;
|
||||
|
||||
public TokenHandler(String secret, UserService userService) {
|
||||
|
||||
@ -14,7 +14,9 @@ import java.util.Collection;
|
||||
public class UserAuthentication implements Authentication {
|
||||
|
||||
private static final long serialVersionUID = -7410905698525654537L;
|
||||
|
||||
private final User user;
|
||||
|
||||
private boolean authenticated = true;
|
||||
|
||||
public UserAuthentication(User user) {
|
||||
|
||||
@ -22,4 +22,5 @@ public class JacksonConfiguration {
|
||||
mapper.setSerializationInclusion(Include.NON_NULL);
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
package com.monitorjbl.json;
|
||||
|
||||
public class JsonResult {
|
||||
|
||||
private static final JsonResult instance = new JsonResult();
|
||||
|
||||
private static final ThreadLocal<JsonView<?>> current = new ThreadLocal<>();
|
||||
|
||||
private JsonResult() {
|
||||
@ -49,4 +51,5 @@ public class JsonResult {
|
||||
return obj.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user