本文整理汇总了Java中org.pentaho.di.repository.RepositoryElementInterface.getObjectId方法的典型用法代码示例。如果您正苦于以下问题:Java RepositoryElementInterface.getObjectId方法的具体用法?Java RepositoryElementInterface.getObjectId怎么用?Java RepositoryElementInterface.getObjectId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.repository.RepositoryElementInterface
的用法示例。
在下文中一共展示了RepositoryElementInterface.getObjectId方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: save
import org.pentaho.di.repository.RepositoryElementInterface; //导入方法依赖的package包/类
public void save(RepositoryElementInterface repositoryElement, String versionComment, ProgressMonitorListener monitor, ObjectId parentId, boolean used) throws KettleException {
try {
if (!(repositoryElement instanceof XMLInterface) && !(repositoryElement instanceof SharedObjectInterface)) {
throw new KettleException("Class ["+repositoryElement.getClass().getName()+"] needs to implement the XML Interface in order to save it to disk");
}
if (!Const.isEmpty(versionComment)) {
insertLogEntry(versionComment);
}
ObjectId objectId = new StringObjectId(calcObjectId(repositoryElement));
FileObject fileObject = getFileObject(repositoryElement);
String xml = ((XMLInterface)repositoryElement).getXML();
OutputStream os = KettleVFS.getOutputStream(fileObject, false);
os.write(xml.getBytes(Const.XML_ENCODING));
os.close();
if (repositoryElement instanceof ChangedFlagInterface) {
((ChangedFlagInterface)repositoryElement).clearChanged();
}
// See if the element was already saved in the repository.
// If the object ID is different, then we created an extra copy.
// If so, we need to now remove the old file to prevent us from having multiple copies.
//
if (repositoryElement.getObjectId()!=null && !repositoryElement.getObjectId().equals(objectId)) {
delObject(repositoryElement.getObjectId());
}
repositoryElement.setObjectId(objectId);
} catch(Exception e) {
throw new KettleException("Unable to save repository element ["+repositoryElement+"] to XML file : "+calcFilename(repositoryElement), e);
}
}
示例2: isRenamed
import org.pentaho.di.repository.RepositoryElementInterface; //导入方法依赖的package包/类
private boolean isRenamed( final RepositoryElementInterface element, final RepositoryFile file )
throws KettleException {
if ( element.getObjectId() == null ) {
return false; // never been saved
}
String filename = element.getName();
switch ( element.getRepositoryElementType() ) {
case TRANSFORMATION:
filename += RepositoryObjectType.TRANSFORMATION.getExtension();
break;
case JOB:
filename += RepositoryObjectType.JOB.getExtension();
break;
case DATABASE:
filename += RepositoryObjectType.DATABASE.getExtension();
break;
case SLAVE_SERVER:
filename += RepositoryObjectType.SLAVE_SERVER.getExtension();
break;
case CLUSTER_SCHEMA:
filename += RepositoryObjectType.CLUSTER_SCHEMA.getExtension();
break;
case PARTITION_SCHEMA:
filename += RepositoryObjectType.PARTITION_SCHEMA.getExtension();
break;
default:
throw new KettleException( "unknown element type [" + element.getClass().getName() + "]" );
}
if ( !file.getName().equals( checkAndSanitize( filename ) ) ) {
return true;
}
return false;
}
示例3: saveRepositoryElement
import org.pentaho.di.repository.RepositoryElementInterface; //导入方法依赖的package包/类
protected void saveRepositoryElement( RepositoryElementInterface element, String versionComment,
ITransformer transformer, Serializable elementsFolderId )
throws KettleException {
boolean isUpdate = ( element.getObjectId() != null );
RepositoryFile file;
if ( isUpdate ) {
file = pur.getFileById( element.getObjectId().getId() );
// update title & description
file =
new RepositoryFile.Builder( file ).title( RepositoryFile.DEFAULT_LOCALE, element.getName() ).description(
RepositoryFile.DEFAULT_LOCALE, Const.NVL( element.getDescription(), "" ) ).build();
// first rename, it is safe as only a name is changed, but not a path
renameIfNecessary( element, file );
file =
pur.updateFile( file,
new NodeRepositoryFileData( transformer.elementToDataNode( element ) ), versionComment );
} else {
file =
new RepositoryFile.Builder(
checkAndSanitize( element.getName() + element.getRepositoryElementType().getExtension() ) )
.title( RepositoryFile.DEFAULT_LOCALE, element.getName() )
.description( RepositoryFile.DEFAULT_LOCALE, Const.NVL( element.getDescription(), "" ) ).versioned(
VERSION_SHARED_OBJECTS ).build();
file =
pur
.createFile( elementsFolderId, file, new NodeRepositoryFileData( transformer.elementToDataNode( element ) ),
versionComment );
}
// side effects
ObjectId objectId = new StringObjectId( file.getId().toString() );
element.setObjectId( objectId );
element.setObjectRevision( getObjectRevision( objectId, null ) );
if ( element instanceof ChangedFlagInterface ) {
( (ChangedFlagInterface) element ).clearChanged();
}
updateSharedObjectCache( element );
}
示例4: savePartitionSchema
import org.pentaho.di.repository.RepositoryElementInterface; //导入方法依赖的package包/类
protected void savePartitionSchema( final RepositoryElementInterface element, final String versionComment,
Calendar versionDate ) {
try {
// Even if the object id is null, we still have to check if the element is not present in the PUR
// For example, if we import data from an XML file and there is a element with the same name in it.
//
if ( element.getObjectId() == null ) {
element.setObjectId( getPartitionSchemaID( element.getName() ) );
}
saveRepositoryElement( element, versionComment, partitionSchemaTransformer, getPartitionSchemaParentFolderId() );
} catch ( KettleException ke ) {
ke.printStackTrace();
}
}
示例5: saveSlaveServer
import org.pentaho.di.repository.RepositoryElementInterface; //导入方法依赖的package包/类
protected void saveSlaveServer( final RepositoryElementInterface element, final String versionComment,
Calendar versionDate ) throws KettleException {
try {
// Even if the object id is null, we still have to check if the element is not present in the PUR
// For example, if we import data from an XML file and there is a element with the same name in it.
//
if ( element.getObjectId() == null ) {
element.setObjectId( getSlaveID( element.getName() ) );
}
saveRepositoryElement( element, versionComment, slaveTransformer, getSlaveServerParentFolderId() );
} catch ( KettleException ke ) {
ke.printStackTrace();
}
}
示例6: saveClusterSchema
import org.pentaho.di.repository.RepositoryElementInterface; //导入方法依赖的package包/类
protected void saveClusterSchema( final RepositoryElementInterface element, final String versionComment,
Calendar versionDate ) {
try {
// Even if the object id is null, we still have to check if the element is not present in the PUR
// For example, if we import data from an XML file and there is a element with the same name in it.
//
if ( element.getObjectId() == null ) {
element.setObjectId( getClusterID( element.getName() ) );
}
saveRepositoryElement( element, versionComment, clusterTransformer, getClusterSchemaParentFolderId() );
} catch ( KettleException ke ) {
ke.printStackTrace();
}
}
示例7: assertExistsAndGetRevisions
import org.pentaho.di.repository.RepositoryElementInterface; //导入方法依赖的package包/类
private List<VersionSummary> assertExistsAndGetRevisions( RepositoryElementInterface transOrJob ) {
ObjectId id = transOrJob.getObjectId();
assertNotNull( id );
RepositoryFile file = unifiedRepository.getFileById( id.toString() );
assertNotNull( file );
return unifiedRepository.getVersionSummaries( id.toString() );
}
示例8: existsUserInfo
import org.pentaho.di.repository.RepositoryElementInterface; //导入方法依赖的package包/类
public boolean existsUserInfo(RepositoryElementInterface user) throws KettleException {
return (user.getObjectId()!=null || getUserID(user.getName())!=null);
}
示例9: save
import org.pentaho.di.repository.RepositoryElementInterface; //导入方法依赖的package包/类
public void save(RepositoryElementInterface repositoryElement, String versionComment, ProgressMonitorListener monitor, ObjectId parentId, boolean used) throws KettleException {
try {
if (!(repositoryElement instanceof XMLInterface) && !(repositoryElement instanceof SharedObjectInterface)) {
throw new KettleException("Class ["+repositoryElement.getClass().getName()+"] needs to implement the XML Interface in order to save it to disk");
}
if (!Const.isEmpty(versionComment)) {
insertLogEntry("Save repository element : "+repositoryElement.toString()+" : "+versionComment);
}
ObjectId objectId = new StringObjectId(calcObjectId(repositoryElement));
FileObject fileObject = getFileObject(repositoryElement);
String xml = ((XMLInterface)repositoryElement).getXML();
OutputStream os = KettleVFS.getOutputStream(fileObject, false);
os.write(xml.getBytes(Const.XML_ENCODING));
os.close();
if (repositoryElement instanceof ChangedFlagInterface) {
((ChangedFlagInterface)repositoryElement).clearChanged();
}
// See if the element was already saved in the repository.
// If the object ID is different, then we created an extra copy.
// If so, we need to now remove the old file to prevent us from having multiple copies.
//
if (repositoryElement.getObjectId()!=null && !repositoryElement.getObjectId().equals(objectId)) {
delObject(repositoryElement.getObjectId());
}
// See if this is a transformation & if the transformation has a defined data service.
// If so, we want to store a separate .das (DAta Service) file for performance reasons.
//
if (repositoryElement instanceof TransMeta) {
FileObject dasFile = KettleVFS.getFileObject(calcFilename(repositoryElement.getRepositoryDirectory(), repositoryElement.getName(), EXT_DATA_SERVICE));
// Remove possible old file
//
if (dasFile.exists()) {
dasFile.delete();
}
TransMeta transMeta = (TransMeta)repositoryElement;
if (transMeta.getDataService().isDefined()) {
// Write new data service file
//
xml = transMeta.getDataService().getXML();
os = KettleVFS.getOutputStream(dasFile, false);
os.write(XMLHandler.getXMLHeader().getBytes(Const.XML_ENCODING));
os.write(xml.getBytes(Const.XML_ENCODING));
os.close();
}
}
repositoryElement.setObjectId(objectId);
} catch(Exception e) {
throw new KettleException("Unable to save repository element ["+repositoryElement+"] to XML file : "+calcFilename(repositoryElement), e);
}
}
示例10: existsUserInfo
import org.pentaho.di.repository.RepositoryElementInterface; //导入方法依赖的package包/类
public boolean existsUserInfo( RepositoryElementInterface user ) throws KettleException {
return ( user.getObjectId() != null || getUserID( user.getName() ) != null );
}
示例11: save
import org.pentaho.di.repository.RepositoryElementInterface; //导入方法依赖的package包/类
public void save( RepositoryElementInterface repositoryElement, String versionComment,
ProgressMonitorListener monitor, ObjectId parentId, boolean used ) throws KettleException {
try {
if ( !( repositoryElement instanceof XMLInterface )
&& !( repositoryElement instanceof SharedObjectInterface ) ) {
throw new KettleException( "Class ["
+ repositoryElement.getClass().getName()
+ "] needs to implement the XML Interface in order to save it to disk" );
}
if ( !Utils.isEmpty( versionComment ) ) {
insertLogEntry( "Save repository element : " + repositoryElement.toString() + " : " + versionComment );
}
ObjectId objectId = new StringObjectId( calcObjectId( repositoryElement ) );
FileObject fileObject = getFileObject( repositoryElement );
String xml = ( (XMLInterface) repositoryElement ).getXML();
OutputStream os = KettleVFS.getOutputStream( fileObject, false );
os.write( xml.getBytes( Const.XML_ENCODING ) );
os.close();
if ( repositoryElement instanceof ChangedFlagInterface ) {
( (ChangedFlagInterface) repositoryElement ).clearChanged();
}
// See if the element was already saved in the repository.
// If the object ID is different, then we created an extra copy.
// If so, we need to now remove the old file to prevent us from having multiple copies.
//
if ( repositoryElement.getObjectId() != null && !repositoryElement.getObjectId().equals( objectId ) ) {
delObject( repositoryElement.getObjectId() );
}
repositoryElement.setObjectId( objectId );
// Finally, see if there are external objects that need to be stored or updated in the MetaStore
//
if ( repositoryElement instanceof TransMeta ) {
( (TransMeta) repositoryElement ).saveMetaStoreObjects( this, metaStore );
}
if ( repositoryElement instanceof JobMeta ) {
( (JobMeta) repositoryElement ).saveMetaStoreObjects( this, metaStore );
}
} catch ( Exception e ) {
throw new KettleException( "Unable to save repository element ["
+ repositoryElement + "] to XML file : " + calcFilename( repositoryElement ), e );
}
}
示例12: saveDatabaseMeta
import org.pentaho.di.repository.RepositoryElementInterface; //导入方法依赖的package包/类
protected void saveDatabaseMeta( final RepositoryElementInterface element, final String versionComment,
Calendar versionDate ) throws KettleException {
try {
// Even if the object id is null, we still have to check if the element is not present in the PUR
// For example, if we import data from an XML file and there is a element with the same name in it.
//
if ( element.getObjectId() == null ) {
element.setObjectId( getDatabaseID( element.getName() ) );
}
boolean isUpdate = element.getObjectId() != null;
RepositoryFile file = null;
if ( isUpdate ) {
file = pur.getFileById( element.getObjectId().getId() );
// update title
final String title = ( (DatabaseMeta) element ).getDisplayName();
Date modifiedDate = null;
if ( versionDate != null && versionDate.getTime() != null ) {
modifiedDate = versionDate.getTime();
} else {
modifiedDate = new Date();
}
file = new RepositoryFile.Builder( file ).title( RepositoryFile.DEFAULT_LOCALE, title )
.lastModificationDate( modifiedDate ).build();
renameIfNecessary( element, file );
file =
pur.updateFile( file, new NodeRepositoryFileData( databaseMetaTransformer.elementToDataNode( element ) ),
versionComment );
} else {
Date createdDate = null;
if ( versionDate != null && versionDate.getTime() != null ) {
createdDate = versionDate.getTime();
} else {
createdDate = new Date();
}
file =
new RepositoryFile.Builder(
checkAndSanitize( RepositoryFilenameUtils.escape( element.getName(), pur.getReservedChars() )
+ RepositoryObjectType.DATABASE.getExtension() ) ).title( RepositoryFile.DEFAULT_LOCALE,
element.getName() ).createdDate( createdDate ).versioned( VERSION_SHARED_OBJECTS ).build();
file =
pur.createFile( getDatabaseMetaParentFolderId(), file,
new NodeRepositoryFileData( databaseMetaTransformer.elementToDataNode( element ) ), versionComment );
}
// side effects
ObjectId objectId = new StringObjectId( file.getId().toString() );
element.setObjectId( objectId );
element.setObjectRevision( getObjectRevision( objectId, null ) );
if ( element instanceof ChangedFlagInterface ) {
( (ChangedFlagInterface) element ).clearChanged();
}
updateSharedObjectCache( element );
} catch ( Exception e ) {
// determine if there is an "access denied" issue and throw a nicer error message.
if ( e.getMessage().indexOf( "access denied" ) >= 0 ) {
throw new KettleException(
BaseMessages.getString( PKG, "PurRepository.ERROR_0004_DATABASE_UPDATE_ACCESS_DENIED", element.getName() ),
e );
}
}
}