CPD Results

The following document contains the results of PMD's CPD 5.0.5.

Duplications

File Line
org\andromda\metafacades\uml14\AttributeFacadeLogic.java 1026
org\andromda\metafacades\uml14\ParameterFacadeLogic.java 918
                + this.THIS().toString() + ": " + th.getMessage(), th);
        }
        try
        {
            final Object contextElement = this.THIS();
            boolean constraintValid = OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(Boolean.valueOf(String.valueOf(OCLIntrospector.invoke(contextElement,"type.wrappedPrimitive"))).booleanValue()&&OCLExpressions.equal(OCLIntrospector.invoke(contextElement,"many"),false))).booleanValue()?(OCLExpressions.equal(OCLIntrospector.invoke(contextElement,"lower"),0)):true));
            if (!constraintValid)
            {
                validationMessages.add(
                    new ModelValidationMessage(
                        (MetafacadeBase)contextElement ,
File Line
org\andromda\metafacades\uml14\ModelElementFacadeLogic.java 1421
org\andromda\metafacades\uml14\ModelFacadeLogic.java 579
org\andromda\metafacades\uml14\TemplateArgumentFacadeLogic.java 115
    protected abstract Object handleGetStateMachineContext();

    /**
     * @param validationMessages Collection<ModelValidationMessage>
     * @see MetafacadeBase#validateInvariants(Collection validationMessages)
     */
    @Override
    public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
    {
    }

    /**
     * The property that stores the name of the metafacade.
     */
    private static final String NAME_PROPERTY = "name";
    private static final String FQNAME_PROPERTY = "fullyQualifiedName";

    /**
     * @see Object#toString()
     */
    @Override
    public String toString()
    {
        final StringBuilder toString = new StringBuilder(this.getClass().getName());
        toString.append("[");
        try
        {
            toString.append(Introspector.instance().getProperty(this, FQNAME_PROPERTY));
        }
        catch (final Throwable tryAgain)
        {
            try
            {
                toString.append(Introspector.instance().getProperty(this, NAME_PROPERTY));
            }
            catch (final Throwable ignore)
            {
                // - just ignore when the metafacade doesn't have a name or fullyQualifiedName property
            }
        }
        toString.append("]");
        return toString.toString();
    }
}
File Line
org\andromda\metafacades\uml14\AttributeFacadeLogic.java 91
org\andromda\metafacades\uml14\DependencyFacadeLogic.java 79
    public boolean isAttributeFacadeMetaType()
    {
        return true;
    }

    // --------------- attributes ---------------------

   /**
    * @see AttributeFacade#getGetterName()
    * @return String
    */
    protected abstract String handleGetGetterName();

    private String __getterName1a;
    private boolean __getterName1aSet = false;

    /**
     * The name of the accessor operation that would retrieve this attribute's value.
     * @return (String)handleGetGetterName()
     */
    public final String getGetterName()
    {
        String getterName1a = this.__getterName1a;
        if (!this.__getterName1aSet)
        {
            // getterName has no pre constraints
            getterName1a = handleGetGetterName();
            // getterName has no post constraints
            this.__getterName1a = getterName1a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__getterName1aSet = true;
            }
        }
        return getterName1a;
    }

   /**
    * @see AttributeFacade#getSetterName()
    * @return String
    */
    protected abstract String handleGetSetterName();

    private String __setterName2a;
    private boolean __setterName2aSet = false;

    /**
     * The name of the mutator operation that would retrieve this attribute's value.
     * @return (String)handleGetSetterName()
     */
    public final String getSetterName()
    {
        String setterName2a = this.__setterName2a;
        if (!this.__setterName2aSet)
        {
            // setterName has no pre constraints
            setterName2a = handleGetSetterName();
            // setterName has no post constraints
            this.__setterName2a = setterName2a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__setterName2aSet = true;
            }
        }
        return setterName2a;
    }
File Line
org\andromda\metafacades\uml14\AssociationClassFacadeLogic.java 1425
org\andromda\metafacades\uml14\ModelElementFacadeLogic.java 1430
org\andromda\metafacades\uml14\ModelFacadeLogic.java 588
org\andromda\metafacades\uml14\TemplateArgumentFacadeLogic.java 124
org\andromda\metafacades\uml14\TemplateParameterFacadeLogic.java 458
    }

    /**
     * The property that stores the name of the metafacade.
     */
    private static final String NAME_PROPERTY = "name";
    private static final String FQNAME_PROPERTY = "fullyQualifiedName";

    /**
     * @see Object#toString()
     */
    @Override
    public String toString()
    {
        final StringBuilder toString = new StringBuilder(this.getClass().getName());
        toString.append("[");
        try
        {
            toString.append(Introspector.instance().getProperty(this, FQNAME_PROPERTY));
        }
        catch (final Throwable tryAgain)
        {
            try
            {
                toString.append(Introspector.instance().getProperty(this, NAME_PROPERTY));
            }
            catch (final Throwable ignore)
            {
                // - just ignore when the metafacade doesn't have a name or fullyQualifiedName property
            }
        }
        toString.append("]");
        return toString.toString();
    }
}
File Line
org\andromda\metafacades\uml14\AssociationEndFacadeLogicImpl.java 174
org\andromda\metafacades\uml14\AttributeFacadeLogicImpl.java 189
    protected boolean handleIsMany()
    {
        boolean isMany = false;
        final Multiplicity multiplicity = this.metaObject.getMultiplicity();

        // we'll say a null multiplicity is 1
        if (multiplicity != null)
        {
            final Collection<MultiplicityRange> ranges = multiplicity.getRange();
            if (ranges != null && !ranges.isEmpty())
            {
                for (MultiplicityRange multiplicityRange : ranges)
                {
                    final int upper = multiplicityRange.getUpper();
                    isMany = upper > 1 || upper < 0;
                }
            }
        }
        if (null!=this.getType() && !isMany)
        {
            // isCollectionType causes too many problems with the metafacades
            isMany = this.getType().isArrayType();
        }
        return isMany;
    }
