Example usage for java.util TreeSet first

List of usage examples for java.util TreeSet first

Introduction

In this page you can find the example usage for java.util TreeSet first.

Prototype

public E first() 

Source Link

Usage

From source file:org.zaproxy.zap.extension.accessControl.ExtensionAccessControl.java

private Document generateLastScanXMLReport(int contextId) throws ParserConfigurationException {
    // Prepare the document and the root element
    DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
    Document doc = docBuilder.newDocument();

    Element rootElement = doc.createElement("report");
    doc.appendChild(rootElement);/*from  w ww .  j a  va 2s.c  om*/

    // Localization
    Element localizationElement = doc.createElement("localization");
    rootElement.appendChild(localizationElement);
    ReportGenerator.addChildTextNode(doc, localizationElement, "title",
            Constant.messages.getString("accessControl.report.title"));
    ReportGenerator.addChildTextNode(doc, localizationElement, "url",
            Constant.messages.getString("accessControl.report.table.header.url"));
    ReportGenerator.addChildTextNode(doc, localizationElement, "method",
            Constant.messages.getString("accessControl.report.table.header.method"));
    ReportGenerator.addChildTextNode(doc, localizationElement, "authorization",
            Constant.messages.getString("accessControl.report.table.header.authorization"));
    ReportGenerator.addChildTextNode(doc, localizationElement, "access-control",
            Constant.messages.getString("accessControl.report.table.header.accessControl"));
    ReportGenerator.addChildTextNode(doc, localizationElement, "show-all",
            Constant.messages.getString("accessControl.report.button.all"));
    ReportGenerator.addChildTextNode(doc, localizationElement, "show-valid",
            Constant.messages.getString("accessControl.report.button.valid"));
    ReportGenerator.addChildTextNode(doc, localizationElement, "show-illegal",
            Constant.messages.getString("accessControl.report.button.illegal"));
    final String UNAUTHENICATED_USER_NAME = Constant.messages
            .getString("accessControl.scanOptions.unauthenticatedUser");
    final String AUTHORIZED_STRING = Constant.messages.getString("accessControl.report.table.field.authorized");
    final String UNAUTHORIZED_STRING = Constant.messages
            .getString("accessControl.report.table.field.unauthorized");

    AccessControlScannerThread scanThread = threadManager.getScannerThread(contextId);
    List<AccessControlResultEntry> scanResults = scanThread.getLastScanResults();

    // If there are no scan results (i.e. hasn't run yet, return the document as is at this
    // point
    if (scanResults == null) {
        return doc;
    }

    // Create a sorted list of users based on id (null/unauthenticated user first)
    List<User> users = new ArrayList<>(scanThread.getStartOptions().targetUsers);
    Collections.sort(users, new Comparator<User>() {
        @Override
        public int compare(User o1, User o2) {
            if (o1 == o2) {
                return 0;
            }
            if (o1 == null) {
                return -1;
            }
            if (o2 == null) {
                return 1;
            }
            return o1.getId() - o2.getId();
        }
    });
    // ... and add the list of users in the report
    Element usersElement = doc.createElement("users");
    rootElement.appendChild(usersElement);
    for (User user : users) {
        Element userElement = doc.createElement("user");
        usersElement.appendChild(userElement);
        userElement.setAttribute("name", user == null ? UNAUTHENICATED_USER_NAME : user.getName());
        userElement.setAttribute("id", Integer.toString(user == null ? -1 : user.getId()));
    }

    // Prepare a comparator that keeps scan results in order based on the user id
    Comparator<AccessControlResultEntry> resultsComparator = new Comparator<AccessControlScannerThread.AccessControlResultEntry>() {
        @Override
        public int compare(AccessControlResultEntry o1, AccessControlResultEntry o2) {
            if (o1.getUser() == o2.getUser()) {
                return 0;
            }
            if (o1.getUser() == null) {
                return -1;
            }
            if (o2.getUser() == null) {
                return 1;
            }
            return o1.getUser().getId() - o2.getUser().getId();
        }
    };
    Map<String, TreeSet<AccessControlResultEntry>> uriResults = new HashMap<>(scanResults.size());
    TreeSet<AccessControlResultEntry> uriResultsSet;
    for (AccessControlResultEntry result : scanResults) {
        uriResultsSet = uriResults.get(result.getUri());
        if (uriResultsSet == null) {
            uriResultsSet = new TreeSet<>(resultsComparator);
            uriResults.put(result.getUri(), uriResultsSet);
        }
        uriResultsSet.add(result);
    }

    // Actually add the results nodes
    Element resultsElement = doc.createElement("results");
    rootElement.appendChild(resultsElement);
    for (TreeSet<AccessControlResultEntry> uriResultSet : uriResults.values()) {
        // For each result node...
        Element uriElement = doc.createElement("result");
        resultsElement.appendChild(uriElement);
        // ... add the URI and the HTTP method ...
        AccessControlResultEntry firstEntry = uriResultSet.first();
        uriElement.setAttribute("uri", firstEntry.getUri());
        uriElement.setAttribute("method", firstEntry.getMethod());
        // ... and for every result entry, add the necessary data
        for (AccessControlResultEntry result : uriResultSet) {
            Element userResultElement = doc.createElement("userResult");
            uriElement.appendChild(userResultElement);
            if (result.getUser() == null) {
                userResultElement.setAttribute("name", UNAUTHENICATED_USER_NAME);
            } else {
                userResultElement.setAttribute("name", result.getUser().getName());
            }
            userResultElement.setAttribute("authorization",
                    result.isRequestAuthorized() ? AUTHORIZED_STRING : UNAUTHORIZED_STRING);
            userResultElement.setAttribute("access-control", result.getResult().name());
            userResultElement.setAttribute("access-control-localized", result.getResult().toString());
        }
    }

    return doc;
}

