Esempio n. 1
0
  /** Called before a resource method is executed */
  @Override
  public void filter(ContainerRequestContext context) {
    if (activityLog.isEnabled()) {
      try {
        String message =
            String.format("%s %s", context.getMethod(), context.getUriInfo().getRequestUri());
        Long serverId = getServerId(context);
        Long clientId = ActivityConstants.DEFAULT_CLIENT_ID;
        if (Strings.isNumeric(context.getHeaders().getFirst("osee.client.id"))) {
          clientId = Long.valueOf(context.getHeaders().getFirst("osee.client.id"));
        }

        Long accountId = ActivityConstants.DEFAULT_ACCOUNT_ID;
        if (Strings.isNumeric(context.getHeaders().getFirst("osee.account.id"))) {
          accountId = Long.valueOf(context.getHeaders().getFirst("osee.account.id"));
        }
        Long entryId =
            activityLog.createActivityThread(
                Activity.JAXRS_METHOD_CALL, accountId, serverId, clientId, message);

        context.setProperty(ActivityConstants.HTTP_HEADER__ACTIVITY_ENTRY_ID, entryId);
      } catch (Throwable th) {
        logger.error(th, "Error during ActivityContainerRequestFilter");
      }
    }
  }
Esempio n. 2
0
  @Override
  protected void restoreWidgetValues() {
    super.restoreWidgetValues();
    IDialogSettings settings = getDialogSettings();
    if (settings != null) {
      if (getDefaultSourceFile() == null) {
        directoryFileSelector.setDirectorySelected(settings.getBoolean("isDirectory"));
        String file = settings.get("source.file");
        if (Strings.isValid(file)) {
          directoryFileSelector.setText(file);
        }
      }

      String parser = settings.get("selected.parser");
      if (Strings.isValid(parser)) {
        for (IArtifactExtractor item : importContributionManager.getExtractors()) {
          if (parser.equals(item.getClass().getSimpleName())) {
            parserSelectPanel.setArtifactExtractor(item);
          }
        }
      }
      if (getDefaultDestinationArtifact() == null) {
        String guid = settings.get("destination.artifact.guid");
        String branchUuidStr = settings.get("destination.branch.uuid");

        if (GUID.isValid(guid) && Strings.isNumeric(branchUuidStr)) {
          try {
            Long bramchUuid = Long.valueOf(branchUuidStr);
            Artifact artifact =
                ArtifactQuery.getArtifactFromId(guid, BranchManager.getBranchByUuid(bramchUuid));
            artifactSelectPanel.setDefaultItem(artifact);
          } catch (OseeCoreException ex) {
            OseeLog.logf(
                Activator.class,
                Level.SEVERE,
                "Unable to restore destination artifact- guid:[%s] branch uuid:[%d]",
                guid,
                branchUuidStr);
          }
        }
      }

      boolean toUpdate = settings.getBoolean("is.update.existing.selected");
      updateExistingArtifacts.setSelection(toUpdate);
      deleteUnmatchedArtifacts.setEnabled(toUpdate);
      if (toUpdate) {
        try {
          ArtifactType artType = ArtifactTypeManager.getType(getArtifactType());
          attributeTypeSelectPanel.setAllowedAttributeTypes(
              artType.getAttributeTypes(getDestinationArtifact().getFullBranch()));
        } catch (OseeCoreException ex) {
          OseeLog.log(Activator.class, Level.SEVERE, ex);
        }
      } else {
        attributeTypeSelectPanel.setAllowedAttributeTypes(new ArrayList<IAttributeType>());
      }
    }
  }
Esempio n. 3
0
 private static void setConfig(String branchUuid, String name) {
   if (!Strings.isValid(name)) {
     name = "unknown";
   }
   if (Strings.isValid(branchUuid) && branchUuid.matches("\\d+")) {
     atsBranch = TokenFactory.createBranch(Long.valueOf(branchUuid), name);
     atsConfigName = name;
   }
 }
 private void relationMateriallyDiffers(IOseeStatement chStmt) throws OseeCoreException {
   if (!materiallyDifferent) {
     String currentRationale = chStmt.getString("rationale");
     materiallyDifferent |=
         Strings.isValid(currentRationale) && !currentRationale.equals(netRationale);
   }
 }
  @Override
  protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    String cmd = req.getParameter("cmd");
    String argList = req.getParameter("args");

    List<String> args;
    if (Strings.isValid(argList)) {
      args = Arrays.asList(argList.split(","));
    } else {
      args = Collections.emptyList();
    }
    resp.setStatus(HttpServletResponse.SC_OK);
    CommandInterpreter interpreter =
        new HttpCommandInterpreter(context, resp.getWriter(), args.iterator());
    Object object = interpreter.execute(cmd);
    if (object instanceof Job) {
      Job job = (Job) object;
      try {
        job.join();
        IStatus status = job.getResult();
        interpreter.println(status.toString());
      } catch (InterruptedException ex) {
        interpreter.print(ex);
      }
    }
  }
Esempio n. 6
0
 public static IOseeBranch getAtsBranch() {
   synchronized (lock) {
     if (atsBranch == null) {
       // Preference store overrides all
       if (AtsPreferencesService.isAvailable()) {
         try {
           String atsBranchUuid = AtsPreferencesService.get(ATS_BRANCH_UUID);
           setConfig(atsBranchUuid, AtsPreferencesService.get(ATS_BRANCH_NAME));
         } catch (Exception ex) {
           OseeLog.log(AtsUtilCore.class, Level.SEVERE, "Error processing stored ATS Branch.", ex);
         }
       }
       // osee.ini -D option overrides default
       if (atsBranch == null) {
         String atsBranchUuid = System.getProperty(ATS_BRANCH_UUID);
         if (Strings.isValid(atsBranchUuid)) {
           setConfig(atsBranchUuid, System.getProperty(ATS_BRANCH_NAME));
         }
       }
       // default is always common
       if (atsBranch == null) {
         atsBranch = CoreBranches.COMMON;
         atsConfigName = CoreBranches.COMMON.getName();
       }
     }
   }
   return atsBranch;
 }
Esempio n. 7
0
 public static String getGuid(IAtsObject atsObject) {
   String guid = uuidToGuidMap.get(atsObject.getUuid());
   if (!Strings.isValid(guid) && atsObject.getStoreObject() != null) {
     guid = atsObject.getStoreObject().getGuid();
   }
   return guid;
 }
Esempio n. 8
0
  public static Job createWorkingBranch(
      final TeamWorkFlowArtifact teamArt, final TransactionRecord parentTransactionId, boolean pend)
      throws OseeCoreException {
    final String branchName =
        Strings.truncate(TeamWorkFlowManager.getBranchName(teamArt), 195, true);
    Conditions.checkNotNull(teamArt, "Parent Team Workflow");
    Conditions.checkNotNull(parentTransactionId, "Parent Branch");

    IExceptionableRunnable runnable =
        new IExceptionableRunnable() {

          @Override
          public IStatus run(IProgressMonitor monitor) throws OseeCoreException {
            teamArt.setWorkingBranchCreationInProgress(true);
            BranchManager.createWorkingBranch(parentTransactionId, branchName, teamArt);
            teamArt.setWorkingBranchCreationInProgress(false);
            performPostBranchCreationTasks(teamArt);
            return Status.OK_STATUS;
          }
        };

    //            Jobs.runInJob("Create Branch", runnable, Activator.class, Activator.PLUGIN_ID);
    Job job =
        Jobs.startJob(
            new CatchAndReleaseJob("Create Branch", runnable, Activator.class, Activator.PLUGIN_ID),
            true);
    if (pend) {
      try {
        job.join();
      } catch (InterruptedException ex) {
        throw new OseeWrappedException(ex);
      }
    }
    return job;
  }
  private void createStatusWindow(Composite parent) {
    statusWindow = new StatusWindowWidget(parent);

    statusWindow.setLabelAndValue(
        UpdateableLabel.HOSTLABEL.name(),
        "Selected Host",
        NOT_CONNECTED,
        SWT.BOLD,
        SWT.COLOR_DARK_RED);

    String selectedFile = testManagerEditor.loadValue(testManagerEditor.configFileName);
    if (!Strings.isValid(selectedFile)) {
      selectedFile = testManagerEditor.getDefaultConfigPath();
      testManagerEditor.storeValue(testManagerEditor.configFileName, selectedFile);
    }
    OseeLog.log(TestManagerPlugin.class, Level.INFO, "The default config is: " + selectedFile);

    statusWindow.setLabelAndValue(
        UpdateableLabel.CONFIGPATHLABEL.name(), "Config File Path", selectedFile);

    saveWidget.setStatusLabel(statusWindow);
    loadWidget.setStatusLabel(statusWindow);

    // // Status ICON Labels
    // connectStatusIconLabel = new
    // Label(statusWindow.getStatusIconComposite(), SWT.NONE);
    // hostWidget.setConnectStatusLabel(connectStatusIconLabel);
    // connectStatusIconLabel.setVisible(false);

    statusWindow.refresh();
  }
Esempio n. 10
0
  @Override
  public Callable<?> createCallable(Console console, ConsoleParameters params) {
    List<Long> branchUuids = new ArrayList<Long>();
    for (String uuid : params.getArray("branchUuids")) {
      if (Strings.isNumeric(uuid)) {
        branchUuids.add(Long.parseLong(uuid));
      } else {
        console.writeln("UUID listed %s is not a valid UUID", uuid);
      }
    }

    if (branchUuids.isEmpty()) {
      console.writeln("No branch uuids where specified");
    }

    Collection<String> options = params.getOptions();
    boolean recurse = options.contains("R");
    boolean unArchived = options.contains("A");
    boolean unDeleted = options.contains("D");
    boolean baseline = options.contains("B");
    boolean runPurge = options.contains("P");

    OrcsBranch orcsBranch = getOrcsApi().getBranchOps(null);
    return new PurgeBranchCallable(
        console,
        orcsBranch,
        getOrcsApi().getQueryFactory(null),
        branchUuids,
        recurse,
        unArchived,
        unDeleted,
        baseline,
        runPurge);
  }
 private Collection<String> getSet(Map<String, Object> props, String key, String defaultValue) {
   Set<String> toReturn = new HashSet<>();
   String joinedArray = get(props, key, "");
   if (Strings.isValid(joinedArray)) {
     String[] split = joinedArray.split(",");
     for (String value : split) {
       String toAdd = AuthorizationUtil.normalize(value);
       if (Strings.isValid(toAdd)) {
         toReturn.add(toAdd);
       }
     }
   } else {
     toReturn.add(defaultValue);
   }
   return toReturn;
 }
Esempio n. 12
0
  @Override
  public InputStream getRenderInputStream(
      PresentationType presentationType, List<Artifact> artifacts) throws OseeCoreException {
    InputStream stream = null;
    try {
      if (artifacts.isEmpty()) {
        stream =
            Streams.convertStringToInputStream(
                WordWholeDocumentAttribute.getEmptyDocumentContent(), "UTF-8");
      } else {
        Artifact artifact = artifacts.iterator().next();
        String content =
            artifact.getOrInitializeSoleAttributeValue(CoreAttributeTypes.WholeWordContent);
        if (presentationType == PresentationType.DIFF
            && WordUtil.containsWordAnnotations(content)) {
          throw new OseeStateException(
              "Trying to diff the [%s] artifact on the [%s] branch, which has tracked changes turned on.  All tracked changes must be removed before the artifacts can be compared.",
              artifact.getName(), artifact.getBranch().getName());
        }

        LinkType linkType = LinkType.OSEE_SERVER_LINK;
        content = WordMlLinkHandler.link(linkType, artifact, content);

        String classification = WordRendererUtil.getDataRightsClassification(artifact);
        if (Strings.isValid(classification)) {
          content = addDataRights(content, classification, artifact);
        }

        stream = Streams.convertStringToInputStream(content, "UTF-8");
      }
    } catch (IOException ex) {
      OseeExceptions.wrapAndThrow(ex);
    }
    return stream;
  }
Esempio n. 13
0
 public SecretKey decodeSecretKey(String encodedSecretKey, String secretKeyAlgorithm) {
   String secretKeyAlgorithmToUse = secretKeyAlgorithm;
   if (!Strings.isValid(secretKeyAlgorithmToUse)) {
     secretKeyAlgorithmToUse = AES_CRYPTO_ALGO;
   }
   return CryptoUtils.decodeSecretKey(encodedSecretKey, secretKeyAlgorithmToUse);
 }
 @Override
 public String getTaskEditorLabel(SearchType searchType) throws OseeCoreException {
   StringBuffer sb = new StringBuffer();
   Collection<IAtsTeamDefinition> teamDefs = getSelectedTeamDefinitions();
   if (teamDefs.size() > 0) {
     sb.append(" - Teams: ");
     sb.append(org.eclipse.osee.framework.jdk.core.util.Collections.toString(",", teamDefs));
   }
   if (getSelectedVersionArtifact() != null) {
     sb.append(" - Version: ");
     sb.append(getSelectedVersionArtifact());
   }
   if (getSelectedGroups().size() > 0) {
     sb.append(" - Groups: ");
     sb.append(Collections.toString(",", getSelectedGroups()));
   }
   if (getSelectedUser() != null) {
     sb.append(" - Assignee: ");
     sb.append(getSelectedUser());
   }
   if (getSelectedState() != null) {
     sb.append(" - State: ");
     sb.append(getSelectedState());
   }
   if (isIncludeCompletedCheckbox() && isIncludeCancelledCheckbox()) {
     sb.append(" - Include Completed/Cancelled");
   }
   if (isIncludeCompletedCheckbox()) {
     sb.append(" - Include Completed");
   }
   if (isIncludeCancelledCheckbox()) {
     sb.append(" - Include Cancelled");
   }
   return Strings.truncate("Tasks" + sb.toString(), TaskEditor.TITLE_MAX_LENGTH, true);
 }
 public Result isValid() {
   if (!Strings.isValid(getSubject())) {
     return new Result("Must enter subject");
   }
   if (!Strings.isValid(getBody())) {
     return new Result("Must enter body");
   }
   if (workflows.isEmpty()) {
     return new Result("No workflows dropped");
   }
   for (Artifact workflow : workflows) {
     if (!(workflow instanceof AbstractWorkflowArtifact)) {
       return new Result(
           "Only valid for Workflow Artifacts, not [%s]", workflow.getArtifactTypeName());
     }
   }
   return Result.TrueResult;
 }
Esempio n. 16
0
 private Set<String> asSet(String key, JSONArray array) throws JSONException {
   Set<String> toReturn = new TreeSet<String>();
   for (int index = 0; index < array.length(); index++) {
     String name = array.getString(index);
     if (Strings.isValid(name)) {
       toReturn.add(name);
     }
   }
   return toReturn;
 }
Esempio n. 17
0
 public static Image getCoverageItemUserImage(ICoverage coverageItem) {
   try {
     if (coverageItem.isAssignable() && Strings.isValid(coverageItem.getAssignees())) {
       return FrameworkArtifactImageProvider.getUserImage(
           UsersByIds.getUsers(coverageItem.getAssignees()));
     }
   } catch (OseeCoreException ex) {
     OseeLog.log(Activator.class, Level.SEVERE, ex);
   }
   return null;
 }
