Search in sources :

Example 21 with TinyCGIException

use of net.sourceforge.processdash.net.http.TinyCGIException in project processdash by dtuma.

the class EVReport method getEVModel.

private void getEVModel() throws TinyCGIException {
    taskListName = settings.getTaskListName();
    if (taskListName == null)
        throw new TinyCGIException(400, "schedule name missing");
    else if (FAKE_MODEL_NAME.equals(taskListName)) {
        evModel = null;
        return;
    }
    long now = System.currentTimeMillis();
    synchronized (EVReport.class) {
        if (drawingChart && (now - lastRecalcTime < MAX_DELAY) && taskListName.equals(lastTaskListName)) {
            evModel = lastEVModel.get();
            if (evModel != null)
                return;
        }
    }
    evModel = EVTaskList.openExisting(taskListName, getDataRepository(), getPSPProperties(), getObjectCache(), // change notification not required
    false);
    if (evModel == null)
        throw new TinyCGIException(404, "Not Found", "No such task/schedule");
    UserFilter f = settings.getUserGroupFilter();
    if (f != null && !UserGroup.isEveryone(f) && evModel instanceof EVTaskListRollup) {
        EVTaskListRollup rollup = (EVTaskListRollup) evModel;
        rollup.applyTaskListFilter(new EVTaskListGroupFilter(f));
        String permID = (parameters.containsKey(CHARTS_PARAM) ? EVPermissions.PERSONAL_CHARTS : EVPermissions.PERSONAL_REPORT);
        settings.checkPersonalDataPermission(rollup, permID);
    }
    EVDependencyCalculator depCalc = new EVDependencyCalculator(getDataRepository(), getPSPProperties(), getObjectCache());
    evModel.setDependencyCalculator(depCalc);
    evModel.setTaskLabeler(new DefaultTaskLabeler(getDashboardContext()));
    if (settings.getBool(CUSTOMIZE_HIDE_BASELINE))
        evModel.disableBaselineData();
    evModel.recalc();
    synchronized (EVReport.class) {
        lastTaskListName = taskListName;
        lastRecalcTime = now;
        lastEVModel = new WeakReference<EVTaskList>(evModel);
    }
}
Also used : EVTaskListGroupFilter(net.sourceforge.processdash.ev.EVTaskListGroupFilter) EVDependencyCalculator(net.sourceforge.processdash.ev.EVDependencyCalculator) EVTaskListRollup(net.sourceforge.processdash.ev.EVTaskListRollup) UserFilter(net.sourceforge.processdash.team.group.UserFilter) EVTaskList(net.sourceforge.processdash.ev.EVTaskList) DefaultTaskLabeler(net.sourceforge.processdash.ev.DefaultTaskLabeler) TinyCGIException(net.sourceforge.processdash.net.http.TinyCGIException)

Example 22 with TinyCGIException

use of net.sourceforge.processdash.net.http.TinyCGIException in project processdash by dtuma.

the class RestoreIndivDataWorker method checkPreconditions.

private void checkPreconditions() throws IOException {
    String hierProjectID = getStrData(projectPrefix, PROJECT_ID);
    String importProjectID = getStrData(importedProjectRoot, PROJECT_ID);
    if (!hierProjectID.equals(importProjectID))
        throw new TinyCGIException(400, "Project IDs do not match");
}
Also used : TinyCGIException(net.sourceforge.processdash.net.http.TinyCGIException)

Aggregations

TinyCGIException (net.sourceforge.processdash.net.http.TinyCGIException)22 IOException (java.io.IOException)3 InputStream (java.io.InputStream)3 Date (java.util.Date)3 EVTaskList (net.sourceforge.processdash.ev.EVTaskList)3 DashHierarchy (net.sourceforge.processdash.hier.DashHierarchy)3 PropertyKey (net.sourceforge.processdash.hier.PropertyKey)3 Map (java.util.Map)2 DefaultTaskLabeler (net.sourceforge.processdash.ev.DefaultTaskLabeler)2 EVDependencyCalculator (net.sourceforge.processdash.ev.EVDependencyCalculator)2 EVTaskListGroupFilter (net.sourceforge.processdash.ev.EVTaskListGroupFilter)2 EVTaskListRollup (net.sourceforge.processdash.ev.EVTaskListRollup)2 UserFilter (net.sourceforge.processdash.team.group.UserFilter)2 BufferedInputStream (java.io.BufferedInputStream)1 File (java.io.File)1 OutputStream (java.io.OutputStream)1 HttpURLConnection (java.net.HttpURLConnection)1 MalformedURLException (java.net.MalformedURLException)1 URLConnection (java.net.URLConnection)1 ArrayList (java.util.ArrayList)1