Package uk.gov.nationalarchives.droid.profile

Examples of uk.gov.nationalarchives.droid.profile.ProfileResourceNode


     */
    @SuppressWarnings("unchecked")
    @Override
    public void treeWillCollapse(TreeExpansionEvent event) {
        DefaultMutableTreeNode collapsingNode = (DefaultMutableTreeNode) event.getPath().getLastPathComponent();
        ProfileResourceNode prn = (ProfileResourceNode) collapsingNode.getUserObject();
        profileForm.getInMemoryNodes().remove(prn.getId());
       
        for (Enumeration<DefaultMutableTreeNode> e = collapsingNode.children(); e.hasMoreElements();) {
            DefaultMutableTreeNode nodeToRemove = e.nextElement();
            final ProfileResourceNode node = (ProfileResourceNode) nodeToRemove.getUserObject();
            profileForm.getInMemoryNodes().remove(node.getId());
        }
        collapsingNode.removeAllChildren();
       
        profileForm.getTreeModel().nodeStructureChanged(collapsingNode);
    }
View Full Code Here


            if (cellObject != null) {
                String cellValue = cellObject.toString();
                resultsOutline.setToolTipText(cellValue);
               
                if (colModelIndex == 0) {
                    ProfileResourceNode resourceNode = (ProfileResourceNode) ((DefaultMutableTreeNode)
                            cellObject).getUserObject();
                    resultsOutline.setToolTipText(java.net.URLDecoder.decode(resourceNode.getUri().toString()));
                }
               
                if (colModelIndex == OutlineColumn.PUID.ordinal() + 1) {
                    cellValue = resultsOutline.getValueAt(rowIndex, colIndex).toString();
                    cellValue = cellValue.replace(puidValuePrefix, "");
View Full Code Here

                DirectoryComparableLong count = (DirectoryComparableLong) resultsOutline
                    .getValueAt(rowIndex, colIndex);
                if (count != null && count.getSource() != null && count.getSource() > 1) {
                    int rowModelIndex = resultsOutline.convertRowIndexToModel(rowIndex);
                    DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) mdl.getValueAt(rowModelIndex, 0);
                    ProfileResourceNode node = (ProfileResourceNode) treeNode.getUserObject();
                    multiIdentificationDialog.showDialog(node);
                }
            }
        }
View Full Code Here

        File file = new File("test_sig_files/DROID 5  Architecture.doc");
        URI uri = file.toURI();
        AbstractProfileResource resource = mock(AbstractProfileResource.class);
        when(resource.getUri()).thenReturn(uri);
       
        ProfileResourceNode node = mock(ProfileResourceNode.class);
        when(node.getUri()).thenReturn(uri);
       
        ArgumentCaptor<IdentificationRequest> requestCaptor = ArgumentCaptor.forClass(IdentificationRequest.class);

        fileEventHandler.onEvent(file, new ResourceId(1L, ""), null);
       
View Full Code Here

        final RequestIdentifier identifier = request.getIdentifier();
        URI uri = identifier.getUri();
        //log.debug(String.format("handling error for job [%s]", uri));
       
        final Long nodeId = identifier.getNodeId();
        ProfileResourceNode node;
        if (nodeId != null) {
            node = resultHandlerDao.loadNode(nodeId);
            node.getMetaData().setNodeStatus(NodeStatus.ERROR);
            // Need to initialise the collection eagerly...
            node.getFormatIdentifications().size();
        } else {
            node = new ProfileResourceNode(uri);
            node.setFinished(new Date());
            final NodeMetaData metaData = node.getMetaData();
           
            metaData.setNodeStatus(getNodeStatus(e.getErrorType()));
            metaData.setResourceType(ResourceType.FILE);
            node.setNoFormatsIdentified();
           
            RequestMetaData requestMetaData = request.getRequestMetaData();
           
            metaData.setName(requestMetaData.getName());
            metaData.setSize(requestMetaData.getSize());
            metaData.setExtension(request.getExtension());
            metaData.setLastModified(request.getRequestMetaData().getTime());
            metaData.setHash(requestMetaData.getHash());
           
            node.addFormatIdentification(Format.NULL);
            resultHandlerDao.save(node, identifier.getParentResourceId());
        }
        progressMonitor.stopJob(node);
    }
