Newer
Older
tampopo-server-dtram / src / main / java / org / example / tampoposerverdtram / resources / RoomId.java
package org.example.tampoposerverdtram.resources;

import java.util.*;
import jakarta.ws.rs.*;
import jakarta.ws.rs.client.*;
import jakarta.ws.rs.core.*;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.core.JsonProcessingException;

@Path("/roomId")
@Component
public class RoomId {
	private String value = "0";
	@Produces(MediaType.APPLICATION_JSON)
	@GET
	public String getValue() {
		return new String(this.value);
	}
	@POST
	public void updateFromChatRooms(@FormParam("chatRooms") String chatRooms_json) throws JsonProcessingException {
		Map<String, Map<String, String>> chatRooms = new HashMap<>();
		{
			Map<String, Map<String, String>>i = new ObjectMapper().readValue(chatRooms_json, HashMap.class);
			chatRooms = i;
		}
		String temp_if22;
		if (chatRooms.containsKey(this.value)) {
			temp_if22 = (this.value+"1");
		} else {
			temp_if22 = this.value;
		}
		this.value = temp_if22;
	}
}