From source file:gov.nih.nci.ncicb.tcga.dcc.dam.dao.DAMQueriesLevel2.java

/**
 * Combines all the level2DataFiles (getConstituentDataFiles()) into one file
 * @param dataFile//w  w  w. ja  v  a2  s .co m
 * @throws IOException
 */

public void createConsolidatedFiles(final DataFile dataFile) throws IOException {

    DiseaseContextHolder.setDisease(dataFile.getDiseaseType());

    if (tempfileDirectory == null) {
        throw new IOException("No tempfileDirectory specified");
    }
    if (!(new File(tempfileDirectory)).exists()) {
        throw new IOException("Directory does not exist " + tempfileDirectory);
    }
    final DataFileLevelTwoConsolidated dataFileLevelTwoConsolidated = (DataFileLevelTwoConsolidated) dataFile;
    final String uniqueName = getUniqueFilename(dataFileLevelTwoConsolidated);
    final String consolidatedFilePath = tempfileDirectory + File.separator + uniqueName;
    final String consolidatedTmpFilePath = consolidatedFilePath + "_tmp";
    dataFileLevelTwoConsolidated.setPath(consolidatedFilePath);

    TreeSet<DataFileLevelTwo> dataFilesLevelTwo = dataFileLevelTwoConsolidated.getConstituentDataFiles();
    // copy first file into consolidatedFile
    FileUtil.copyFile(dataFilesLevelTwo.first().getPath(), consolidatedFilePath);
    // copy other files into consolidated file
    final StringBuilder dataToWrite = new StringBuilder();
    for (DataFileLevelTwo dataFileLevelTwo : dataFilesLevelTwo.tailSet(dataFilesLevelTwo.first(), false)) {

        BufferedReader consolidatedFile = null;
        BufferedReader constituentFile = null;
        BufferedWriter consolidatedTmpFile = null;

        try {
            consolidatedFile = new BufferedReader(new FileReader(consolidatedFilePath), SIXTY_FOUR_MEGS);
            constituentFile = new BufferedReader(new FileReader(dataFileLevelTwo.getPath()), SIXTY_FOUR_MEGS);
            consolidatedTmpFile = new BufferedWriter(new FileWriter(consolidatedTmpFilePath), SIXTY_FOUR_MEGS);
            String constituentRowData = "";
            boolean firstRow = true;
            int numColumnsToSkip = 1; // default, but will change if file has constant columns

            // assuming all the files will have same row count
            while ((constituentRowData = constituentFile.readLine()) != null) {
                // clear the data
                dataToWrite.delete(0, dataToWrite.length());
                final String consolidatedRowData = consolidatedFile.readLine();

                if (consolidatedRowData != null) {

                    final String[] rowDataArray = constituentRowData.split("\\t");
                    if (firstRow) {
                        for (final String cellData : rowDataArray) {
                            if (cellData.length() == 0) {
                                numColumnsToSkip++;
                            }
                        }
                    } else {
                        dataToWrite.append("\n");
                    }

                    dataToWrite.append(consolidatedRowData);
                    for (int i = numColumnsToSkip; i < rowDataArray.length; i++) {
                        dataToWrite.append("\t").append(rowDataArray[i]);
                    }
                    consolidatedTmpFile.write(dataToWrite.toString());
                }
                firstRow = false;

            }

        } finally {
            closeFile(consolidatedFile);
            closeFile(constituentFile);
            closeFile(consolidatedTmpFile);
            // move consolidatedTmpFile  to consolidatedFile
            FileUtil.move(consolidatedTmpFilePath, consolidatedFilePath);
            new File(consolidatedTmpFilePath).delete();
        }
    }

}

From source file:org.jasig.schedassist.model.VisibleScheduleBuilderTest.java

/**
 * Same as {@link #testOffsetStart()}, only use 40 minute blocks.
 *///from   w w  w  . j  a  v  a 2s  .c  o  m
@Test
public void testOffsetStart40() throws Exception {
    MeetingDurations fortyMinuteDurations = new MeetingDurations("40", 40, 40);

    Set<AvailableBlock> blocks = AvailableBlockBuilder.createBlocks("9:00 AM", "1:00 PM", "MWF",
            makeDateTime("20090720-0000"), makeDateTime("20090725-0000"), 1, null);

    TreeSet<AvailableBlock> expanded = new TreeSet<AvailableBlock>(AvailableBlockBuilder.expand(blocks, 40));
    Assert.assertEquals(makeDateTime("20090720-0900"), expanded.first().getStartTime());
    Assert.assertEquals(makeDateTime("20090720-0940"), expanded.first().getEndTime());
    Assert.assertEquals(makeDateTime("20090724-1220"), expanded.last().getStartTime());
    Assert.assertEquals(makeDateTime("20090724-1300"), expanded.last().getEndTime());
    AvailableSchedule schedule = new AvailableSchedule(expanded);

    Calendar emptyCalendar = new Calendar();

    MockScheduleOwner owner = new MockScheduleOwner(new MockCalendarAccount(), 1);
    owner.setPreference(Preferences.DURATIONS, fortyMinuteDurations.getKey());
    VisibleSchedule control = this.builder.calculateVisibleSchedule(makeDateTime("20090719-0000"),
            makeDateTime("20090726-0000"), emptyCalendar, schedule, owner);
    Assert.assertEquals(18, control.getFreeCount());
    // verify that all the free blocks start on the twenty minute marks
    for (AvailableBlock freeBlock : control.getFreeList()) {
        java.util.Calendar startTimeCal = java.util.Calendar.getInstance();
        startTimeCal.setTime(freeBlock.getStartTime());
        Assert.assertTrue(startTimeCal.get(java.util.Calendar.MINUTE) % 20 == 0);
        java.util.Calendar endTimeCal = java.util.Calendar.getInstance();
        endTimeCal.setTime(freeBlock.getEndTime());
        Assert.assertTrue(endTimeCal.get(java.util.Calendar.MINUTE) % 20 == 0);
    }

    // now start the offset in between a block
    VisibleSchedule startsInBlock = this.builder.calculateVisibleSchedule(makeDateTime("20090720-1005"),
            makeDateTime("20090727-1005"), emptyCalendar, schedule, owner);
    Assert.assertEquals(16, startsInBlock.getFreeList().size());
    // verify that all the free blocks start on the twenty minute marks
    for (AvailableBlock freeBlock : startsInBlock.getFreeList()) {
        java.util.Calendar startTimeCal = java.util.Calendar.getInstance();
        startTimeCal.setTime(freeBlock.getStartTime());
        Assert.assertTrue(startTimeCal.get(java.util.Calendar.MINUTE) % 20 == 0);
        java.util.Calendar endTimeCal = java.util.Calendar.getInstance();
        endTimeCal.setTime(freeBlock.getEndTime());
        Assert.assertTrue(endTimeCal.get(java.util.Calendar.MINUTE) % 20 == 0);
    }
}

From source file:org.jasig.schedassist.model.VisibleScheduleBuilderTest.java

/**
 * Verify that start and end times of blocks stay consistent for calculateVisibleSchedule.
 * /*from w ww . j  ava2  s . c o  m*/
 * @throws Exception
 */
@Test
public void testOffsetStart() throws Exception {
    Set<AvailableBlock> blocks = AvailableBlockBuilder.createBlocks("9:00 AM", "1:00 PM", "MWF",
            makeDateTime("20090720-0000"), makeDateTime("20090725-0000"), 1, null);

    TreeSet<AvailableBlock> expanded = new TreeSet<AvailableBlock>(AvailableBlockBuilder.expand(blocks, 30));
    Assert.assertEquals(makeDateTime("20090720-0900"), expanded.first().getStartTime());
    Assert.assertEquals(makeDateTime("20090720-0930"), expanded.first().getEndTime());
    Assert.assertEquals(makeDateTime("20090724-1230"), expanded.last().getStartTime());
    Assert.assertEquals(makeDateTime("20090724-1300"), expanded.last().getEndTime());
    AvailableSchedule schedule = new AvailableSchedule(expanded);

    Calendar emptyCalendar = new Calendar();

    MockScheduleOwner owner = new MockScheduleOwner(new MockCalendarAccount(), 1);
    owner.setPreference(Preferences.DURATIONS, MeetingDurations.THIRTY.getKey());
    VisibleSchedule control = this.builder.calculateVisibleSchedule(makeDateTime("20090719-0000"),
            makeDateTime("20090726-0000"), emptyCalendar, schedule, owner);
    Assert.assertEquals(24, control.getFreeCount());
    // verify that all the free blocks start on the half hour
    SortedMap<AvailableBlock, AvailableStatus> blockMap = control.getBlockMap();
    for (Entry<AvailableBlock, AvailableStatus> entry : blockMap.entrySet()) {
        if (AvailableStatus.FREE.equals(entry.getValue())) {
            AvailableBlock freeBlock = entry.getKey();
            java.util.Calendar startTimeCal = java.util.Calendar.getInstance();
            startTimeCal.setTime(freeBlock.getStartTime());
            Assert.assertTrue(startTimeCal.get(java.util.Calendar.MINUTE) % 30 == 0);
            java.util.Calendar endTimeCal = java.util.Calendar.getInstance();
            endTimeCal.setTime(freeBlock.getEndTime());
            Assert.assertTrue(endTimeCal.get(java.util.Calendar.MINUTE) % 30 == 0);
        }
    }

    // now start the offset in between a block
    VisibleSchedule startsInBlock = this.builder.calculateVisibleSchedule(makeDateTime("20090720-1005"),
            makeDateTime("20090727-1005"), emptyCalendar, schedule, owner);
    Assert.assertEquals(21, startsInBlock.getFreeCount());
    // verify that all the free blocks start on the half hour
    SortedMap<AvailableBlock, AvailableStatus> blockMap2 = startsInBlock.getBlockMap();
    for (Entry<AvailableBlock, AvailableStatus> entry : blockMap2.entrySet()) {
        if (AvailableStatus.FREE.equals(entry.getValue())) {
            AvailableBlock freeBlock = entry.getKey();
            java.util.Calendar startTimeCal = java.util.Calendar.getInstance();
            startTimeCal.setTime(freeBlock.getStartTime());
            Assert.assertTrue(startTimeCal.get(java.util.Calendar.MINUTE) % 30 == 0);
            java.util.Calendar endTimeCal = java.util.Calendar.getInstance();
            endTimeCal.setTime(freeBlock.getEndTime());
            Assert.assertTrue(endTimeCal.get(java.util.Calendar.MINUTE) % 30 == 0);
        }
    }
}

