Examples of PropertyOptions


Examples of com.adobe.xmp.options.PropertyOptions

        String ns = registry.getNamespaceURI( keyParts[0] );
        if (ns != null) {
            try {
                int arrayType = tikaToXMPArrayType( property.getPrimaryProperty().getPropertyType() );
                xmpData.setProperty( ns, keyParts[1], null, new PropertyOptions( arrayType ) );

                for (String value : values) {
                    xmpData.appendArrayItem( ns, keyParts[1], value );
                }
            }
View Full Code Here

Examples of com.adobe.xmp.options.PropertyOptions

     */
    protected void createArrayProperty(String tikaKey, String ns, String propertyName, int arrayType)
            throws XMPException {
        String[] values = metadata.getValues( tikaKey );
        if (values != null) {
            meta.setProperty( ns, propertyName, null, new PropertyOptions( arrayType ) );
            for (String value : values) {
                meta.appendArrayItem( ns, propertyName, value );
            }
        }
    }
View Full Code Here

Examples of com.adobe.xmp.options.PropertyOptions

     */
    protected void createCommaSeparatedArray(String tikaKey, String ns, String propertyName,
            int arrayType) throws XMPException {
        String value = metadata.get( tikaKey );
        if (value != null && value.length() > 0) {
            XMPUtils.separateArrayItems( meta, ns, propertyName, value, new PropertyOptions(
                    arrayType ), false );
        }
    }
View Full Code Here

Examples of com.adobe.xmp.options.PropertyOptions

   * Removes one qualifier node and fixes the options.
   * @param qualNode qualifier to remove
   */
  public void removeQualifier(XMPNode qualNode)
  {
    PropertyOptions opts = getOptions();
    if (qualNode.isLanguageNode())
    {
      // if "xml:lang" is removed, remove hasLanguage-flag too
      opts.setHasLanguage(false);
    }
    else if (qualNode.isTypeNode())
    {
      // if "rdf:type" is removed, remove hasType-flag too
      opts.setHasType(false);
    }
   
    getQualifier().remove(qualNode);
    if (qualifier.isEmpty())
    {
      opts.setHasQualifiers(false);
      qualifier = null;
    }
   
  }
View Full Code Here

Examples of com.adobe.xmp.options.PropertyOptions

  /**
   * Removes all qualifiers from the node and sets the options appropriate.
   */
  public void removeQualifiers()
  {
    PropertyOptions opts = getOptions();
    // clear qualifier related options
    opts.setHasQualifiers(false);
    opts.setHasLanguage(false);
    opts.setHasType(false);
    qualifier = null;
  }
View Full Code Here

Examples of com.adobe.xmp.options.PropertyOptions

   *
   * @see java.lang.Object#clone()
   */
  public Object clone()
  {
    PropertyOptions newOptions;
    try
    {
      newOptions = new PropertyOptions(getOptions().getOptions());
    }
    catch (XMPException e)
    {
      // cannot happen
      newOptions = new PropertyOptions();
    }
   
    XMPNode newNode = new XMPNode(name, value, newOptions);
    cloneSubtree(newNode);
   
View Full Code Here

Examples of com.adobe.xmp.options.PropertyOptions

   */
  public PropertyOptions getOptions()
  {
    if (options == null)
    {
      options = new PropertyOptions();
    }
    return options;
  }
View Full Code Here

Examples of com.adobe.xmp.options.PropertyOptions

  {
    for (int i = 1; i <= dcSchema.getChildrenLength(); i++)
    {
      XMPNode currProp = dcSchema.getChild(i);
     
      PropertyOptions arrayForm = (PropertyOptions) dcArrayForms.get(currProp.getName());
      if (arrayForm == null)
      {
        continue;
      }
      else if (currProp.getOptions().isSimple())
      { 
        // create a new array and add the current property as child,
        // if it was formerly simple
        XMPNode newArray = new XMPNode(currProp.getName(), arrayForm);
        currProp.setName(XMPConst.ARRAY_ITEM_NAME);
        newArray.addChild(currProp);
        dcSchema.replaceChild(i, newArray);
 
        // fix language alternatives
        if (arrayForm.isArrayAltText()  &&  !currProp.getOptions().getHasLanguage())
        {
          XMPNode newLang = new XMPNode(XMPConst.XML_LANG, XMPConst.X_DEFAULT, null);
          currProp.addQualifier(newLang);
        }
      }
      else
      {
        // clear array options and add corrected array form if it has been an array before
        currProp.getOptions().setOption(
          PropertyOptions.ARRAY  |
          PropertyOptions.ARRAY_ORDERED  |
          PropertyOptions.ARRAY_ALTERNATE  |
          PropertyOptions.ARRAY_ALT_TEXT, 
          false);
        currProp.getOptions().mergeWith(arrayForm);
       
        if (arrayForm.isArrayAltText())
        {
          // applying for "dc:description", "dc:rights", "dc:title"
          repairAltText(currProp);
        }
      }
View Full Code Here

Examples of com.adobe.xmp.options.PropertyOptions

  private static void initDCArrays()
  {
    dcArrayForms = new HashMap();
   
    // Properties supposed to be a "Bag".
    PropertyOptions bagForm = new PropertyOptions();
    bagForm.setArray(true);
    dcArrayForms.put("dc:contributor", bagForm);
    dcArrayForms.put("dc:language", bagForm);
    dcArrayForms.put("dc:publisher", bagForm);
    dcArrayForms.put("dc:relation", bagForm);
    dcArrayForms.put("dc:subject", bagForm);
    dcArrayForms.put("dc:type", bagForm);

    // Properties supposed to be a "Seq".
    PropertyOptions seqForm = new PropertyOptions();
    seqForm.setArray(true);
    seqForm.setArrayOrdered(true);
    dcArrayForms.put("dc:creator", seqForm);
    dcArrayForms.put("dc:date", seqForm);
   
    // Properties supposed to be an "Alt" in alternative-text form.
    PropertyOptions altTextForm = new PropertyOptions();
    altTextForm.setArray(true);
    altTextForm.setArrayOrdered(true);
    altTextForm.setArrayAlternate(true);
    altTextForm.setArrayAltText(true);
    dcArrayForms.put("dc:description", altTextForm);
    dcArrayForms.put("dc:rights", altTextForm);
    dcArrayForms.put("dc:title", altTextForm);
  }
View Full Code Here

Examples of com.adobe.xmp.options.PropertyOptions

        String ns = registry.getNamespaceURI( keyParts[0] );
        if (ns != null) {
            try {
                int arrayType = tikaToXMPArrayType( property.getPrimaryProperty().getPropertyType() );
                xmpData.setProperty( ns, keyParts[1], null, new PropertyOptions( arrayType ) );

                for (String value : values) {
                    xmpData.appendArrayItem( ns, keyParts[1], value );
                }
            }
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.