Esempio n. 18
0
 private String generatePath(String name) throws MalformedLocatorException {
   StringBuilder builder = new StringBuilder();
   builder.append(getSupportedProtocol());
   builder.append("://");
   if (Strings.isValid(name)) {
     builder.append(name);
   } else {
     throw new MalformedLocatorException("Invalid arguments during locator generation.");
   }
   return builder.toString();
 }
Esempio n. 19
0
  @Override
  protected void processData(Map<String, String> fieldMap) {
    String fileName = fieldMap.get(ExportImportXml.ID);
    Integer priority = new Integer(fieldMap.get(ExportImportXml.PRIORITY));
    String source = fieldMap.get(ExportImportXml.SOURCE);

    if (Strings.isValid(fileName) && Strings.isValid(source)) {
      if (source.equals(ExportImportXml.TYPE_MODEL)) {
        typeModelFile = fileName;
      } else if (source.equals(ExportImportXml.DB_SCHEMA)) {
        this.metadataFile = fileName;
      } else {
        ImportFile importFile = new ImportFile(fileName, source, priority);
        if (source.equals("osee_branch")) {
          branchFile = importFile;
        } else {
          filesToImport.add(importFile);
        }
      }
    }
  }
Esempio n. 20
0
  @Override
  public void run(TableLoadOption... tableLoadOptions) throws OseeCoreException {

    List<Artifact> activeTeams = new LinkedList<>();
    for (Artifact agTeam :
        ArtifactQuery.getArtifactListFromType(
            AtsArtifactTypes.AgileTeam, AtsUtilCore.getAtsBranch())) {
      if (agTeam.getSoleAttributeValue(AtsAttributeTypes.Active, true)) {
        activeTeams.add(agTeam);
      }
    }
    FilteredTreeArtifactDialog dialog =
        new FilteredTreeArtifactDialog(
            getName(),
            "Select Agile Team",
            activeTeams,
            new ArtifactTreeContentProvider(),
            new ArtifactLabelProvider());
    if (dialog.open() == 0) {

      EntryDialog ed =
          new EntryDialog(getName(), "Enter new Agile Sprint name(s) (comma delimited)");
      if (ed.open() == 0) {
        if (Strings.isValid(ed.getEntry())) {
          try {
            AgileEndpointApi ageilEp = AtsClientService.getAgileEndpoint();
            JaxNewAgileSprint newSprint = new JaxNewAgileSprint();
            int teamUuid = ((Artifact) dialog.getSelectedFirst()).getArtId();
            for (String name : ed.getEntry().split(",")) {
              newSprint.setName(name);
              newSprint.setTeamUuid(teamUuid);
              Response response = ageilEp.createSprint(new Long(teamUuid), newSprint);
              JaxAgileSprint sprint = response.readEntity(JaxAgileSprint.class);
              if (sprint != null) {
                long uuid = sprint.getUuid();
                Artifact sprintArt =
                    ArtifactQuery.getArtifactFromId(
                        new Long(uuid).intValue(), AtsUtilCore.getAtsBranch());
                sprintArt.getParent().reloadAttributesAndRelations();
                AtsUtil.openArtifact(sprintArt.getGuid(), OseeCmEditor.CmPcrEditor);
              } else {
                AWorkbench.popup("Error creating Agile Team [%s]", response.toString());
                return;
              }
            }
          } catch (Exception ex) {
            OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
          }
        }
      }
    }
  }
Esempio n. 21
0
 private List<String> fromCertString(String certs) {
   List<String> toReturn = null;
   if (Strings.isValid(certs)) {
     toReturn = new ArrayList<String>();
     String[] certArray = certs.split(";");
     for (String cert : certArray) {
       toReturn.add(cert);
     }
   } else {
     toReturn = Collections.emptyList();
   }
   return toReturn;
 }
 @Override
 public AccessContext getContext(Collection<AccessContext> contexts, IAccessContextId contextId)
     throws OseeCoreException {
   Conditions.checkNotNull(contexts, "accessContext collection");
   Conditions.checkNotNull(contextId, "accessContextId");
   AccessContext toReturn = null;
   for (AccessContext accessContext : contexts) {
     if (contextId.getGuid().equals(Strings.unquote(accessContext.getGuid()))) {
       toReturn = accessContext;
     }
   }
   return toReturn;
 }
