private boolean validateAddProtocolMapper()

in custos-services/custos-core-services/iam-admin-core-service/src/main/java/org/apache/custos/iam/validator/IAMInputValidator.java [449:486]


    private boolean validateAddProtocolMapper(Object obj) {
        if (obj instanceof AddProtocolMapperRequest) {
            AddProtocolMapperRequest request = (AddProtocolMapperRequest) obj;
            if (request.getTenantId() == 0) {
                throw new MissingParameterException("Tenant Id should not be null", null);
            }

            if (request.getClientId() == null || request.getClientId().trim().equals("")) {
                throw new MissingParameterException("Client Id should not be null", null);
            }

            if (request.getClaimName() == null || request.getClaimName().trim().equals("")) {
                throw new MissingParameterException("Claim name should not be null", null);
            }
            if (request.getMapperType() == null) {
                throw new MissingParameterException("Mapper Type should not be null", null);
            }

            if (request.getMapperType().equals(MapperTypes.USER_ATTRIBUTE)) {
                if (request.getAttributeName() == null || request.getAttributeName().trim().equals("")) {
                    throw new MissingParameterException("Attribute name should not be null", null);
                }
            }


            if (request.getName() == null || request.getName().trim().equals("")) {
                throw new MissingParameterException("Name should not be null", null);
            }


            if (request.getClaimType() == null) {
                throw new MissingParameterException("Claim Type should not be null", null);
            }


        }
        return true;
    }