private File getPropertiesFile(LocalArtefactAPI artefact) { if (artefact.isFolder()) { return new File(propertiesLocation, artefact.getArtefactPath().withoutFirstSegment().getStringValue() + (File.separator + FolderHelper.FOLDER_PROPERTIES_FILE)); } else { return new File(propertiesLocation, artefact.getArtefactPath().withoutFirstSegment().getStringValue() + FolderHelper.RESOURCE_PROPERTIES_EXT); } }
public ArtefactPathImpl(ArtefactPath artefactPath) { // this.state = artefactPath.state; segments.addAll(artefactPath.getSegments()); }
public AProjectArtefact getArtefactByPath(ArtefactPath artefactPath) throws ProjectException { String projectName = artefactPath.segment(0); AProject ralProject = getProject(projectName); ArtefactPath pathInProject = artefactPath.withoutFirstSegment(); return ralProject.getArtefactByPath(pathInProject); }
public JcrEntityAPI(Node node, ArtefactPath path, boolean oldVersion) throws RepositoryException { super(node, path.segment(path.segmentCount() - 1), oldVersion); this.path = path; version = new JcrVersion(node); properties = new HashMap<String, org.openl.rules.common.Property>(); initProperties(); props = new HashMap<String, Object>(); loadProps(); }
try { AProjectFolder folder = selectedProject; for (int i = 0; i < artefactPath.segmentCount() - 1; i++) { String segment = artefactPath.segment(i); if (!folder.hasArtefact(segment)) { folder.addFolder(segment); if (!artefact.isFolder()) { FacesUtils.addErrorMessage( String.format("Artefact %s is not a folder", artefact.getArtefactPath().getStringValue())); return null; ArtefactPath selectedNodePath = selectedNode.getData().getArtefactPath().withoutFirstSegment(); is = ((AProjectResource) forExport.getArtefactByPath(selectedNodePath)).getContent(); } else { .addResource(artefactPath.segment(artefactPath.segmentCount() - 1), is); fileName = addedFileResource.getName(); repositoryTreeState
private AProjectArtefact getExcelArtefactByPath(List<AProjectArtefact> excelArtefacts, String path) { for (AProjectArtefact excelArtefact : excelArtefacts) { if (excelArtefact.getArtefactPath().getStringValue().equals(path)) { return excelArtefact; } } return null; }
public Collection<ProjectVersion> getVersions() { if (data instanceof AProjectArtefact) { RulesProject project = findProjectContainingCurrentArtefact(); List<ProjectVersion> result; if (project != null) { result = project.getVersionsForArtefact((getData()).getArtefactPath().withoutFirstSegment()); } else { result = getData().getVersions(); } Collections.sort(result, RepositoryUtils.VERSIONS_REVERSE_COMPARATOR); return result; } else { return new LinkedList<ProjectVersion>(); } }
private LocalArtefactAPI getArtefactForChild(File child) { if (child.isDirectory()) { return new LocalFolderAPI(child, path.withSegment(child.getName()), workspace); } else { return new LocalResourceAPI(child, path.withSegment(child.getName()), workspace); } }
@Override public Map<String, InheritedProperty> getInheritedProps() { int segmentId = path.segmentCount(); if (segmentId > 1) { LocalArtefactAPI parentArtefactAPI = new LocalArtefactAPI(source.getParentFile(), path.withoutSegment(segmentId - 1), workspace); Map<String, InheritedProperty> inheritedProps = new HashMap<String, InheritedProperty>(); inheritedProps.putAll(parentArtefactAPI.getInheritedProps()); if (parentArtefactAPI.getProps() != null) { Map<String, Object> parentProp = parentArtefactAPI.getProps(); for (Map.Entry<String, Object> entry: parentProp.entrySet()) { InheritedProperty inhProp = new InheritedProperty(entry.getValue(), (parentArtefactAPI.source.isDirectory() ? ArtefactType.FOLDER : ArtefactType.PROJECT ), parentArtefactAPI.getName() ); inheritedProps.put(entry.getKey(), inhProp); } } return inheritedProps; } return new HashMap<String, InheritedProperty>(); }
private File getProjectLocation(){ String projectName = getArtefactPath().segment(0); return new File(workspace.getLocation(), projectName); }
try { AProjectFolder folder = selectedProject; for (int i = 0; i < artefactPath.segmentCount() - 1; i++) { String segment = artefactPath.segment(i); if (!folder.hasArtefact(segment)) { folder.addFolder(segment); if (!artefact.isFolder()) { FacesUtils.addErrorMessage( String.format("Artefact %s is not a folder", artefact.getArtefactPath().getStringValue())); return null; ArtefactPath selectedNodePath = selectedNode.getData().getArtefactPath().withoutFirstSegment(); is = ((AProjectResource) forExport.getArtefactByPath(selectedNodePath)).getContent(); } else { .addResource(artefactPath.segment(artefactPath.segmentCount() - 1), is); fileName = addedFileResource.getName(); repositoryTreeState
private AProjectArtefact getExcelArtefactByPath(List<AProjectArtefact> excelArtefacts, String path) { for (AProjectArtefact excelArtefact : excelArtefacts) { if (excelArtefact.getArtefactPath().getStringValue().equals(path)) { return excelArtefact; } } return null; }
public JcrEntityAPI(Node node, ArtefactPath path, boolean oldVersion) throws RepositoryException { super(node, path.segment(path.segmentCount() - 1), oldVersion); this.path = path; version = new JcrVersion(node); properties = new HashMap<String, org.openl.rules.common.Property>(); initProperties(); props = new HashMap<String, Object>(); loadProps(); }
@Override public boolean hasVersions() { // getVersions().isEmpty() shouldn't be used, because it will be much slower if (data != null) { RulesProject project = findProjectContainingCurrentArtefact(); if (project != null) { if (data.isFolder()) { return false; } else { List<ProjectVersion> versions = project.getArtefactVersions(getData().getArtefactPath().withoutFirstSegment()); return versions.size() > 0; } } else { return getData().getVersionsCount() > 0; } } else { return false; } }
public LocalFolderAPI addFolder(String name) throws ProjectException { File newFolder = new File(source, name); if (!newFolder.mkdir() && !newFolder.exists()) { throw new ProjectException(String.format("Can't create the folder '%s'", newFolder.getAbsolutePath())); } LocalFolderAPI localFolder = new LocalFolderAPI(newFolder, path.withSegment(name), workspace); notifyModified(); return localFolder; }
public String getCurrentNodePath() { AProjectArtefact projectArtefact = getSelectedNode().getData(); return projectArtefact == null ? null : projectArtefact.getArtefactPath().withoutFirstSegment().getStringValue(); }
private AProjectArtefact getExcelArtefactByPath(List<AProjectArtefact> excelArtefacts, String path) { for (AProjectArtefact excelArtefact : excelArtefacts) { if (excelArtefact.getArtefactPath().getStringValue().equals(path)) { return excelArtefact; } } return null; }
public AProjectArtefact getArtefactByPath(ArtefactPath artefactPath) throws ProjectException { String projectName = artefactPath.segment(0); AProject uwp = getProject(projectName); ArtefactPath pathInProject = artefactPath.withoutFirstSegment(); return uwp.getArtefactByPath(pathInProject); }
public ArtefactPathImpl(ArtefactPath artefactPath) { // this.state = artefactPath.state; segments.addAll(artefactPath.getSegments()); }
@Override public boolean hasVersions() { // getVersions().isEmpty() shouldn't be used, because it will be much slower if (data != null) { RulesProject project = findProjectContainingCurrentArtefact(); if (project != null) { if (data.isFolder()) { return false; } else { List<ProjectVersion> versions = project.getArtefactVersions(getData().getArtefactPath().withoutFirstSegment()); return versions.size() > 0; } } else { return getData().getVersionsCount() > 0; } } else { return false; } }