Search in sources :

Example 1 with TDQJrxmlItem

use of org.talend.dataquality.properties.TDQJrxmlItem in project tdq-studio-se by Talend.

the class JrxmlFileDuplicateHandle method createJrxml.

/**
 * create jrxml file.
 *
 * @param path
 * @param label
 * @param initFile
 * @param extendtion
 * @return
 */
public TDQJrxmlItem createJrxml(IPath path, String label, File initFile, String extendtion) {
    Property property = PropertiesFactory.eINSTANCE.createProperty();
    property.setVersion(VersionUtils.DEFAULT_VERSION);
    property.setStatusCode(PluginConstant.EMPTY_STRING);
    property.setLabel(label);
    TDQJrxmlItem routineItem = org.talend.dataquality.properties.PropertiesFactory.eINSTANCE.createTDQJrxmlItem();
    routineItem.setProperty(property);
    routineItem.setExtension(extendtion);
    routineItem.setName(label);
    ByteArray byteArray = duplicateByteArray(initFile);
    routineItem.setContent(byteArray);
    IProxyRepositoryFactory repositoryFactory = ProxyRepositoryFactory.getInstance();
    try {
        property.setId(repositoryFactory.getNextId());
        if (path != null) {
            repositoryFactory.createParentFoldersRecursively(ERepositoryObjectType.getItemType(routineItem), path);
        }
        repositoryFactory.create(routineItem, path);
    } catch (PersistenceException e) {
        ExceptionHandler.process(e);
    }
    return routineItem;
}
Also used : TDQJrxmlItem(org.talend.dataquality.properties.TDQJrxmlItem) PersistenceException(org.talend.commons.exception.PersistenceException) ByteArray(org.talend.core.model.properties.ByteArray) Property(org.talend.core.model.properties.Property) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Aggregations

PersistenceException (org.talend.commons.exception.PersistenceException)1 ByteArray (org.talend.core.model.properties.ByteArray)1 Property (org.talend.core.model.properties.Property)1 TDQJrxmlItem (org.talend.dataquality.properties.TDQJrxmlItem)1 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)1