Subversion Repositories SmartDukaan

Rev

Rev 22217 | Rev 23506 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 22217 Rev 22533
Line 25... Line 25...
25
	public LoginDetails getCookiesObject(HttpServletRequest request) throws ProfitMandiBusinessException{
25
	public LoginDetails getCookiesObject(HttpServletRequest request) throws ProfitMandiBusinessException{
26
		Cookie[] cookies = request.getCookies();
26
		Cookie[] cookies = request.getCookies();
27
		if (cookies == null){
27
		if (cookies == null){
28
			throw new ProfitMandiBusinessException("", "", "");
28
			throw new ProfitMandiBusinessException("", "", "");
29
		}
29
		}
30
		String fofoIdFound = null, emailIdFound = null, roleNamesString = null, fofoFlagFound = null;
30
		String fofoIdFound = null, emailIdFound = null, roleNamesString = null;
31
		for(Cookie cookie : cookies){
31
		for(Cookie cookie : cookies){
32
			LOGGER.info("Requested Cookie {}={}", cookie.getName(), cookie.getValue());
32
			LOGGER.info("Requested Cookie {}={}", cookie.getName(), cookie.getValue());
33
			if(cookie.getName().equals(ProfitMandiConstants.FOFO_ID) && cookie.getValue() != null && !cookie.getValue().isEmpty()){
33
			if(cookie.getName().equals(ProfitMandiConstants.FOFO_ID) && cookie.getValue() != null && !cookie.getValue().isEmpty()){
34
				fofoIdFound = cookie.getValue();
34
				fofoIdFound = cookie.getValue();
35
			}
35
			}
Line 38... Line 38...
38
			}
38
			}
39
			if(cookie.getName().equals(ProfitMandiConstants.ROLE_NAMES) && cookie.getValue() != null){
39
			if(cookie.getName().equals(ProfitMandiConstants.ROLE_NAMES) && cookie.getValue() != null){
40
				roleNamesString = cookie.getValue();
40
				roleNamesString = cookie.getValue();
41
				//LOGGER.info("roleNameString is {}", roleNamesString);
41
				//LOGGER.info("roleNameString is {}", roleNamesString);
42
			}
42
			}
43
			if(cookie.getName().equals(ProfitMandiConstants.FOFO_FLAG) && cookie.getValue() != null && !cookie.getValue().isEmpty()){
-
 
44
				fofoFlagFound = cookie.getValue();
-
 
45
			}
-
 
46
			if(fofoIdFound != null && emailIdFound != null && roleNamesString != null && fofoFlagFound != null){
43
			if(fofoIdFound != null && emailIdFound != null && roleNamesString != null){
47
				break;
44
				break;
48
			}
45
			}
49
		}
46
		}
50
		
47
		
51
		if(fofoIdFound == null || emailIdFound == null || roleNamesString == null || fofoFlagFound == null){
48
		if(fofoIdFound == null || emailIdFound == null || roleNamesString == null){
52
			LOGGER.info("roleNameString is {}", roleNamesString);
49
			LOGGER.info("roleNameString is {}", roleNamesString);
53
			LOGGER.info("fofoIdFound is {}", fofoIdFound);
50
			LOGGER.info("fofoIdFound is {}", fofoIdFound);
54
			LOGGER.info("emailIdFound is {}", emailIdFound);
51
			LOGGER.info("emailIdFound is {}", emailIdFound);
55
			LOGGER.info("fofoFlagFound is {}", fofoFlagFound);
-
 
56
			LOGGER.error("Requested session is not valid");
52
			LOGGER.error("Requested session is not valid");
57
			throw new ProfitMandiBusinessException("", "", "");
53
			throw new ProfitMandiBusinessException("", "", "");
58
		}else{
54
		}else{
59
			LoginDetails fofoDetails = new LoginDetails();
55
			LoginDetails fofoDetails = new LoginDetails();
60
			fofoDetails.setFofoId(Integer.parseInt(fofoIdFound));
56
			fofoDetails.setFofoId(Integer.parseInt(fofoIdFound));
Line 64... Line 60...
64
			for(String roleName : roleNames){
60
			for(String roleName : roleNames){
65
				RoleType roleType = RoleType.valueOf(roleName);
61
				RoleType roleType = RoleType.valueOf(roleName);
66
				roleTypes.add(roleType);
62
				roleTypes.add(roleType);
67
			}
63
			}
68
			fofoDetails.setRoleTypes(roleTypes);
64
			fofoDetails.setRoleTypes(roleTypes);
69
			fofoDetails.setFofo(Boolean.parseBoolean(fofoFlagFound));
-
 
70
 			return fofoDetails;
65
 			return fofoDetails;
71
		}
66
		}
72
		
67
		
73
	}
68
	}
74
	
69