Search in sources :

Example 1 with RequirementType

use of org.obeonetwork.dsl.requirement.RequirementType in project InformationSystem by ObeoNetwork.

the class RequirementRequirementPropertiesEditionComponent method updatePart.

/**
 * {@inheritDoc}
 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
 */
public void updatePart(Notification msg) {
    super.updatePart(msg);
    if (editingPart.isVisible()) {
        RequirementPropertiesEditionPart requirementPart = (RequirementPropertiesEditionPart) editingPart;
        if (RequirementPackage.eINSTANCE.getRequirement_Id().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && requirementPart != null && isAccessible(RequirementViewsRepository.Requirement_.id)) {
            if (msg.getNewValue() != null) {
                requirementPart.setId(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
            } else {
                requirementPart.setId("");
            }
        }
        if (RequirementPackage.eINSTANCE.getRequirement_Version().equals(msg.getFeature()) && requirementPart != null && isAccessible(RequirementViewsRepository.Requirement_.version)) {
            if (msg.getNewValue() != null) {
                requirementPart.setVersion((Integer) msg.getNewValue());
            } else {
                requirementPart.setVersion(null);
            }
        }
        if (RequirementPackage.eINSTANCE.getRequirement_ModifiedOn().equals(msg.getFeature()) && requirementPart != null && isAccessible(RequirementViewsRepository.Requirement_.modifiedOn)) {
            if (msg.getNewValue() != null) {
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                requirementPart.setModifiedOn(simpleDateFormat.format(msg.getNewValue()));
            } else {
                requirementPart.setModifiedOn("");
            }
            return;
        }
        if (RequirementPackage.eINSTANCE.getRequirement_CreatedOn().equals(msg.getFeature()) && requirementPart != null && isAccessible(RequirementViewsRepository.Requirement_.createdOn)) {
            if (msg.getNewValue() != null) {
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                requirementPart.setCreatedOn(simpleDateFormat.format(msg.getNewValue()));
            } else {
                requirementPart.setCreatedOn("");
            }
            return;
        }
        if (RequirementPackage.eINSTANCE.getNamedElement_Name().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && requirementPart != null && isAccessible(RequirementViewsRepository.Requirement_.name)) {
            if (msg.getNewValue() != null) {
                requirementPart.setName(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
            } else {
                requirementPart.setName("");
            }
        }
        if (RequirementPackage.eINSTANCE.getRequirement_Statement().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && requirementPart != null && isAccessible(RequirementViewsRepository.Requirement_.statement)) {
            if (msg.getNewValue() != null) {
                requirementPart.setStatement(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
            } else {
                requirementPart.setStatement("");
            }
        }
        if (RequirementPackage.eINSTANCE.getRequirement_Type().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && isAccessible(RequirementViewsRepository.Requirement_.type))
            requirementPart.setType((RequirementType) msg.getNewValue());
        if (RequirementPackage.eINSTANCE.getRequirement_Status().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && requirementPart != null && isAccessible(RequirementViewsRepository.Requirement_.status)) {
            if (msg.getNewValue() != null) {
                requirementPart.setStatus(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
            } else {
                requirementPart.setStatus("");
            }
        }
        if (RequirementPackage.eINSTANCE.getRequirement_Subtype().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && requirementPart != null && isAccessible(RequirementViewsRepository.Requirement_.subtype)) {
            if (msg.getNewValue() != null) {
                requirementPart.setSubtype(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
            } else {
                requirementPart.setSubtype("");
            }
        }
        if (RequirementPackage.eINSTANCE.getRequirement_ModifiedOn().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && requirementPart != null && isAccessible(RequirementViewsRepository.Requirement_.modifiedOn)) {
            if (msg.getNewValue() != null) {
                requirementPart.setModifiedOn(EcoreUtil.convertToString(EcorePackage.Literals.EDATE, msg.getNewValue()));
            } else {
                requirementPart.setModifiedOn("");
            }
        }
        if (RequirementPackage.eINSTANCE.getRequirement_CreatedOn().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && requirementPart != null && isAccessible(RequirementViewsRepository.Requirement_.createdOn)) {
            if (msg.getNewValue() != null) {
                requirementPart.setCreatedOn(EcoreUtil.convertToString(EcorePackage.Literals.EDATE, msg.getNewValue()));
            } else {
                requirementPart.setCreatedOn("");
            }
        }
    }
}
Also used : RequirementPropertiesEditionPart(org.obeonetwork.dsl.requirement.parts.RequirementPropertiesEditionPart) RequirementType(org.obeonetwork.dsl.requirement.RequirementType) SimpleDateFormat(java.text.SimpleDateFormat)

Example 2 with RequirementType

use of org.obeonetwork.dsl.requirement.RequirementType in project InformationSystem by ObeoNetwork.

the class RequirementSpec method setType.

@Override
public void setType(RequirementType newType) {
    RequirementType oldType = getType();
    super.setType(newType == null ? RequirementType.FUNCTIONAL : newType);
    handleRequirementModification();
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, RequirementPackage.REQUIREMENT__TYPE, oldType, newType));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) RequirementType(org.obeonetwork.dsl.requirement.RequirementType)

Aggregations

RequirementType (org.obeonetwork.dsl.requirement.RequirementType)2 SimpleDateFormat (java.text.SimpleDateFormat)1 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1 RequirementPropertiesEditionPart (org.obeonetwork.dsl.requirement.parts.RequirementPropertiesEditionPart)1