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

com.wadpam.oauth2.service.ConnectionServiceImpl Maven / Gradle / Ivy

The newest version!
/*
 * INSERT COPYRIGHT HERE
 */

package com.wadpam.oauth2.service;

import com.wadpam.oauth2.dao.DConnectionDao;
import com.wadpam.oauth2.domain.DConnection;
import com.wadpam.open.mvc.MardaoCrudService;
import java.util.ArrayList;
import java.util.Arrays;
import org.springframework.beans.factory.annotation.Autowired;

/**
 *
 * @author sosandstrom
 */
public class ConnectionServiceImpl extends MardaoCrudService 
    implements ConnectionService {

    @Override
    public Iterable queryByAppArg0(String appArg0) {
        return dao.queryByAppArg0(appArg0);
    }
    
    public Iterable queryByProviderIdProviderUserId(String providerId, String providerUserId) {
        return dao.queryByProviderIdProviderUserId(providerId, providerUserId);
    }
    
    public static String convertRoles(Iterable from) {
        if (null == from) {
            return null;
        }
        final StringBuffer to = new StringBuffer();
        boolean first = true;
        for (String s : from) {
            if (!first) {
                to.append(ROLE_SEPARATOR);
            }
            to.append(s.trim());
            first = false;
        }
        return to.toString();
    }
    
    public static ArrayList convertRoles(String from) {
        final ArrayList to = new ArrayList();
        if (null != from) {
            final String roles[] = from.split(ROLE_SEPARATOR);
            for (String r : roles) {
                to.add(r.trim());
            }
        }
        return to;
    }

    @Autowired
    public void setDConnectionDao(DConnectionDao dConnectionDao) {
        this.dao = dConnectionDao;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy