Esempio n. 1
0
  public void reinitialize() {
    if (reinitializing) return;
    reinitializing = true;
    // remove all projects quietly
    System.out.println("----------------reinitialize---------------");
    clear(false);
    ProjectFactory.getInstance()
        .setPromptDisabled(true); // prevent remove projects job from prompting to save
    GraphicManager gm = GraphicManager.getInstance();

    Container container = gm == null ? null : gm.getContainer();
    instanceFromNewSession(container, false); // reinit
    ProjectFactory.getInstance().setPromptDisabled(false); // enable prompting again
    ((DefaultFrameManager) GraphicManager.getInstance().getFrameManager()).cleanUp(true);
    doExtraReinit();
    reinitializing = false;
  }
Esempio n. 2
0
   */ public Boolean verifyOpenWritable(Long projectId) {
    if (projectId == null || projectId == 0) return null;
    if (ProjectFactory.getInstance().isResourcePoolOpenAndWritable()) {
      Alert.warn(Messages.getString("Warn.resourcePoolOpen"));
      return null;
    }

    String locker = getLockerName(projectId);
    boolean openAs = false;
    if (locker != null) {
      openAs =
          (JOptionPane.YES_OPTION
              == Alert.confirmYesNo(Messages.getStringWithParam("Warn.lockMessage", locker)));
      if (openAs == false) return null;
    }
    return !openAs;
  }
Esempio n. 3
0
  public static String getLockerName(long projectId) {
    ProjectData projectData = (ProjectData) ProjectFactory.getProjectData(projectId);
    System.out.println(
        "Locked is "
            + projectData.isLocked()
            + "  Lock info: User is "
            + Environment.getUser().getUniqueId()
            + "  locker id is "
            + projectData.getLockedById()
            + " locker is "
            + projectData.getLockedByName());

    if (projectData != null && projectData.isLocked()) {

      if (Environment.getUser().getUniqueId() != projectData.getLockedById())
        return projectData.getLockedByName();
    }
    return null;
  }
Esempio n. 4
0
  public static void clear(boolean graphic) {
    ProjectFactory.getInstance()
        .setPromptDisabled(true); // prevent remove projects job from prompting to save
    Job job =
        ProjectFactory.getInstance().getPortfolio().getRemoveAllProjectsJob(null, false, null);
    SessionFactory.getInstance().getLocalSession().schedule(job);
    try {
      job.waitResult();
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    if (graphic) {
      GraphicManager gm = GraphicManager.getInstance();
      if (gm != null) ((DefaultFrameManager) gm.getFrameManager()).cleanUp(false);
    }
    ProjectFactory.getInstance().getPortfolio().getObjectEventManager().removeAll();
    ProjectFactory.getInstance().setPromptDisabled(false); // enable prompting again

    // Singletons, most of them can cause problems when it re-used.
    // Other singletons shouldn't be problem but have a cleanUp method just in case
    SessionFactory.cleanUp();
    ProjectFactory.cleanUp();
    ResourcePoolFactory.cleanUp();
    UniqueIdPool.cleanUp();
    MainFrame.cleanUp();
    GraphicManager.cleanUpStatic();
    StartupFactory.cleanUpStatic();

    CalendarCatalog.cleanUp();
    CalendarDefinition.cleanUp();
    CalendarService.cleanUp();
    WorkingCalendar.cleanUp();

    AdvancedOption.cleanUp();
    CalculationOption.cleanUp();
    CalendarOption.cleanUp();
    EditOption.cleanUp();
    GanttOption.cleanUp();
    GeneralOption.cleanUp();
    ScheduleOption.cleanUp();
    TimesheetOption.cleanUp();

    FieldConverter.cleanUp();

    ActionLists.cleanUp();
    CellStyles.cleanUp();
    Configuration.cleanUp();
    Dictionary.cleanUp();

    Factory.cleanUp();
    ImportedCalendarService.cleanUp(); // remove dep
    NotAssignmentFilter.cleanUp();
    NotVoidFilter.cleanUp();
    HelpUtil.cleanUp();
    ZeroFunctor.cleanUp();
    NameCellComponent.cleanUp();
    ScheduleService.cleanUp();
    PageSizes.cleanUp();
    ContextStore.cleanUp();
    CustomFieldsMapper.cleanUp(); // remove dep
  }