use of org.talend.core.model.properties.RoutineItem in project tdi-studio-se by Talend.
the class DemosImportTest method getUserRoutineSize.
protected int getUserRoutineSize() throws PersistenceException {
List<IRepositoryViewObject> all = ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.ROUTINES);
int currentRoutineItemsSize = 0;
for (IRepositoryViewObject obj : all) {
Property property = obj.getProperty();
Item item = property.getItem();
if (item instanceof RoutineItem && !((RoutineItem) item).isBuiltIn()) {
// only check for user routine.
currentRoutineItemsSize++;
}
}
return currentRoutineItemsSize;
}
use of org.talend.core.model.properties.RoutineItem in project tdi-studio-se by Talend.
the class TalendJavaSourceViewer method getImports.
private static String getImports() {
//$NON-NLS-1$
String imports = "";
if (!GlobalServiceRegister.getDefault().isServiceRegistered(IRepositoryService.class)) {
return imports;
}
IRepositoryService service = (IRepositoryService) GlobalServiceRegister.getDefault().getService(IRepositoryService.class);
IProxyRepositoryFactory repositoryFactory = service.getProxyRepositoryFactory();
Project project = ProjectManager.getInstance().getProject(null);
try {
List<IRepositoryViewObject> routines = repositoryFactory.getAll(ERepositoryObjectType.ROUTINES);
for (IRepositoryViewObject routine : routines) {
if (routine.getProperty().getItem() instanceof RoutineItem && ((RoutineItem) routine.getProperty().getItem()).isBuiltIn()) {
//$NON-NLS-1$ //$NON-NLS-2$
imports += "import routines." + routine.getLabel() + ";\n";
} else {
//$NON-NLS-1$ //$NON-NLS-2$
imports += "import routines." + routine.getLabel() + ";\n";
}
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
//$NON-NLS-1$
return "";
}
//$NON-NLS-1$
imports += "import routines.system.*;\n";
//$NON-NLS-1$
imports += "import java.text.ParseException;\n";
//$NON-NLS-1$
imports += "import java.text.SimpleDateFormat;\n";
//$NON-NLS-1$
imports += "import java.util.Date;\n";
//$NON-NLS-1$
imports += "import java.util.List;\n";
//$NON-NLS-1$
imports += "import java.math.BigDecimal;\n";
imports += "\n";
imports += "@SuppressWarnings(\"unused\")";
imports += "\n\n";
return imports;
}
use of org.talend.core.model.properties.RoutineItem in project tdi-studio-se by Talend.
the class JavaRoutineSynchronizer method syncRoutineItems.
private void syncRoutineItems(Collection<RoutineItem> routineObjects, boolean forceUpdate) throws SystemException {
for (RoutineItem routineItem : routineObjects) {
syncRoutine(routineItem, true, forceUpdate);
}
try {
ILibrariesService jms = CorePlugin.getDefault().getLibrariesService();
List<URL> urls = jms.getTalendRoutinesFolder();
for (URL systemModuleURL : urls) {
if (systemModuleURL != null) {
String fileName = systemModuleURL.getPath();
if (fileName.startsWith("/")) {
//$NON-NLS-1$
fileName = fileName.substring(1);
}
File f = new File(systemModuleURL.getPath());
if (f.isDirectory()) {
syncModule(f.listFiles());
}
}
}
} catch (IOException e) {
throw new SystemException(e);
}
}
use of org.talend.core.model.properties.RoutineItem in project tdi-studio-se by Talend.
the class ProblemsView method propertyChange.
/*
* (non-Javadoc)
*
* @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
*/
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (!(evt.getNewValue() instanceof IRepositoryObject)) {
return;
}
IRepositoryObject object = (IRepositoryObject) evt.getNewValue();
if (object.getRepositoryObjectType() != ERepositoryObjectType.ROUTINES) {
return;
}
if (evt.getPropertyName().equals(ERepositoryActionName.DELETE_TO_RECYCLE_BIN.getName()) || evt.getPropertyName().equals(ERepositoryActionName.DELETE_FOREVER.getName())) {
String routineLabel = object.getProperty().getLabel();
Problems.removeProblemsByRoutine(routineLabel);
}
if (evt.getPropertyName().equals(ERepositoryActionName.RESTORE.getName())) {
RoutineItem item = (RoutineItem) object.getProperty().getItem();
restoreProblem(item);
}
}
use of org.talend.core.model.properties.RoutineItem in project tdi-studio-se by Talend.
the class Problems method addRoutineFile.
public static List<Information> addRoutineFile(IFile file, final Property property, boolean... fromJob) {
if (file == null) {
return Collections.emptyList();
}
String routineFileName = null;
String version = null;
if (property == null) {
routineFileName = getFileName(file);
} else {
routineFileName = property.getLabel();
version = property.getVersion();
}
ProblemType type = ProblemType.NONE;
if (property.getItem() instanceof RoutineItem) {
type = ProblemType.ROUTINE;
} else if (property.getItem() instanceof ProcessItem) {
type = ProblemType.JOB;
}
List<Information> listInfos = addRoutineFile(file, type, routineFileName, version, fromJob);
if (property == null || listInfos == null) {
return Collections.emptyList();
}
return listInfos;
}
Aggregations