use of com.xpn.xwiki.objects.classes.DateClass in project celements-blog by celements.
the class AddBlogDateValidationMigrator method migrate.
@Override
public void migrate(SubSystemHibernateMigrationManager manager, XWikiContext context) throws XWikiException {
XWikiDocument doc = context.getWiki().getDocument(((BlogClasses) blogClasses).getArticleClassRef(context.getDatabase()), context);
BaseClass bClass = doc.getXClass();
DateClass publishDateElement = (DateClass) bClass.get("publishdate");
DateClass archiveDateElement = (DateClass) bClass.get("archivedate");
publishDateElement.setValidationRegExp("/^((0[1-9]|[12][0-9]|3[01])\\.(0[1-9]|1[012])\\.([0-9]{4}) " + "([01][0-9]|2[0-4])(\\:[0-5][0-9]))$/");
publishDateElement.setValidationMessage("cel_blog_validation_publishdate");
publishDateElement.setDateFormat("dd.MM.yyyy HH:mm");
archiveDateElement.setValidationRegExp("/(^$)|^((0[1-9]|[12][0-9]|3[01])\\.(0[1-9]|1[012])\\.([0-9]{4}) " + "([01][0-9]|2[0-4])(\\:[0-5][0-9]))$/");
archiveDateElement.setValidationMessage("cel_blog_validation_archivedate");
archiveDateElement.setDateFormat("dd.MM.yyyy HH:mm");
context.getWiki().saveDocument(doc, context);
}
use of com.xpn.xwiki.objects.classes.DateClass in project xwiki-platform by xwiki.
the class DBListClassPropertyValuesProviderTest method configure.
@Before
public void configure() throws Exception {
super.configure();
addProperty("category", this.dbListClass, true);
addProperty("date", new DateClass(), false);
when(this.xcontext.getWiki().getDocument(new ClassPropertyReference("status", this.classReference), this.xcontext)).thenReturn(this.classDocument);
this.entityReferenceSerializer = this.mocker.getInstance(EntityReferenceSerializer.TYPE_STRING);
this.authorExecutor = this.mocker.getInstance(AuthorExecutor.class);
DefaultParameterizedType listQueryBuilderType = new DefaultParameterizedType(null, QueryBuilder.class, ListClass.class);
}
Aggregations