示例#1
0
 @Override
 public RulesProfile createProfile(ValidationMessages validation) {
   return xmlProfileParser.parseResource(
       getClass().getClassLoader(),
       "org/sonar/plugins/php/profile/drupal-profile.xml",
       validation);
 }
 /**
  * @see
  *     org.sonar.api.profiles.ProfileDefinition#createProfile(org.sonar.api.utils.ValidationMessages)
  */
 @Override
 public RulesProfile createProfile(ValidationMessages messages) {
   return parser.parseResource(
       getClass().getClassLoader(),
       "org/sonar/plugins/php/profiles/all-phpmd-profile.xml",
       messages);
 }
示例#3
0
 public ValidationMessages restoreProfile(String xmlBackup) {
   ValidationMessages messages = ValidationMessages.create();
   RulesProfile profile = xmlProfileParser.parse(new StringReader(xmlBackup), messages);
   if (profile != null) {
     DatabaseSession session = sessionFactory.getSession();
     RulesProfile existingProfile =
         session.getSingleResult(
             RulesProfile.class, "name", profile.getName(), "language", profile.getLanguage());
     if (existingProfile != null) {
       messages.addErrorText(
           "The profile " + profile + " already exists. Please delete it before restoring.");
     } else if (!messages.hasErrors()) {
       session.saveWithoutFlush(profile);
       session.commit();
     }
   }
   return messages;
 }