1717package org .labkey .targetedms ;
1818
1919import com .google .common .base .Joiner ;
20+ import lombok .Getter ;
21+ import lombok .Setter ;
2022import org .apache .commons .io .FilenameUtils ;
2123import org .apache .commons .lang3 .StringUtils ;
2224import org .apache .logging .log4j .Logger ;
@@ -207,7 +209,8 @@ public static TargetedMSManager get()
207209
208210 public static List <SampleFileChromInfo > getSampleFileChromInfos (SampleFile sampleFile )
209211 {
210- return new TableSelector (getTableInfoSampleFileChromInfo (), new SimpleFilter (FieldKey .fromParts ("SampleFileId" ), sampleFile .getId ()), new Sort ("TextId" )).getArrayList (SampleFileChromInfo .class ); }
212+ return new TableSelector (getTableInfoSampleFileChromInfo (), new SimpleFilter (FieldKey .fromParts ("SampleFileId" ), sampleFile .getId ()), new Sort ("TextId" )).getArrayList (SampleFileChromInfo .class );
213+ }
211214
212215 public static SampleFileChromInfo getSampleFileChromInfo (int id , Container c )
213216 {
@@ -548,7 +551,8 @@ public static TableInfo getTableInfoQuantificationSettings()
548551 return getSchema ().getTable (TargetedMSSchema .TABLE_QUANTIIFICATION_SETTINGS );
549552 }
550553
551- public static TableInfo getTableInfoCalibrationCurve () {
554+ public static TableInfo getTableInfoCalibrationCurve ()
555+ {
552556 return getSchema ().getTable (TargetedMSSchema .TABLE_CALIBRATION_CURVE );
553557 }
554558
@@ -628,19 +632,23 @@ public static TableInfo getTableInfoSkylineAuditLogMessage()
628632 return getSchema ().getTable (TargetedMSSchema .TABLE_SKYLINE_AUDITLOG_MESSAGE );
629633 }
630634
631- public static TableInfo getTableInfoListDefinition () {
635+ public static TableInfo getTableInfoListDefinition ()
636+ {
632637 return getSchema ().getTable (TargetedMSSchema .TABLE_LIST_DEFINITION );
633638 }
634639
635- public static TableInfo getTableInfoListColumnDefinition () {
640+ public static TableInfo getTableInfoListColumnDefinition ()
641+ {
636642 return getSchema ().getTable (TargetedMSSchema .TABLE_LIST_COLUMN_DEFINITION );
637643 }
638644
639- public static TableInfo getTableInfoListItem () {
645+ public static TableInfo getTableInfoListItem ()
646+ {
640647 return getSchema ().getTable (TargetedMSSchema .TABLE_LIST_ITEM );
641648 }
642649
643- public static TableInfo getTableInfoListItemValue () {
650+ public static TableInfo getTableInfoListItemValue ()
651+ {
644652 return getSchema ().getTable (TargetedMSSchema .TABLE_LIST_ITEM_VALUE );
645653 }
646654
@@ -1246,7 +1254,7 @@ public List<InstrumentNickname> getNickname(String name, TargetedMSSchema schema
12461254 }
12471255
12481256 List <InstrumentNickname > result = new ArrayList <>(dedupeAcrossContainers .values ());
1249-
1257+
12501258 if (matches .isEmpty ())
12511259 {
12521260 String sql = "SELECT DISTINCT InstrumentNickname, " +
@@ -3046,6 +3054,39 @@ private QueryUpdateService getNicknameUpdateService(User user, Container contain
30463054 return Objects .requireNonNull (table .getUpdateService ());
30473055 }
30483056
3057+ public static class InstrumentDetails
3058+ {
3059+ @ Getter @ Setter
3060+ private String instrumentSerialNumber ;
3061+ @ Getter @ Setter
3062+ private String model ;
3063+
3064+ public InstrumentDetails ()
3065+ {
3066+ }
3067+ }
3068+
3069+ public static List <InstrumentDetails > getInstrumentDetails (Container container )
3070+ {
3071+ SQLFragment sql = new SQLFragment ("SELECT DISTINCT sf.InstrumentSerialNumber, i.Model FROM " );
3072+ sql .append (getTableInfoSampleFile (), "sf" );
3073+ sql .append (" INNER JOIN " );
3074+ sql .append (getTableInfoInstrument (), "i" );
3075+ sql .append (" ON sf.InstrumentId = i.Id " );
3076+ sql .append (" INNER JOIN " );
3077+ sql .append (getTableInfoReplicate (), "rep" );
3078+ sql .append (" ON sf.ReplicateId = rep.Id " );
3079+ sql .append (" INNER JOIN " );
3080+ sql .append (getTableInfoRuns (), "r" );
3081+ sql .append (" ON rep.RunId = r.Id " );
3082+ sql .append (" WHERE r.Container = ?" );
3083+ sql .add (container );
3084+
3085+ return new SqlSelector (getSchema (), sql ).getArrayList (InstrumentDetails .class );
3086+
3087+ }
3088+
3089+
30493090 public void deleteNickname (InstrumentNickname name , User user ) throws SQLException , BatchValidationException , QueryUpdateServiceException , InvalidKeyException
30503091 {
30513092 getNicknameUpdateService (user , name .getContainer ()).
@@ -3071,4 +3112,15 @@ public void saveNickname(InstrumentNickname name, User user) throws SQLException
30713112 insertRows (user , name .getContainer (), Arrays .asList (row ), errors , null , null );
30723113 }
30733114 }
3115+
3116+ public static boolean isQCAnnotationTypeShareable (int qcAnnotationTypeId )
3117+ {
3118+ SQLFragment sql = new SQLFragment ("SELECT Shareable FROM " );
3119+ sql .append (getTableInfoQCAnnotationType ());
3120+ sql .append (" WHERE Id = ?" );
3121+ sql .add (qcAnnotationTypeId );
3122+
3123+ Boolean isShareable = new SqlSelector (getSchema (), sql ).getObject (Boolean .class );
3124+ return isShareable != null && isShareable ;
3125+ }
30743126}
0 commit comments