File Line
org\andromda\metafacades\uml14\ClassifierFacadeLogicImpl.java 591
org\andromda\metafacades\uml14\ClassifierFacadeLogicImpl.java 1013
            for (ClassifierFacade superClass = (ClassifierFacade)getGeneralization(); superClass != null && follow;
                 superClass = (ClassifierFacade)superClass.getGeneralization())
            {
                for (final AssociationEndFacade superAssociationEnd : superClass.getNavigableConnectingEnds())
                {
                    boolean present = false;
                    for (final Iterator<AssociationEndFacade> endIterator = this.getAssociationEnds().iterator(); endIterator.hasNext();)
                    {
                        final AssociationEndFacade associationEnd = endIterator.next();
                        if (associationEnd.getName().equals(superAssociationEnd.getName()))
                        {
                            present = true;
                            break;
                        }
                    }
                    if (!present)
                    {
File Line
org\andromda\metafacades\uml14\AssociationEndFacadeLogicImpl.java 344
org\andromda\metafacades\uml14\AttributeFacadeLogicImpl.java 493
                    this.isOrdered() ? mappings.getTo(UMLProfile.LIST_TYPE_NAME)
                                     : mappings.getTo(UMLProfile.COLLECTION_TYPE_NAME);
            }

            // set this association end's type as a template parameter if required
            if (BooleanUtils.toBoolean(
                    ObjectUtils.toString(this.getConfiguredProperty(UMLMetafacadeProperties.ENABLE_TEMPLATING)))
                    && this.getType() != null)
            {
                String type = this.getType().getFullyQualifiedName();
                /*Collection<GeneralizableElementFacade> specializations = this.getType().getAllSpecializations();
                if ((specializations != null && !specializations.isEmpty()))
                {
                    name += "<? extends " + type + '>';
                }
                else
                {*/
                    name += '<' + type + '>';
                //}
            }
        }
        if (name == null && this.getType() != null)
        {
            name = this.getType().getFullyQualifiedName();
        }
        return name;
    }

    /**
     * @see org.andromda.metafacades.uml.AssociationEndFacade#isRequired()
     */
    @Override
    protected boolean handleIsRequired()
File Line
org\andromda\metafacades\uml14\AttributeFacadeLogicImpl.java 82
org\andromda\metafacades\uml14\ParameterFacadeLogicImpl.java 121
        if (StringUtils.isNotBlank(defaultValue) && !this.isMany() && this.metaObject.getType() != null && defaultValue != null)
        {
            String typeName = this.metaObject.getType().getName();
            if ("String".equals(typeName) && defaultValue.indexOf('"')<0)
            {
                defaultValue = '"' + defaultValue + '"';
            }
            else if (("char".equals(typeName) || "Character".equals(typeName))
                && defaultValue.indexOf('\'')<0)
            {
                defaultValue = "'" + defaultValue.charAt(0) + '\'';
            }
        }
        if (defaultValue==null) defaultValue="";
        return defaultValue;
    }

    /**
     * @see org.andromda.metafacades.uml.AttributeFacade#isChangeable()
     */
    @Override
    public boolean handleIsChangeable()
File Line
org\andromda\metafacades\uml14\EntityLogic.java 1237
org\andromda\metafacades\uml14\ServiceLogic.java 361
                + this.THIS().toString() + ": " + th.getMessage(), th);
        }
        try
        {
            final Object contextElement = this.THIS();
            boolean constraintValid = OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(OCLCollections.notEmpty(OCLIntrospector.invoke(contextElement,"specializations")))).booleanValue()?OCLCollections.forAll(OCLIntrospector.invoke(contextElement,"specializations"),new Predicate(){public boolean evaluate(Object object){return Boolean.valueOf(String.valueOf(object instanceof Entity)).booleanValue();}}):true));
File Line
org\andromda\metafacades\uml14\AttributeFacadeLogic.java 976
org\andromda\metafacades\uml14\ParameterFacadeLogic.java 893
                + this.THIS().toString() + ": " + th.getMessage(), th);
        }
        try
        {
            final Object contextElement = this.THIS();
            boolean constraintValid = OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(OCLIntrospector.invoke(contextElement,"type.primitive"))).booleanValue()?(OCLExpressions.greater(OCLIntrospector.invoke(contextElement,"lower"),0)):true));
            if (!constraintValid)
            {
                validationMessages.add(
                    new ModelValidationMessage(
                        (MetafacadeBase)contextElement ,
File Line
org\andromda\metafacades\uml14\AttributeFacadeLogic.java 1001
org\andromda\metafacades\uml14\ParameterFacadeLogic.java 868
                + this.THIS().toString() + ": " + th.getMessage(), th);
        }
        try
        {
            final Object contextElement = this.THIS();
            boolean constraintValid = OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(OCLIntrospector.invoke(contextElement,"type.primitive"))).booleanValue()?(OCLExpressions.equal(OCLIntrospector.invoke(contextElement,"many"),false)):true));
            if (!constraintValid)
            {
                validationMessages.add(
                    new ModelValidationMessage(
                        (MetafacadeBase)contextElement ,