public static String idToPath( String pathId ) { String path = pathId; path = RepositoryPathEncoder.decodeRepositoryPath( path ); if ( path == null || path.trim().isEmpty() ) { path = ""; } else { if ( !path.startsWith( PATH_SEPARATOR ) ) { path = PATH_SEPARATOR + path; } } return path; }
/** * Create URL to access REST API based on provided parameters * * @return * @throws Exception */ private String createPurgeServiceURL() throws Exception { StringBuffer service = new StringBuffer(); service.append( url ); service.append( BASE_PATH ); service.append( "/" ); String path = RepositoryPathEncoder.encodeRepositoryPath( repositoryPath ); path = RepositoryPathEncoder.encode( path ); service.append( path + "/" ); service.append( SERVICE_NAME ); return service.toString(); }
private synchronized FileVersioningConfiguration callVersioningService( String fullPath ) throws KettleException { // If we just made this web service call on this file, don't do it again if ( fullPath.equals( lastFileVersioningPath ) && ( new Date() ).getTime() - lastVersioningTime.getTime() < 2000 ) { return lastFileVersioningConfiguration; } // Do the web service call PurRepositoryRestService.PurRepositoryPluginApiRevision servicePort = (PurRepositoryRestService.PurRepositoryPluginApiRevision) repository .getService( PurRepositoryRestService.PurRepositoryPluginApiRevision.class ); PentahoDiPlugin.PurRepositoryPluginApiRevision.PathIdVersioningConfiguration fileVersioningConfigurationService = servicePort.pathIdVersioningConfiguration( RepositoryPathEncoder.encodeRepositoryPath( fullPath ) ); lastFileVersioningConfiguration = fileVersioningConfigurationService.getAsFileVersioningConfigurationXml(); lastVersioningTime = new Date(); lastFileVersioningPath = fullPath; return fileVersioningConfigurationService.getAsFileVersioningConfigurationXml(); }
public void testUsingNullString() { Color color = ColorHelper.lookupColor( null ); assertEquals( color, null); }
/** * Returns an instance of {@link IAction} created from the provided parameters. * * @param actionClassName the name of the class being resolved * @param actionId the is of the action which corresponds to some bean id * @return {@link IAction} created from the provided parameters. * @throws Exception when the {@link IAction} cannot be created for some reason */ public static IAction createActionBean( final String actionClassName, final String actionId ) throws ActionInvocationException { return createActionBean( actionClassName, actionId, true /* default retryBeanInstantiationIfFailed */ ); }
public BigDecimal getDecimalParameter( final String name, final BigDecimal defaultValue ) { return ParameterHelper.parameterToDecimal( getStringParameter( name, "" ), defaultValue ); //$NON-NLS-1$ }
public Date getDateParameter( final String name, final Date defaultValue ) { return ParameterHelper.parameterToDate( getStringParameter( name, null ), defaultValue ); }
public static boolean isPlatformServer() { String productId; productId = VersionHelper.getVersionInfo().getProductID(); if ( productId == null ) { return false; } return productId.equals( PLATFORM_PRODUCT_ID ); } }
/** * Test default values. */ @Test public void testDefaults() { final VersionInfo info = new VersionInfo(); doTest( info, false, null, null, null, null, null, null, null, "" ); }
public static JarEntityResolver getInstance() { if ( JarEntityResolver.instance == null ) { JarEntityResolver.instance = new JarEntityResolver(); } return JarEntityResolver.instance; }
/** * Returns the application version number found in the manifest */ public String getApplicationVersion() { return PentahoVersionCheckDataProvider.versionInfo == null ? null : PentahoVersionCheckDataProvider.versionInfo .getVersionNumber(); }
public Object[] getArrayParameter( final String name, final Object[] defaultValue ) { return ParameterHelper.parameterToObjectArray( getParameter( name ), defaultValue ); }
public String[] getStringArrayParameter( final String name, final String[] defaultValue ) { return ParameterHelper.parameterToStringArray( getParameter( name ), defaultValue ); }
/** * Returns the application id (code) for this application (the pentaho platform) */ public String getApplicationID() { return PentahoVersionCheckDataProvider.versionInfo == null ? null : PentahoVersionCheckDataProvider.versionInfo .getProductID(); }
public static void main( final String[] args ) { VersionHelperTest test = new VersionHelperTest(); try { test.testVersionHelper(); } finally { } }
/** * Retrieves the manifest information for the jar file which contains this utility class. * * @return The Manifest file for the jar file which contains this utility class, or <code>null</code> if the code * is not in a jar file. */ public static Manifest getManifest() { return ManifestUtil.getManifest( ManifestUtil.class ); }
public static TestEntityResolver getInstance() { if ( TestEntityResolver.instance == null ) { TestEntityResolver.instance = new TestEntityResolver(); } return TestEntityResolver.instance; }
public void testUsingNullStringAnColor() { Color color = ColorHelper.lookupColor( null, Color.BLACK); assertEquals( color, Color.BLACK); }
public void testUsingDefaultWhenNotFound() { assertEquals( ColorHelper.lookupColor( "noSuchColorInMap", Color.BLACK ), Color.BLACK ); }
public void testColorHelper() { Color color = ColorHelper.lookupColor( "thistle" ); //$NON-NLS-1$ assertEquals( color, Color.decode( "#d8bfd8" ) ); //$NON-NLS-1$ color = ColorHelper.lookupColor( "teal", Color.BLACK ); //$NON-NLS-1$ assertEquals( color, Color.decode( "#008080" ) ); //$NON-NLS-1$ }