From source file:net.sourceforge.fenixedu.domain.degree.DegreeType.java

public CycleType getFirstOrderedCycleType() {
    final TreeSet<CycleType> ordered = getOrderedCycleTypes();
    return ordered.isEmpty() ? null : ordered.first();
}

From source file:biz.netcentric.cq.tools.actool.dumpservice.impl.DumpserviceImpl.java

private void createTransientDumpNode(String dump, Node rootNode)
        throws ItemExistsException, PathNotFoundException, NoSuchNodeTypeException, LockException,
        VersionException, ConstraintViolationException, RepositoryException, ValueFormatException {

    NodeIterator nodeIt = rootNode.getNodes();

    // TreeSet used here since only this type offers the methods first() and
    // last()/*from w ww . jav a  2  s .  c  o m*/
    TreeSet<Node> dumpNodes = new TreeSet<Node>(new JcrCreatedComparator());

    Node previousDumpNode = null;

    // get all dump nodes
    while (nodeIt.hasNext()) {
        Node currNode = nodeIt.nextNode();

        if (currNode.getName().startsWith(DUMP_NODE_PREFIX)) {
            dumpNodes.add(currNode);
        }
    }
    // try to get previous dump node
    if (!dumpNodes.isEmpty()) {
        previousDumpNode = dumpNodes.first();
    }
    // is limit of dump nodes to save reached?
    if (dumpNodes.size() > (nrOfSavedDumps - 1)) {
        Node oldestDumpNode = dumpNodes.last();
        oldestDumpNode.remove();
    }
    Node dumpNode = getNewDumpNode(dump, rootNode);

    // order the newest dump node as first child node of ac root node
    if (previousDumpNode != null) {
        rootNode.orderBefore(dumpNode.getName(), previousDumpNode.getName());
    }
}

From source file:org.jasig.schedassist.model.VisibleScheduleBuilderTest.java

/**
 * //w w  w  . j a  va2 s .c  o  m
 * @throws Exception
 */
