Package org.gephi.io.importer.api

Examples of org.gephi.io.importer.api.ContainerUnloader


    public void testAttributeModel() {
        final Container container = Lookup.getDefault().lookup(ContainerFactory.class).newContainer();
        container.setReport(new Report());
        importer.execute(container.getLoader());

        ContainerUnloader unloader = container.getUnloader();
        assertNotNull(unloader.getAttributeModel().getNodeTable().getColumn("0", AttributeType.DYNAMIC_STRING));
        assertNotNull(unloader.getAttributeModel().getNodeTable().getColumn("1", AttributeType.DYNAMIC_FLOAT));
        assertNotNull(unloader.getAttributeModel().getNodeTable().getColumn("2", AttributeType.LIST_STRING));
        assertNotNull(unloader.getAttributeModel().getNodeTable().getColumn("3", AttributeType.DYNAMIC_FLOAT));
        assertNotNull(unloader.getAttributeModel().getNodeTable().getColumn("4", AttributeType.DYNAMIC_FLOAT));

        assertNotNull(unloader.getAttributeModel().getNodeTable().getColumn("type", AttributeType.DYNAMIC_STRING));
        assertNotNull(unloader.getAttributeModel().getNodeTable().getColumn("Attribute 1", AttributeType.DYNAMIC_FLOAT));
        assertNotNull(unloader.getAttributeModel().getNodeTable().getColumn("Attribute 2", AttributeType.LIST_STRING));
        assertNotNull(unloader.getAttributeModel().getNodeTable().getColumn("Attribute 3", AttributeType.DYNAMIC_FLOAT));
        assertNotNull(unloader.getAttributeModel().getNodeTable().getColumn("Attribute 4", AttributeType.DYNAMIC_FLOAT));

        assertNotNull(unloader.getAttributeModel().getEdgeTable().getColumn("weight", AttributeType.DYNAMIC_FLOAT));
    }
