Package org.fcrepo.client.utility.validate.types

Examples of org.fcrepo.client.utility.validate.types.DatastreamInfo


    private void confirmMatchForDsTypeModel(ValidationResult result,
                                            DsTypeModel typeModel,
                                            String contentModelPid,
                                            ObjectInfo object) {
        String id = typeModel.getId();
        DatastreamInfo dsInfo = object.getDatastreamInfo(id);
        if (dsInfo == null) {
            // If there is no datastream by that name, nothing to check.
            result.addNote(ValidationResultNotation
                    .noMatchingDatastreamId(contentModelPid, id));
            return;
        }

        Collection<Form> forms = typeModel.getForms();
        if (forms.isEmpty()) {
            // If the type model has no forms, it's an automatic match.
            return;
        }

        // Otherwise, the datastream must meet the constraints of at least one form.
        for (Form form : forms) {
            if (meetsConstraint(dsInfo.getMimeType(), form.getMimeType())
                    && meetsConstraint(dsInfo.getFormatUri(), form
                            .getFormatUri())) {
                return;
            }
        }
        result.addNote(ValidationResultNotation
View Full Code Here


    /**
     * Convert a WSDL-style {@link Datastream} into a local
     * {@link DatastreamInfo}.
     */
    private static DatastreamInfo convertGenDatastreamDefToDatastreamInfo(Datastream ds) {
        return new DatastreamInfo(ds.getID(), ds.getMIMEType(), ds
                .getFormatURI());
    }
View Full Code Here

            ObjectInfo object = getValidationObject(pid);
            if (object == null) {
                return null;
            }

            DatastreamInfo dsInfo =
                    object.getDatastreamInfo(DS_COMPOSITE_MODEL);
            if (dsInfo == null) {
                throw new InvalidContentModelException(pid,
                                                       "Content model has no '"
                                                               + DS_COMPOSITE_MODEL
                                                               + "' datastream.");
            }

            if (!DS_COMPOSITE_MODEL_FORMAT.equals(dsInfo.getFormatUri())) {
                throw new InvalidContentModelException(pid, "Datastream '"
                        + DS_COMPOSITE_MODEL + "' has incorrect format URI: '"
                        + dsInfo.getFormatUri() + "'.");
            }

            MIMETypedStream ds =
                    apia.getDatastreamDissemination(pid,
                                                    DS_COMPOSITE_MODEL,
View Full Code Here

                contentModel("model", typeModels(typeNeither,
                                                 typeMime,
                                                 typeFormat,
                                                 typeBoth));

        DatastreamInfo dsNeither = new DatastreamInfo("neither", null, null);
        DatastreamInfo dsMime = new DatastreamInfo("mime only", "mime", null);
        DatastreamInfo dsFormat =
                new DatastreamInfo("format_uri only", null, "format_uri");
        DatastreamInfo dsBoth =
                new DatastreamInfo("both", "both_mime", "both_format_uri");
        BasicObjectInfo matcher =
                basicObject("severalDatastreamAllMatch",
                            contentModelRelations(model),
                            datastreams(dsNeither, dsMime, dsFormat, dsBoth));
View Full Code Here

                contentModel("model", typeModels(typeNeither));

        BasicObjectInfo neither =
                basicObject("neitherMatchesNeither",
                            contentModelRelations(model),
                            datastreams(new DatastreamInfo("neither",
                                                           null,
                                                           null)));

        BasicObjectInfo mime =
                basicObject("anyMimeMatchesNeither",
                            contentModelRelations(model),
                            datastreams(new DatastreamInfo("neither",
                                                           "wrongMime",
                                                           null)));

        BasicObjectInfo formatUri =
                basicObject("anyFormatMatchesNeither",
                            contentModelRelations(model),
                            datastreams(new DatastreamInfo("neither",
                                                           null,
                                                           "wrongFormat")));

        addSeedsToObjectSource(model, neither, mime, formatUri);
        validateObject(neither);
View Full Code Here

                contentModel("model", typeModels(typeMime));

        BasicObjectInfo neither =
                basicObject("neitherFailsOnMime",
                            contentModelRelations(model),
                            datastreams(new DatastreamInfo("mime", null, null)));

        BasicObjectInfo mime =
                basicObject("mimeMatch",
                            contentModelRelations(model),
                            datastreams(new DatastreamInfo("mime",
                                                           "mimeType",
                                                           null)));

        BasicObjectInfo wrongMime =
                basicObject("mimeMisMatch",
                            contentModelRelations(model),
                            datastreams(new DatastreamInfo("mime",
                                                           "wrongMime",
                                                           null)));

        ValidationResultNotation note =
                ValidationResultNotation.datastreamDoesNotMatchForms(model
View Full Code Here

                contentModel("model", typeModels(typeBoth));

        BasicObjectInfo neither =
                basicObject("neitherFails",
                            contentModelRelations(model),
                            datastreams(new DatastreamInfo("both", null, null)));

        BasicObjectInfo mimeOnly =
                basicObject("mimeFails",
                            contentModelRelations(model),
                            datastreams(new DatastreamInfo("both",
                                                           "mimeType",
                                                           null)));

        BasicObjectInfo fuOnly =
                basicObject("fuFails",
                            contentModelRelations(model),
                            datastreams(new DatastreamInfo("both",
                                                           null,
                                                           "formatUri")));

        BasicObjectInfo both =
                basicObject("bothMatch",
                            contentModelRelations(model),
                            datastreams(new DatastreamInfo("both",
                                                           "mimeType",
                                                           "formatUri")));

        BasicObjectInfo wrongMime =
                basicObject("mimeMismatch",
                            contentModelRelations(model),
                            datastreams(new DatastreamInfo("both",
                                                           "wrongMime",
                                                           "formatUri")));

        BasicObjectInfo wrongFu =
                basicObject("fuMismatch",
                            contentModelRelations(model),
                            datastreams(new DatastreamInfo("both",
                                                           "mime",
                                                           "wrongFormatUri")));

        ValidationResultNotation note =
                ValidationResultNotation.datastreamDoesNotMatchForms(model
View Full Code Here

                             typeModels(typeModel("ds2",
                                                  new TestForm("formatY", null)),
                                        typeModel("dsBoth",
                                                  new TestForm("formatX", null))));

        DatastreamInfo ds1Pass = new DatastreamInfo("ds1", null, "formatA");
        DatastreamInfo ds1Fail = new DatastreamInfo("ds1", null, null);
        DatastreamInfo ds2Pass = new DatastreamInfo("ds2", "mimeK", "formatY");
        DatastreamInfo ds2Fail = new DatastreamInfo("ds2", "mimeK", "formatZ");
        DatastreamInfo dsBothPass =
                new DatastreamInfo("dsBoth", "mimeB", "formatX");
        DatastreamInfo dsBothFail = new DatastreamInfo("dsBoth", "mimeB", null);

        BasicObjectInfo success =
                basicObject("success",
                            contentModelRelations(model1, model2),
                            datastreams(ds1Pass, ds2Pass, dsBothPass));

        BasicObjectInfo failDs1 =
                basicObject("failDs1",
                            contentModelRelations(model1, model2),
                            datastreams(ds1Fail, ds2Pass, dsBothPass));

        BasicObjectInfo failDs2 =
                basicObject("failDs2",
                            contentModelRelations(model1, model2),
                            datastreams(ds1Pass, ds2Fail, dsBothPass));

        BasicObjectInfo failDsBoth =
                basicObject("failDsBoth",
                            contentModelRelations(model1, model2),
                            datastreams(ds1Pass, ds2Pass, dsBothFail));

        ValidationResultNotation note1 =
                ValidationResultNotation.datastreamDoesNotMatchForms(model1
                        .getPid(), ds1Fail.getId());
        ValidationResultNotation note2 =
                ValidationResultNotation.datastreamDoesNotMatchForms(model2
                        .getPid(), ds2Fail.getId());
        ValidationResultNotation note3 =
                ValidationResultNotation.datastreamDoesNotMatchForms(model2
                        .getPid(), dsBothFail.getId());

        addSeedsToObjectSource(model1, success, failDs1, failDs2, failDsBoth);
        addSeedsToObjectSource(model2, success, failDs1, failDs2, failDsBoth);
        validateObject(success);
        validateObject(failDs1, note1);
View Full Code Here

TOP

Related Classes of org.fcrepo.client.utility.validate.types.DatastreamInfo

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.