@Test
public void testAlternateMeetingDurations() throws Exception {
    MockCalendarAccount person = new MockCalendarAccount();
    person.setEmailAddress("someowner@wisc.edu");
    person.setDisplayName("Some Owner");
    MockScheduleOwner owner = new MockScheduleOwner(person, 1);

    // 4 week available schedule
    Set<AvailableBlock> blocks = AvailableBlockBuilder.createBlocks("9:00 AM", "12:00 PM", "MRF",
            makeDateTime("20091102-0000"), makeDateTime("20091127-0000"), 1, null);

    TreeSet<AvailableBlock> expanded = new TreeSet<AvailableBlock>(AvailableBlockBuilder.expand(blocks, 30));
    //Assert.assertEquals(72, expanded.size());
    LOG.info("expanded set first: " + expanded.first() + ", last: " + expanded.last());
    AvailableSchedule schedule = new AvailableSchedule(expanded);

    // event conflict is thursday of 2nd week
    DateTime eventStart = new net.fortuna.ical4j.model.DateTime(makeDateTime("20091112-0930"));
    eventStart.setTimeZone(americaChicago);
    DateTime eventEnd = new net.fortuna.ical4j.model.DateTime(makeDateTime("20091112-1030"));
    eventEnd.setTimeZone(americaChicago);
    VEvent someEvent = new VEvent(eventStart, eventEnd, "some event");

    ParameterList parameterList = new ParameterList();
    parameterList.add(PartStat.ACCEPTED);
    parameterList.add(CuType.INDIVIDUAL);
    parameterList.add(Rsvp.FALSE);
    parameterList.add(new Cn(person.getDisplayName()));
    Attendee attendee = new Attendee(parameterList, "mailto:" + person.getEmailAddress());
    someEvent.getProperties().add(attendee);
    ComponentList components = new ComponentList();
    components.add(someEvent);

    VisibleSchedule visible = this.builder.calculateVisibleSchedule(makeDateTime("20091102-0000"),
            makeDateTime("20091130-0000"), new Calendar(components), schedule, owner);

    Assert.assertEquals(2, visible.getBusyCount());
    Assert.assertEquals(70, visible.getFreeCount());
    Assert.assertEquals(72, visible.getSize());

    owner.setPreference(Preferences.DURATIONS, MeetingDurations.FIFTEEN.getKey());
    TreeSet<AvailableBlock> expanded2 = new TreeSet<AvailableBlock>(AvailableBlockBuilder.expand(blocks, 15));
    VisibleSchedule visible2 = this.builder.calculateVisibleSchedule(makeDateTime("20091102-0000"),
            makeDateTime("20091130-0000"), new Calendar(components), new AvailableSchedule(expanded2), owner);
    Assert.assertEquals(4, visible2.getBusyCount());
    Assert.assertEquals(140, visible2.getFreeCount());
    Assert.assertEquals(144, visible2.getSize());

    owner.setPreference(Preferences.DURATIONS, MeetingDurations.FORTYFIVE.getKey());
    TreeSet<AvailableBlock> expanded3 = new TreeSet<AvailableBlock>(AvailableBlockBuilder.expand(blocks, 45));
    VisibleSchedule visible3 = this.builder.calculateVisibleSchedule(makeDateTime("20091102-0000"),
            makeDateTime("20091130-0000"), new Calendar(components), new AvailableSchedule(expanded3), owner);

    Assert.assertEquals(2, visible3.getBusyCount());
    Assert.assertEquals(46, visible3.getFreeCount());
    Assert.assertEquals(48, visible3.getSize());

}

From source file:org.jtrfp.trcl.obj.SmokeSystem.java

private boolean isNewSmokeFeasible(final Vector3D loc, SmokeType type) {
    final TreeSet<Smoke> proximalSmokes = new TreeSet<Smoke>(new Comparator<Smoke>() {
        @Override//from  www. j a v  a  2 s.c o  m
        public int compare(Smoke o1, Smoke o2) {
            return Misc.satCastInt(o1.getTimeOfLastReset() - o2.getTimeOfLastReset());
        }
    });
    for (int smokeTypeIndex = 0; smokeTypeIndex < allSmokes.length; smokeTypeIndex++) {
        Smoke[] explosionsOfThisType = allSmokes[smokeTypeIndex];
        for (Smoke thisSmoke : explosionsOfThisType) {
            if (thisSmoke.isActive()) {
                final double distance = new Vector3D(thisSmoke.getPosition()).distance(loc);
                if (distance < 1000)
                    return false;
                if (distance < OneShotBillboardEvent.PROXIMITY_TEST_DIST)
                    proximalSmokes.add(thisSmoke);
            } // end if(isActive)
        } // end for(explosionsOfThisType)
    } // end for(explosions)
    if (proximalSmokes.size() + 1 > OneShotBillboardEvent.MAX_PROXIMAL_EVENTS)
        proximalSmokes.first().destroy();// Destroy oldest
    return true;
}

From source file:net.sourceforge.fenixedu.presentationTier.Action.coordinator.thesis.ManageThesisDA.java