View Full Code Here

    @Transactional(propagation = Propagation.REQUIRED)
    public ResourceId handleDirectory(IdentificationResult result,
            ResourceId parentId, boolean restricted) {
        final URI uri = result.getIdentifier().getUri();
        //log.debug(String.format("handling directory [%s]", uri));
        ProfileResourceNode node = new ProfileResourceNode(uri);

        RequestMetaData requestMetaData = result.getMetaData();
       
        NodeMetaData metaData = new NodeMetaData();
        metaData.setName(requestMetaData.getName());
        metaData.setSize(null);
        metaData.setLastModified(requestMetaData.getTime());
        metaData.setIdentificationMethod(IdentificationMethod.NULL);
        metaData.setNodeStatus(restricted ? NodeStatus.ACCESS_DENIED : NodeStatus.DONE);
        metaData.setResourceType(ResourceType.FOLDER);
        node.setMetaData(metaData);
       
        resultHandlerDao.save(node, parentId);
        node.setFinished(new Date());

        node.addFormatIdentification(Format.NULL);

        progressMonitor.stopJob(node);
        return new ResourceId(node.getId(), node.getPrefix());
    }
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public int compare(DefaultMutableTreeNode o1, DefaultMutableTreeNode o2) {

        ProfileResourceNode f1 = (ProfileResourceNode) o1.getUserObject();
        ProfileResourceNode f2 = (ProfileResourceNode) o2.getUserObject();
       
        ResourceType resourceType1 = f1.getMetaData().getResourceType();
        ResourceType resourceType2 = f2.getMetaData().getResourceType();
       
        int typeCompare = -(resourceType1.compareTo(resourceType2));
        if (column.isAscending()) {
            typeCompare = -typeCompare;
        }
       
        return typeCompare == 0
                ? String.CASE_INSENSITIVE_ORDER.compare(f1.getMetaData().getName(), f2.getMetaData().getName())
                : typeCompare;
    }
View Full Code Here

     * @param node the node
     * @return the display name
     */
    public String getDisplayName(Object node) {

        ProfileResourceNode profileNode = (ProfileResourceNode) ((DefaultMutableTreeNode) node)
            .getUserObject();
        return profileNode.getParentId() == null ? new File(profileNode.getUri()).getPath()
                : profileNode.getMetaData().getName();
        //return profileNode.getParent() == null ? new File(profileNode.getUri()).getPath()
        //        : profileNode.getMetaData().getName();
    }
View Full Code Here

     */
    // CHECKSTYLE:OFF cyclomatic complexity caused by switch statement.
    public Icon getIcon(Object node) {
    // CHECKSTYLE:ON
       
        ProfileResourceNode profileNode = getNode(node);
        NodeMetaData metadata = profileNode.getMetaData();
        ResourceType nodeType = metadata.getResourceType();
        NodeStatus status = metadata.getNodeStatus();
        Icon icon = null;       
        switch (nodeType) {
            case FOLDER:
                if (profileNode.getFilterStatus() != 1) {
                    icon = folderResourceTypeNotDoneIcon;
                } else {
                    switch (status) {
                        case NOT_DONE:
                            icon = folderResourceTypeNotDoneIcon;
                            break;
                        case ACCESS_DENIED:
                            icon = folderResourceTypeAccessDeniedIcon;
                            break;
                        case NOT_FOUND:
                            icon = folderResourceTypeNotFoundIcon;
                            break;
                        case ERROR:
                            icon = folderResourceTypeErrorIcon;
                            break;
                        default:
                            icon = folderResourceTypeIcon;
                            break;
                    }
                }
                break;
            case FILE:
                if (profileNode.getFilterStatus() != 1) {
                    icon = fileResourceTypeNotDoneIcon;
                } else {
                    switch (status) {
                        case NOT_DONE:
                            icon = fileResourceTypeNotDoneIcon;
                            break;
                        case ACCESS_DENIED:
                            icon = fileResourceTypeAccessDeniedIcon;
                            break;
                        case NOT_FOUND:
                            icon = fileResourceTypeNotFoundIcon;
                            break;
                        case ERROR:
                            icon = fileResourceTypeErrorIcon;
                            break;
                        default:
                            icon = fileResourceTypeIcon;
                    }
                }
                break;
            case CONTAINER:
                if (profileNode.getFilterStatus() != 1) {
                    icon = containerResourceTypeNotDoneIcon;
                } else {
                    switch (status) {
                        case NOT_DONE: // should be impossible, but implemented anyway.
                            icon = containerResourceTypeNotDoneIcon;
View Full Code Here

        int[] selectedRows = outline.getSelectedRows();
        for (int i = selectedRows.length; i > 0; i--) {
            int index = selectedRows[i - 1];
            DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) outline
                    .getValueAt(index, 0);
            ProfileResourceNode prn = (ProfileResourceNode) treeNode
                    .getUserObject();
            results.add(prn);
        }
        return results;
    }
View Full Code Here

TOP

Related Classes of uk.gov.nationalarchives.droid.profile.ProfileResourceNode

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.