All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nl.tno.bim.nmd.controller.ProfileSetController Maven / Gradle / Ivy

The newest version!
package nl.tno.bim.nmd.controller;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.ApiOperation;
import nl.tno.bim.nmd.domain.NmdProfileSet;

@CrossOrigin()
@RestController()
@RequestMapping(value = "/api")
public class ProfileSetController extends BaseNMDController{
	
	public ProfileSetController() {
		super();
	}
	
	@ApiOperation(value = "Get ProfileSet(s) By ProductCard Ids ")
	@RequestMapping(method = RequestMethod.GET, value = "/{versionId}/profileset/{ids}")
    public ResponseEntity> getProfileSetByProductCardIds(
    		@PathVariable Integer versionId, 
    		@PathVariable String ids) {
		
    	logMessage("triggering method getProfileSetProductCardByIds ");
        
        List pcIds = new ArrayList<>();
        String[] sIds = ids.split(",");
        for (String id : sIds) {
        	pcIds.add(Integer.parseInt(id));
        }

        Map ps;
		ps = this.getService(versionId).getProfileSetsByIds(pcIds);
        if (ps == null) {
        	logMessage("returning 404 no data found ");
            return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null);
        }

    	logMessage("returning ProfileSet List 200 object");
        return ResponseEntity.status(HttpStatus.OK).body(ps);

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy