Package org.dspace.content.authority

Examples of org.dspace.content.authority.ChoiceAuthorityManager


    {
        try
        {
            Item item = Item.find(context, itemID);
            String rpKey = cris.getCrisID();
            ChoiceAuthorityManager cam = ChoiceAuthorityManager.getManager();
            if (metadata == null)
            {
                metadata = cam.getAuthorityMetadataForAuthority(getAuthorityName());
            }
            for (String issued : metadata)
            {
                String[] metadata = issued.split("\\.");
                DCValue[] original = item.getMetadata(issued);
View Full Code Here


        try
        {
            Item item = Item.find(context, itemID);
            String rpKey = cris.getCrisID();
            // the item is not linked with the RP
            ChoiceAuthorityManager cam = ChoiceAuthorityManager.getManager();
            metadata = cam
                    .getAuthorityMetadataForAuthority(getAuthorityName());

            List<String> names = new ArrayList<String>();
            String fieldKey = metadata.get(0);
            String[] split = fieldKey.split("\\.");
            String fschema = split[0];
            String felement = split[1];
            String fqualifier = split.length > 2 ? split[2] : null;
            names.add(cam.getLabel(fschema, felement, fqualifier, rpKey, null));
            List<String> variants = cam.getVariants(fschema, felement, fqualifier,
                    rpKey, null);
            if (variants != null)
            {
                names.addAll(variants);
            }
View Full Code Here

                        String inputType = dcInput.getInputType();

                        // if this field is configured as choice control and its
                        // presentation format is SELECT, render it as select field:
                        String fieldKey = MetadataAuthorityManager.makeFieldKey(schema, element, qualifier);
                        ChoiceAuthorityManager cmgr = ChoiceAuthorityManager.getManager();
                        if (cmgr.isChoicesConfigured(fieldKey) &&
                            Params.PRESENTATION_SELECT.equals(cmgr.getPresentation(fieldKey)))
                        {
                                renderChoiceSelectField(form, fieldName, collection, dcInput, dcValues, readonly);
                        }
                        else if (inputType.equals("name"))
                        {
View Full Code Here

            {
                fieldName = schema + "_" + element;
            }

            String fieldKey = MetadataAuthorityManager.makeFieldKey(schema, element, qualifier);
            ChoiceAuthorityManager cmgr = ChoiceAuthorityManager.getManager();
            String inputType = inputs[j].getInputType();
            if (inputType.equals("name"))
            {
                readNames(request, item, schema, element, qualifier, inputs[j]
                        .getRepeatable());
            }
            else if (inputType.equals("date"))
            {
                readDate(request, item, schema, element, qualifier);
            }
            // choice-controlled input with "select" presentation type is
            // always rendered as a dropdown menu
            else if (inputType.equals("dropdown") || inputType.equals("list") ||
                     (cmgr.isChoicesConfigured(fieldKey) &&
                      "select".equals(cmgr.getPresentation(fieldKey))))
            {
                String[] vals = request.getParameterValues(fieldName);
                if (vals != null)
                {
                    for (int z = 0; z < vals.length; z++)
View Full Code Here

     */
    public void addMetadata(String schema, String element, String qualifier, String lang,
            String[] values, String authorities[], int confidences[])
    {
        MetadataAuthorityManager mam = MetadataAuthorityManager.getManager();
        ChoiceAuthorityManager cam = ChoiceAuthorityManager.getManager();
        boolean authorityControlled = mam.isAuthorityControlled(schema, element, qualifier);
        boolean authorityRequired = mam.isAuthorityRequired(schema, element, qualifier);
        String fieldName = schema+"."+element+((qualifier==null)? "": "."+qualifier);

        // We will not verify that they are valid entries in the registry
View Full Code Here

     *  locale - explicit locale, pass to choice plugin
     */
    private void process(Context context, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException {
        String[] paths = request.getPathInfo().split("/");
        String field = paths[paths.length-1];
        ChoiceAuthorityManager cam = ChoiceAuthorityManager.getManager();

        String query = request.getParameter("query");
        String format = request.getParameter("format");
        int collection = UIUtil.getIntParameter(request, "collection");
        int start = UIUtil.getIntParameter(request, "start");
        int limit = UIUtil.getIntParameter(request, "limit");

        Choices result = cam.getMatches(field, query, collection, start, limit, null);
//        Choice[] testValues = {
//            new Choice("rp0001", "VALUE1","TEST LABEL1"),
//            new Choice("rp0002", "VALUE2","TEST LABEL2"),
//            new Choice("rp0003", "VALUE3","TEST LABEL3"),
//            new Choice("rp0004", "VALUE COGN, LABEL1","TEST COGN, LABEL1"),
View Full Code Here

            String value = "";
            if (info.hasValue())
            {
                if (bix.isAuthorityIndex())
                {
                    ChoiceAuthorityManager cm = ChoiceAuthorityManager.getManager();
                    String fk = cm.makeFieldKey(bix.getMetadata(0));
                    value = "\""+cm.getLabel(fk, info.getValue(), null)+"\"";
                }
                else
                    value = "\"" + info.getValue() + "\"";
            }
View Full Code Here

                header.addCell().addContent(T_column1);
                header.addCell().addContent(T_column2);
                header.addCell().addContent(T_column3);
                header.addCell().addContent(T_column4);

                ChoiceAuthorityManager cmgr = ChoiceAuthorityManager.getManager();
                for(DCValue value : values)
                {
                        String name = value.schema + "_" + value.element;
                        if (value.qualifier != null)
                                name += "_" + value.qualifier;

                        Row row = table.addRow(name,Row.ROLE_DATA,"metadata-value");

                        CheckBox remove = row.addCell().addCheckBox("remove_"+index);
                        remove.setLabel("remove");
                        remove.addOption(index);

                        Cell cell = row.addCell();
                        cell.addContent(name.replaceAll("_", ". "));
                        cell.addHidden("name_"+index).setValue(name);

                        // value entry cell:
                        Cell mdCell = row.addCell();
                        String fieldKey = MetadataAuthorityManager.makeFieldKey(value.schema, value.element, value.qualifier);

                        // put up just a selector when preferred choice presentation is select:
                        if (cmgr.isChoicesConfigured(fieldKey) &&
                            Params.PRESENTATION_SELECT.equals(cmgr.getPresentation(fieldKey)))
                        {
                            Select mdSelect = mdCell.addSelect("value_"+index);
                            mdSelect.setSize(1);
                            Choices cs = cmgr.getMatches(fieldKey, value.value, collectionID, 0, 0, null);
                            if (cs.defaultSelected < 0)
                                mdSelect.addOption(true, value.value, value.value);
                            for (int i = 0; i < cs.values.length; ++i)
                            {
                                mdSelect.addOption(i == cs.defaultSelected, cs.values[i].value, cs.values[i].label);
View Full Code Here

            {
                fieldName = schema + "_" + element;
            }

            String fieldKey = MetadataAuthorityManager.makeFieldKey(schema, element, qualifier);
            ChoiceAuthorityManager cmgr = ChoiceAuthorityManager.getManager();
            String inputType = inputs[j].getInputType();
            if (inputType.equals("name"))
            {
                readNames(request, item, schema, element, qualifier, inputs[j]
                        .getRepeatable());
            }
            else if (inputType.equals("date"))
            {
                readDate(request, item, schema, element, qualifier);
            }
            // choice-controlled input with "select" presentation type is
            // always rendered as a dropdown menu
            else if (inputType.equals("dropdown") || inputType.equals("list") ||
                     (cmgr.isChoicesConfigured(fieldKey) &&
                      "select".equals(cmgr.getPresentation(fieldKey))))
            {
                String[] vals = request.getParameterValues(fieldName);
                if (vals != null)
                {
                    for (int z = 0; z < vals.length; z++)
View Full Code Here

     *  locale - explicit locale, pass to choice plugin
     */
    private void process(Context context, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException {
        String[] paths = request.getPathInfo().split("/");
        String field = paths[paths.length-1];
        ChoiceAuthorityManager cam = ChoiceAuthorityManager.getManager();

        String query = request.getParameter("query");
        String format = request.getParameter("format");
        int collection = UIUtil.getIntParameter(request, "collection");
        int start = UIUtil.getIntParameter(request, "start");
        int limit = UIUtil.getIntParameter(request, "limit");

        Choices result = cam.getMatches(field, query, collection, start, limit, null);
//        Choice[] testValues = {
//            new Choice("rp0001", "VALUE1","TEST LABEL1"),
//            new Choice("rp0002", "VALUE2","TEST LABEL2"),
//            new Choice("rp0003", "VALUE3","TEST LABEL3"),
//            new Choice("rp0004", "VALUE COGN, LABEL1","TEST COGN, LABEL1"),
View Full Code Here

TOP

Related Classes of org.dspace.content.authority.ChoiceAuthorityManager

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.