Examples of XMPSchema


Examples of org.apache.jempbox.xmp.XMPSchema

     * @throws IOException Signals an error with the XMP processing.
     */
    public void testDateList() throws IOException
    {
        XMPMetadata xmp = new XMPMetadata();
        XMPSchema schema = new XMPSchema(xmp, "test", "http://test.com/test");

        Calendar c1 = Calendar.getInstance();
        c1.set(1999, 11, 31, 0, 0, 0);
        c1.set(Calendar.MILLISECOND, 0);

        Calendar c2 = Calendar.getInstance();
        c2.set(2000, 11, 31, 0, 0, 0);
        c2.set(Calendar.MILLISECOND, 0);
        // System.out.println( DateConverter.toISO8601(c1));

        schema.addSequenceDateValue("test:importantDates", c1);
        schema.addSequenceDateValue("test:importantDates", c2);

        List<Calendar> l = schema.getSequenceDateList("test:importantDates");

        assertEquals(2, l.size());

        assertEquals(c1, (Calendar) l.get(0));
        assertEquals(c2, (Calendar) l.get(1));

        schema.removeSequenceDateValue("test:importantDates", c1);

        l = schema.getSequenceDateList("test:importantDates");

        assertEquals(1, l.size());

        assertEquals(c2, (Calendar) l.get(0));

        // Already removed
        schema.removeSequenceDateValue("test:importantDates", c1);
        l = schema.getSequenceDateList("test:importantDates");
        assertEquals(1, l.size());
        assertEquals(c2, (Calendar) l.get(0));

        // Duplicates Allowed
        schema.addSequenceDateValue("test:importantDates", c2);
        l = schema.getSequenceDateList("test:importantDates");
        assertEquals(2, l.size());
        assertEquals(c2, (Calendar) l.get(0));
        assertEquals(c2, (Calendar) l.get(1));

        // Remvoes all
        schema.removeSequenceDateValue("test:importantDates", c2);
        l = schema.getSequenceDateList("test:importantDates");
        assertEquals(0, l.size());
    }
View Full Code Here

Examples of org.apache.jempbox.xmp.XMPSchema

     * @throws IOException Signals an error with the XMP processing.
     */
    public void testSeqList() throws IOException
    {
        XMPMetadata xmp = new XMPMetadata();
        XMPSchema schema = new XMPSchema(xmp, "test", "http://test.com/test");

        schema.addSequenceValue("author", "Tom DeMarco");
        schema.addSequenceValue("author", "Kent Beck");
        {

            List l = schema.getSequenceList("author");

            assertEquals(2, l.size());

            assertEquals("Tom DeMarco", l.get(0));
            assertEquals("Kent Beck", l.get(1));
        }
        {
            schema.removeSequenceValue("author", "Tom DeMarco");
            List l = schema.getSequenceList("author");
            assertEquals(1, l.size());
            assertTrue(l.get(0).equals("Kent Beck"));
        }
        { // Already removed
            schema.removeSequenceValue("author", "Tom DeMarco");
            List l = schema.getSequenceList("author");
            assertEquals(1, l.size());
            assertTrue(l.get(0).equals("Kent Beck"));
        }
        { // Duplicates allowed!
            schema.addSequenceValue("author", "Kent Beck");
            List l = schema.getSequenceList("author");
            assertEquals(2, l.size());
            assertTrue(l.get(0).equals("Kent Beck"));
            assertTrue(l.get(1).equals("Kent Beck"));
        }
        { // Remvoes all
            schema.removeSequenceValue("author", "Kent Beck");
            List l = schema.getSequenceList("author");
            assertEquals(0, l.size());
        }
    }
View Full Code Here

