Examples of DocumentSchema


Examples of com.bluetangstudio.searchcloud.client.model.schema.DocumentSchema

     * Builds the DocumentSchema and return it.
     *
     * @return the DocumentSchema
     * */       
    public final DocumentSchema build() {
        return new DocumentSchema(fields);
    }
View Full Code Here

Examples of com.bluetangstudio.searchcloud.client.model.schema.DocumentSchema

        RestSearchCloudClient client = new RestSearchCloudClient(new DefaultHttpClientFactory(), getUri(), "apikey");

        String modelId = "test_SetSchema";

        DocumentSchemaBuilder builder = new DocumentSchemaBuilder();
        DocumentSchema schema = builder.withField("string", new StringFieldType(Language.ZH_TW)).withField("date",
                new DateFieldType()).withField("location", new LocationFieldType()).withField("int",
                new IntegerFieldType(true)).withField("double", new DoubleFieldType(true)).build();
       
        client.setSchema(new SetSchemaRequest(modelId, schema));
View Full Code Here

Examples of com.bluetangstudio.searchcloud.client.model.schema.DocumentSchema

    public void testGetSchema() throws IOException, ServiceException {

        RestSearchCloudClient client = new RestSearchCloudClient(new DefaultHttpClientFactory(), getUri(), "apikey");

        String modelId = "test_GetSchema";
        DocumentSchema schema = client.getSchema(new GetSchemaRequest(modelId));

        Assert.assertNotNull(schema);

        DocumentSchemaBuilder builder = new DocumentSchemaBuilder();
        DocumentSchema expectedSchema = builder.withField("string", new StringFieldType(Language.ZH_TW)).withField(
                "date", new DateFieldType()).withField("location", new LocationFieldType()).withField("int",
                new IntegerFieldType(true)).withField("double", new DoubleFieldType(true)).build();

        Assert.assertEquals(schema, expectedSchema);
    }
View Full Code Here

Examples of com.bluetangstudio.searchcloud.client.model.schema.DocumentSchema

    @GET
    public DocumentSchema get(@PathParam("modelId") String modelId) {
        Assert.assertNotNull(modelId);

        DocumentSchemaBuilder builder = new DocumentSchemaBuilder();
        DocumentSchema schema = builder.withField("string", new StringFieldType(Language.ZH_TW)).withField("date",
                new DateFieldType()).withField("location", new LocationFieldType()).withField("int",
                new IntegerFieldType(true)).withField("double", new DoubleFieldType(true)).build();

        return schema;
    }
View Full Code Here

Examples of com.bluetangstudio.searchcloud.client.model.schema.DocumentSchema

    @Test
    public void buildHttpUriRequest() {

        DocumentSchemaBuilder documentSchemaBuilder = new DocumentSchemaBuilder();
        DocumentSchema schema = documentSchemaBuilder.withField("string", new StringFieldType(Language.ZH_TW))
                .withField("date", new DateFieldType()).withField("location", new LocationFieldType()).withField("int",
                        new IntegerFieldType(true)).withField("double", new DoubleFieldType(true)).build();

        SetSchemaRequest buildSchemaRequest = new SetSchemaRequest("BuildSchemaRequestBuilderTest", schema);
        setTrackingVariables(buildSchemaRequest);
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.automaton.DocumentSchema

    return doc = cxt.document();
  }

  private MutableDocument<Node, Element, Text> getDocWithSchema(String innerXml) {
    cxt = ContextProviders.createTestPojoContext(innerXml, null, null, null,
        new DocumentSchema() {
          @Override
          public List<String> getRequiredInitialChildren(String typeOrNull) {
            return SCHEMA.getRequiredInitialChildren(typeOrNull);
          }
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.automaton.DocumentSchema

  /** For performance testing
   * @throws OperationException */
  public static void main(String[] argv) throws OperationException {
    RandomProvider random = new RandomProviderImpl(1);
    RandomDocOpGenerator.Parameters params = PARAM_SETS[0];
    DocumentSchema constraints = DocumentSchema.NO_SCHEMA_CONSTRAINTS;
    IndexedDocument<Node, Element, Text> doc =
      new IndexedDocumentImpl<Node, Element, Text, Void>(RawDocumentImpl.PROVIDER.parse("<a></a>"),
          new AnnotationTree<Object>("a", "b", null), constraints);
    AutomatonDocument autoDoc = Automatons.fromReadable(doc);

View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.automaton.DocumentSchema

    private Factory(SchemaProvider schemas) {
      this.schemas = schemas;
    }

    private DocumentSchema getSchemaForId(WaveletId waveletId, String documentId) {
      DocumentSchema result = schemas.getSchemaForId(waveletId, documentId);
      return (result != null) ? result : DocumentSchema.NO_SCHEMA_CONSTRAINTS;
    }
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.automaton.DocumentSchema

   * be the result.  If none return a value null will be returned; if more than
   * one does an {@link IllegalStateException} will be thrown.
   */
  @Override
  public DocumentSchema getSchemaForId(WaveletId waveletId, String documentId) {
    DocumentSchema result = null;
    for (SchemaProvider provider : providers) {
      // TODO(user): Change the way providers (or individual schemas) are
      //   registered to catch ambiguities earlier.
      DocumentSchema value = provider.getSchemaForId(waveletId, documentId);
      assert value != null;
      if (value != DocumentSchema.NO_SCHEMA_CONSTRAINTS) {
        // Check that only one schema matches.  This ensures that the ordering of
        // resolvers doesn't influence which schema is used which could lead to
        // some pretty horrible bugs.
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.automaton.DocumentSchema

        logger.error().log("Error", e);
      }
      return;
    }

    DocumentSchema schema = getSchema();

    ViolationCollector vc = new ViolationCollector();
    if (!DocOpValidator.validate(vc, schema, op).isValid()) {
      logger.error().log("That content does not conform to the schema", vc);
      return;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.