public Collection<? extends EObject> convert( Collection<? extends EObject> eObjects, Map<String, String> options, DiagnosticChain diagnostics, Map<Object, Object> context) { packages = EcoreUtil.getObjectsByType(eObjects, UMLPackage.Literals.PACKAGE); this.options = options; this.diagnostics = diagnostics; this.context = context; for (org.eclipse.uml2.uml.Package package_ : packages) { doSwitch(package_); } if (options != null) { processOptions(options, diagnostics, context); } return getRootContainers(EcoreUtil.<EObject> getObjectsByType( elementToEModelElementMap.values(), EcorePackage.Literals.EPACKAGE)); }
public Collection<? extends EObject> convert( Collection<? extends EObject> eObjects, Map<String, String> options, DiagnosticChain diagnostics, Map<Object, Object> context) { ePackages = EcoreUtil.getObjectsByType(eObjects, EcorePackage.Literals.EPACKAGE); this.options = options; this.diagnostics = diagnostics; this.context = context; for (EPackage ePackage : ePackages) { doSwitch(ePackage); } if (options != null) { processOptions(options, diagnostics, context); } return getRootContainers(EcoreUtil .<EObject> getObjectsByType(eModelElementToElementMap.values(), UMLPackage.Literals.PACKAGE)); } }
protected static EClass getObjectById(final SecurityModel securityModel, final EClass meta, final String id) { final Collection<?> objects = EcoreUtil.getObjectsByType(securityModel.getEClassifiers(), meta); for (final Object object : objects) { if (object instanceof UamElement) { if ((((UamElement) object).getId()).equals(id)) { return (EClass) object; } } } return null; }
protected static EList<Extension> getOwnedExtensions(Profile profile, boolean requiredOnly, EList<Extension> ownedExtensions) { for (Extension extension : EcoreUtil.<Extension> getObjectsByType( profile.getPackagedElements(), UMLPackage.Literals.EXTENSION)) { if (!requiredOnly || extension.isRequired()) { ownedExtensions.add(extension); } } return ownedExtensions; }
public static Collection<EObject> getNsDataObjectVariable(Component component, Page page) { List<EObject> elements = getNsElementsInRange(component, page); return EcoreUtil.getObjectsByType(elements, PomPackage.eINSTANCE.getDataObjectVariable()); }
public static Collection<Role> getAllRoles(@Nonnull final SecurityModel securityModel) { final Collection<Role> roles = EcoreUtil.getObjectsByType(securityModel.getEClassifiers(), UamPackage.eINSTANCE.getRole()); final TreeSet<Role> set = new TreeSet<>(new RoleComparator()); set.addAll(roles); return set; }
private static Role findRole(final SecurityModel model, final String roleId) { final Collection<Role> objects = EcoreUtil.getObjectsByType(model.getEClassifiers(), UamPackage.eINSTANCE.getRole()); for (final Role object : objects) { if (object.getId() .equals(roleId)) { return object; } } return null; }
private static PObject findPObject(final SecurityModel model, final String classname) { final Collection<PObject> allPObjects = EcoreUtil.getObjectsByType(model.getEClassifiers(), UamPackage.eINSTANCE.getPObject()); for (final PObject object : allPObjects) { final String className = EcoreUtil.getAnnotation(object, UamPackage.eNS_URI, "#class_name"); //$NON-NLS-1$ if (classname.equals(className)) { return object; } } return null; }
private static PObject findCustomPObject(final SecurityModel model, final String objectName) { assert model != null && objectName != null; final Collection<PObject> allPObjects = EcoreUtil.getObjectsByType(model.getEClassifiers(), UamPackage.eINSTANCE.getPObject()); for (final PObject object : allPObjects) { if (objectName.equals(object.getName())) { return object; } } return null; }
protected static <NE extends NamedElement> Collection<NE> findNamedElements( Collection<? extends EObject> eObjects, String qualifiedName, boolean ignoreCase, EClass eClass, Collection<NE> namedElements) { int index = qualifiedName.indexOf(NamedElement.SEPARATOR); if (index == -1) { for (NE member : EcoreUtil.<NE> getObjectsByType(eObjects, eClass)) { if (ignoreCase ? qualifiedName.equalsIgnoreCase(member.getName()) : qualifiedName.equals(member.getName())) { namedElements.add(member); } } } else { String name = qualifiedName.substring(0, index); qualifiedName = qualifiedName.substring(index + NamedElement.SEPARATOR.length()); for (Namespace namespace : EcoreUtil.<Namespace> getObjectsByType( eObjects, UMLPackage.Literals.NAMESPACE)) { if (ignoreCase ? name.equalsIgnoreCase(namespace.getName()) : name.equals(namespace.getName())) { findNamedElements(namespace.getMembers(), qualifiedName, ignoreCase, eClass, namedElements); } } } return namedElements; }
/** * @generated NOT */ public DataView getDefaultDataView() { if (null == defaultView) { Collection<DataView> dataViews = EcoreUtil.getObjectsByType(eContainer().eContents(), DomPackage.eINSTANCE .getDataView()); for (Iterator<DataView> iterator = dataViews.iterator(); iterator.hasNext() && defaultView == null;) { DataView dataView = (DataView) iterator.next(); if (getDefaultDataViewName().equals(dataView.getName())) { defaultView = dataView; } } } return defaultView; }
public void removeCategory(String category, SecurityModel model) { if(category == null){ throw new IllegalArgumentException("Category must not be null"); } Collection<Permission> permissions = EcoreUtil.getObjectsByType(model.getEClassifiers(), UamPackage.eINSTANCE.getPermission()); for (Permission permission : permissions) { removeCategoryFromModelElement(category,permission); } removeCategoryFromModelElement(category,model); }
@Check(CheckType.NORMAL) public void checkIfAttributeIsUnique(final Attribute attribute) { Collection<EObject> attributes = getObjectsByType(attribute.eContainer().eContents(), DomPackage.eINSTANCE.getAttribute()); final ListMultimap<String, ? extends EObject> multiMap = Multimaps.index(attributes, NAME_RESOLVER); Collection<EObject> duplicateAttributeNames = Collections2.filter(attributes, new Predicate<EObject>() { public boolean apply(EObject input) { return input.equals(attribute) && multiMap.get(NAME_RESOLVER.apply(input)).size() > 1; } }); if (!duplicateAttributeNames.isEmpty()) { error("Duplicate attribute '" + attribute.getName() + "'", DomPackage.eINSTANCE.getPresentableFeature_Name()); } }
public Collection<Role> getAllRoles(final String modelId) throws ObjectNotFoundException { if (!modelRegistry.hasModel(modelId)) { throw new ObjectNotFoundException("Model not found", modelId); //$NON-NLS-1$ } final SecurityModel securityModel = modelRegistry.getModel(modelId); final Collection<Role> roles = EcoreUtil.getObjectsByType(securityModel.getEClassifiers(), UamPackage.eINSTANCE.getRole()); final TreeSet<Role> set = new TreeSet<>(new RoleComparator()); set.addAll(roles); return set; }
public PObject getPObjectByName(final String modelId, final String name) throws ObjectNotFoundException { if (!modelRegistry.hasModel(modelId)) { throw new ObjectNotFoundException("Model not found", modelId); //$NON-NLS-1$ } final SecurityModel securityModel = modelRegistry.getModel(modelId); final Collection<PObject> pobjects = EcoreUtil.getObjectsByType(securityModel.getEClassifiers(), UamPackage.eINSTANCE.getPObject()); for (final PObject object : pobjects) { if (object.getName().equals(name)) { return object; } } return null; }
public Role getRoleByName(final String modelId, final String name) throws ObjectNotFoundException { if (!modelRegistry.hasModel(modelId)) { throw new ObjectNotFoundException("Model not found", modelId); //$NON-NLS-1$ } final SecurityModel securityModel = modelRegistry.getModel(modelId); final Collection<Role> roles = EcoreUtil.getObjectsByType(securityModel.getEClassifiers(), UamPackage.eINSTANCE.getRole()); for (final Role role : roles) { if (role.getName().equals(name)) { return role; } } return null; }
/** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated NOT */ public Dao getRepository() { if (this.repository == null) { Collection<Dao> daos = EcoreUtil.getObjectsByType(eContainer().eContents(), DomPackage.eINSTANCE.getDao()); if (daos != null) { for (Dao dao : daos) { if (dao.getEntity() != null && dao.getEntity().equals(this)) { this.repository = dao; } } } } return this.repository; }
public Collection<PObject> getAllPObjects(final String modelId) throws ObjectNotFoundException { if (!modelRegistry.hasModel(modelId)) { throw new ObjectNotFoundException("Model not found", modelId); //$NON-NLS-1$ } final SecurityModel securityModel = modelRegistry.getModel(modelId); return EcoreUtil.getObjectsByType(securityModel.getEClassifiers(), UamPackage.eINSTANCE.getPObject()); }
public Collection<Permission> getAllPermissions(final String modelId) throws ObjectNotFoundException { if (!modelRegistry.hasModel(modelId)) { throw new ObjectNotFoundException("Model not found", modelId); //$NON-NLS-1$ } final SecurityModel securityModel = modelRegistry.getModel(modelId); return EcoreUtil.getObjectsByType(securityModel.getEClassifiers(), UamPackage.eINSTANCE.getPermission()); }
public void removeCategory(String category, Permission permission) { if(category == null){ throw new IllegalArgumentException("Category must not be null"); } removeCategoryFromModelElement(category,permission); Collection<Permission> permissions = EcoreUtil.getObjectsByType(permission.getEPackage().getEClassifiers(), UamPackage.eINSTANCE.getPermission()); boolean found = false; for (Permission perm : permissions) { if (hasCategory(category, perm)) { found = true; break; } } if (!found) { removeCategoryFromModelElement(category,permission.getEPackage()); } }