use of com.emc.metalnx.core.domain.entity.DataGridMetadata in project metalnx-web by irods-contrib.
the class MetadataController method getMetadata.
@RequestMapping(value = "/getMetadata/", method = RequestMethod.POST)
public String getMetadata(final Model model, final String path) throws DataGridConnectionRefusedException, FileNotFoundException {
logger.info("MetadataController getMetadata() starts !!");
List<DataGridMetadata> metadataList = metadataService.findMetadataValuesByPath(path);
DataGridCollectionAndDataObject dgColObj = null;
try {
dgColObj = collectionService.findByName(path);
permissionsService.resolveMostPermissiveAccessForUser(dgColObj, loggedUserUtils.getLoggedDataGridUser());
} catch (DataGridException e) {
logger.error("Could not retrieve collection/dataobject from path: {}", path);
}
model.addAttribute("permissionOnCurrentPath", collectionService.getPermissionsForPath(path));
model.addAttribute("dataGridMetadataList", metadataList);
model.addAttribute("currentPath", path);
model.addAttribute("collectionAndDataObject", dgColObj);
model.addAttribute("metadataFlag", true);
logger.info("MetadataController getMetadata() ends !!");
return "metadata/metadataTable :: metadataTable";
}
use of com.emc.metalnx.core.domain.entity.DataGridMetadata in project metalnx-web by irods-contrib.
the class MetadataController method exportToCSV.
@RequestMapping(value = "/exportToCSV")
public void exportToCSV(final HttpServletResponse response) throws IOException, DataGridConnectionRefusedException {
String filePath = collectionController.getCurrentPath();
List<DataGridMetadata> metadataList = metadataService.findMetadataValuesByPath(filePath);
setReponseHeaderForCSVExport(response);
ServletOutputStream outputStream = response.getOutputStream();
outputStream.print("File path\n");
outputStream.print(String.format("%s\n\n", filePath));
outputStream.print("Attribute Name,Value,Unit\n");
for (DataGridMetadata m : metadataList) {
outputStream.print(String.format("%s,%s,%s\n", m.getAttribute(), m.getValue(), m.getUnit()));
}
outputStream.flush();
}
use of com.emc.metalnx.core.domain.entity.DataGridMetadata in project metalnx-web by irods-contrib.
the class TestAddDataGridMetadataListToColls method setUp.
@Before
public void setUp() throws DataGridException {
parentPath = String.format("/%s/home/%s", zone, username);
path = String.format("%s/test-metadata-transfer", parentPath);
fos.deleteCollection(path, true);
cs.createCollection(new DataGridCollectionAndDataObject(path, parentPath, true));
expectedMetadataList = new ArrayList<>();
expectedMetadataList.add(new DataGridMetadata("attr1", "val1", "unit1"));
expectedMetadataList.add(new DataGridMetadata("attr2", "val2", "unit2"));
expectedMetadataList.add(new DataGridMetadata("attr3", "val3", "unit3"));
for (int i = 0; i < NUMBER_OF_COLLS; i++) {
String collname = BASE_COLL_NAME + i;
String collPath = String.format("%s/%s", path, collname);
cs.createCollection(new DataGridCollectionAndDataObject(collPath, path, true));
metadataService.addMetadataToPath(collPath, expectedMetadataList);
}
}
use of com.emc.metalnx.core.domain.entity.DataGridMetadata in project metalnx-web by irods-contrib.
the class TestAddDataGridMetadataToColls method setUp.
@Before
public void setUp() throws DataGridException {
parentPath = String.format("/%s/home/%s", zone, username);
path = String.format("%s/test-metadata-transfer", parentPath);
fos.deleteCollection(path, true);
cs.createCollection(new DataGridCollectionAndDataObject(path, parentPath, true));
expectedMetadataList = MetadataUtils.createRandomMetadata(NUMBER_OF_METADATA_TAGS);
for (int i = 0; i < NUMBER_OF_COLLS; i++) {
String collPath = String.format("%s/%s", path, BASE_COLL_NAME + i);
cs.createCollection(new DataGridCollectionAndDataObject(collPath, path, true));
for (DataGridMetadata metadata : expectedMetadataList) {
metadataService.addMetadataToPath(collPath, metadata);
}
}
}
use of com.emc.metalnx.core.domain.entity.DataGridMetadata in project metalnx-web by irods-contrib.
the class TestAddMetadataToColls method assertMetadataInPath.
private void assertMetadataInPath(String path) throws DataGridConnectionRefusedException {
List<DataGridMetadata> actualMetadataList = metadataService.findMetadataValuesByPath(path);
Assert.assertEquals(expectedMetadataList.size(), actualMetadataList.size());
for (DataGridMetadata m : actualMetadataList) {
String metadataStr = m.getAttribute() + " " + m.getValue() + " " + m.getUnit();
assertTrue(expectedMetadataList.contains(metadataStr));
}
}
Aggregations