Search in sources :

Example 16 with VersionSummary

use of org.pentaho.platform.api.repository2.unified.VersionSummary in project pentaho-platform by pentaho.

the class FileSystemRepositoryFileDao method getVersionSummary.

public VersionSummary getVersionSummary(Serializable fileId, Serializable versionId) {
    RepositoryFile file = getFile(fileId, versionId);
    List<String> labels = new ArrayList<String>();
    return new VersionSummary(fileId, (versionId != null ? versionId : fileId), false, file.getCreatedDate(), file.getCreatorId(), StringUtils.EMPTY, labels);
}
Also used : ArrayList(java.util.ArrayList) VersionSummary(org.pentaho.platform.api.repository2.unified.VersionSummary) RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile)

Example 17 with VersionSummary

use of org.pentaho.platform.api.repository2.unified.VersionSummary in project pentaho-platform by pentaho.

the class FileSystemBackedUnifiedRepository method getVersionSummaryInBatch.

public List<VersionSummary> getVersionSummaryInBatch(List<RepositoryFile> files) {
    Assert.notNull(files);
    List<VersionSummary> versionSummaryList = new ArrayList<VersionSummary>(files.size());
    for (RepositoryFile file : files) {
        versionSummaryList.add(getVersionSummary(file.getId(), file.getVersionId()));
    }
    return versionSummaryList;
}
Also used : ArrayList(java.util.ArrayList) VersionSummary(org.pentaho.platform.api.repository2.unified.VersionSummary) RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile)

Example 18 with VersionSummary

use of org.pentaho.platform.api.repository2.unified.VersionSummary in project pentaho-platform by pentaho.

the class DefaultUnifiedRepository method getVersionSummaryInBatch.

/**
 * {@inheritDoc}
 */
public List<VersionSummary> getVersionSummaryInBatch(final List<RepositoryFile> files) {
    Assert.notNull(files);
    List<VersionSummary> summaries = new ArrayList<VersionSummary>(files.size());
    for (RepositoryFile file : files) {
        Assert.notNull(file);
        summaries.add(getVersionSummary(file.getId(), file.getVersionId()));
    }
    return summaries;
}
Also used : ArrayList(java.util.ArrayList) VersionSummary(org.pentaho.platform.api.repository2.unified.VersionSummary) RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile)

Example 19 with VersionSummary

use of org.pentaho.platform.api.repository2.unified.VersionSummary in project pentaho-platform by pentaho.

the class JcrRepositoryFileDaoIT method testUpdateFile1.

@Test
public // Running within defined date
void testUpdateFile1() throws Exception {
    RepositoryFile newFile = createFile("JcrRepositoryFileDaoTest1.test");
    IRepositoryFileData dataMock = new SampleRepositoryFileData("", true, 0);
    Date startDate = new Date();
    newFile = new RepositoryFile.Builder(newFile).createdDate(startDate).build();
    repo.updateFile(newFile, dataMock, "edition #2");
    List<VersionSummary> summaries = repo.getVersionSummaries(newFile.getId());
    Date lastVersionDate = summaries.get(summaries.size() - 1).getDate();
    assertEquals("incorrect version date", lastVersionDate, startDate);
}
Also used : IRepositoryFileData(org.pentaho.platform.api.repository2.unified.IRepositoryFileData) SampleRepositoryFileData(org.pentaho.platform.api.repository2.unified.data.sample.SampleRepositoryFileData) VersionSummary(org.pentaho.platform.api.repository2.unified.VersionSummary) RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile) Date(java.util.Date) Test(org.junit.Test)

Example 20 with VersionSummary

use of org.pentaho.platform.api.repository2.unified.VersionSummary in project pentaho-kettle by pentaho.

the class UnifiedRepositoryPurgeServiceTest method verifyAllVersionsDeleted.

private static void verifyAllVersionsDeleted(HashMap<String, List<VersionSummary>> versionListMap, IUnifiedRepository mockRepo, String fileId) {
    List<VersionSummary> list = versionListMap.get(fileId);
    int i = 1;
    for (VersionSummary sum : list) {
        if (i < list.size()) {
            verify(mockRepo, times(1)).deleteFileAtVersion(fileId, sum.getId());
        }
        i++;
    }
}
Also used : VersionSummary(org.pentaho.platform.api.repository2.unified.VersionSummary)

Aggregations

VersionSummary (org.pentaho.platform.api.repository2.unified.VersionSummary)32 ArrayList (java.util.ArrayList)21 Test (org.junit.Test)18 Matchers.anyString (org.mockito.Matchers.anyString)17 RepositoryFile (org.pentaho.platform.api.repository2.unified.RepositoryFile)16 List (java.util.List)12 IUnifiedRepository (org.pentaho.platform.api.repository2.unified.IUnifiedRepository)9 Date (java.util.Date)7 ITenant (org.pentaho.platform.api.mt.ITenant)7 ByteArrayInputStream (java.io.ByteArrayInputStream)5 SimpleRepositoryFileData (org.pentaho.platform.api.repository2.unified.data.simple.SimpleRepositoryFileData)5 Serializable (java.io.Serializable)4 KettleException (org.pentaho.di.core.exception.KettleException)4 NodeRepositoryFileData (org.pentaho.platform.api.repository2.unified.data.node.NodeRepositoryFileData)4 SampleRepositoryFileData (org.pentaho.platform.api.repository2.unified.data.sample.SampleRepositoryFileData)4 Calendar (java.util.Calendar)3 Node (javax.jcr.Node)3 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)3 IdNotFoundException (org.pentaho.di.core.exception.IdNotFoundException)3 KettleFileException (org.pentaho.di.core.exception.KettleFileException)3