use of nl.knaw.huygens.timbuctoo.model.Change in project timbuctoo by HuygensING.
the class ChangeRangeFacetGetterTest method serializedChangeWithDate.
/**
* Serializes a Change with a json object mapper.
*
* @param dateString a date in the format yyyyMMdd
* @return the serialized Change
*/
private String serializedChangeWithDate(String dateString) {
try {
LocalDate localDate = LocalDate.parse(dateString, DateTimeFormatter.BASIC_ISO_DATE);
Instant instant = localDate.atStartOfDay(ZoneId.systemDefault()).toInstant();
Change change = new Change(instant.toEpochMilli(), "notImportant", "notImportant");
return new ObjectMapper().writeValueAsString(change);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of nl.knaw.huygens.timbuctoo.model.Change in project timbuctoo by HuygensING.
the class TimbuctooActions method createEntity.
public UUID createEntity(Collection collection, Optional<Collection> baseCollection, Iterable<TimProperty<?>> properties, User user) throws PermissionFetchingException, IOException {
checkIfAllowedToWrite(user, collection);
UUID id = UUID.randomUUID();
Change created = createChange(user);
CreateEntity createEntity = ImmutableCreateEntity.builder().properties(properties).id(id).created(created).build();
dataStoreOperations.createEntity(collection, baseCollection, createEntity);
afterSuccessTaskExecutor.addTask(new AddPersistentUrlTask(persistentUrlCreator, uriToRedirectToFromPersistentUrls.apply(collection.getCollectionName(), id, 1), ImmutableEntityLookup.builder().rev(1).timId(id).collection(collection.getCollectionName()).build()));
return id;
}
Aggregations