Examples of org.apache.jempbox.xmp.XMPSchema

     * @throws IOException Signals an error with the XMP processing.
     */
    public void testDateList() throws IOException
    {
        XMPMetadata xmp = new XMPMetadata();
        XMPSchema schema = new XMPSchema(xmp, "test", "http://test.com/test");

        Calendar c1 = Calendar.getInstance();
        c1.set(1999, 11, 31, 0, 0, 0);
        c1.set(Calendar.MILLISECOND, 0);

        Calendar c2 = Calendar.getInstance();
        c2.set(2000, 11, 31, 0, 0, 0);
        c2.set(Calendar.MILLISECOND, 0);
        System.out.println( DateConverter.toISO8601(c1));

        schema.addSequenceDateValue("test:importantDates", c1);
        schema.addSequenceDateValue("test:importantDates", c2);

        List l = schema.getSequenceDateList("test:importantDates");

        assertEquals(2, l.size());

        assertEquals(c1, (Calendar) l.get(0));
        assertEquals(c2, (Calendar) l.get(1));

        schema.removeSequenceDateValue("test:importantDates", c1);

        l = schema.getSequenceDateList("test:importantDates");

        assertEquals(1, l.size());

        assertEquals(c2, (Calendar) l.get(0));

        // Already removed
        schema.removeSequenceDateValue("test:importantDates", c1);
        l = schema.getSequenceDateList("test:importantDates");
        assertEquals(1, l.size());
        assertEquals(c2, (Calendar) l.get(0));

        // Duplicates Allowed
        schema.addSequenceDateValue("test:importantDates", c2);
        l = schema.getSequenceDateList("test:importantDates");
        assertEquals(2, l.size());
        assertEquals(c2, (Calendar) l.get(0));
        assertEquals(c2, (Calendar) l.get(1));

        // Remvoes all
        schema.removeSequenceDateValue("test:importantDates", c2);
        l = schema.getSequenceDateList("test:importantDates");
        assertEquals(0, l.size());
    }
View Full Code Here

Examples of org.apache.jempbox.xmp.XMPSchema

     */
    public void testRDFDescription() throws IOException, ParserConfigurationException
    {
        // Check constructor using an element
        XMPMetadata xmp = new XMPMetadata();
        XMPSchema basic = new XMPSchema(xmp, "test", "http://test.com/test");

        assertNotNull(basic.getElement());
        assertEquals("rdf:Description", basic.getElement().getTagName());

        // Then Check using the Document Builder Factory
        DocumentBuilderFactory builderFactory = DocumentBuilderFactory
                .newInstance();
        DocumentBuilder builder = builderFactory.newDocumentBuilder();
        Element e = builder.newDocument().createElement("rdf:Description");

        XMPSchema schema = new XMPSchema(e, "test");

        assertEquals(e, schema.getElement());
        assertEquals("rdf:Description", schema.getElement().getTagName());
    }
View Full Code Here

Examples of org.apache.jempbox.xmp.XMPSchema

     * @throws IOException Signals an error with the XMP processing.
     */
    public void testTextProperty() throws IOException
    {
        XMPMetadata xmp = new XMPMetadata();
        XMPSchema schema = new XMPSchema(xmp, "test", "http://test.com/test");

        schema.setTextProperty("test:title",
                "The advanced Flux-Compensation for Delawney-Separation");

        Element e = schema.getElement();
        assertEquals("The advanced Flux-Compensation for Delawney-Separation",
                e.getAttribute("test:title"));

        assertEquals("The advanced Flux-Compensation for Delawney-Separation",
                schema.getTextProperty("test:title"));

        schema.setTextProperty("test:title",
                "Bacon's Dictum and Healey's Heaven");

        e = schema.getElement();
        assertEquals("Bacon's Dictum and Healey's Heaven", e
                .getAttribute("test:title"));

        assertEquals("Bacon's Dictum and Healey's Heaven", schema
                .getTextProperty("test:title"));

        schema
                .setTextProperty(
                        "test:abstract",
                        "   The abstract\n can go \n \n on several" +
                        " \n lines with \n many \n\n empty ones in \n between.");
        assertEquals(
                "   The abstract\n can go \n \n on several" +
                " \n lines with \n many \n\n empty ones in \n between.",
                schema.getTextProperty("test:abstract"));
    }
View Full Code Here