private ExecutionYear getExecutionYear(HttpServletRequest request) {
    String id = request.getParameter("executionYearId");
    if (id == null) {
        id = request.getParameter("executionYear");
    }//from  ww w .  j ava  2  s .  co m
    if (id == null) {
        TreeSet<ExecutionYear> executionYears = new TreeSet<ExecutionYear>(new ReverseComparator());
        executionYears.addAll(getDegreeCurricularPlan(request).getExecutionYears());

        if (executionYears.isEmpty()) {
            return ExecutionYear.readCurrentExecutionYear();
        } else {
            return executionYears.first();
        }
    } else {
        return FenixFramework.getDomainObject(id);
    }
}

From source file:org.lockss.servlet.DisplayContentTab.java

/**
 * Creates table rows for each AU// ww  w  .  ja v a2s  .co  m
 *
 *
 * @param divTable        The table object to add to
 * @param auMap              Archival unit object for this row
 * @param cleanNameString Sanitised name used to create classes and divs
 * @throws UnsupportedEncodingException
 */
private void createAuRow(Table divTable, Map.Entry<String, TreeSet<ArchivalUnit>> auMap, String cleanNameString)
        throws UnsupportedEncodingException {
    String title = auMap.getKey();
    String cleanTitleString = cleanName(title);
    TreeSet<ArchivalUnit> auSet = auMap.getValue();

    if (auSet.size() > 0) {
        ArchivalUnit firstAu = auSet.first();
        TdbAu firstTdbAu = TdbUtil.getTdbAu(firstAu);
        divTable.newRow();
        Block columnRow = divTable.row();
        columnRow.attribute("class", cleanNameString + "_class column-row hide-row");
        divTable.addCell("", "class=\"checkboxDiv\"");
        for (String columnArray : columnArrayList) {
            Block columnHeader = new Block(Block.Bold);
            columnHeader.add(columnArray);
            divTable.addCell(columnHeader, "class=\"column-header\"");
        }
        divTable.newRow();
        Block titleDiv = divTable.row();
        titleDiv.attribute("id", cleanName(title) + "_title");
        titleDiv.attribute("class", "journal-title " + cleanNameString + "_class hide-row");
        Table titleTable = new Table();
        titleTable.attribute("class", "title-table");
        Input titleCheckbox = new Input(Input.Checkbox, cleanNameString + "_checkbox");
        titleCheckbox.attribute("onClick", "titleCheckbox(this, \"" + cleanTitleString + "\")");
        Block titleCheckboxDiv = new Block(Block.Div);
        titleCheckboxDiv.attribute("class", "checkboxDiv");
        titleCheckboxDiv.add(titleCheckbox);
        divTable.addCell(titleCheckboxDiv, "class=\"checkboxDiv\"");
        addTitleRow(titleTable, "Title:", HtmlUtil.encode(firstTdbAu.getJournalTitle(), HtmlUtil.ENCODE_TEXT));
        addTitleRow(titleTable, "Print ISSN:", firstTdbAu.getIssn());
        addTitleRow(titleTable, "E-ISSN:", firstTdbAu.getEissn());
        divTable.addCell(titleTable, "colspan=\"6\"");
        int rowCount = 0;
        for (ArchivalUnit au : auSet) {
            if (filterAu(au)) {
                String rowClass = rowCss(rowCount);
                TdbAu tdbAu = TdbUtil.getTdbAu(au);
                AuState auState = AuUtil.getAuState(au);
                String auName = HtmlUtil.encode(au.getName(), HtmlUtil.ENCODE_TEXT);
                String cleanedAuName = cleanAuName(auName);
                String encodedHref = URLEncoder.encode(au.getAuId(), "UTF-8");
                divTable.newRow();
                Block newRow = divTable.row();
                newRow.attribute("class", cleanNameString + "_class hide-row " + rowClass);
                Block auDiv = new Block(Block.Div);
                auDiv.attribute("id", cleanedAuName + "_au_title");
                auDiv.attribute("class", "au-title");
                Link auLink = new Link("DaemonStatus");
                if (tdbAu != null) {
                    auLink.attribute("onClick",
                            "updateDiv('" + cleanedAuName + "', '" + au.getAuId() + "', '" + cleanNameString
                                    + "-au', '" + cleanNameString + tdbAu.getYear() + "_image');return false");
                    Image auLinkImage = new Image(EXPAND_ICON);
                    auLinkImage.attribute("id", cleanNameString + tdbAu.getYear() + "_image");
                    auLinkImage.attribute("class", "title-icon");
                    auLinkImage.attribute("alt", "Expand Volume");
                    auLinkImage.attribute("title", "Expand Volume");
                    auLink.add(auLinkImage);
                    auLink.add(auName);
                    auDiv.add(auLink);
                    Block checkboxDiv = new Block(Block.Div);
                    checkboxDiv.attribute("class", "checkboxDiv");
                    Input checkbox = new Input("checkbox", "deleteAu");
                    checkbox.attribute("value", au.getAuId());
                    checkbox.attribute("class", "chkbox " + cleanTitleString + "_chkbox");
                    checkboxDiv.add(checkbox);
                    divTable.addCell(checkboxDiv, "class='checkboxDiv'");
                    divTable.addCell(auDiv, "class='au-title-cell'");
                    divTable.addCell(tdbAu.getYear());
                    divTable.addCell(checkHasContent(auState.getSubstanceState()));
                    divTable.addCell(
                            getCrawlImage(auState.getLastCrawlResult(), auState.getLastCrawlResultMsg()) + " "
                                    + showTimeElapsed(auState.getLastCrawlTime(), timeKey));
                    divTable.addCell(showTimeElapsed(auState.getLastPollStart(), timeKey));
                } else {
                    log.debug("TdbAu not found for Au " + au.getName());
                    auLink.attribute("onClick",
                            "updateDiv('" + cleanedAuName + "', '" + au.getAuId() + "', '" + cleanNameString
                                    + "-au', '" + cleanNameString + rowCount + "_image');return false");
                    Image auLinkImage = new Image(EXPAND_ICON);
                    auLinkImage.attribute("id", cleanNameString + rowCount + "_image");
                    auLinkImage.attribute("class", "title-icon");
                    auLinkImage.attribute("alt", "Expand Volume");
                    auLinkImage.attribute("title", "Expand Volume");
                    auLink.add(auLinkImage);
                    auLink.add(auName);
                    auDiv.add(auLink);
                    divTable.addCell(auDiv);
                    divTable.addCell(au.getName());
                    divTable.addCell("unknown");
                    divTable.addCell("unknown");
                    divTable.addCell(checkCollected(au, auState.getLastCrawlTime()));
                }
                Block serveContentDiv = new Block(Block.Div);
                serveContentDiv.attribute("class", "au-serve-content-div");
                Link serveContentLink = new Link("ServeContent?auid=" + encodedHref);
                serveContentLink.target("_blank");
                Image externalLinkImage = new Image(EXTERNAL_LINK_ICON);
                serveContentLink.add("Serve content<sup>" + externalLinkImage + "</sup>");
                serveContentLink.attribute("class", "au-link");
                serveContentDiv.add("[ " + serveContentLink + " ]");
                divTable.addCell(serveContentDiv);
                divTable.newRow("class='hide-row " + rowClass + " " + cleanNameString + "-au' id='"
                        + cleanedAuName + "_row'");
                Block detailsDiv = new Block(Block.Div);
                detailsDiv.attribute("id", cleanedAuName + "_cell");
                detailsDiv.attribute("class", rowClass);
                divTable.addCell(detailsDiv, "colspan='7' id='" + cleanedAuName + "'");
            }
            rowCount++;
        }
    }
    addClearRow(divTable, cleanNameString, true);
}