Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Commit

Permalink
Replace strings with enum
Browse files Browse the repository at this point in the history
  • Loading branch information
svenpopping committed Dec 9, 2017
1 parent b9e45db commit af590d2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package ch.wisv.payments.model.eventsync;

public enum EventsSyncEnum {

PRODUCT_CREATE_EDIT,
PRODUCT_DELETE
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.nio.charset.Charset;
import java.util.Base64;

import static ch.wisv.payments.model.eventsync.EventsSyncEnum.valueOf;
import static ch.wisv.payments.util.ResponseEntityBuilder.createResponseEntity;

@RestController
Expand Down Expand Up @@ -56,11 +57,11 @@ public ResponseEntity<?> eventSync(HttpServletRequest request, @RequestBody Prod
return createResponseEntity(HttpStatus.UNAUTHORIZED, "User is not authorized", null);
}

switch (productEventsSync.getTrigger()) {
case "PRODUCT_CREATE_EDIT":
switch (valueOf(productEventsSync.getTrigger())) {
case PRODUCT_CREATE_EDIT:
this.createOrUpdate(productEventsSync);
break;
case "PRODUCT_DELETE":
case PRODUCT_DELETE:
eventsSyncProductService.deleteProduct(productEventsSync);
break;
default:
Expand Down

0 comments on commit af590d2

Please sign in to comment.