Package org.wso2.carbon.governance.gadgets.resourceimpact.util

Source Code of org.wso2.carbon.governance.gadgets.resourceimpact.util.CommonUtil

package org.wso2.carbon.governance.gadgets.resourceimpact.util;

import org.wso2.carbon.governance.gadgets.resourceimpact.beans.AssociationBean;
import org.wso2.carbon.registry.core.Association;
import org.wso2.carbon.registry.core.Registry;
import org.wso2.carbon.registry.core.exceptions.RegistryException;

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

public class CommonUtil {

    public static AssociationBean[] getAssociations(String path, Registry registry) throws RegistryException {
        List<AssociationBean> associationBeanList = new ArrayList<AssociationBean>();

        Association[] associations = registry.getAllAssociations(path);

        for (Association association : associations) {
           AssociationBean bean = new AssociationBean();
            bean.setAssociationType(association.getAssociationType());
            bean.setDestinationPath(association.getDestinationPath());
            bean.setSourcePath(association.getSourcePath());

            associationBeanList.add(bean);
        }

        AssociationBean[] returnBeanList = new AssociationBean[associations.length];
        return associationBeanList.toArray(returnBeanList);
    }
}
TOP

Related Classes of org.wso2.carbon.governance.gadgets.resourceimpact.util.CommonUtil

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.