private void init(String uri, Resource resource) { this.uri = uri; this.resource = resource; this.documentMetadata = new DocumentMetadataHandle(); }
@Override public DocumentMetadataWriteHandle getMetadata() { DocumentMetadataHandle h = new DocumentMetadataHandle(); if (collections != null) { h.withCollections(collections); } if (permissions != null) { for (String role : permissions.keySet()) { h.withPermission(role, permissions.get(role)); } } return h; }
public DocumentMetadataHandle getMetadata(String uri) { return client.newDocumentManager().readMetadata(uri, new DocumentMetadataHandle()); }
protected DocumentMetadataHandle buildMetadata() { DocumentMetadataHandle h = new DocumentMetadataHandle(); h = h.withCollections(collections); if (permissions != null) { String[] array = permissions.split(","); for (int i = 0; i < array.length; i += 2) { h.getPermissions().add(array[i], Capability.valueOf(array[i + 1].toUpperCase())); } } return h; }
/** * @param moduleName appended to the baseUri to determine the model definition URI * @param modelDefinition JSON or XML * @return */ public String loadModel(String moduleName, String modelDefinition) { GenericDocumentManager mgr = client.newDocumentManager(); DocumentMetadataHandle dmh = new DocumentMetadataHandle(); dmh.getCollections().add(modelCollection); String modelUri = baseUri + moduleName; mgr.write(modelUri, dmh, new BytesHandle(modelDefinition.getBytes())); return modelUri; }
private static void uploadData() throws Exception { DocumentMetadataHandle meta = new DocumentMetadataHandle() .withCollections(collection); JSONDocumentManager docMgr = evalClient.newJSONDocumentManager(); File folder = new File("src/test/resources/legal_holds/data"); for ( Path path: Files.newDirectoryStream(folder.toPath(), "*.json") ) { File file = path.toFile(); docMgr.write(directory + file.getName(), meta, new FileHandle(file)); } }
@Override public void saveJob(Job job, Transaction transaction) { JacksonDatabindHandle<Job> contentHandle = new JacksonDatabindHandle<>(job); contentHandle.setMapper(objectMapper); DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle(); metadataHandle = metadataHandle.withCollections("job"); DocumentWriteSet writeSet = docMgr.newWriteSet(); writeSet.add("/jobs/" + job.getJobId() + ".json", metadataHandle, contentHandle); docMgr.write(writeSet, transaction); }
@Ignore public void testIssue646() throws Exception { WriteBatcher ihb2 = moveMgr.newWriteBatcher() .withBatchSize(10); ihb2.onBatchFailure( (batch, throwable) -> throwable.printStackTrace() ); for (int j =0 ;j < 21; j++){ String uri ="/local/string-"+ j; DocumentMetadataHandle meta6 = new DocumentMetadataHandle().withProperty("docMeta-1", "true"); ihb2.addAs(uri , meta6, "test"); } ihb2.flushAndWait(); }
public DocumentMetadataHandle setUpdatedMetadataProperties() { // create and initialize a handle on the metadata DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle(); metadataHandle.getProperties().put("reviewed", false); metadataHandle.getProperties().put("myString", "bar"); metadataHandle.getProperties().put("myInteger", 20); metadataHandle.getProperties().put("myDecimal", 3459.012678); metadataHandle.getProperties().put("myCalendar", Calendar.getInstance().get(Calendar.YEAR)); metadataHandle.setQuality(12); return metadataHandle; }
public DocumentMetadataHandle setUpdatedMetadataCollections() { // create and initialize a handle on the metadata DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle().withCollections("my-collection3", "my-collection4"); // metadataHandle.getCollections().addAll("my-collection1","my-collection2"); metadataHandle.getPermissions().add("app-user", Capability.UPDATE, Capability.READ); metadataHandle.getProperties().put("reviewed", true); metadataHandle.getProperties().put("myString", "foo"); metadataHandle.getProperties().put("myInteger", 10); metadataHandle.getProperties().put("myDecimal", 34.56678); metadataHandle.getProperties().put("myCalendar", Calendar.getInstance().get(Calendar.YEAR)); metadataHandle.setQuality(23); return metadataHandle; }
public DocumentMetadataHandle setMetadata() { // create and initialize a handle on the metadata DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle(); metadataHandle.getCollections().addAll("my-collection1", "my-collection2"); metadataHandle.getPermissions().add("app-user", Capability.UPDATE, Capability.READ); metadataHandle.getProperties().put("reviewed", true); metadataHandle.getProperties().put("myString", "foo"); metadataHandle.getProperties().put("myInteger", 10); metadataHandle.getProperties().put("myDecimal", 34.56678); metadataHandle.getProperties().put("myCalendar", Calendar.getInstance().get(Calendar.YEAR)); metadataHandle.setQuality(23); return metadataHandle; }
public DocumentMetadataHandle setMetadata() { // create and initialize a handle on the meta-data DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle(); metadataHandle.getCollections().addAll("my-collection1", "my-collection2"); metadataHandle.getPermissions().add("app-user", Capability.UPDATE, Capability.READ); metadataHandle.getProperties().put("reviewed", true); metadataHandle.getProperties().put("myString", "foo"); metadataHandle.getProperties().put("myInteger", 10); metadataHandle.getProperties().put("myDecimal", 34.56678); metadataHandle.getProperties().put("myCalendar", Calendar.getInstance().get(Calendar.YEAR)); metadataHandle.setQuality(23); return metadataHandle; }
public DocumentMetadataHandle setMetadata() { // create and initialize a handle on the meta-data DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle(); metadataHandle.getCollections().addAll("my-collection1", "my-collection2"); metadataHandle.getPermissions().add("app-user", Capability.UPDATE, Capability.READ); metadataHandle.getProperties().put("reviewed", true); metadataHandle.getProperties().put("myString", "foo"); metadataHandle.getProperties().put("myInteger", 10); metadataHandle.getProperties().put("myDecimal", 34.56678); metadataHandle.getProperties().put("myCalendar", Calendar.getInstance().get(Calendar.YEAR)); metadataHandle.setQuality(23); return metadataHandle; }
public DocumentMetadataHandle setMetadata() { // create and initialize a handle on the metadata DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle(); metadataHandle.getCollections().addAll("my-collection1", "my-collection2"); metadataHandle.getPermissions().add("app-user", Capability.UPDATE, Capability.READ); metadataHandle.getProperties().put("reviewed", true); metadataHandle.getProperties().put("myString", "foo"); metadataHandle.getProperties().put("myInteger", 10); metadataHandle.getProperties().put("myDecimal", 34.56678); metadataHandle.getProperties().put("myCalendar", Calendar.getInstance().get(Calendar.YEAR)); metadataHandle.setQuality(23); return metadataHandle; }
public DocumentMetadataHandle setMetadata() { // create and initialize a handle on the metadata DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle(); metadataHandle.getCollections().addAll("my-collection1", "my-collection2"); metadataHandle.getPermissions().add("app-user", Capability.UPDATE, Capability.READ); metadataHandle.getProperties().put("reviewed", true); metadataHandle.getProperties().put("myString", "foo"); metadataHandle.getProperties().put("myInteger", 10); metadataHandle.getProperties().put("myDecimal", 34.56678); metadataHandle.getProperties().put("myCalendar", Calendar.getInstance().get(Calendar.YEAR)); metadataHandle.setQuality(23); return metadataHandle; }
public DocumentMetadataHandle setMetadata() { // create and initialize a handle on the metadata DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle(); metadataHandle.getCollections().addAll("my-collection1", "my-collection2"); metadataHandle.getPermissions().add("app-user", Capability.UPDATE, Capability.READ); metadataHandle.getProperties().put("reviewed", true); metadataHandle.getProperties().put("myString", "foo"); metadataHandle.getProperties().put("myInteger", 10); metadataHandle.getProperties().put("myDecimal", 34.56678); metadataHandle.getProperties().put("myCalendar", Calendar.getInstance().get(Calendar.YEAR)); metadataHandle.setQuality(23); return metadataHandle; }
public DocumentMetadataHandle setMetadata() { // create and initialize a handle on the metadata DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle(); metadataHandle.getCollections().addAll("my-collection1", "my-collection2"); metadataHandle.getPermissions().add("app-user", Capability.UPDATE, Capability.READ); metadataHandle.getProperties().put("reviewed", true); metadataHandle.getProperties().put("myString", "foo"); metadataHandle.getProperties().put("myInteger", 10); metadataHandle.getProperties().put("myDecimal", 34.56678); metadataHandle.getProperties().put("myCalendar", Calendar.getInstance().get(Calendar.YEAR)); metadataHandle.setQuality(23); return metadataHandle; }
private void addFinalDocs() { clearDatabases(HubConfig.DEFAULT_STAGING_NAME, HubConfig.DEFAULT_FINAL_NAME); DocumentMetadataHandle meta = new DocumentMetadataHandle(); meta.getCollections().add("tester"); meta.getPermissions().add(getHubAdminConfig().getHubRoleName(), READ, UPDATE, EXECUTE); installFinalDoc("/employee1.xml", meta, "flow-manager-test/input/employee1.xml"); installFinalDoc("/employee2.xml", meta, "flow-manager-test/input/employee2.xml"); }
private void addStagingDocs() { clearDatabases(HubConfig.DEFAULT_STAGING_NAME, HubConfig.DEFAULT_FINAL_NAME); DocumentMetadataHandle meta = new DocumentMetadataHandle(); meta.getCollections().add("tester"); meta.getPermissions().add(getHubAdminConfig().getHubRoleName(), READ, UPDATE, EXECUTE); installStagingDoc("/employee1.xml", meta, "flow-manager-test/input/employee1.xml"); installStagingDoc("/employee2.xml", meta, "flow-manager-test/input/employee2.xml"); }
public DocumentMetadataHandle setMetadata() { // create and initialize a handle on the meta-data DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle(); metadataHandle.getCollections().addAll("my-collection1", "my-collection2"); metadataHandle.getPermissions().add("app-user", Capability.UPDATE, Capability.READ); metadataHandle.getProperties().put("reviewed", true); metadataHandle.getProperties().put("myString", "foo"); metadataHandle.getProperties().put("myInteger", 10); metadataHandle.getProperties().put("myDecimal", 34.56678); metadataHandle.getProperties().put("myCalendar", Calendar.getInstance().get(Calendar.YEAR)); metadataHandle.setQuality(23); return metadataHandle; }