Package it.cilea.osd.jdyna.model

Examples of it.cilea.osd.jdyna.model.AValue


                        List<AValue> values = new ArrayList<AValue>();
                        if (proprieties != null)
                        {
                            for (P prop : proprieties)
                            {
                                AValue val = prop.getValue();
                                if (StringUtils.isNotEmpty(md[2])
                                        && val instanceof PointerValue
                                        && prop.getObject() instanceof ACrisObject)
                                {
                                    List pointProps = (List) ((ACrisObject) prop.getObject())
                                            .getAnagrafica4view().get(md[2]);
                                    if (pointProps != null
                                            && pointProps.size() > 0)
                                    {
                                        for (Object pprop : pointProps)
                                        {
                                            values.add(((Property) pprop)
                                                    .getValue());
                                        }
                                    }
                                }
                                else
                                {
                                    values.add(val);
                                }
                            }
                        }

                        // if we have values to index on, then do so
                        for (AValue val : values)
                        {
                            if (val == null)
                            {
                                continue;
                            }
                            String authority = null;
                            String sval = val.toString();
                            if (val instanceof PointerValue
                                    && val.getObject() instanceof ACrisObject)
                            {
                                authority = ((ACrisObject) val.getObject()).getId()
                                        .toString();
                            }                           

                            if (bi.isAuthorityIndex()
                                    && StringUtils.isNotEmpty(authority))
                            {
                                // if we have an authority index only
                                // authored metadata will go here!
                                log.debug("Skipping cris=" + item.getUuid()
                                        + ", field=" + md[0] + "." + md[1]
                                        + "." + md[2] + ", value=" + sval
                                        + ", authority=" + authority
                                        + " (BAD AUTHORITY)");
                                continue;
                            }

                            // is there any valid (with appropriate
                            // confidence) authority key?
                            if ((ignoreAuthority && !bi.isAuthorityIndex())
                                    || StringUtils.isNotEmpty(authority))
                            {
                                String nLabel = OrderFormat.makeSortString(
                                        sval, null, bi.getDataType());

                                distFValues.add(nLabel
                                        + SolrServiceImpl.FILTER_SEPARATOR
                                        + sval
                                        + SolrServiceImpl.AUTHORITY_SEPARATOR
                                        + authority);
                                distFAuths.add(authority);
                                distValuesForAC.add(sval);
                            }
                            else
                            // put it in the browse index as if it
                            // hasn't have an authority key
                            {
                                // get the normalised version of the
                                // value
                                String nVal = OrderFormat.makeSortString(sval,
                                        null, bi.getDataType());
                                distFValues.add(nVal
                                        + SolrServiceImpl.FILTER_SEPARATOR
                                        + sval);
                                distFVal.add(sval);
                                distValuesForAC.add(sval);
                            }
                        }
                    }
                }

                for (String facet : distFValues)
                {
                    doc.addField(bi.getDistinctTableName() + "_filter", facet);
                }
                for (String facet : distFAuths)
                {
                    doc.addField(bi.getDistinctTableName()
                            + "_authority_filter", facet);
                }
                for (String facet : distValuesForAC)
                {
                    doc.addField(bi.getDistinctTableName() + "_partial", facet);
                }
                for (String facet : distFVal)
                {
                    doc.addField(bi.getDistinctTableName() + "_value_filter",
                            facet);
                }
            }
        }

        // Add sorting options as configurated for the browse system
        try
        {
            for (SortOption so : SortOption.getSortOptions())
            {
                String[] md = so.getMdBits();
                if (!md[0].equalsIgnoreCase("cris" + item.getPublicPath()))
                {
                    continue;
                }

                List<P> proprieties = item.getAnagrafica4view().get(md[1]);
                Object val = null;
                if (proprieties != null && proprieties.size() > 0)
                {
                    val = proprieties.get(0).getObject();
                }

                if (StringUtils.isNotEmpty(md[2]) && val instanceof ACrisObject)
                {
                    List pointProps = (List) ((ACrisObject) val)
                            .getAnagrafica4view().get(md[2]);
                    if (pointProps != null && pointProps.size() > 0)
                    {
                        val = ((Property) pointProps.get(0)).getObject();
                    }
                }
                if (val != null)
                {
                    String sval = val.toString();
                    String nValue = OrderFormat.makeSortString(sval, null,
                            so.getType());
                    doc.addField("bi_sort_" + so.getNumber() + "_sort", nValue);
                }
            }
View Full Code Here


            List<String> toProjectionFields,
            Map<String, DiscoverySortFieldConfiguration> sortFields,
            List<String> sortFieldsAdded, Set<String> hitHighlightingFields,
            Set<String> moreLikeThisFields)
    {
        AValue value = meta.getValue();

        if (value == null || meta.getVisibility() != VisibilityConstants.PUBLIC)
        {
            return;
        }

        String svalue = meta.toString();
        String authority = null;
        if (value instanceof PointerValue
                && value.getObject() instanceof ACrisObject)
        {
            authority = ResearcherPageUtils
                    .getPersistentIdentifier((ACrisObject) value.getObject());
        }

        if (value instanceof DateValue)
        {
            // TODO: make this date format configurable !
View Full Code Here

TOP

Related Classes of it.cilea.osd.jdyna.model.AValue

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.