Package org.apache.padaf.xmpbox.type

Examples of org.apache.padaf.xmpbox.type.AbstractField


     * @param qualifiedName
     *            the full qualified name of property wanted
     * @return Integer Type property
     */
    public IntegerType getIntegerProperty(String qualifiedName) {
        AbstractField prop = getAbstractProperty(qualifiedName);
        if (prop != null) {
            if (prop instanceof IntegerType) {
                return ((IntegerType) prop);
            } else {
                throw new IllegalArgumentException(
View Full Code Here


     *            The fully qualified property name for the integer.
     *
     * @return The value of the property as an integer.
     */
    public Integer getIntegerPropertyValue(String qualifiedName) {
        AbstractField prop = getAbstractProperty(qualifiedName);
        if (prop != null) {
            if (prop instanceof IntegerType) {
                return ((IntegerType) prop).getValue();
            } else {
                throw new IllegalArgumentException(
View Full Code Here

        ComplexProperty seq = (ComplexProperty) getAbstractProperty(qualifiedSeqName);
        if (seq != null) {
            ArrayList<AbstractField> toDelete = new ArrayList<AbstractField>();
            Iterator<AbstractField> it = seq.getContainer().getAllProperties()
            .iterator();
            AbstractField tmp;
            while (it.hasNext()) {
                tmp = it.next();
                if (tmp instanceof DateType) {
                    if (((DateType) tmp).getValue().equals(date)) {
                        toDelete.add(tmp);
View Full Code Here

        ComplexProperty seq = (ComplexProperty) getAbstractProperty(qualifiedSeqName);
        if (seq != null) {
            retval = new ArrayList<Calendar>();
            Iterator<AbstractField> it = seq.getContainer().getAllProperties()
            .iterator();
            AbstractField tmp;
            while (it.hasNext()) {
                tmp = it.next();
                if (tmp instanceof DateType) {
                    retval.add(((DateType) tmp).getValue());
                }
View Full Code Here

     * @param alt
     *            The property to reorganize
     */
    public void reorganizeAltOrder(ComplexPropertyContainer alt) {
        Iterator<AbstractField> it = alt.getAllProperties().iterator();
        AbstractField xdefault = null;
        boolean xdefaultFound = false;
        // If alternatives contains x-default in first value
        if (it.hasNext()) {
            if (it.next().getAttribute("xml:lang").getValue().equals(
            "x-default")) {
                return;
            }
        }
        // Find the xdefault definition
        while (it.hasNext() && !xdefaultFound) {
            xdefault = it.next();
            if (xdefault.getAttribute("xml:lang").getValue()
                    .equals("x-default")) {
                alt.removeProperty(xdefault);
                xdefaultFound = true;
            }
        }
        if (xdefaultFound) {
            it = alt.getAllProperties().iterator();
            ArrayList<AbstractField> reordered = new ArrayList<AbstractField>();
            ArrayList<AbstractField> toDelete = new ArrayList<AbstractField>();
            reordered.add(xdefault);
            AbstractField tmp;
            while (it.hasNext()) {
                tmp = it.next();
                reordered.add(tmp);
                toDelete.add(tmp);
            }
View Full Code Here

     * @param value
     *            The value of the property in the specified language.
     */
    public void setLanguagePropertyValue(String qualifiedName, String language,
            String value) {
        AbstractField property = getAbstractProperty(qualifiedName);
        ComplexProperty prop;
        if (property != null) {
            // Analyzing content of property
            if (property instanceof ComplexProperty) {
                prop = (ComplexProperty) property;
                Iterator<AbstractField> itCplx = prop.getContainer()
                .getAllProperties().iterator();
                // try to find the same lang definition
                AbstractField tmp;
                // Try to find a definition
                while (itCplx.hasNext()) {
                    tmp = itCplx.next();
                    // System.err.println(tmp.getAttribute("xml:lang").getStringValue());
                    if (tmp.getAttribute("xml:lang").getValue()
                            .equals(language)) {
                        // the same language has been found
                        if (value == null) {
                            // if value null, erase this definition
                            prop.getContainer().removeProperty(tmp);
View Full Code Here

     *
     * @return The value of the language property.
     */
    public String getLanguagePropertyValue(String qualifiedName, String expectedLanguage) {
        String language = (expectedLanguage!=null)?expectedLanguage:"x-default";
        AbstractField property = getAbstractProperty(qualifiedName);
        if (property != null) {
            if (property instanceof ComplexProperty) {
                ComplexProperty prop = (ComplexProperty) property;
                Iterator<AbstractField> langsDef = prop.getContainer()
                .getAllProperties().iterator();
                AbstractField tmp;
                Attribute text;
                while (langsDef.hasNext()) {
                    tmp = langsDef.next();
                    text = tmp.getAttribute("xml:lang");
                    if (text != null) {
                        if (text.getValue().equals(language)) {
                            return ((TextType) tmp).getStringValue();
                        }
                    }
View Full Code Here

     *         if none have been defined.
     */
    public List<String> getLanguagePropertyLanguagesValue(String qualifiedName) {
        List<String> retval = new ArrayList<String>();

        AbstractField property = getAbstractProperty(qualifiedName);
        if (property != null) {
            if (property instanceof ComplexProperty) {
                ComplexProperty prop = (ComplexProperty) property;
                Iterator<AbstractField> langsDef = prop.getContainer()
                .getAllProperties().iterator();
                AbstractField tmp;
                Attribute text;
                while (langsDef.hasNext()) {
                    tmp = langsDef.next();
                    text = tmp.getAttribute("xml:lang");
                    if (text != null) {
                        retval.add(text.getValue());
                    } else {
                        retval.add("x-default");
                    }
View Full Code Here

        }

        String analyzedPropQualifiedName;
        Iterator<AbstractField> itProp = xmpSchema.content.getAllProperties()
        .iterator();
        AbstractField prop;
        while (itProp.hasNext()) {
            prop = itProp.next();
            if (prop.getPrefix().equals(getPrefix())) {
                if (prop instanceof ComplexProperty) {
                    analyzedPropQualifiedName = prop.getQualifiedName();
                    Iterator<AbstractField> itActualEmbeddedProperties = content
                    .getAllProperties().iterator();
                    AbstractField tmpEmbeddedProperty;

                    Iterator<AbstractField> itNewValues;
                    TextType tmpNewValue;

                    Iterator<AbstractField> itOldValues;
                    TextType tmpOldValue;

                    boolean alreadyPresent = false;

                    while (itActualEmbeddedProperties.hasNext()) {
                        tmpEmbeddedProperty = itActualEmbeddedProperties.next();
                        if (tmpEmbeddedProperty instanceof ComplexProperty) {
                            if (tmpEmbeddedProperty.getQualifiedName().equals(
                                    analyzedPropQualifiedName)) {
                                itNewValues = ((ComplexProperty) prop)
                                .getContainer().getAllProperties()
                                .iterator();
                                // Merge a complex property
View Full Code Here

     */
    public List<AbstractField> getArrayList(String qualifiedName)
    throws BadFieldValueException {
        ComplexProperty array = null;
        Iterator<AbstractField> itProp = content.getAllProperties().iterator();
        AbstractField tmp;
        while (itProp.hasNext()) {
            tmp = itProp.next();
            if (tmp.getQualifiedName().equals(qualifiedName)) {
                if (tmp instanceof ComplexProperty) {
                    array = (ComplexProperty) tmp;
                    break;
                } else {
                    throw new BadFieldValueException(
View Full Code Here

TOP

Related Classes of org.apache.padaf.xmpbox.type.AbstractField

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.