use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.
the class SetupProcessDependenciesRoutinesDialog method getAllReferenceProjects.
private void getAllReferenceProjects(Project currentProject, Set<Project> referenceProjects) {
for (Project p : ProjectManager.getInstance().getReferencedProjects(currentProject)) {
referenceProjects.add(p);
getAllReferenceProjects(p, referenceProjects);
}
}
use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.
the class JavaProcessorUtilities method computeLibrariesPath.
/**
* DOC nrousseau Comment method "computeLibrariesPath".
*
* @param hashSet
* @param process
* @param alreadyRetrievedModules
* @throws BusinessException
*/
public static void computeLibrariesPath(Set<ModuleNeeded> jobModuleList, IProcess process, Set<ModuleNeeded> alreadyRetrievedModules) throws ProcessorException {
RepositoryContext repositoryContext = (RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY);
Project project = repositoryContext.getProject();
if (projectSetup == null || !projectSetup.equals(project.getTechnicalLabel())) {
projectSetup = project.getTechnicalLabel();
}
// use maven to update the class path.
try {
sortClasspath(jobModuleList, process, alreadyRetrievedModules);
} catch (CoreException e) {
ExceptionHandler.process(e);
}
if (alreadyRetrievedModules.isEmpty()) {
// to update this only one time in one build of full job/subjobs
checkAndUpdateLog4jFile();
}
}
use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.
the class JavaProcessor method generateContextCode.
/*
* (non-Javadoc)
*
* @see org.talend.designer.runprocess.Processor#generateContextCode()
*/
@Override
public void generateContextCode() throws ProcessorException {
RepositoryContext repositoryContext = (RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY);
Project project = repositoryContext.getProject();
ICodeGenerator codeGen;
ICodeGeneratorService service = RunProcessPlugin.getDefault().getCodeGeneratorService();
//$NON-NLS-1$
String javaInterpreter = "";
//$NON-NLS-1$
String javaLib = "";
String currentJavaProject = project.getTechnicalLabel();
String javaContext = getContextPath().toPortableString();
codeGen = service.createCodeGenerator(process, false, false, javaInterpreter, javaLib, javaContext, currentJavaProject);
updateContextCode(codeGen);
}
use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.
the class TosTokenCollector method collectProjectDetails.
private JSONObject collectProjectDetails() throws PersistenceException, JSONException {
JSONObject jObject = new JSONObject();
Project currentProject = ProjectManager.getInstance().getCurrentProject();
final IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
JSONObject repoStats = new JSONObject();
// metadata
for (DynaEnum type : ERepositoryObjectType.values()) {
if (type instanceof ERepositoryObjectType && ((ERepositoryObjectType) type).isResourceItem()) {
try {
List<IRepositoryViewObject> all = factory.getAll(currentProject, (ERepositoryObjectType) type);
int nb = all.size();
if (ERepositoryObjectType.TDQ_INDICATOR_ELEMENT.equals(type) || ERepositoryObjectType.TDQ_PATTERN_ELEMENT.equals(type) || ERepositoryObjectType.TDQ_RULES.equals(type) || "TDQ_SOURCE_FILE_ELEMENT".equals(type.getType())) {
//$NON-NLS-1$
continue;
}
if (ERepositoryObjectType.ROUTINES.equals(type)) {
nb = 0;
List<IRepositoryViewObject> newList = new ArrayList<IRepositoryViewObject>();
for (IRepositoryViewObject object : all) {
RoutineItem rItem = (RoutineItem) object.getProperty().getItem();
if (!rItem.isBuiltIn()) {
nb++;
newList.add(object);
}
}
all = newList;
}
if (ERepositoryObjectType.SQLPATTERNS.equals(type)) {
nb = 0;
for (IRepositoryViewObject object : all) {
SQLPatternItem spItem = (SQLPatternItem) object.getProperty().getItem();
if (!spItem.isSystem()) {
nb++;
}
}
}
if ("MDM.DataModel".equals(type.getType())) {
//$NON-NLS-1$
nb = 0;
for (IRepositoryViewObject object : all) {
String path = object.getProperty().getItem().getState().getPath();
if (!"System".equals(path)) {
//$NON-NLS-1$
nb++;
}
}
}
if (nb > 0) {
JSONObject typeStats = new JSONObject();
//$NON-NLS-1$
typeStats.put("nb", nb);
if (ERepositoryObjectType.getAllTypesOfProcess().contains(type)) {
JSONObject jobDetails = new JSONObject();
collectJobDetails(all, jobDetails);
//$NON-NLS-1$
typeStats.put("details", jobDetails);
}
if (ERepositoryObjectType.ROUTINES.equals(type) || //$NON-NLS-1$
((ERepositoryObjectType) type).getFolder().startsWith("metadata/") || ERepositoryObjectType.CONTEXT.equals(type) || type.equals(ERepositoryObjectType.JOBLET)) {
int nbUsed = 0;
for (IRepositoryViewObject object : all) {
List<Relation> relations = RelationshipItemBuilder.getInstance().getItemsHaveRelationWith(object.getId());
relations.addAll(RelationshipItemBuilder.getInstance().getItemsHaveRelationWith(object.getLabel()));
if (relations.size() > 0) {
nbUsed++;
}
}
//$NON-NLS-1$
typeStats.put("nb.used", nbUsed);
}
if (ERepositoryObjectType.METADATA_CONNECTIONS.equals(type)) {
JSONObject objects = new JSONObject();
for (IRepositoryViewObject object : all) {
DatabaseConnectionItem item = (DatabaseConnectionItem) object.getProperty().getItem();
String dbType = ((DatabaseConnection) item.getConnection()).getDatabaseType();
int nbDbTypes = 1;
if (objects.has(dbType)) {
nbDbTypes = objects.getInt(dbType);
nbDbTypes++;
}
objects.put(dbType, nbDbTypes);
}
//$NON-NLS-1$
typeStats.put("types", objects);
}
repoStats.put(type.getType(), typeStats);
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
}
//$NON-NLS-1$
jObject.put(PROJECTS.getKey(), repoStats);
jObject.put(TYPE.getKey(), ProjectManager.getInstance().getProjectType(currentProject));
int nbRef = ProjectManager.getInstance().getAllReferencedProjects().size();
if (nbRef > 0) {
jObject.put("nb.refProjects", nbRef);
}
return jObject;
}
use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.
the class AbstractConextAction method updateNodeToLastVersion.
/*
* (non-Javadoc)
*
* @see org.talend.repository.ui.actions.AContextualAction#updateNodeToLastVersion()
*/
@Override
protected void updateNodeToLastVersion() {
if (repositoryNode == null || repositoryNode.getObject() == null || !(repositoryNode.getObject() instanceof RepositoryObject)) {
return;
}
Property property = repositoryNode.getObject().getProperty();
Property updatedProperty = null;
try {
updatedProperty = ProxyRepositoryFactory.getInstance().getLastVersion(new Project(ProjectManager.getInstance().getProject(property.getItem())), property.getId()).getProperty();
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
// update the property of the node repository object
// repositoryNode.getObject().setProperty(updatedProperty);
}
Aggregations