Skip to content

Commit

Permalink
Merge pull request #1589 from iTerminate/master
Browse files Browse the repository at this point in the history
Patch 3.15.3
  • Loading branch information
iTerminate authored Feb 28, 2023
2 parents e075163 + 8f99886 commit 7888100
Show file tree
Hide file tree
Showing 15 changed files with 173 additions and 12 deletions.
28 changes: 28 additions & 0 deletions db/sql/create_stored_procedures.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,34 @@ BEGIN
LIMIT limit_row;
END //

DROP PROCEDURE IF EXISTS search_items_no_entity_type;//
CREATE PROCEDURE `search_items_no_entity_type` (IN limit_row int, IN domain_id int, IN search_string VARCHAR(255))
BEGIN
SET search_string = CONCAT('%', search_string, '%');
SELECT item.* from item
INNER JOIN v_item_self_element ise ON item.id = ise.item_id
INNER JOIN item_element ie ON ise.self_element_id = ie.id
INNER JOIN entity_info ei ON ise.entity_info_id = ei.id
INNER JOIN user_info owneru ON ei.owner_user_id = owneru.id
INNER JOIN user_info creatoru ON ei.created_by_user_id = creatoru.id
INNER JOIN user_info updateu ON ei.last_modified_by_user_id = updateu.id
LEFT OUTER JOIN item derived_item ON derived_item.id = item.derived_from_item_id
LEFT OUTER JOIN item_entity_type iet on iet.item_id = item.id
WHERE item.domain_id = domain_id AND iet.entity_type_id is NULL
AND (
item.name LIKE search_string
OR item.qr_id LIKE search_string
OR item.item_identifier1 LIKE search_string
OR item.item_identifier2 LIKE search_string
OR ie.description LIKE search_string
OR derived_item.name LIKE search_string
OR owneru.username LIKE search_string
OR creatoru.username LIKE search_string
OR updateu.username LIKE search_string
)
LIMIT limit_row;
END //

DROP PROCEDURE IF EXISTS search_cable_design_items;//
CREATE PROCEDURE `search_cable_design_items` (IN limit_row int, IN search_string VARCHAR(255))
BEGIN
Expand Down
37 changes: 37 additions & 0 deletions db/sql/updates/updateTo3.15.3.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
--
-- Copyright (c) UChicago Argonne, LLC. All rights reserved.
-- See LICENSE file.
--

-- Execute by running `mysql CDB_DB_NAME --host=127.0.0.1 --user=cdb -p < updateTo3.15.3.sql`


delimiter //

DROP PROCEDURE IF EXISTS search_items_no_entity_type;//
CREATE PROCEDURE `search_items_no_entity_type` (IN limit_row int, IN domain_id int, IN search_string VARCHAR(255))
BEGIN
SET search_string = CONCAT('%', search_string, '%');
SELECT item.* from item
INNER JOIN v_item_self_element ise ON item.id = ise.item_id
INNER JOIN item_element ie ON ise.self_element_id = ie.id
INNER JOIN entity_info ei ON ise.entity_info_id = ei.id
INNER JOIN user_info owneru ON ei.owner_user_id = owneru.id
INNER JOIN user_info creatoru ON ei.created_by_user_id = creatoru.id
INNER JOIN user_info updateu ON ei.last_modified_by_user_id = updateu.id
LEFT OUTER JOIN item derived_item ON derived_item.id = item.derived_from_item_id
LEFT OUTER JOIN item_entity_type iet on iet.item_id = item.id
WHERE item.domain_id = domain_id AND iet.entity_type_id is NULL
AND (
item.name LIKE search_string
OR item.qr_id LIKE search_string
OR item.item_identifier1 LIKE search_string
OR item.item_identifier2 LIKE search_string
OR ie.description LIKE search_string
OR derived_item.name LIKE search_string
OR owneru.username LIKE search_string
OR creatoru.username LIKE search_string
OR updateu.username LIKE search_string
)
LIMIT limit_row;
END //
2 changes: 1 addition & 1 deletion etc/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.15.2
3.15.3
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,9 @@ public ItemDomainMachineDesign createRepresentingMachineForAssemblyElement(ItemD
return newMachine;
}

