Search in sources :

Example 1 with WSRoleE

use of org.talend.mdm.repository.model.mdmserverobject.WSRoleE in project tmdm-studio-se by Talend.

the class WSRoleItemImpl method getWsRole.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public WSRoleE getWsRole() {
    if (wsRole != null && wsRole.eIsProxy()) {
        InternalEObject oldWsRole = (InternalEObject) wsRole;
        wsRole = (WSRoleE) eResolveProxy(oldWsRole);
        if (wsRole.eResource() == null && eResource() != null) {
            URI uri = EcoreUtil.getURI(wsRole);
            if (uri.hasFragment()) {
                uri = uri.trimFragment();
            }
            Resource resource = eResource().getResourceSet().getResource(uri, true);
            for (EObject object : resource.getContents()) {
                if (object instanceof WSRoleE) {
                    wsRole = (WSRoleE) object;
                    break;
                }
            }
        }
        if (wsRole != oldWsRole) {
            if (eNotificationRequired()) {
                eNotify(new ENotificationImpl(this, Notification.RESOLVE, MdmpropertiesPackage.WS_ROLE_ITEM__WS_ROLE, oldWsRole, wsRole));
            }
        }
    }
    return wsRole;
}
Also used : WSRoleE(org.talend.mdm.repository.model.mdmserverobject.WSRoleE) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) EObject(org.eclipse.emf.ecore.EObject) InternalEObject(org.eclipse.emf.ecore.InternalEObject) Resource(org.eclipse.emf.ecore.resource.Resource) URI(org.eclipse.emf.common.util.URI) InternalEObject(org.eclipse.emf.ecore.InternalEObject)

Example 2 with WSRoleE

use of org.talend.mdm.repository.model.mdmserverobject.WSRoleE in project tmdm-studio-se by Talend.

the class WSRoleItemImpl method setWsRole.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setWsRole(WSRoleE newWsRole) {
    WSRoleE oldWsRole = wsRole;
    wsRole = newWsRole;
    if (eNotificationRequired()) {
        eNotify(new ENotificationImpl(this, Notification.SET, MdmpropertiesPackage.WS_ROLE_ITEM__WS_ROLE, oldWsRole, wsRole));
    }
}
Also used : WSRoleE(org.talend.mdm.repository.model.mdmserverobject.WSRoleE) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 3 with WSRoleE

use of org.talend.mdm.repository.model.mdmserverobject.WSRoleE in project tmdm-studio-se by Talend.

the class AddBrowseItemsWizardR method modifyRolesWithAttachedBrowseItem.

@Override
protected void modifyRolesWithAttachedBrowseItem(String browseItem, List<Line> roles) {
    for (Line line : roles) {
        List<KeyValue> keyValues = line.keyValues;
        String roleName = keyValues.get(0).value;
        MDMServerObjectItem roleItem = RepositoryQueryService.findServerObjectItemByName(IServerObjectRepositoryType.TYPE_ROLE, roleName);
        if (roleItem != null) {
            CommandManager.getInstance().pushCommand(ICommand.CMD_MODIFY, roleItem.getProperty().getId(), roleItem.getMDMServerObject().getName());
        }
        if (roleItem != null) {
            IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
            if (factory.isEditableAndLockIfPossible(roleItem)) {
                WSRoleE role = ((WSRoleItem) roleItem).getWsRole();
                for (WSRoleSpecificationE spec : role.getSpecification()) {
                    if (spec.getObjectType().equals("View")) {
                        // $NON-NLS-1$
                        EList<WSRoleSpecificationInstanceE> specInstance = spec.getInstance();
                        // 
                        WSRoleSpecificationInstanceE newInstance = MdmserverobjectFactory.eINSTANCE.createWSRoleSpecificationInstanceE();
                        newInstance.setInstanceName(browseItem);
                        // $NON-NLS-1$
                        newInstance.setWritable(keyValues.get(1).value.equals("Read Only") ? false : true);
                        // 
                        specInstance.add(newInstance);
                        // 
                        break;
                    }
                }
                RepositoryResourceUtil.saveItem(roleItem);
            }
            try {
                factory.unlock(roleItem);
            } catch (PersistenceException e) {
                log.error(e.getMessage(), e);
            } catch (LoginException e) {
                log.error(e.getMessage(), e);
            }
        }
    }
}
Also used : KeyValue(com.amalto.workbench.models.KeyValue) WSRoleE(org.talend.mdm.repository.model.mdmserverobject.WSRoleE) WSRoleSpecificationInstanceE(org.talend.mdm.repository.model.mdmserverobject.WSRoleSpecificationInstanceE) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) WSRoleSpecificationE(org.talend.mdm.repository.model.mdmserverobject.WSRoleSpecificationE) Line(com.amalto.workbench.models.Line) WSRoleItem(org.talend.mdm.repository.model.mdmproperties.WSRoleItem) PersistenceException(org.talend.commons.exception.PersistenceException) LoginException(org.talend.commons.exception.LoginException) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Aggregations

WSRoleE (org.talend.mdm.repository.model.mdmserverobject.WSRoleE)3 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)2 KeyValue (com.amalto.workbench.models.KeyValue)1 Line (com.amalto.workbench.models.Line)1 URI (org.eclipse.emf.common.util.URI)1 EObject (org.eclipse.emf.ecore.EObject)1 InternalEObject (org.eclipse.emf.ecore.InternalEObject)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 LoginException (org.talend.commons.exception.LoginException)1 PersistenceException (org.talend.commons.exception.PersistenceException)1 MDMServerObjectItem (org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem)1 WSRoleItem (org.talend.mdm.repository.model.mdmproperties.WSRoleItem)1 WSRoleSpecificationE (org.talend.mdm.repository.model.mdmserverobject.WSRoleSpecificationE)1 WSRoleSpecificationInstanceE (org.talend.mdm.repository.model.mdmserverobject.WSRoleSpecificationInstanceE)1 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)1