Skip to content
Closed
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
2 changes: 1 addition & 1 deletion api/src/org/labkey/api/exp/property/Lookup.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public Lookup()
public Lookup(Container c, String schema, String query)
{
_container = c;
_schemaKey = null == schema ? null : SchemaKey.fromString(schema);
_schemaKey = SchemaKey.fromString(schema);
_queryName = query;
}

Expand Down
3 changes: 2 additions & 1 deletion api/src/org/labkey/api/query/QueryKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.fasterxml.jackson.annotation.JsonValue;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.labkey.api.util.PageFlowUtil;

import java.io.Serializable;
Expand Down Expand Up @@ -92,7 +93,7 @@ static protected <T extends QueryKey<T>> T decode(Factory<T> factory, String div
return ret;
}

static protected <T extends QueryKey<T>> T fromString(Factory<T> factory, String divider, String str)
static protected <T extends QueryKey<T>> T fromString(Factory<T> factory, String divider, @Nullable String str)
{
if (str == null)
return null;
Expand Down
3 changes: 2 additions & 1 deletion api/src/org/labkey/api/query/SchemaKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import org.apache.commons.beanutils.ConversionException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.junit.Assert;
import org.junit.Test;

Expand Down Expand Up @@ -53,7 +54,7 @@ static public SchemaKey decode(String str)
* parts of the SchemaKey, and will enable us to maintain flexibility to change the
* escaping algorithm.
*/
static public SchemaKey fromString(String str)
static public SchemaKey fromString(@Nullable String str)
{
return QueryKey.fromString(FACTORY, DIVIDER, str);
}
Expand Down
8 changes: 5 additions & 3 deletions issues/src/org/labkey/issue/IssuesController.java
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ public List<IssuesForm> getIssueForms()
for (String prop : rec.keySet())
{
Object value = rec.get(prop);
stringMap.put(prop, value.toString());
stringMap.put(prop, JSONObject.NULL.equals(value) ? null : value.toString());
}
form.setStrings(stringMap);
_issueForms.add(form);
Expand Down Expand Up @@ -817,11 +817,13 @@ public void validateForm(IssuesApiForm form, Errors errors)
Map<String, Object> prevIssueProps = prevIssue == null ? Collections.emptyMap() : prevIssue.getProperties();

Map<String, String> stringMap = new CaseInsensitiveHashMap<>(issuesForm.getStrings());
for (PropertyStorageSpec prop : kind.getRequiredProperties())
for (DomainProperty prop : issueListDef.getDomain(getUser()).getProperties())
{
if (!IssueDefDomainKind.RESOLUTION_LOOKUP.equalsIgnoreCase(prop.getName()))
stringMap.computeIfAbsent(prop.getName(), (propName) -> Objects.toString(prevIssueProps.get(propName), null));
}
// Be sure that the posted values take precedence, even if they're null
stringMap.putAll(issuesForm.getStrings());
issuesForm.setStrings(stringMap);
}
IssueObject issue = issuesForm.getBean();
Expand All @@ -844,7 +846,7 @@ public ApiResponse execute(IssuesApiForm form, BindException errors) throws Exce
{
Issue.action action = getAction(issuesForm);

if (action != Issue.action.insert)
if (action != Issue.action.insert)
{
// if we are updating an existing issue pull in existing values
IssueObject prevIssue = IssueManager.getIssue(getContainer(), getUser(), issuesForm.getIssueId());
Expand Down
6 changes: 3 additions & 3 deletions issues/src/org/labkey/issue/model/IssueListDef.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.labkey.api.issues.IssuesSchema;
import org.labkey.api.query.BatchValidationException;
import org.labkey.api.query.FieldKey;
import org.labkey.api.query.SchemaKey;
import org.labkey.api.security.Group;
import org.labkey.api.security.SecurityManager;
import org.labkey.api.security.User;
Expand All @@ -46,7 +47,6 @@
import org.labkey.issue.query.IssueDefDomainKind;

import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

Expand Down Expand Up @@ -158,7 +158,7 @@ public AbstractIssuesListDefDomainKind getDomainKind()

private static String generateDomainURI(Container c, User user, String name, String kindName)
{
DomainKind domainKind = PropertyService.get().getDomainKindByName(kindName);
DomainKind<?> domainKind = PropertyService.get().getDomainKindByName(kindName);
return domainKind.generateDomainURI(IssuesSchema.getInstance().getSchemaName(), name, c, user);
}

Expand Down Expand Up @@ -296,7 +296,7 @@ private void ensureDomainProperties(Domain domain, AbstractIssuesListDefDomainKi
if (foreignKeyMap.containsKey(spec.getName()))
{
PropertyStorageSpec.ForeignKey fk = foreignKeyMap.get(spec.getName());
Lookup lookup = new Lookup(domain.getContainer(), fk.getSchemaName(), domainKind.getLookupTableName(getName(), fk.getTableName()));
Lookup lookup = new Lookup(domain.getContainer(), SchemaKey.fromString(fk.getSchemaName()), domainKind.getLookupTableName(getName(), fk.getTableName()));

prop.setLookup(lookup);
}
Expand Down