Search in sources :

Example 1 with DataGridMetadata

use of com.emc.metalnx.core.domain.entity.DataGridMetadata in project metalnx-web by irods-contrib.

the class MetadataServiceImpl method copyMetadata.

@Override
public boolean copyMetadata(String srcPath, String dstPath) throws DataGridConnectionRefusedException {
    if (srcPath == null || srcPath.isEmpty() || dstPath == null || dstPath.isEmpty())
        return false;
    logger.info("Copying metadata from {} to {}", srcPath, dstPath);
    boolean isMetadataCopied = true;
    for (DataGridMetadata metadata : findMetadataValuesByPath(srcPath)) {
        isMetadataCopied &= addMetadataToPath(dstPath, metadata);
    }
    return isMetadataCopied;
}
Also used : DataGridMetadata(com.emc.metalnx.core.domain.entity.DataGridMetadata)

Example 2 with DataGridMetadata

use of com.emc.metalnx.core.domain.entity.DataGridMetadata in project metalnx-web by irods-contrib.

the class TestAddDataGridMetadataListToObjs 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"));
    MockMultipartFile file;
    for (int i = 0; i < NUMBER_OF_FILES; i++) {
        String filename = BASE_FILE_NAME + i;
        String filepath = String.format("%s/%s", path, filename);
        file = new MockMultipartFile(filename, "Hello World Transfer".getBytes());
        us.upload(file, path, false, false, "", RESOURCE, false);
        metadataService.addMetadataToPath(filepath, expectedMetadataList);
    }
}
Also used : MockMultipartFile(org.springframework.mock.web.MockMultipartFile) DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject) DataGridMetadata(com.emc.metalnx.core.domain.entity.DataGridMetadata) Before(org.junit.Before)

Example 3 with DataGridMetadata

use of com.emc.metalnx.core.domain.entity.DataGridMetadata in project metalnx-web by irods-contrib.

the class TestAddDataGridMetadataToObjs 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);
    MockMultipartFile file;
    for (int i = 0; i < NUMBER_OF_FILES; i++) {
        String filename = BASE_FILE_NAME + i;
        String filepath = String.format("%s/%s", path, filename);
        file = new MockMultipartFile(filename, "Hello World Transfer".getBytes());
        us.upload(file, path, false, false, "", RESOURCE, false);
        for (DataGridMetadata metadata : expectedMetadataList) {
            metadataService.addMetadataToPath(filepath, metadata);
        }
    }
}
Also used : MockMultipartFile(org.springframework.mock.web.MockMultipartFile) DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject) DataGridMetadata(com.emc.metalnx.core.domain.entity.DataGridMetadata) Before(org.junit.Before)

Example 4 with DataGridMetadata

use of com.emc.metalnx.core.domain.entity.DataGridMetadata in project metalnx-web by irods-contrib.

the class TestAddMetadataToObjs 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));
    }
}
Also used : DataGridMetadata(com.emc.metalnx.core.domain.entity.DataGridMetadata)

Example 5 with DataGridMetadata

use of com.emc.metalnx.core.domain.entity.DataGridMetadata in project metalnx-web by irods-contrib.

the class TestCopyCollWithMetadata method assertMetadataInPath.

private void assertMetadataInPath(String path) throws DataGridConnectionRefusedException {
    List<DataGridMetadata> actualMetadataList = metadataService.findMetadataValuesByPath(path);
    assertEquals(expectedMetadataList.size(), actualMetadataList.size());
    for (DataGridMetadata m : actualMetadataList) {
        String metadataStr = m.getAttribute() + " " + m.getValue() + " " + m.getUnit();
        assertTrue(expectedMetadataList.contains(metadataStr));
    }
}
Also used : DataGridMetadata(com.emc.metalnx.core.domain.entity.DataGridMetadata)

Aggregations

DataGridMetadata (com.emc.metalnx.core.domain.entity.DataGridMetadata)13 DataGridCollectionAndDataObject (com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject)6 Before (org.junit.Before)4 ArrayList (java.util.ArrayList)2 MockMultipartFile (org.springframework.mock.web.MockMultipartFile)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 DataGridException (com.emc.metalnx.core.domain.exceptions.DataGridException)1 HashSet (java.util.HashSet)1 ServletOutputStream (javax.servlet.ServletOutputStream)1 JargonException (org.irods.jargon.core.exception.JargonException)1 CollectionAO (org.irods.jargon.core.pub.CollectionAO)1 CollectionAndDataObjectListAndSearchAO (org.irods.jargon.core.pub.CollectionAndDataObjectListAndSearchAO)1 DataObjectAO (org.irods.jargon.core.pub.DataObjectAO)1 DataObject (org.irods.jargon.core.pub.domain.DataObject)1 JargonQueryException (org.irods.jargon.core.query.JargonQueryException)1 MetaDataAndDomainData (org.irods.jargon.core.query.MetaDataAndDomainData)1