Skip to content

Add multi-folder option on lists #6201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
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
6 changes: 4 additions & 2 deletions api/gwtsrc/org/labkey/api/gwt/client/model/GWTDomain.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ public class GWTDomain<FieldType extends GWTPropertyDescriptor> implements IsSer
@Getter @Setter private String queryName = null;
@Getter @Setter private String templateDescription = null; // null if no template
@Getter @Setter private String instructions = null;
@Getter @Setter private boolean supportsPhiLevel = false;
@Getter @Setter private boolean phiLevelEnabled = false;
@Getter @Setter private String phiLevelDisabledReason = null;

public GWTDomain()
{
Expand Down Expand Up @@ -99,7 +100,8 @@ public GWTDomain(GWTDomain<FieldType> src)
this.defaultValueOptions = src.defaultValueOptions;
this.defaultValuesURL = src.defaultValuesURL;
this.provisioned = src.provisioned;
this.supportsPhiLevel = src.supportsPhiLevel;
this.phiLevelEnabled = src.phiLevelEnabled;
this.phiLevelDisabledReason = src.phiLevelDisabledReason;

if (src.indices != null)
{
Expand Down
8 changes: 2 additions & 6 deletions api/src/org/labkey/api/data/Results.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
/**
* A {@link java.sql.ResultSet} with additional metadata to make it easier to use. Understands the mapping of a
* {@link org.labkey.api.query.FieldKey} that was part of the query to its value in the result set.
* User: matthewb
* Date: Nov 18, 2010
*/
public interface Results extends ResultSet, TableResultSet
{
Expand All @@ -43,11 +41,9 @@ public interface Results extends ResultSet, TableResultSet
@NotNull
Map<FieldKey, ColumnInfo> getFieldMap();

@NotNull
public Map<FieldKey, Integer> getFieldIndexMap();
@NotNull Map<FieldKey, Integer> getFieldIndexMap();

@NotNull
public Map<FieldKey, Object> getFieldKeyRowMap();
@NotNull Map<FieldKey, Object> getFieldKeyRowMap();

@Nullable
ResultSet getResultSet();
Expand Down
8 changes: 0 additions & 8 deletions api/src/org/labkey/api/exp/api/SampleTypeDomainKind.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.labkey.api.collections.CaseInsensitiveHashSet;
import org.labkey.api.compliance.ComplianceService;
import org.labkey.api.data.Container;
import org.labkey.api.data.ContainerFilter;
import org.labkey.api.data.ContainerManager;
Expand Down Expand Up @@ -61,7 +60,6 @@
import org.labkey.api.security.permissions.AdminPermission;
import org.labkey.api.security.permissions.DesignSampleTypePermission;
import org.labkey.api.util.PageFlowUtil;
import org.labkey.api.util.Pair;
import org.labkey.api.util.StringUtilsLabKey;
import org.labkey.api.view.ActionURL;
import org.labkey.api.view.NotFoundException;
Expand Down Expand Up @@ -667,12 +665,6 @@ public boolean hasNullValues(Domain domain, DomainProperty prop)
return false;
}

@Override
public boolean supportsPhiLevel()
{
return ComplianceService.get().isComplianceSupported();
}

@Override
public boolean supportsNamingPattern()
{
Expand Down
3 changes: 3 additions & 0 deletions api/src/org/labkey/api/exp/list/ListDefinition.java
Original file line number Diff line number Diff line change
Expand Up @@ -378,4 +378,7 @@ default boolean isPicklist()

boolean getFileAttachmentIndex();
void setFileAttachmentIndex(boolean index);

boolean getMultiFolder();
void setMultiFolder(boolean multiFolder);
}
7 changes: 6 additions & 1 deletion api/src/org/labkey/api/exp/property/DomainKind.java
Original file line number Diff line number Diff line change
Expand Up @@ -406,11 +406,16 @@ public boolean isUserCreatedType()
return true;
}

public boolean supportsPhiLevel()
public boolean supportsPhiLevel(Domain domain)
{
return false;
}

public String getPhiLevelUnsupportedReason(Domain domain)
{
return "This table type does not support PHI annotations";
}

public boolean supportsNamingPattern()
{
return false;
Expand Down
31 changes: 19 additions & 12 deletions api/src/org/labkey/api/exp/property/DomainUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
Expand Down Expand Up @@ -121,9 +122,8 @@ public static String getFormattedDefaultValue(User user, DomainProperty property
{
if (defaultValue == null || (defaultValue instanceof String && StringUtils.isBlank((String)defaultValue)))
return "[none]";
if (defaultValue instanceof Date)
if (defaultValue instanceof Date defaultDate)
{
Date defaultDate = (Date) defaultValue;
if (property.getFormat() != null)
return DateUtil.formatDateTime(defaultDate, property.getFormat());
else
Expand All @@ -143,7 +143,7 @@ else if (AbstractAssayProvider.PARTICIPANT_VISIT_RESOLVER_PROPERTY_NAME.equalsIg
}
catch (Exception e)
{
LogManager.getLogger(DomainUtil.class).debug("Failed to parse JSON for default value. It may predate JSON encoding for thaw list.", e);
LOG.debug("Failed to parse JSON for default value. It may predate JSON encoding for thaw list.", e);
// And then fall through below to return defaultValue.toString();
}
}
Expand Down Expand Up @@ -215,10 +215,7 @@ private static boolean isValidPdLookup(User user, Container c, GWTPropertyDescri
tableNames = new CaseInsensitiveHashSet(schema.getTableNames());
}

if (tableNames.contains(p.getLookupQuery()))
return true;

return false;
return tableNames.contains(p.getLookupQuery());
}

@Nullable
Expand Down Expand Up @@ -447,7 +444,8 @@ private static GWTDomain<GWTPropertyDescriptor> getDomain(Domain dd)
gwtDomain.setAllowCalculatedFields(kind.allowCalculatedFields());
gwtDomain.setShowDefaultValueSettings(kind.showDefaultValueSettings());
gwtDomain.setInstructions(kind.getDomainEditorInstructions());
gwtDomain.setSupportsPhiLevel(kind.supportsPhiLevel());
gwtDomain.setPhiLevelEnabled(kind.supportsPhiLevel(dd));
gwtDomain.setPhiLevelDisabledReason(kind.getPhiLevelUnsupportedReason(dd));
}
return gwtDomain;
}
Expand Down Expand Up @@ -878,17 +876,27 @@ public static ValidationException updateDomainDescriptor(GWTDomain<? extends GWT
if (!StringUtils.isEmpty(pd.getPropertyURI()))
propertyUrisInUse.add(pd.getPropertyURI());

boolean supportsPhi = kind.supportsPhiLevel(d);
List<String> badPhiFields = new LinkedList<>();

// now add properties
for (GWTPropertyDescriptor pd : update.getFields())
{
addProperty(d, pd, defaultValues, propertyUrisInUse, validationException);
if (!supportsPhi && !PHI.NotPHI.name().equals(pd.getPHI()))
badPhiFields.add(pd.getName());
}

if (!badPhiFields.isEmpty())
validationException.addError(new SimpleValidationError(kind.getPhiLevelUnsupportedReason(d) + " but the " +
StringUtilsLabKey.joinWithConjunction(badPhiFields, "and") + " field" +
(badPhiFields.size() == 1 ? " has" : "s have") + " a PHI level set"));

try
{
if (validationException.getErrors().isEmpty())
{
// Reorder the properties based on what we got from GWT
// Reorder the properties based on what the client sent
Map<String, DomainProperty> dps = new HashMap<>();
for (DomainProperty dp : d.getProperties())
{
Expand Down Expand Up @@ -1199,7 +1207,7 @@ private static List<Map<String, Object>> updatePropertyValidators(DomainProperty

if (v.getExtraProperties() != null && v.getExtraProperties().containsKey("valueUpdates"))
{
if (v.getExtraProperties().get("valueUpdates").size() > 0)
if (!v.getExtraProperties().get("valueUpdates").isEmpty())
valueUpdates.add(v.getExtraProperties().get("valueUpdates"));
}
}
Expand Down Expand Up @@ -1296,7 +1304,6 @@ private static void updateTextChoiceValueRows(Domain domain, User user, String p
}
}

@SuppressWarnings("unchecked")
private static void _copyValidator(IPropertyValidator pv, GWTPropertyValidator gpv)
{
if (pv != null && gpv != null)
Expand Down Expand Up @@ -1343,7 +1350,7 @@ public static ValidationException validateProperties(@Nullable Domain domain, @N

String name = field.getName();

if (null == name || name.trim().length() == 0)
if (null == name || name.trim().isEmpty())
{
exception.addError(new SimpleValidationError(getDomainErrorMessage(updates,"Please provide a name for each field.")));
continue;
Expand Down
2 changes: 0 additions & 2 deletions api/src/org/labkey/api/settings/SiteSettingsProperties.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package org.labkey.api.settings;

import org.apache.logging.log4j.Logger;
import org.labkey.api.security.AuthenticationManager;
import org.labkey.api.security.UserManager;
import org.labkey.api.util.ExceptionReportingLevel;
import org.labkey.api.util.SafeToRenderEnum;
import org.labkey.api.util.UsageReportingLevel;
Expand Down
8 changes: 4 additions & 4 deletions core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
}
},
"dependencies": {
"@labkey/components": "6.8.0",
"@labkey/components": "6.11.3-fb-multifolder.0",
"@labkey/themes": "1.4.0"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,6 @@ class QueryMetadataEditor extends PureComponent<any, Partial<IAppState>> {
hideRequired: true,
isDragDisabled: true,
hideValidators: true,
phiLevelDisabled: true,
hideAddFieldsButton: true,
hideTextOptions: true,
disableMvEnabled: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE exp.List ADD MultiFolder BOOLEAN NOT NULL DEFAULT FALSE;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE exp.List ADD MultiFolder BIT NOT NULL DEFAULT 0;
1 change: 1 addition & 0 deletions experiment/resources/schemas/exp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
<column columnName="EachItemBodySetting" />
<column columnName="EachItemBodyTemplate"/>
<column columnName="FileAttachmentIndex"/>
<column columnName="MultiFolder"/>
</columns>
</table>
<table tableName="Material" tableDbType="TABLE">
Expand Down
4 changes: 2 additions & 2 deletions experiment/src/org/labkey/experiment/ExperimentModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public String getName()
@Override
public Double getSchemaVersion()
{
return 25.000;
return 25.001;
}

@Nullable
Expand Down Expand Up @@ -824,7 +824,7 @@ public Collection<String> getSummary(Container c)
Collection<String> list = new LinkedList<>();
int runGroupCount = ExperimentService.get().getExperiments(c, null, false, true).size();
if (runGroupCount > 0)
list.add("" + runGroupCount + " Run Group" + (runGroupCount > 1 ? "s" : ""));
list.add(runGroupCount + " Run Group" + (runGroupCount > 1 ? "s" : ""));

User user = HttpView.currentContext().getUser();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.labkey.api.collections.CaseInsensitiveHashSet;
import org.labkey.api.compliance.ComplianceService;
import org.labkey.api.data.Container;
import org.labkey.api.data.ContainerFilter;
import org.labkey.api.data.DbSchema;
Expand Down Expand Up @@ -481,12 +480,6 @@ public boolean allowCalculatedFields()
return true;
}

@Override
public boolean supportsPhiLevel()
{
return ComplianceService.get().isComplianceSupported();
}

@Override
public boolean supportsNamingPattern()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ public Object execute(DomainApiForm form, BindException errors)

@Marshal(Marshaller.Jackson)
@RequiresPermission(ReadPermission.class) //Real permissions will be enforced later on by the DomainKind
public class SaveDomainAction extends MutatingApiAction<DomainApiForm>
public static class SaveDomainAction extends MutatingApiAction<DomainApiForm>
{
//Keeping both request and response object mappers to avoid serialization/deserialization issues
//as not sure if request object mapper is needed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@
import java.util.List;
import java.util.Set;

/**
* User: klum
* Date: May 4, 2010
* Time: 4:24:36 PM
*/
public class FilePropertiesDomainKind extends BaseAbstractDomainKind
{
private static final List<String> RESERVED_FIELDS = Collections.unmodifiableList(Arrays.asList(
Expand Down Expand Up @@ -125,7 +120,7 @@ public DefaultValueType getDefaultDefaultType(Domain domain)
}

@Override
public boolean supportsPhiLevel()
public boolean supportsPhiLevel(Domain domain)
{
return ComplianceService.get().isComplianceSupported();
}
Expand Down
41 changes: 21 additions & 20 deletions list/schemas/lists.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://labkey.org/list/xml"
targetNamespace="http://labkey.org/list/xml"
elementFormDefault="qualified" attributeFormDefault="unqualified">
elementFormDefault="qualified">

<xsd:annotation>
<xsd:documentation xml:lang="en">Describes the list settings, list-specific properties beyond those included in tableInfo.xsd.
Expand All @@ -12,31 +12,32 @@

<xsd:element name="lists">
<xsd:complexType>
<xsd:sequence minOccurs="1" maxOccurs="unbounded">
<xsd:sequence maxOccurs="unbounded">
<xsd:element name="list">
<xsd:complexType>
<xsd:attribute name="name" type="xsd:string" use="required"/>
<xsd:attribute name="id" type="xsd:int" use="optional"/>
<xsd:attribute name="discussions" type="xsd:int" default="0" use="optional"/>
<xsd:attribute name="allowDelete" type="xsd:boolean" default="true" use="optional"/>
<xsd:attribute name="allowUpload" type="xsd:boolean" default="true" use="optional"/>
<xsd:attribute name="allowExport" type="xsd:boolean" default="true" use="optional"/>
<xsd:attribute name="id" type="xsd:int"/>
<xsd:attribute name="discussions" type="xsd:int" default="0"/>
<xsd:attribute name="allowDelete" type="xsd:boolean" default="true"/>
<xsd:attribute name="allowUpload" type="xsd:boolean" default="true"/>
<xsd:attribute name="allowExport" type="xsd:boolean" default="true"/>

<xsd:attribute name="eachItemIndex" type="xsd:boolean" default="false" use="optional"/>
<xsd:attribute name="eachItemTitleSetting" type="xsd:int" default="0" use="optional"/>
<xsd:attribute name="eachItemTitleTemplate" type="xsd:string" use="optional"/>
<xsd:attribute name="eachItemBodySetting" type="xsd:int" default="0" use="optional"/>
<xsd:attribute name="eachItemBodyTemplate" type="xsd:string" use="optional"/>
<xsd:attribute name="eachItemIndex" type="xsd:boolean" default="false"/>
<xsd:attribute name="eachItemTitleSetting" type="xsd:int" default="0"/>
<xsd:attribute name="eachItemTitleTemplate" type="xsd:string"/>
<xsd:attribute name="eachItemBodySetting" type="xsd:int" default="0"/>
<xsd:attribute name="eachItemBodyTemplate" type="xsd:string"/>

<xsd:attribute name="entireListIndex" type="xsd:boolean" default="false" use="optional"/>
<xsd:attribute name="entireListIndexSetting" type="xsd:int" default="0" use="optional"/>
<xsd:attribute name="entireListTitleSetting" type="xsd:int" default="0" use="optional"/>
<xsd:attribute name="entireListTitleTemplate" type="xsd:string" use="optional"/>
<xsd:attribute name="entireListBodySetting" type="xsd:int" default="0" use="optional"/>
<xsd:attribute name="entireListBodyTemplate" type="xsd:string" use="optional"/>
<xsd:attribute name="entireListIndex" type="xsd:boolean" default="false"/>
<xsd:attribute name="entireListIndexSetting" type="xsd:int" default="0"/>
<xsd:attribute name="entireListTitleSetting" type="xsd:int" default="0"/>
<xsd:attribute name="entireListTitleTemplate" type="xsd:string"/>
<xsd:attribute name="entireListBodySetting" type="xsd:int" default="0"/>
<xsd:attribute name="entireListBodyTemplate" type="xsd:string"/>

<xsd:attribute name="fileAttachmentIndex" type="xsd:boolean" default="false" use="optional" />
<xsd:attribute name="category" type="xsd:string" use="optional" />
<xsd:attribute name="fileAttachmentIndex" type="xsd:boolean" default="false"/>
<xsd:attribute name="category" type="xsd:string"/>
<xsd:attribute name="multiFolder" type="xsd:boolean" default="false"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
Expand Down
Loading