com.marvelution.jira.plugins.sonar.service.SonarPanelLayoutManager Maven / Gradle / Ivy
/*
* Licensed to Marvelution under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Marvelution licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.marvelution.jira.plugins.sonar.service;
import java.util.Collection;
import java.util.Map;
/**
* Sonar panel layout manager interface
*
* @author Mark Rekveld
*/
public interface SonarPanelLayoutManager {
/**
* Check if the layout is configured with a column that has the given Id
*
* @param columnId the column Id to check
* @return true
if the layout has a column with the given Id, false
otherwise.
*/
boolean hasColumn(int columnId);
/**
* Get all the Gadget Ids that are configured for the given column Id.
*
* The gadget Id is the text between sonar- and -gadget.xml. eq: sonar-comments-gadget.xml -> ID: comments.
*
* @param columnId the column Id to get the gadgets for
* @return {@link Collection} of Gadget Ids, may be null
*/
Collection getColumn(int columnId);
/**
* Get all the column Ids configured in the layout
*
* @return {@link Collection} with all the column Ids
*/
Collection getColumnIds();
/**
* Get the number of columns configured in the layout
*
* @return number of configured columns
*/
int getNumberOfColumn();
/**
* Get the complete configured layout with all the columns and the gadgets configured per column
*
* @return {@link Map} with columnId as key and {@link Collection} of Gadget Ids as value
*/
Map> getLayout();
/**
* Store a complete column configuration of the layout
*
* @param columnId the column Id, may be smaller then 1 (one) for a new column
* @param gadgetIds {@link Collection} of gadgetIds that are configured for column, may be empty
but
* not null
*/
void put(int columnId, Collection gadgetIds);
/**
* Store an extra gadget in the configuration for a column
*
* @param columnId the column Id, may not be smaller then 1 (one)
* @param gadgetId the gadget Id to add to the column configuration store, may not be empty
or
* null
*/
void put(int columnId, String gadgetId);
/**
* Remove the given gadgetId {@link Collection} from the column configuration
*
* @param columnId the column Id to remove the gadget from
* @param gadgetIds the gadget Id {@link Collection} to remove
*/
void remove(int columnId, Collection gadgetIds);
/**
* Remove the given gadgetId from the column configuration
*
* @param columnId the column Id to remove the gadget from
* @param gadgetId the gadgetId to remove
*/
void remove(int columnId, String gadgetId);
/**
* Remove the column with the given columnId from configuration store
*
* @param columnId the columnId to remove
*/
void remove(int columnId);
}