@Override protected String composeIndexNameFromEntry(UpdateDocumentEntry entry) { return MicroschemaContainer.composeIndexName(); }
@Override protected String composeIndexNameFromEntry(UpdateDocumentEntry entry) { return SchemaContainer.composeIndexName(); }
private SchemaModel getLatestVersion(SchemaContainer schema) { return JsonUtil.readValue(schema.getLatestVersion().getJson(), SchemaModelImpl.class); } }
public static MicroschemaContainer mockMicroschemaContainer(String name, User user) { MicroschemaContainer container = mock(MicroschemaContainer.class); when(container.getName()).thenReturn(name); when(container.getUuid()).thenReturn(MICROSCHEMA_UUID); MicroschemaContainerVersion latestVersion = mock(MicroschemaContainerVersion.class); when(latestVersion.getSchema()).thenReturn(mockGeolocationMicroschema()); when(container.getLatestVersion()).thenReturn(latestVersion); when(container.getCreator()).thenReturn(user); when(container.getCreationTimestamp()).thenReturn(TIMESTAMP_OLD); when(container.getEditor()).thenReturn(user); when(container.getLastEditedTimestamp()).thenReturn(TIMESTAMP_NEW); when(container.getRolesWithPerm(GraphPermission.READ_PERM)).thenReturn(createEmptyTraversal()); when(container.getElementVersion()).thenReturn(UUID_5); return container; }
/** * Transform the given schema and add it to the source map. * * @param document * @param schemaContainerVersion */ private void addSchema(JsonObject document, SchemaContainerVersion schemaContainerVersion) { String name = schemaContainerVersion.getName(); String uuid = schemaContainerVersion.getSchemaContainer().getUuid(); Map<String, String> schemaFields = new HashMap<>(); schemaFields.put(NAME_KEY, name); schemaFields.put(UUID_KEY, uuid); schemaFields.put(VERSION_KEY, schemaContainerVersion.getVersion()); document.put("schema", schemaFields); }
private FilterField<NodeContent, ?> createFieldFilter(SchemaContainer schema) { return new MappedFilter<>(schema.getName(), "Filters by fields of the " + schema.getName() + " schema", FieldFilter.filter(context, schema.getLatestVersion().getSchema()), NodeContent::getContainer); } }
public SchemaResponseAssert matches(SchemaContainerVersion version) { assertNotNull(version); assertNotNull(actual); Schema storedSchema = version.getSchema(); matches(storedSchema); SchemaContainer container = version.getSchemaContainer(); matches(container); return this; }
public String generateVersion(SchemaContainer container) { StringBuilder builder = new StringBuilder(); builder.append(container.getElementVersion()); builder.append("|"); builder.append(container.getLatestVersion().getElementVersion()); // No need to add users since the creator/editor edge affects the schema version return ETag.hash(builder.toString()); }
/** * Transform the given microschema container and add it to the source map. * * @param map * @param microschemaContainerVersion */ private void addMicroschema(JsonObject document, MicroschemaContainerVersion microschemaContainerVersion) { JsonObject info = new JsonObject(); info.put(NAME_KEY, microschemaContainerVersion.getName()); info.put(UUID_KEY, microschemaContainerVersion.getUuid()); // TODO add version document.put("microschema", info); }
/** * Return the index name for the given parameters. * * @param projectUuid * @param branchUuid * @param type * @return */ default String getIndexName(String projectUuid, String branchUuid, ContainerType type) { return composeIndexName(projectUuid, branchUuid, getSchemaContainerVersion().getUuid(), type); }
/** * Compare two versions. * * @param version */ default int compareTo(SCV version) { return VersionUtil.compareVersions(getVersion(), version.getVersion()); }
public String generateVersion(MicroschemaContainer microschema) { // No need to add users since the creator/editor edge affects the microschema version return ETag.hash(microschema.getElementVersion()); }
@Override public JsonObject toDocument(MicroschemaContainer microschema) { JsonObject document = new JsonObject(); addBasicReferences(document, microschema); document.put(NAME_KEY, microschema.getName()); addPermissionInfo(document, microschema); // map.put(DESCRIPTION_KEY, microschema.getSchema().getDescription()); document.put(VERSION_KEY, generateVersion(microschema)); return document; }
@Override protected String composeDocumentIdFromEntry(UpdateDocumentEntry entry) { return SchemaContainer.composeDocumentId(entry.getElementUuid()); }
@Override protected String composeDocumentIdFromEntry(UpdateDocumentEntry entry) { return MicroschemaContainer.composeDocumentId(entry.getElementUuid()); }
@Override public JsonObject toDocument(SchemaContainer container) { JsonObject document = new JsonObject(); document.put(NAME_KEY, container.getName()); document.put(DESCRIPTION_KEY, container.getLatestVersion().getSchema().getDescription()); addBasicReferences(document, container); addPermissionInfo(document, container); document.put(VERSION_KEY, generateVersion(container)); return document; }
@Override public Set<String> getSelectedIndices(InternalActionContext ac) { return Collections.singleton(MicroschemaContainer.composeIndexName()); }
@Override public Set<String> getSelectedIndices(InternalActionContext ac) { return Collections.singleton(SchemaContainer.composeIndexName()); }
@Override public Set<String> filterUnknownIndices(Set<String> indices) { return filterIndicesByType(indices, MicroschemaContainer.composeIndexName()); }
@Override public Set<String> filterUnknownIndices(Set<String> indices) { return filterIndicesByType(indices, SchemaContainer.composeIndexName()); }