Package archmapper.stylespecific.spring.rules

Source Code of archmapper.stylespecific.spring.rules.DatabaseAccessOnlyFromDAOComponentsRule

package archmapper.stylespecific.spring.rules;

import org.eclipse.tptp.platform.analysis.core.history.AnalysisHistory;

import archmapper.main.conformance.rules.AbstractRuleWithoutSourceCheck;
import archmapper.main.model.architecture.Component;
import archmapper.main.model.architecture.Role.RoleDirection;
import static archmapper.stylespecific.spring.SpringStyleTypeConstants.*;

public class DatabaseAccessOnlyFromDAOComponentsRule extends
    AbstractRuleWithoutSourceCheck {

  @Override
  public void analyzeWithoutSource(AnalysisHistory history) {
    Component databaseComp = arch.getComponentByName(DATABASE_COMPONENT_NAME);
    if (databaseComp != null) {
      for (Component connectedComp : databaseComp.getConnectedComponents(RoleDirection.in)) {
        if (!DAO_COMPONENT_TYPE.equals(connectedComp.getStyleType())) {
          String typeString = "";
          if (connectedComp.getStyleType() != null) {
            typeString = " of type "+ connectedComp.getStyleType();
          }
         
          generateResultsWithoutSource(history, "The database component "+
              "has an incoming connection from the component "+
              connectedComp.getName() + typeString,
              arch.getAdlFile());
        }
      }
    }
  }

}
TOP

Related Classes of archmapper.stylespecific.spring.rules.DatabaseAccessOnlyFromDAOComponentsRule

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.