Search in sources :

Example 1 with FileVersioningConfiguration

use of org.pentaho.platform.repository2.unified.webservices.FileVersioningConfiguration in project pentaho-platform by pentaho.

the class FileResource method doVersioningConfiguration.

/**
 * This method is used to determine whether versioning should be active for the given path
 *
 * <p><b>Example Request:</b><br />
 *    GET pentaho/api/repo/files/:jmeter-test:test_file_1.ktr/versioningConfiguration
 *  </pre>
 * </p>
 *
 * @param pathId Colon separated path for the repository file.
 *
 * @return The Versioning Configuration applicable to the path submitted
 *
 * <p><b>Example Response:</b></p>
 *  <pre function="syntax.xml">
 * &lt;fileVersioningConfiguration&gt;
 *   &lt;versionCommentEnabled&gt;true&lt;/versionCommentEnabled&gt;
 *   &lt;versioningEnabled&gt;true&lt;/versioningEnabled&gt;
 * &lt;/fileVersioningConfiguration&gt;
 *  </pre>
 */
@GET
@Path("{pathId : .+}/versioningConfiguration")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@StatusCodes({ @ResponseCode(code = 200, condition = "Successfully returns the versioning configuration") })
public FileVersioningConfiguration doVersioningConfiguration(@PathParam("pathId") String pathId) {
    IRepositoryVersionManager repositoryVersionManager = PentahoSystem.get(IRepositoryVersionManager.class);
    String path = FileUtils.idToPath(pathId);
    return new FileVersioningConfiguration(repositoryVersionManager.isVersioningEnabled(path), repositoryVersionManager.isVersionCommentEnabled(path));
}
Also used : FileVersioningConfiguration(org.pentaho.platform.repository2.unified.webservices.FileVersioningConfiguration) IRepositoryVersionManager(org.pentaho.platform.api.repository2.unified.IRepositoryVersionManager) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) StatusCodes(org.codehaus.enunciate.jaxrs.StatusCodes)

Example 2 with FileVersioningConfiguration

use of org.pentaho.platform.repository2.unified.webservices.FileVersioningConfiguration in project pentaho-kettle by pentaho.

the class RevisionResourceTest method testGetVersioningEnabled.

/**
 * @throws Exception
 */
@org.junit.Test
public void testGetVersioningEnabled() throws Exception {
    FileVersioningConfiguration conf = revisionResource.doVersioningConfiguration("foo.ktr");
    Assert.assertTrue(conf.isVersioningEnabled());
    Assert.assertFalse(conf.isVersionCommentEnabled());
}
Also used : FileVersioningConfiguration(org.pentaho.platform.repository2.unified.webservices.FileVersioningConfiguration)

Aggregations

FileVersioningConfiguration (org.pentaho.platform.repository2.unified.webservices.FileVersioningConfiguration)2 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 StatusCodes (org.codehaus.enunciate.jaxrs.StatusCodes)1 IRepositoryVersionManager (org.pentaho.platform.api.repository2.unified.IRepositoryVersionManager)1