use of org.apache.xmpbox.type.IntegerType in project pdfbox by apache.
the class PDFAIdentificationSchema method setPartValueWithString.
/**
* Set the PDFA Version identifier (with string)
*
* @param value
* The version Id value to set
*/
public void setPartValueWithString(String value) {
IntegerType part = (IntegerType) instanciateSimple(PART, value);
addProperty(part);
}
use of org.apache.xmpbox.type.IntegerType in project pdfbox by apache.
the class PhotoshopSchema method setUrgency.
public void setUrgency(Integer s) {
IntegerType tt = (IntegerType) instanciateSimple(URGENCY, s);
setUrgencyProperty(tt);
}
use of org.apache.xmpbox.type.IntegerType in project pdfbox by apache.
the class PhotoshopSchema method setColorMode.
public void setColorMode(String text) {
IntegerType tt = (IntegerType) instanciateSimple(COLOR_MODE, text);
setColorModeProperty(tt);
}
use of org.apache.xmpbox.type.IntegerType in project pdfbox by apache.
the class XMPMediaManagementSchema method setSaveId.
/**
* Set DocumentId value
*
* @param url
* DocumentId value to set
*/
public void setSaveId(Integer url) {
IntegerType tt = (IntegerType) instanciateSimple(SAVE_ID, url);
setSaveIDProperty(tt);
}
use of org.apache.xmpbox.type.IntegerType in project pdfbox by apache.
the class XMPSchemaTest method testProperties.
/**
* Test All common simple properties management in XMPSchema
*
* @throws IllegalArgumentException
* @throws BadFieldValueException
*/
@Test
public void testProperties() throws Exception {
Assert.assertEquals("nsURI", schem.getNamespace());
// In real cases, rdf ns will be declared before !
schem.addNamespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdf");
String aboutVal = "aboutTest";
schem.setAboutAsSimple(aboutVal);
Assert.assertEquals(aboutVal, schem.getAboutValue());
Attribute about = new Attribute(XmpConstants.RDF_NAMESPACE, "about", "YEP");
schem.setAbout(about);
Assert.assertEquals(about, schem.getAboutAttribute());
String textProp = "textProp";
String textPropVal = "TextPropTest";
schem.setTextPropertyValue(textProp, textPropVal);
Assert.assertEquals(textPropVal, schem.getUnqualifiedTextPropertyValue(textProp));
TextType text = parent.getTypeMapping().createText(null, "nsSchem", "textType", "GRINGO");
schem.setTextProperty(text);
Assert.assertEquals(text, schem.getUnqualifiedTextProperty("textType"));
Calendar dateVal = Calendar.getInstance();
String date = "nsSchem:dateProp";
schem.setDatePropertyValue(date, dateVal);
Assert.assertEquals(dateVal, schem.getDatePropertyValue(date));
DateType dateType = parent.getTypeMapping().createDate(null, "nsSchem", "dateType", Calendar.getInstance());
schem.setDateProperty(dateType);
Assert.assertEquals(dateType, schem.getDateProperty("dateType"));
String bool = "nsSchem:booleanTestProp";
Boolean boolVal = false;
schem.setBooleanPropertyValue(bool, boolVal);
Assert.assertEquals(boolVal, schem.getBooleanPropertyValue(bool));
BooleanType boolType = parent.getTypeMapping().createBoolean(null, "nsSchem", "boolType", false);
schem.setBooleanProperty(boolType);
Assert.assertEquals(boolType, schem.getBooleanProperty("boolType"));
String intProp = "nsSchem:IntegerTestProp";
Integer intPropVal = 5;
schem.setIntegerPropertyValue(intProp, intPropVal);
Assert.assertEquals(intPropVal, schem.getIntegerPropertyValue(intProp));
IntegerType intType = parent.getTypeMapping().createInteger(null, "nsSchem", "intType", 5);
schem.setIntegerProperty(intType);
Assert.assertEquals(intType, schem.getIntegerProperty("intType"));
// Check bad type verification
boolean ok = false;
try {
schem.getIntegerProperty("boolType");
} catch (IllegalArgumentException e) {
ok = true;
}
Assert.assertTrue(ok);
ok = false;
try {
schem.getUnqualifiedTextProperty("intType");
} catch (IllegalArgumentException e) {
ok = true;
}
Assert.assertTrue(ok);
ok = false;
try {
schem.getDateProperty("textType");
} catch (IllegalArgumentException e) {
ok = true;
}
Assert.assertTrue(ok);
ok = false;
try {
schem.getBooleanProperty("dateType");
} catch (IllegalArgumentException e) {
ok = true;
}
}
Aggregations