Package org.fcrepo.server.types.gen

Examples of org.fcrepo.server.types.gen.FieldSearchQuery


public abstract class Util {

    public static Map getSDefLabelMap() throws IOException {
        try {
            HashMap labelMap = new HashMap();
            FieldSearchQuery query = new FieldSearchQuery();
            Condition[] conditions = new Condition[1];
            conditions[0] = new Condition();
            conditions[0].setProperty("fType");
            conditions[0].setOperator(ComparisonOperator.fromValue("eq"));
            conditions[0].setValue("D");
            FieldSearchQuery.Conditions conds =
                    new FieldSearchQuery.Conditions();
            conds.getCondition().addAll(Arrays.asList(conditions));
            ObjectFactory factory = new ObjectFactory();
            query.setConditions(factory.createFieldSearchQueryConditions(conds));
            String[] fields = new String[] {"pid", "label"};
            if (true) {
                /* FIXME: find some other way to do this */
                throw new UnsupportedOperationException("This operation uses obsolete field search semantics");
            }
View Full Code Here


     * service defined by the indicated sDef.
     */
    public static Map getDeploymentLabelMap(String sDefPID) throws IOException {
        try {
            HashMap labelMap = new HashMap();
            FieldSearchQuery query = new FieldSearchQuery();
            Condition[] conditions = new Condition[2];
            conditions[0] = new Condition();
            conditions[0].setProperty("fType");
            conditions[0].setOperator(ComparisonOperator.fromValue("eq"));
            conditions[0].setValue("M");
            conditions[1] = new Condition();
            conditions[1].setProperty("bDef");
            conditions[1].setOperator(ComparisonOperator.fromValue("has"));
            conditions[1].setValue(sDefPID);
            FieldSearchQuery.Conditions conds =
                    new FieldSearchQuery.Conditions();
            conds.getCondition().addAll(Arrays.asList(conditions));
            ObjectFactory factory = new ObjectFactory();
            query.setConditions(factory.createFieldSearchQueryConditions(conds));
            String[] fields = new String[] {"pid", "label"};
            if (true) {
                /*
                 * FIXME: find some other way to do this, if we care. it uses
                 * fType and bDef, which are no longer in field search,
View Full Code Here

    /**
     * Get the indicated fields of the indicated object from the repository.
     */
    public static ObjectFields getObjectFields(String pid, String[] fields)
            throws IOException {
        FieldSearchQuery query = new FieldSearchQuery();
        Condition condition = new Condition();
        condition.setProperty("pid");
        condition.setOperator(ComparisonOperator.fromValue("eq"));
        condition.setValue(pid);
        FieldSearchQuery.Conditions conds = new FieldSearchQuery.Conditions();
        conds.getCondition().add(condition);
        ObjectFactory factory = new ObjectFactory();
        query.setConditions(factory.createFieldSearchQueryConditions(conds));
        FieldSearchResult result =
                Administrator.APIA
                        .findObjects(TypeUtility.convertStringtoAOS(fields),
                                     new BigInteger("1"),
                                     query);
View Full Code Here

                                           FedoraAPIMMTOM targetRepoAPIM,
                                           String logMessage,
                                           PrintStream log,
                                           IngestCounter c) throws Exception {
        // prepare the FieldSearch query
        FieldSearchQuery query = new FieldSearchQuery();
        FieldSearchQuery.Conditions condi = new FieldSearchQuery.Conditions();
        org.fcrepo.server.types.gen.Condition cond =
                new org.fcrepo.server.types.gen.Condition();
        cond.setProperty("pid");
        cond.setOperator(ComparisonOperator.fromValue("has"));
        condi.getCondition().add(cond);
        org.fcrepo.server.types.gen.ObjectFactory factory =
                new org.fcrepo.server.types.gen.ObjectFactory();
        query.setConditions(factory.createFieldSearchQueryConditions(condi));
        query.setTerms(null);
        ArrayOfString resultFields = new ArrayOfString();
        resultFields.getItem().add("pid");

        // get the first chunk of search results
        FieldSearchResult result =
View Full Code Here

                            String exportContext,
                            File dir) throws Exception {
        int count = 0;

        // prepare the FieldSearch query
        FieldSearchQuery query = new FieldSearchQuery();
        query.setTerms(null);

        ArrayOfString resultFields = new ArrayOfString();
        resultFields.getItem().add("pid");

        // get the first chunk of search results
View Full Code Here

    @Test
    public void testFindObjects() throws Exception {
        // Test that a search for pid=demo:5 returns one result; demo:5
        String[] resultFields = {"pid"};
        java.math.BigInteger maxResults = new java.math.BigInteger("" + 100);
        FieldSearchQuery query = new FieldSearchQuery();
        Conditions conds = new Conditions();
        Condition cond = new Condition();
        cond.setOperator(ComparisonOperator.EQ);
        cond.setProperty("pid");
        cond.setValue("demo:5");
        conds.getCondition().add(cond);
        ObjectFactory factory = new ObjectFactory();
        query.setConditions(factory.createFieldSearchQueryConditions(conds));
        FieldSearchResult result =
                apia.findObjects(TypeUtility.convertStringtoAOS(resultFields),
                                 maxResults,
                                 query);
        ResultList resultList = result.getResultList();
View Full Code Here

        // test getting xml for object demo:5
        System.out.println("Running TestAPIM.testValidate...");

        String[] resultFields = {"pid"};
        java.math.BigInteger maxResults = new java.math.BigInteger("" + 1000);
        FieldSearchQuery query = new FieldSearchQuery();
        ObjectFactory factory = new ObjectFactory();
        query.setTerms(factory.createFieldSearchQueryTerms("*"));
        FieldSearchResult result =
                apia.findObjects(TypeUtility.convertStringtoAOS(resultFields), maxResults, query);
        List<ObjectFields> fields = result.getResultList().getObjectFields();
        for (ObjectFields objectFields : fields) {
            String pid = objectFields.getPid().getValue();
View Full Code Here

            String baseURL = protocol + "://" + host + ":" + port + "/" + context;
            FedoraClient fc = new FedoraClient(baseURL, user, pass);
            AutoFinder finder = new AutoFinder(fc.getAPIAMTOM());
            fc.shutdown();

            FieldSearchQuery query = new FieldSearchQuery();
            org.fcrepo.server.types.gen.ObjectFactory factory =
                new org.fcrepo.server.types.gen.ObjectFactory();
            query.setTerms(factory.createFieldSearchQueryTerms(phrase));
            String[] arrayS = fields.split(" ");
            ArrayOfString aux = new ArrayOfString();
            aux.getItem().addAll(Arrays.asList(arrayS));
            FieldSearchResult result =
                    finder.findObjects(aux, 20, query);
View Full Code Here


        String termsTemplate = "$value$";
        TemplatedResourceIterator tri = new TemplatedResourceIterator(termsTemplate, "src/test/resources/APIM2/searchvalues");
        while (tri.hasNext()) {
            FieldSearchQuery query;
            // using conditions
            FieldSearchQuery.Conditions conds = new FieldSearchQuery.Conditions();
            Condition c = new Condition();
            c.setProperty("pid");
            c.setOperator(ComparisonOperator.fromValue("eq"));
            c.setValue(tri.getAttributeValue("value"));
            conds.getCondition().add(c);
            query = new FieldSearchQuery();
            ObjectFactory factory = new ObjectFactory();
            query.setConditions(factory.createFieldSearchQueryConditions(conds));
            apia.findObjects(TypeUtility.convertStringtoAOS(resultFields), maxResults, query);


            String terms = tri.next();
            query = new FieldSearchQuery();
            query.setTerms(factory.createFieldSearchQueryTerms(terms));
            apia.findObjects(TypeUtility.convertStringtoAOS(resultFields), maxResults, query);

        }

        purgeDemoObjects(s_client);
View Full Code Here

    @Test
    public void testValidate() throws Exception {
        String[] resultFields = {"pid"};
        java.math.BigInteger maxResults = new java.math.BigInteger("" + 1000);
        FieldSearchQuery query = new FieldSearchQuery();
        org.fcrepo.server.types.gen.ObjectFactory factory = new org.fcrepo.server.types.gen.ObjectFactory();
        query.setTerms(factory.createFieldSearchQueryTerms("*"));
        FieldSearchResult result =
                apia.findObjects(TypeUtility.convertStringtoAOS(resultFields),
                                 maxResults,
                                 query);

View Full Code Here

TOP

Related Classes of org.fcrepo.server.types.gen.FieldSearchQuery

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.