Esempio n. 23
0
  public static void handleArtifactUri(
      IResourceManager resourceManager, String request, String uri, HttpServletResponse response)
      throws OseeCoreException {
    boolean wasProcessed = false;
    if (Strings.isValid(uri)) {
      IResourceLocator locator = resourceManager.getResourceLocator(uri);
      PropertyStore options = new PropertyStore();
      options.put(StandardOptions.DecompressOnAquire.name(), true);
      IResource resource = resourceManager.acquire(locator, options);

      if (resource != null) {
        wasProcessed = true;

        InputStream inputStream = null;
        try {
          inputStream = resource.getContent();

          response.setStatus(HttpServletResponse.SC_OK);
          response.setContentLength(inputStream.available());
          response.setCharacterEncoding("ISO-8859-1");
          String mimeType = URLConnection.guessContentTypeFromStream(inputStream);
          if (mimeType == null) {
            mimeType = URLConnection.guessContentTypeFromName(resource.getLocation().toString());
            if (mimeType == null) {
              mimeType = "application/*";
            }
          }
          response.setContentType(mimeType);
          if (!mimeType.equals("text/html")) {
            response.setHeader("Content-Disposition", "attachment; filename=" + resource.getName());
          }
          Lib.inputStreamToOutputStream(inputStream, response.getOutputStream());
          response.flushBuffer();
        } catch (IOException ex) {
          OseeExceptions.wrapAndThrow(ex);
        } finally {
          Lib.close(inputStream);
        }
      }
    }
    if (!wasProcessed) {
      response.setStatus(HttpServletResponse.SC_NOT_FOUND);
      response.setContentType("text/plain");
      try {
        response.getWriter().write(String.format("Unable to find resource: [%s]", request));
      } catch (IOException ex) {
        OseeExceptions.wrapAndThrow(ex);
      }
    }
  }
 public static boolean isSourceValid(IMemento memento) throws OseeCoreException {
   boolean result = false;
   if (memento != null) {
     String dbId = memento.getString(MEMENTO_SOURCE_GUID);
     if (Strings.isValid(dbId)) {
       String currentDbId = null;
       try {
         currentDbId = OseeInfo.getDatabaseGuid();
       } catch (OseeDataStoreException ex) {
         OseeLog.log(Activator.class, Level.WARNING, "Unable to set memento source db guid");
       }
       if (dbId.equals(currentDbId)) {
         result = true;
       }
     }
   }
   return result;
 }
 public static void closeView(final String viewId, final String secondaryId) {
   if (Strings.isValid(viewId)) {
     Displays.ensureInDisplayThread(
         new Runnable() {
           @Override
           public void run() {
             IWorkbench workbench = PlatformUI.getWorkbench();
             if (workbench != null) {
               IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
               if (workbenchWindow != null) {
                 IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
                 if (workbenchPage != null) {
                   workbenchPage.hideView(workbenchPage.findViewReference(viewId, secondaryId));
                 }
               }
             }
           }
         });
   }
 }