@Override
public List<ItemDomainMachineDesign> searchEntities(String searchString) {
return getEntityDbFacade().searchEntitiesNoEntityType(searchString);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -973,4 +973,19 @@ public List<ItemDomainEntity> searchEntities(String searchString) {
}
return null;
}

public List<ItemDomainEntity> searchEntitiesNoEntityType(String searchString) {
try {
searchString = convertWildcards(searchString);
ItemDomainName domain = getDomain();
return (List<ItemDomainEntity>) em.createNamedStoredProcedureQuery("item.searchItemsNoEntityType")
.setParameter("domain_id", domain.getId())
.setParameter("search_string", searchString)
.setParameter("limit_row", SEARCH_RESULT_LIMIT)
.getResultList();
} catch (NoResultException ex) {

}
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,28 @@
)
}
),
@NamedStoredProcedureQuery(
name = "item.searchItemsNoEntityType",
procedureName = "search_items_no_entity_type",
resultClasses = Item.class,
parameters = {
@StoredProcedureParameter(
name = "limit_row",
mode = ParameterMode.IN,
type = Integer.class
),
@StoredProcedureParameter(
name = "domain_id",
mode = ParameterMode.IN,
type = Integer.class
),
@StoredProcedureParameter(
name = "search_string",
mode = ParameterMode.IN,
type = String.class
)
}
),
@NamedStoredProcedureQuery(
name = "item.itemWithWritePermissionsForUser",
procedureName = "items_with_write_permission_for_user",
Expand Down
2 changes: 1 addition & 1 deletion src/java/CdbWebPortal/src/java/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ prettyPrint: true
cacheTTL: 0
openAPI:
info:
version: '3.15.2'
version: '3.15.3'
title: Component Database API
description: 'The API that provides access to Component Database data.'
contact:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ public abstract class ItemTravelerController extends ItemControllerExtensionHelp
private boolean renderTravelerTemplateLinkDialog;
private boolean renderTravelerTemplateAddDialog;
private boolean renderTravelerTemplateUpdatePrefVersionDialog;
private boolean renderAddNewTravelerDialog;
private boolean renderAddNewTravelerDialog;
private boolean renderLatestDraftVersionColumn;

private Form selectedTemplate;
private Form selectedTravelerInstanceTemplate;
Expand Down Expand Up @@ -206,6 +207,7 @@ protected void resetRenderBooleans() {
renderAddTravelerToBinderDialog = false;
renderAddNewTravelerToBinderDialog = false;
renderAddNewTravelerDialog = false;
renderLatestDraftVersionColumn = false;
renderTravelerTemplateAddDialog = false;
renderTravelerTemplateLinkDialog = false;
renderTravelerTemplateUpdatePrefVersionDialog = false;
Expand Down Expand Up @@ -730,6 +732,10 @@ public boolean isRenderAddNewTravelerDialog() {
return renderAddNewTravelerDialog;
}

public boolean isRenderLatestDraftVersionColumn() {
return renderLatestDraftVersionColumn;
}

public boolean isRenderTravelerTemplateLinkDialog() {
return renderTravelerTemplateLinkDialog;
}
Expand Down Expand Up @@ -1229,6 +1235,24 @@ private void addFormFromPropertyValue(String formId, List<Form> formList, Proper
SessionUtility.addErrorMessage("Error", ex.getMessage());
}
}

public void loadLatestTemplateVersion(List<Form> templateList) {
for (Form template : templateList) {
String preferredReleasedId = template.getPreferredReleasedId();
template.setPreferredReleasedId(null);
loadReleasedTemplatesForTemplate(template, true);
template.setPreferredReleasedId(preferredReleasedId);

ReleasedForm selectedReleasedForm = template.getSelectedReleasedForm();
if (selectedReleasedForm != null) {
template.setLatestVersion(selectedReleasedForm.getVer());
} else {
template.setLatestVersion("No releases");
}
}

renderLatestDraftVersionColumn=true;
}

/**
* Check all property values for traveler instances and call function that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class Form extends TravelerObject {

private transient String preferredReleasedId;
private transient String preferredReleasedVerCache;
private transient String latestVersion;

public Form() {
super();
Expand Down Expand Up @@ -135,7 +136,14 @@ public String getPreferredReleasedVerCache() {

public void setPreferredReleasedVerCache(String preferredReleasedVerCache) {
this.preferredReleasedVerCache = preferredReleasedVerCache;
}

public String getLatestVersion() {
return latestVersion;
}

public void setLatestVersion(String latestVersion) {
this.latestVersion = latestVersion;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ See LICENSE file.
value="#{travelerDomainTemplateController.templatesForCurrent}"
var="templateObject">

<ui:include src="travelerTemplateListObject.xhtml" />
<ui:include src="travelerTemplateListObject.xhtml">
<ui:param name="dataTableTravelerTemplateList"
value="#{travelerDomainTemplateController.templatesForCurrent}"/>
</ui:include>

<p:column headerText="Actions"
exportable="false">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ See LICENSE file.
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:h="http://xmlns.jcp.org/jsf/html">
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core">

<ui:param name="preferredVerRendered"
value="#{preferredVerRendered != null ? preferredVerRendered : true}" />
Expand All @@ -22,7 +23,17 @@ See LICENSE file.
</h:outputLink>
</p:column>

<p:column headerText="Preferred Version" rendered="#{preferredVerRendered}">
<p:column rendered="#{preferredVerRendered}">
<f:facet name="header">
Preferred Version
<p:commandLink id="#{entityTypeName}LoadLatestVersion"
styleClass="fa-link-icon fa fa-cloud-download" title="Load latest version number"
onclick="PF('loadingDialog').show()"
action="#{travelerDomainTemplateController.loadLatestTemplateVersion(dataTableTravelerTemplateList)}"
oncomplete="PF('loadingDialog').hide()"
update="@parent:@parent:@parent"
rendered="#{dataTableTravelerTemplateList != null and !travelerDomainTemplateController.renderLatestDraftVersionColumn}"/>
</f:facet>
<p:commandLink id="#{entityTypeName}UpdateTemplatePreferredVersion"
styleClass="fa-link-icon fa fa-pencil" title="Update Preferred Version"
onclick="PF('loadingDialog').show()"
Expand All @@ -31,7 +42,15 @@ See LICENSE file.
rendered="#{isEntityWriteable}">
<p:tooltip for="#{entityTypeName}UpdateTemplatePreferredVersion" value="Allows user to set preferred version for template entry."/>
</p:commandLink>
<h:outputText value="#{templateObject.preferredReleasedVerCache}"/>
<h:outputText value="#{templateObject.preferredReleasedVerCache}"/>
</p:column>

<p:column headerText="Latest Version" rendered="#{travelerDomainTemplateController.renderLatestDraftVersionColumn}">
<h:outputText rendered="#{templateObject.latestVersion != null}" value="#{templateObject.latestVersion}"/>
</p:column>

<p:column headerText="Draft Version" rendered="#{travelerDomainTemplateController.renderLatestDraftVersionColumn}">
<h:outputText value="#{templateObject.v}"/>
</p:column>

<p:column headerText="Created By">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set name = "ComponentDB-API" %}
{% set version = "3.15.2" %}
{% set version = "3.15.3" %}

package:
name: "{{ name|lower }}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set name = "ComponentDB-CLI" %}
{% set version = "3.15.2" %}
{% set version = "3.15.3" %}

package:
name: "{{ name|lower }}"
Expand Down
2 changes: 1 addition & 1 deletion tools/developer_tools/python-client/setup-api.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from setuptools import find_packages

setup(name='ComponentDB-API',
version='3.15.2',
version='3.15.3',
packages=["cdbApi",
"cdbApi.api",
"cdbApi.models"],
Expand Down
2 changes: 1 addition & 1 deletion tools/developer_tools/python-client/setup-cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from setuptools import find_packages

setup(name='ComponentDB-CLI',
version='3.15.2',
version='3.15.3',
packages=['cdbCli',
'cdbCli.common',
'cdbCli.common.cli',
Expand Down

0 comments on commit 7888100

Please sign in to comment.