package gw.beantransfer uses com.guidewire.commons.metadata.MetadataDependencies uses com.guidewire.pc.api.archive.ArchiveRestoreBundle uses com.guidewire.pl.system.bundle.EntityBundleImpl uses com.guidewire.commons.entity.type.ThreadLocalBundleProvider uses gw.api.util.TypeUtil uses gw.entity.IEntityType uses gw.pl.persistence.core.Bundle class BeanTransferUtil { static function runWithRestoreBeanTransferBundle(apiBlock(bundle : Bundle) : Set) : Set { var bundle = createRestoreBeanTransferBundle() ThreadLocalBundleProvider.set(bundle) try { var rootInfos = apiBlock(bundle) bundle.commit() return rootInfos } finally { ThreadLocalBundleProvider.clear() } } static function createRestoreBeanTransferBundle(): Bundle { return new RestoreBeanTransferBundle() } static function getEntityIntrinsicType(entityTypeName : String) : IEntityType { var entityTypeBaseName = entityTypeName.substring(entityTypeName.lastIndexOf('.') + 1) return MetadataDependencies.getIntrinsicTypeFactory().getEntityIntrinsicType(entityTypeBaseName) } static function isSourceTypeAssignable(sourceType: IEntityType, targetType: IEntityType): boolean { return TypeUtil.isNominallyOrStructurallyAssignable(sourceType, targetType) } /** * This class to used indicate that the bundle is being used to restore a Bean Transfer from an archive XML. */ public static class RestoreBeanTransferBundle extends EntityBundleImpl implements ArchiveRestoreBundle { /** * Note: Do not create new instances of this class outside of this file. */ private construct() {} } }