View Full Code Here


        assertNotNull(n6);
        assertNotNull(n7);
        assertNotNull(n8);
        assertNotNull(n9);

        ContainerUnloader unloader = container.getUnloader();
        AttributeColumn col0 = unloader.getAttributeModel().getNodeTable().getColumn("0");
        AttributeColumn col1 = unloader.getAttributeModel().getNodeTable().getColumn("1");
        AttributeColumn col2 = unloader.getAttributeModel().getNodeTable().getColumn("2");
        AttributeColumn col3 = unloader.getAttributeModel().getNodeTable().getColumn("3");
        AttributeColumn col4 = unloader.getAttributeModel().getNodeTable().getColumn("4");

        try {
            assertEquals("Node 1", n1.getLabel());
            assertEquals("2000-01-01", DynamicUtilities.getXMLDateStringFromDouble(n1.getTimeInterval().getValues().get(0)[0]));
            assertEquals("2000-12-31", DynamicUtilities.getXMLDateStringFromDouble(n1.getTimeInterval().getValues().get(0)[1]));
View Full Code Here

                sourceLabel.setText(source);

                //Autoscale
                autoscaleCheckbox.setSelected(container.isAutoScale());

                ContainerUnloader unloader = container.getUnloader();

                //Node & Edge count
                int nodeCount = unloader.getNodes().size();
                int edgeCount = unloader.getEdges().size();
                nodeCountLabel.setText("" + nodeCount);
                edgeCountLabel.setText("" + edgeCount);

                switch (unloader.getEdgeDefault()) {
                    case DIRECTED:
                        graphTypeCombo.setSelectedIndex(0);
                        break;
                    case UNDIRECTED:
                        graphTypeCombo.setSelectedIndex(1);
View Full Code Here

        if (!container.nodeExists(fromAddress.getAddress())) {
            //whether use one node to display the same display name
            boolean exist = false;
            if(isUseOneNodeIfSameDisplayName()){
                if(container instanceof ContainerUnloader){
                    ContainerUnloader con = (ContainerUnloader)container;
                    Collection<? extends NodeDraftGetter> allNodes = con.getNodes();
                    for(NodeDraftGetter node : allNodes){
                        if(node.getLabel() == null || node.getLabel().isEmpty())
                            continue;
                        if(node.getLabel().equals(fromAddress.getPersonal())){
                            sourceNode = container.getNode(node.getId());
                            exist = true;
                            break;
                        }
                    }
                }
            }
            if(!exist || !isUseOneNodeIfSameDisplayName()){
                sourceNode = container.factory().newNodeDraft();
                sourceNode.setId(Utilities.codecTranslate(codecType, fromAddress.getAddress()));
                sourceNode.setLabel(Utilities.codecTranslate(codecType, fromAddress.getPersonal()));
                container.addNode(sourceNode);
            }
        } else {
            sourceNode = container.getNode(fromAddress.getAddress());
        }
        //construct the target node
        Address[] recipietsTo = null;
        try {
            recipietsTo = msg.getRecipients(RecipientType.TO);
        } catch (MessagingException ex) {
            report.log("message:"+msg+",can't get the To adress of the email");
            return;//log
        }
        if(recipietsTo != null){
            for (Address addr : recipietsTo) {
                InternetAddress addrTo = (InternetAddress) addr;
                if (!container.nodeExists(addrTo.getAddress())) {
                    //whether use one node to display the same display name
                    boolean exist = false;
                    if (isUseOneNodeIfSameDisplayName()) {
                        if(container instanceof ContainerUnloader){
                            ContainerUnloader con = (ContainerUnloader)container;
                            Collection<? extends NodeDraftGetter> allNodes = con.getNodes();
                            for(NodeDraftGetter node : allNodes){
                                if(node.getLabel() == null || node.getLabel().isEmpty())
                                    continue;
                                if(node.getLabel().equals(fromAddress.getPersonal())){
                                    targetNode = container.getNode(node.getId());
                                    exist = true;
                                    break;
                                }
                            }
                        }
                    }
                    if (!exist) {
                        targetNode = container.factory().newNodeDraft();
                        targetNode.setId(Utilities.codecTranslate(codecType, addrTo.getAddress()));
                        targetNode.setLabel(Utilities.codecTranslate(codecType, addrTo.getPersonal()));
                        container.addNode(targetNode);
                    }
                } else {
                    targetNode = container.getNode(addrTo.getAddress());
                }
                //add an edge
                EdgeDraft edge = container.getEdge(sourceNode, targetNode);
                if (edge == null) {
                    edge = container.factory().newEdgeDraft();
                    edge.setSource(sourceNode);
                    edge.setTarget(targetNode);
                    edge.setWeight(1f);
                    container.addEdge(edge);
                } else {
                    edge.setWeight(edge.getWeight() + 1f);
                }
            }
        }
        // cc or bcc as weight
        if (hasCcAsWeight()) {
            //construct the target node of cc
            Address[] recipietsCc = null;
            try {
                recipietsCc = msg.getRecipients(RecipientType.CC);
            } catch (MessagingException ex) {
                report.log("message:"+msg+",can't get the Cc of the email");
                return ;
                //log
            }
            if(recipietsCc != null){
                for (Address addr : recipietsCc) {
                    InternetAddress addrCc = (InternetAddress) addr;
                    if (!container.nodeExists(addrCc.getAddress())) {
                        //whether use one node to display the same display name
                        boolean exist = false;
                        if (isUseOneNodeIfSameDisplayName()) {
                            if(container instanceof ContainerUnloader){
                                ContainerUnloader con = (ContainerUnloader)container;
                                Collection<? extends NodeDraftGetter> allNodes = con.getNodes();
                                for(NodeDraftGetter node : allNodes){
                                    if(node.getLabel() == null || node.getLabel().isEmpty())
                                        continue;
                                    if(node.getLabel().equalsIgnoreCase(fromAddress.getPersonal())){
                                        targetNode = container.getNode(node.getId());
                                        exist = true;
                                        break;
                                    }
                                }
                            }
                        }
                        if (!exist || !isUseOneNodeIfSameDisplayName()) {
                            targetNode = container.factory().newNodeDraft();
                            targetNode.setId(Utilities.codecTranslate(codecType, addrCc.getAddress()));
                            targetNode.setLabel(Utilities.codecTranslate(codecType, addrCc.getPersonal()));
                            container.addNode(targetNode);
                        }

                    } else {
                        targetNode = container.getNode(addr.toString());
                    }
                    //if use cc as weight, add an edge between cc
                    EdgeDraft edge = container.getEdge(sourceNode, targetNode);
                    if (edge == null) {
                        edge = container.factory().newEdgeDraft();
                        edge.setSource(sourceNode);
                        edge.setTarget(targetNode);
                        container.addEdge(edge);
                        edge.setWeight(1f);
                    } else {
                        edge.setWeight(edge.getWeight() + 1f);
                    }
                }
            }
        }
        if (hasBccAsWeight()) {
            //construct the target node of bcc
            Address[] recipietsBcc = null;
            try {
                recipietsBcc = msg.getRecipients(RecipientType.BCC);
            } catch (MessagingException ex) {
                report.log("message:"+msg+",can't get the Bcc of the email");
                return;
                //TODO log
            }
            if(recipietsBcc != null){
                for (Address addr : recipietsBcc) {
                    InternetAddress addrBcc = (InternetAddress) addr;
                    if (!container.nodeExists(addrBcc.getAddress())) {
                        //whether use one node to display the same display name
                        boolean exist = false;
                        if (isUseOneNodeIfSameDisplayName()) {
                            if(container instanceof ContainerUnloader){
                                ContainerUnloader con = (ContainerUnloader)container;
                                Collection<? extends NodeDraftGetter> allNodes = con.getNodes();
                                for(NodeDraftGetter node : allNodes){
                                    if(node.getLabel() == null || node.getLabel().isEmpty())
                                        continue;
                                    if(node.getLabel().equals(fromAddress.getPersonal())){
                                        targetNode = container.getNode(node.getId());
View Full Code Here

                    source = source.replaceFirst("." + label[label.length - 2], "");
                }

                sourceLabel.setText(source);

                ContainerUnloader unloader = container.getUnloader();

                //Node & Edge count
                int nodeCount = unloader.getNodeCount();
                int edgeCount = unloader.getEdgeCount();
                nodeCountLabel.setText("" + nodeCount);
                edgeCountLabel.setText("" + edgeCount);

                //Dynamic & Hierarchical graph
                String yes = NbBundle.getMessage(getClass(), "ReportPanel.yes");
View Full Code Here

        if (!container.nodeExists(fromAddress.getAddress())) {
            //whether use one node to display the same display name
            boolean exist = false;
            if (isUseOneNodeIfSameDisplayName()) {
                if (container instanceof ContainerUnloader) {
                    ContainerUnloader con = (ContainerUnloader) container;
                    Collection<? extends NodeDraftGetter> allNodes = con.getNodes();
                    for (NodeDraftGetter node : allNodes) {
                        if (node.getLabel() == null || node.getLabel().isEmpty()) {
                            continue;
                        }
                        if (node.getLabel().equals(fromAddress.getPersonal())) {
                            sourceNode = container.getNode(node.getId());
                            exist = true;
                            break;
                        }
                    }
                }
            }
            if (!exist || !isUseOneNodeIfSameDisplayName()) {
                sourceNode = container.factory().newNodeDraft();
                sourceNode.setId(Utilities.codecTranslate(codecType, fromAddress.getAddress()));
                sourceNode.setLabel(Utilities.codecTranslate(codecType, fromAddress.getPersonal()));
                container.addNode(sourceNode);
            }
        } else {
            sourceNode = container.getNode(fromAddress.getAddress());
        }
        //construct the target node
        Address[] recipietsTo = null;
        try {
            recipietsTo = msg.getRecipients(RecipientType.TO);
        } catch (MessagingException ex) {
            report.log("message:" + msg + ",can't get the To adress of the email");
            return;//log
        }
        if (recipietsTo != null) {
            for (Address addr : recipietsTo) {
                InternetAddress addrTo = (InternetAddress) addr;
                if (!container.nodeExists(addrTo.getAddress())) {
                    //whether use one node to display the same display name
                    boolean exist = false;
                    if (isUseOneNodeIfSameDisplayName()) {
                        if (container instanceof ContainerUnloader) {
                            ContainerUnloader con = (ContainerUnloader) container;
                            Collection<? extends NodeDraftGetter> allNodes = con.getNodes();
                            for (NodeDraftGetter node : allNodes) {
                                if (node.getLabel() == null || node.getLabel().isEmpty()) {
                                    continue;
                                }
                                if (node.getLabel().equals(fromAddress.getPersonal())) {
                                    targetNode = container.getNode(node.getId());
                                    exist = true;
                                    break;
                                }
                            }
                        }
                    }
                    if (!exist) {
                        targetNode = container.factory().newNodeDraft();
                        targetNode.setId(Utilities.codecTranslate(codecType, addrTo.getAddress()));
                        targetNode.setLabel(Utilities.codecTranslate(codecType, addrTo.getPersonal()));
                        container.addNode(targetNode);
                    }
                } else {
                    targetNode = container.getNode(addrTo.getAddress());
                }
                //add an edge
                EdgeDraft edge = container.getEdge(sourceNode, targetNode);
                if (edge == null) {
                    edge = container.factory().newEdgeDraft();
                    edge.setSource(sourceNode);
                    edge.setTarget(targetNode);
                    edge.setWeight(1f);
                    container.addEdge(edge);
                } else {
                    edge.setWeight(edge.getWeight() + 1f);
                }
            }
        }
        // cc or bcc as weight
        if (hasCcAsWeight()) {
            //construct the target node of cc
            Address[] recipietsCc = null;
            try {
                recipietsCc = msg.getRecipients(RecipientType.CC);
            } catch (MessagingException ex) {
                report.log("message:" + msg + ",can't get the Cc of the email");
                return;
                //log
            }
            if (recipietsCc != null) {
                for (Address addr : recipietsCc) {
                    InternetAddress addrCc = (InternetAddress) addr;
                    if (!container.nodeExists(addrCc.getAddress())) {
                        //whether use one node to display the same display name
                        boolean exist = false;
                        if (isUseOneNodeIfSameDisplayName()) {
                            if (container instanceof ContainerUnloader) {
                                ContainerUnloader con = (ContainerUnloader) container;
                                Collection<? extends NodeDraftGetter> allNodes = con.getNodes();
                                for (NodeDraftGetter node : allNodes) {
                                    if (node.getLabel() == null || node.getLabel().isEmpty()) {
                                        continue;
                                    }
                                    if (node.getLabel().equalsIgnoreCase(fromAddress.getPersonal())) {
                                        targetNode = container.getNode(node.getId());
                                        exist = true;
                                        break;
                                    }
                                }
                            }
                        }
                        if (!exist || !isUseOneNodeIfSameDisplayName()) {
                            targetNode = container.factory().newNodeDraft();
                            targetNode.setId(Utilities.codecTranslate(codecType, addrCc.getAddress()));
                            targetNode.setLabel(Utilities.codecTranslate(codecType, addrCc.getPersonal()));
                            container.addNode(targetNode);
                        }

                    } else {
                        targetNode = container.getNode(addr.toString());
                    }
                    //if use cc as weight, add an edge between cc
                    EdgeDraft edge = container.getEdge(sourceNode, targetNode);
                    if (edge == null) {
                        edge = container.factory().newEdgeDraft();
                        edge.setSource(sourceNode);
                        edge.setTarget(targetNode);
                        container.addEdge(edge);
                        edge.setWeight(1f);
                    } else {
                        edge.setWeight(edge.getWeight() + 1f);
                    }
                }
            }
        }
        if (hasBccAsWeight()) {
            //construct the target node of bcc
            Address[] recipietsBcc = null;
            try {
                recipietsBcc = msg.getRecipients(RecipientType.BCC);
            } catch (MessagingException ex) {
                report.log("message:" + msg + ",can't get the Bcc of the email");
                return;
                //TODO log
            }
            if (recipietsBcc != null) {
                for (Address addr : recipietsBcc) {
                    InternetAddress addrBcc = (InternetAddress) addr;
                    if (!container.nodeExists(addrBcc.getAddress())) {
                        //whether use one node to display the same display name
                        boolean exist = false;
                        if (isUseOneNodeIfSameDisplayName()) {
                            if (container instanceof ContainerUnloader) {
                                ContainerUnloader con = (ContainerUnloader) container;
                                Collection<? extends NodeDraftGetter> allNodes = con.getNodes();
                                for (NodeDraftGetter node : allNodes) {
                                    if (node.getLabel() == null || node.getLabel().isEmpty()) {
                                        continue;
                                    }
                                    if (node.getLabel().equals(fromAddress.getPersonal())) {
View Full Code Here

TOP

Related Classes of org.gephi.io.importer.api.ContainerUnloader

Copyright © 2018 www.massapicom. 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.