EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.pcm.dialogs.datatype]

COVERAGE SUMMARY FOR SOURCE FILE [DataTypeCommand.java]

nameclass, %method, %block, %line, %
DataTypeCommand.java0%   (0/3)0%   (0/7)0%   (0/169)0%   (0/41)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DataTypeCommand0%   (0/1)0%   (0/3)0%   (0/45)0%   (0/11)
DataTypeCommand (TransactionalEditingDomain): void 0%   (0/1)0%   (0/6)0%   (0/3)
createCollectionDataType (Repository, DataType, DataType, String): void 0%   (0/1)0%   (0/20)0%   (0/4)
createCompositeDataType (Repository, CompositeDataType, String): void 0%   (0/1)0%   (0/19)0%   (0/4)
     
class DataTypeCommand$10%   (0/1)0%   (0/2)0%   (0/81)0%   (0/23)
DataTypeCommand$1 (DataTypeCommand, TransactionalEditingDomain, DataType, Str... 0%   (0/1)0%   (0/19)0%   (0/2)
doExecute (): void 0%   (0/1)0%   (0/62)0%   (0/21)
     
class DataTypeCommand$20%   (0/1)0%   (0/2)0%   (0/43)0%   (0/10)
DataTypeCommand$2 (DataTypeCommand, TransactionalEditingDomain, CompositeData... 0%   (0/1)0%   (0/16)0%   (0/2)
doExecute (): void 0%   (0/1)0%   (0/27)0%   (0/8)

1package de.uka.ipd.sdq.pcm.dialogs.datatype;
2 
3import org.eclipse.core.runtime.Assert;
4import org.eclipse.emf.transaction.RecordingCommand;
5import org.eclipse.emf.transaction.TransactionalEditingDomain;
6 
7import de.uka.ipd.sdq.pcm.repository.CollectionDataType;
8import de.uka.ipd.sdq.pcm.repository.CompositeDataType;
9import de.uka.ipd.sdq.pcm.repository.DataType;
10import de.uka.ipd.sdq.pcm.repository.Repository;
11import de.uka.ipd.sdq.pcm.repository.RepositoryFactory;
12 
13/**
14 * The class place the methods for the production of new DataType.
15 * 
16 * @author Roman Andrej
17 */
18public class DataTypeCommand {
19        
20        /** The transactional editing domain which is used to get the commands */
21        private TransactionalEditingDomain editingDomain;
22        
23        public DataTypeCommand(TransactionalEditingDomain editingDomain) {
24                this.editingDomain = editingDomain;
25        }
26 
27        /* (non-Javadoc)
28         * @see de.uka.ipd.sdq.pcmbench.tabs.dialogs.CreateDataTypeDialog#createCollectionDataType()
29         */
30        public void createCollectionDataType(final Repository repository,
31                        final DataType dataType, final DataType innerDataType,
32                        final String entityName) {
33 
34                RecordingCommand recCommand = new RecordingCommand(editingDomain) {
35                        @Override
36                        protected void doExecute() {
37                                CollectionDataType collectionDataType;
38 
39                                if (dataType != null) {
40                                        // Edite existet DataType
41                                        collectionDataType = (CollectionDataType) dataType;
42                                        String typeName = collectionDataType.getEntityName();
43                                        DataType innerType = collectionDataType
44                                                        .getInnerType_CollectionDataType();
45 
46                                        if ((entityName != null) && (!typeName.equals(entityName)))
47                                                collectionDataType.setEntityName(entityName);
48 
49                                        if ((innerDataType != null)
50                                                        && (!innerType.equals(innerDataType)))
51                                                collectionDataType
52                                                                .setInnerType_CollectionDataType(innerDataType);
53                                } else {
54                                        // Create new DataType
55                                        collectionDataType = RepositoryFactory.eINSTANCE
56                                                        .createCollectionDataType();
57                                        collectionDataType.setRepository__DataType(repository);
58 
59                                        Assert.isNotNull(collectionDataType);
60                                        Assert.isNotNull(innerDataType);
61                                        Assert.isNotNull(entityName);
62 
63                                        collectionDataType.setEntityName(entityName);
64                                        collectionDataType
65                                                        .setInnerType_CollectionDataType(innerDataType);
66                                }
67                        }
68                };
69                recCommand.setDescription("Add new/Edite CollectionDataType");
70                editingDomain.getCommandStack().execute(recCommand);
71        }
72 
73        /* (non-Javadoc)
74         * @see de.uka.ipd.sdq.pcmbench.tabs.dialogs.CreateDataTypeDialog#createCompositeDataType()
75         */
76        public void createCompositeDataType(final Repository repository,
77                        final CompositeDataType compositeDataType, final String entityName) {
78 
79                RecordingCommand recCommand = new RecordingCommand(editingDomain) {
80                        @Override
81                        protected void doExecute() {
82                                Assert.isNotNull(compositeDataType);
83 
84                                if ((entityName != null)
85                                                && (!compositeDataType.getEntityName().equals(
86                                                                entityName)))
87                                        compositeDataType.setEntityName(entityName);
88 
89                                if (repository != null)
90                                        compositeDataType.setRepository__DataType(repository);
91                        }
92                };
93 
94                recCommand.setDescription("Add new CompositeDataType");
95                editingDomain.getCommandStack().execute(recCommand);
96        }
97}

[all classes][de.uka.ipd.sdq.pcm.dialogs.datatype]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov