on 01-29-2007 9:58 AM
Hello everyone,
I am trying to create in the KM a custom file property which will be assigned automatically the default date once the file new file is saves.
I have tried various combos all unsuccesful
using Type => Date, Timestamp
Property Renderer => creationdate in the definition of the property metadata.
Is there anyone outher that has done this? I would be very grateful if you could point me to the right direction.
Thanks
Dimitris
Hello Dimitris,
To create custom Date/TimeStamp property for a Resource, I used this code:
String[] datePatterns = new String[] { "dd.MM.yyyy HH:mm:ss", "dd.MM.yyyy", "yy.MM.dd'/'HH:mm" };
ICollection collection = (ICollection) getOrCreateResource(targetFolderName, resourceContext);
IMutablePropertyMap propMap = new MutablePropertyMap();
if (metaName.getType().equals("Timestamp")) {
prop = new MutableProperty(propName, org.apache.commons.lang.time.DateUtils.parseDate(propValue, datePatterns));
} else if (metaName.getType().equals("Date")) {
prop = new MutableProperty(propName, org.apache.commons.lang.time.DateUtils.parseDate(propValue, datePatterns));
}
propMap.put(prop);
IResource actualResource = collection.createResource(targetFileName, props, newContent, false);
Greetings,
Praveen Gudapati
p.s. Points are always welcome for helpful answers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.