Examples of org.apache.jempbox.xmp.XMPSchema

     */
    public void testBags() throws IOException
    {

        XMPMetadata xmp = new XMPMetadata();
        XMPSchema schema = new XMPSchema(xmp, "test", "http://test.com/test");

        schema.addBagValue("author", "Tom DeMarco");
        schema.addBagValue("author", "Kent Beck");
        {

            List l = schema.getBagList("author");

            assertEquals(2, l.size());

            assertTrue(l.get(0).equals("Tom DeMarco")
                    || l.get(1).equals("Tom DeMarco"));
            assertTrue(l.get(0).equals("Kent Beck")
                    || l.get(1).equals("Kent Beck"));
        }
        {
            schema.removeBagValue("author", "Kent Beck");
            List l = schema.getBagList("author");
            assertEquals(1, l.size());
            assertTrue(l.get(0).equals("Tom DeMarco"));
        }
        { // Already removed
            schema.removeBagValue("author", "Kent Beck");
            List l = schema.getBagList("author");
            assertEquals(1, l.size());
            assertTrue(l.get(0).equals("Tom DeMarco"));
        }
        { // Duplicates allowed!
            schema.addBagValue("author", "Tom DeMarco");
            List l = schema.getBagList("author");
            assertEquals(2, l.size());
            assertTrue(l.get(0).equals("Tom DeMarco"));
            assertTrue(l.get(1).equals("Tom DeMarco"));
        }
        { // Removes both
            schema.removeBagValue("author", "Tom DeMarco");
            List l = schema.getBagList("author");
            assertEquals(0, l.size());
        }
    }
View Full Code Here

Examples of org.apache.padaf.xmpbox.schema.XMPSchema

    } else {
      int c = 0;
      String namespaceUri = reader.get().getNamespaceURI(c);
      String namespacePrefix = reader.get().getNamespacePrefix(c);
      c++;
      XMPSchema schema = nsMap.getAssociatedSchemaObject(metadata, namespaceUri, namespacePrefix);
      while (c<reader.get().getNamespaceCount() && schema==null) {
        // try next
        namespaceUri = reader.get().getNamespaceURI(c);
        namespacePrefix = reader.get().getNamespacePrefix(c);
        schema = nsMap.getAssociatedSchemaObject(metadata, namespaceUri, namespacePrefix);
        c++;
      }

      if (schema != null) {
        namespaces.remove(namespacePrefix);
      } else {
        schema = metadata.createAndAddDefaultSchema(namespacePrefix,namespaceUri);
      }

      for (int i = 1; i < cptNS; i++) {
        schema.setAttribute(new Attribute(XMPSchema.NS_NAMESPACE,
            "xmlns", reader.get().getNamespacePrefix(i), reader.get().getNamespaceURI(i)));
      }
      treatDescriptionAttributes(metadata, schema);
      while (reader.get().nextTag() == XMLStreamReader.START_ELEMENT) {
        parseProperty(schema, metadata);
View Full Code Here

Examples of org.apache.padaf.xmpbox.schema.XMPSchema

   *             When Instancing specified Object Schema failed
   */
  @SuppressWarnings("unchecked")
  public XMPSchema createXMPSchema(XMPMetadata metadata, String prefix)
  throws XmpSchemaException {
    XMPSchema schema = null;
    Class[] argsClass;
    Object[] schemaArgs;

    if (isDeclarative) {
      argsClass = new Class[] { XMPMetadata.class, String.class, String.class };
View Full Code Here

Examples of org.apache.padaf.xmpbox.schema.XMPSchema

  @Before
  public void init() throws Exception {
    metadata = new XMPMetadata();
    String tmpNsURI = "http://www.test.org/schem/";
    tmp = new XMPSchema(metadata, "test", tmpNsURI);
    tmp.addBagValue("test:BagContainer", "Value1");
    tmp.addBagValue("test:BagContainer", "Value2");
    tmp.addBagValue("test:BagContainer", "Value3");

    tmp.addSequenceValue("test:SeqContainer", "Value1");
    tmp.addSequenceValue("test:SeqContainer", "Value2");
    tmp.addSequenceValue("test:SeqContainer", "Value3");

    tmp
        .addProperty(new TextType(metadata, "test", "simpleProperty",
            "YEP"));

    tmp2 = new XMPSchema(metadata, "space", "http://www.space.org/schem/");
    tmp2.addSequenceValue("test:SeqSpContainer", "ValueSpace1");
    tmp2.addSequenceValue("test:SeqSpContainer", "ValueSpace2");
    tmp2.addSequenceValue("test:SeqSpContainer", "ValueSpace3");

    metadata.addSchema(tmp);
View Full Code Here

Examples of org.apache.padaf.xmpbox.schema.XMPSchema

  protected XMPSchema schem;

  @Before
  public void resetDocument() throws Exception {
    parent = new XMPMetadata();
    schem = new XMPSchema(parent, "nsSchem", "nsURI");

  }
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.