Package org.dspace.authority

Examples of org.dspace.authority.AuthorityValue


                    maxDocs = limit;
                List<AuthorityValue> alreadyPresent = new ArrayList<AuthorityValue>();
                for (int i = 0; i < maxDocs; i++) {
                    SolrDocument solrDocument = authDocs.get(i);
                    if (solrDocument != null) {
                        AuthorityValue val = AuthorityValue.fromSolr(solrDocument);

                        Map<String, String> extras = val.choiceSelectMap();
                        extras.put("insolr", val.getId());
                        choices.add(new Choice(val.getId(), val.getValue(), val.getValue(), extras));
                        alreadyPresent.add(val);
                    }
                }

                if (externalResults && StringUtils.isNotBlank(text)) {
View Full Code Here


                List<AuthorityValue> values = source.queryAuthorities(text, max * 2); // max*2 because results get filtered

                // filtering loop
                Iterator<AuthorityValue> iterator = values.iterator();
                while (iterator.hasNext()) {
                    AuthorityValue next = iterator.next();
                    if (alreadyPresent.contains(next)) {
                        iterator.remove();
                    }
                }

                // adding choices loop
                int added = 0;
                iterator = values.iterator();
                while (iterator.hasNext() && added < max) {
                    AuthorityValue val = iterator.next();
                    Map<String, String> extras = val.choiceSelectMap();
                    extras.put("insolr", "false");
                    choices.add(new Choice(val.generateString(), val.getValue(), val.getValue(), extras));
                    added++;
                }
            } catch (Exception e) {
                log.error("Error", e);
            }
View Full Code Here

        for (AuthorityIndexerInterface indexerInterface : indexers) {
            log.info("Initialize " + indexerInterface.getClass().getName());
            System.out.println("Initialize " + indexerInterface.getClass().getName());
            indexerInterface.init(context);
            while (indexerInterface.hasMore()) {
                AuthorityValue authorityValue = indexerInterface.nextValue();
                if(authorityValue != null){
                    toIndexValues.put(authorityValue.getId(), authorityValue);
                }
            }
            //Close up
            indexerInterface.close();
        }
View Full Code Here

        for (AuthorityIndexerInterface indexerInterface : indexers) {

            indexerInterface.init(context , item);
            while (indexerInterface.hasMore()) {
                AuthorityValue authorityValue = indexerInterface.nextValue();
                if(authorityValue != null)
                    indexingService.indexContent(authorityValue, true);
            }
            //Close up
            indexerInterface.close();
View Full Code Here

    }


    @Override
    public AuthorityValue newInstance(String info) {
        AuthorityValue authorityValue = null;
        if (StringUtils.isNotBlank(info)) {
            Orcid orcid = Orcid.getOrcid();
            authorityValue = orcid.queryAuthorityID(info);
        } else {
            authorityValue = OrcidAuthorityValue.create();
View Full Code Here

        {
            String[] bits = md.split("\\[");
            language = bits[1].substring(0, bits[1].length() - 1);
        }

        AuthorityValue fromAuthority = getAuthorityValueType(md);
        if (md.indexOf(':') > 0) {
            md = md.substring(md.indexOf(':') + 1);
        }

        String[] bits = md.split("\\.");
View Full Code Here

        if (md.contains("["))
        {
            String[] bits = md.split("\\[");
            language = bits[1].substring(0, bits[1].length() - 1);
        }
        AuthorityValue fromAuthority = getAuthorityValueType(md);
        if (md.indexOf(':') > 0) {
            md = md.substring(md.indexOf(':')+1);
        }

        String[] bits = md.split("\\.");
View Full Code Here

            }
        }
    }

    public static AuthorityValue getAuthorityValueType(String md) {
        AuthorityValue fromAuthority = null;
        List<AuthorityValue> types = AuthorityValue.getAuthorityTypes().getTypes();
        for (AuthorityValue type : types) {
            if (StringUtils.startsWithIgnoreCase(md,type.getAuthorityType())) {
                fromAuthority = type;
            }
View Full Code Here

                value = value.substring(0, value.indexOf(':'));
            }

            // look up the value and authority in solr
            List<AuthorityValue> byValue = authorityValueFinder.findByValue(c, schema, element, qualifier, value);
            AuthorityValue authorityValue = null;
            if (byValue.isEmpty()) {
                String toGenerate = fromAuthority.generateString() + value;
                String field = schema + "_" + element + (StringUtils.isNotBlank(qualifier) ? "_" + qualifier : "");
                authorityValue = AuthorityValueGenerator.generate(toGenerate, value, field);
                dcv.authority = toGenerate;
            } else {
                authorityValue = byValue.get(0);
                dcv.authority = authorityValue.getId();
            }

            dcv.value = authorityValue.getValue();
            dcv.confidence = Choices.CF_ACCEPTED;
        } else if (value == null || !value.contains(DSpaceCSV.authoritySeparator)) {
            simplyCopyValue(value, dcv);
        } else {
            String[] parts = value.split(DSpaceCSV.escapedAuthoritySeparator);
View Full Code Here

                    headings.add(element);
                }
                else if (!"id".equals(element))
                {
                    String authorityPrefix = "";
                    AuthorityValue authorityValueType = MetadataImport.getAuthorityValueType(element);
                    if (authorityValueType != null) {
                        String authorityType = authorityValueType.getAuthorityType();
                        authorityPrefix = element.substring(0, authorityType.length() + 1);
                        element = element.substring(authorityPrefix.length());
                    }

                    // Verify that the heading is valid in the metadata registry
View Full Code Here

TOP

Related Classes of org.dspace.authority.AuthorityValue

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.