@Before
 public void setup() throws Exception {
   artifact =
       ArtifactTypeManager.addArtifact(
           CoreArtifactTypes.GeneralDocument,
           DemoBranches.SAW_Bld_1,
           method.getQualifiedTestName());
   artifact.setAttributeValues(CoreAttributeTypes.StaticId, START_VALUE);
 }
예제 #2
0
 /** Creates a simple artifact and adds it to the root artifact default hierarchical relation */
 public static Artifact createSimpleArtifact(
     IArtifactType artifactType, String name, IOseeBranch branch) throws OseeCoreException {
   Artifact softArt = ArtifactTypeManager.addArtifact(artifactType, branch);
   softArt.setName(name);
   softArt.addAttribute(CoreAttributeTypes.Subsystem, "Electrical");
   Artifact rootArtifact = OseeSystemArtifacts.getDefaultHierarchyRootArtifact(branch);
   rootArtifact.addRelation(CoreRelationTypes.Default_Hierarchical__Child, softArt);
   return softArt;
 }
  /** Create the TableViewer */
  private void okSelected() {
    ArrayList<ArtifactModel> artifactList =
        relationTableViewer.getArtifactList().getArtifactModel();

    for (int i = 0; i < artifactList.size(); i++) {
      ArtifactModel model = artifactList.get(i);

      if (model.isAdd()) {
        Artifact artifact = model.getArtifact();
        descriptor = model.getDescriptor();
        if (artifact == null) {
          if (descriptor != null) {
            try {
              artifact = ArtifactTypeManager.addArtifact(descriptor, branch);
              artifact.setName(model.getName());
              artifact.setSoleAttributeValue(
                  CoreAttributeTypes.ContentUrl, urls.get(names.indexOf(model.getName())));
              artifact.persist(getClass().getSimpleName());
            } catch (Exception ex) {
              OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
            }
          }
        } else {
          artifact = model.getArtifact();
        }

        if (artifact != null) {
          try {
            relationGroup.getArtifact().addRelation(relationGroup, artifact);
          } catch (OseeCoreException ex) {
            OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
          }
        }
      }
    }
    if (persistOnOk) {
      try {
        relationGroup.getArtifact().persist(getClass().getSimpleName());
      } catch (OseeCoreException ex) {
        OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
      }
    }
    shell.dispose();
    viewer.refresh();
  }
 protected Artifact getArtifactOrCreate(
     AtsArtifactConfigCache cache,
     IArtifactType artifactType,
     IAtsConfigObject atsObject,
     SkynetTransaction transaction)
     throws OseeCoreException {
   Artifact artifact = cache.getArtifact(atsObject);
   if (artifact == null) {
     artifact =
         ArtifactTypeManager.addArtifact(
             artifactType,
             AtsUtilCore.getAtsBranchToken(),
             atsObject.getName(),
             atsObject.getGuid(),
             atsObject.getHumanReadableId());
     artifact.persist(transaction);
   }
   return artifact;
 }