use of com.archimatetool.model.IProfile in project archi by archimatetool.
the class ArchimateModelUtilsTests method hasProfileByNameAndType_Model.
@Test
public void hasProfileByNameAndType_Model() {
IArchimateModel model = IArchimateFactory.eINSTANCE.createArchimateModel();
model.setDefaults();
String name1 = "profile";
String name2 = "profile2";
String conceptType1 = IArchimatePackage.eINSTANCE.getBusinessActor().getName();
String conceptType2 = IArchimatePackage.eINSTANCE.getBusinessRole().getName();
assertFalse(ArchimateModelUtils.hasProfileByNameAndType(model, name1, conceptType1));
IProfile profile = IArchimateFactory.eINSTANCE.createProfile();
profile.setName(name1);
profile.setConceptType(conceptType1);
model.getProfiles().add(profile);
assertTrue(ArchimateModelUtils.hasProfileByNameAndType(model, name1, conceptType1));
// Check case insensitive
assertTrue(ArchimateModelUtils.hasProfileByNameAndType(model, "ProFile", conceptType1));
profile.setConceptType(conceptType2);
assertFalse(ArchimateModelUtils.hasProfileByNameAndType(model, name1, conceptType1));
// Check case insensitive
assertFalse(ArchimateModelUtils.hasProfileByNameAndType(model, "ProFile", conceptType1));
profile.setName(name2);
profile.setConceptType(conceptType1);
assertFalse(ArchimateModelUtils.hasProfileByNameAndType(model, name1, conceptType1));
}
use of com.archimatetool.model.IProfile in project archi by archimatetool.
the class ArchimateModelUtilsTests method findProfilesForConceptType.
@Test
public void findProfilesForConceptType() {
IArchimateModel model = IArchimateFactory.eINSTANCE.createArchimateModel();
model.setDefaults();
IProfile profile1 = IArchimateFactory.eINSTANCE.createProfile();
profile1.setConceptType(IArchimatePackage.eINSTANCE.getBusinessActor().getName());
model.getProfiles().add(profile1);
IProfile profile2 = IArchimateFactory.eINSTANCE.createProfile();
profile2.setConceptType(IArchimatePackage.eINSTANCE.getBusinessActor().getName());
model.getProfiles().add(profile2);
IProfile profile3 = IArchimateFactory.eINSTANCE.createProfile();
profile3.setConceptType(IArchimatePackage.eINSTANCE.getBusinessRole().getName());
model.getProfiles().add(profile3);
List<IProfile> profiles = ArchimateModelUtils.findProfilesForConceptType(model, IArchimatePackage.eINSTANCE.getBusinessActor());
assertEquals(2, profiles.size());
assertSame(profile1, profiles.get(0));
assertSame(profile2, profiles.get(1));
profiles = ArchimateModelUtils.findProfilesForConceptType(model, IArchimatePackage.eINSTANCE.getBusinessRole());
assertEquals(1, profiles.size());
assertSame(profile3, profiles.get(0));
profiles = ArchimateModelUtils.findProfilesForConceptType(model, IArchimatePackage.eINSTANCE.getBusinessEvent());
assertEquals(0, profiles.size());
}
use of com.archimatetool.model.IProfile in project archi by archimatetool.
the class ProfileTests method testGetCopy.
@Test
public void testGetCopy() {
profile.setName("name");
profile.setConceptType(IArchimatePackage.eINSTANCE.getBusinessActor().getName());
profile.setImagePath("somePath");
profile.setSpecialization(false);
profile.getFeatures().add(IArchimateFactory.eINSTANCE.createFeature());
IProfile copy = (IProfile) profile.getCopy();
assertNotSame(profile, copy);
assertNotNull(copy.getId());
assertNotEquals(profile.getId(), copy.getId());
assertEquals(profile.getName(), copy.getName());
assertEquals(profile.getConceptType(), copy.getConceptType());
assertEquals(profile.getImagePath(), copy.getImagePath());
assertEquals(profile.isSpecialization(), copy.isSpecialization());
assertNotSame(profile.getFeatures(), copy.getFeatures());
assertEquals(profile.getFeatures().size(), copy.getFeatures().size());
}
use of com.archimatetool.model.IProfile in project archi by archimatetool.
the class CSVImporter method setProfileForNewConcept.
// -------------------------------- Profile Helpers --------------------------------
/**
* Set a profile for a newly created concept
*/
private void setProfileForNewConcept(IArchimateConcept newConcept, String specializationName) {
// Do we have a matching Profile in the model?
IProfile profile = findModelProfile(specializationName, newConcept.eClass().getName());
// No, so create a new Profile and add it to the lookup list
if (profile == null) {
profile = createNewProfile(specializationName, newConcept.eClass().getName());
}
// Assign it
newConcept.getProfiles().add(profile);
}
use of com.archimatetool.model.IProfile in project archi by archimatetool.
the class CSVExporter method createElementRow.
/**
* Create a String Row for an Element
*/
String createElementRow(IArchimateElement element) {
StringBuffer sb = new StringBuffer();
// ID
String id = element.getId();
sb.append(surroundWithQuotes(id));
sb.append(fDelimiter);
// Class
sb.append(surroundWithQuotes(element.eClass().getName()));
sb.append(fDelimiter);
// Name
String name = normalise(element.getName());
sb.append(surroundWithQuotes(name));
sb.append(fDelimiter);
// Documentation
String documentation = normalise(element.getDocumentation());
sb.append(surroundWithQuotes(documentation));
sb.append(fDelimiter);
// Specialization
IProfile profile = element.getPrimaryProfile();
// $NON-NLS-1$
String specialization = normalise(profile != null ? profile.getName() : "");
sb.append(surroundWithQuotes(specialization));
return sb.toString();
}
Aggregations