Esempio n. 26
0
 public Map<String, JdbcServiceConfig> parse(String source) {
   Map<String, JdbcServiceConfig> toReturn = new LinkedHashMap<String, JdbcServiceConfig>();
   if (Strings.isValid(source)) {
     try {
       Set<String> allBindings = new HashSet<String>();
       JSONArray array = new JSONArray(source);
       for (int index = 0; index < array.length(); index++) {
         JSONObject object = array.getJSONObject(index);
         JdbcServiceConfig newConfig = asConfig(object);
         if (!newConfig.isEmpty()) {
           checkBinding(newConfig, allBindings);
           checkId(newConfig);
           JdbcServiceConfig oldConfig = toReturn.put(newConfig.getId(), newConfig);
           checkUnique(oldConfig, newConfig);
         }
       }
     } catch (JSONException ex) {
       throw JdbcException.newJdbcException(ex, "Error parsing jdbc config [%s]", source);
     }
   }
   return toReturn;
 }
 private Collection<TaskArtifact> filterByCompletedAndStateAndSelectedUser(
     Collection<? extends Artifact> artifacts) throws OseeCoreException {
   Set<TaskArtifact> tasks = new HashSet<TaskArtifact>();
   String selectedState = getSelectedState();
   boolean isSelectedStateValid = Strings.isValid(selectedState);
   for (Artifact art : artifacts) {
     TaskArtifact taskArt = (TaskArtifact) art;
     if (isSelectedStateValid) {
       if (!taskArt.getCurrentStateName().equals(selectedState)) {
         continue;
       }
     }
     // If not include completed and task is such, skip this task
     if (!isIncludeCompletedCheckbox() && taskArt.isCompleted()) {
       continue;
     }
     if (!isIncludeCancelledCheckbox() && taskArt.isCancelled()) {
       continue;
     }
     boolean isIncludeCompletedAndCompleted =
         isIncludeCompletedCheckbox() && taskArt.isCompleted();
     boolean isIncludeCancelledAndCancelled =
         isIncludeCancelledCheckbox() && taskArt.isCancelled();
     // If include completed and task is such and user not implementer, skip this task
     if ((isIncludeCompletedAndCompleted || isIncludeCancelledAndCancelled)
         && getSelectedUser() != null
         && taskArt.getImplementers().contains(getSelectedUser())) {
       tasks.add(taskArt);
       continue;
     }
     // If user is selected and not user is assigned, skip this task
     else if (getSelectedUser() != null
         && !taskArt.getStateMgr().getAssignees().contains(getSelectedUser())) {
       continue;
     }
     tasks.add(taskArt);
   }
   return tasks;
 }
Esempio n. 28
0
 @Override
 public Image getColumnImage(Object element, XViewerColumn xCol, int columnIndex) {
   if (element instanceof MessageCoverageItem && xCol.equals(CoverageXViewerFactory.Name)) {
     return ImageManager.getImage(FrameworkImage.X_RED);
   }
   if (element instanceof MessageCoverageItem) {
     return null;
   }
   ICoverage coverageItem = (ICoverage) element;
   if (xCol.equals(CoverageXViewerFactory.Assignees_Col)) {
     return getCoverageItemUserImage(coverageItem);
   }
   if (xCol.equals(CoverageXViewerFactory.Name)) {
     return ImageManager.getImage(coverageItem.getOseeImage());
   }
   if (xCol.equals(CoverageXViewerFactory.Work_Product_Task)) {
     if (Strings.isValid(coverageItem.getWorkProductTaskStr())) {
       return ImageManager.getImage(ServiceProvider.getOseeCmService().getImage(ImageType.Task));
     }
   }
   return null;
 }
 private IAtsVersion getSelectedVersionArtifact() throws OseeCoreException {
   if (versionCombo == null) {
     return null;
   }
   String versionStr = versionCombo.get();
   if (!Strings.isValid(versionStr)) {
     return null;
   }
   Collection<IAtsTeamDefinition> teamDefs = getSelectedTeamDefinitions();
   if (teamDefs.size() > 0) {
     IAtsTeamDefinition teamDefHoldingVersions =
         teamDefs.iterator().next().getTeamDefinitionHoldingVersions();
     if (teamDefHoldingVersions == null) {
       return null;
     }
     for (IAtsVersion versionArtifact :
         teamDefHoldingVersions.getVersions(VersionReleaseType.Both, VersionLockedType.Both)) {
       if (versionArtifact.getName().equals(versionStr)) {
         return versionArtifact;
       }
     }
   }
   return null;
 }
Esempio n. 30
0
 private boolean isPathValid(String value) {
   return Strings.isValid(value) && value.startsWith(getSupportedProtocol() + "://");
 }