Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

/**
Expand Down Expand Up @@ -846,6 +847,96 @@ private void startOperation() {
this.lastError.remove();
}

/**
* Checks if a <w:p> block contains "Artifact Id" followed by a numeric value.
*
* @param paragraphElement the <w:p> element to check.
* @return true if the <w:p> contains "Artifact Id" followed by a numeric value; false otherwise.
*/
public static boolean isArtifactIdMetadataAttribute(Element paragraphElement) {
// Get all <w:t> elements within this <w:p>
NodeList textNodes = paragraphElement.getElementsByTagName("w:t");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question, is there not a stream/iterator way of doing this like for(TextNode node: paragraphElement.getElementsByTagName("w:t")){...}?
Additionally, if you can do this with streams, you can use .anyMatch()


boolean foundArtifactIdLabel = false;

for (int i = 0; i < textNodes.getLength(); i++) {
Node textNode = textNodes.item(i);

if (textNode.getNodeType() == Node.ELEMENT_NODE) {
Element textElement = (Element) textNode;

// Check if this <w:t> contains "Artifact Id"
if ("Artifact Id".equals(textElement.getTextContent())) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be startsWith or contains?

foundArtifactIdLabel = true;
}

// Check if this <w:t> contains a numeric artifact ID (e.g., "200406")
if (foundArtifactIdLabel && textElement.getTextContent().matches("\\d+")) {
return true;
}
}
}

// Return false if no matching structure is found
return false;
}

/**
* Checks if a <w:p> block contains any of the specified artifact names.
*
* @param paragraphElement the <w:p> element to check.
* @param artifactNames an array of artifact names to check for.
* @return true if the <w:p> contains any of the artifact names; false otherwise.
*/
public static boolean containsAnyName(Element paragraphElement, String[] artifactNames) {
// Get all <w:t> elements within this <w:p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar comment as above

NodeList textNodes = paragraphElement.getElementsByTagName("w:t");

for (int i = 0; i < textNodes.getLength(); i++) {
Node textNode = textNodes.item(i);

if (textNode.getNodeType() == Node.ELEMENT_NODE) {
Element textElement = (Element) textNode;

// Check if the text matches any of the artifact names
String textContent = textElement.getTextContent();
for (String artifactName : artifactNames) {
if (artifactName.equals(textContent)) {
return true;
}
}
}
}

return false;
}

/**
* Checks if a <w:p> block contains an outline number (e.g., <wx:t wx:val="4.1.3.1.1">).
*
* @param paragraphElement the <w:p> element to check.
* @return true if the <w:p> contains an outline number; false otherwise.
*/
public static boolean hasOutlineNumber(Element paragraphElement) {
// Get all <wx:t> elements within this <w:p>
NodeList outlineNodes = paragraphElement.getElementsByTagName("wx:t");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar comment as above


for (int i = 0; i < outlineNodes.getLength(); i++) {
Node outlineNode = outlineNodes.item(i);

if (outlineNode.getNodeType() == Node.ELEMENT_NODE) {
Element outlineElement = (Element) outlineNode;

// Check if the wx:val attribute is present
if (outlineElement.hasAttribute("wx:val")) {
return true;
}
}
}

return false;
}

}

/* EOF */
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { combineLatest, map, switchMap, tap } from 'rxjs';
template: `<button
mat-raised-button
(click)="createWorkingBranch()"
class="tw-bg-primary tw-text-background-background">
class="tw-bg-osee-blue-7 tw-text-background-background dark:tw-bg-osee-blue-10">
<mat-icon>alt_route</mat-icon>Create Branch
</button>`,
changeDetection: ChangeDetectionStrategy.OnPush,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<th
mat-header-cell
*matHeaderCellDef
class="tw-text-primary-600">
class="tw-text-osee-blue-7 dark:tw-text-osee-blue-10">
{{
(getHeaderByName(header) | async)?.humanReadable ||
''
Expand Down
Loading