Changeset 7593
- Timestamp:
- Feb 20, 2019, 9:13:00 AM (5 years ago)
- Location:
- trunk/src/plugins/core/net/sf/basedb/plugins
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plugins/core/net/sf/basedb/plugins/AnnotationFlatFileImporter.java
r7591 r7593 53 53 import net.sf.basedb.core.Item; 54 54 import net.sf.basedb.core.ItemContext; 55 import net.sf.basedb.core.ItemList; 55 56 import net.sf.basedb.core.ItemNotFoundException; 56 57 import net.sf.basedb.core.ItemParameterType; … … 495 496 if (forJob) 496 497 { 498 storeValue(job, request, ri.getParameter("memberOfList")); 497 499 storeValue(job, request, ri.getParameter("includeMine")); 498 500 storeValue(job, request, ri.getParameter("includeShared")); … … 614 616 private Map<String, Set<NewAnnotations>> itemCache; 615 617 private ItemQuery<?> itemQuery; 618 private ItemList itemList; 616 619 private boolean addToUnlimited; 617 620 private boolean replaceExisting; … … 684 687 this.idMethod = getIdMethod(dc, itemType, (String)job.getValue("idMethod")); 685 688 this.idMapping = (String)job.getValue(idMethod.getColumnMappingParameterName()); 686 687 /* 688 if (job.getValue("externalIdColumnMapping") != null) 689 { 690 this.searchProperty = "externalId"; 691 this.searchParameterType = Type.STRING; 692 this.searchMapping = (String)job.getValue("externalIdColumnMapping"); 693 } 694 else if (job.getValue("internalIdColumnMapping") != null) 695 { 696 this.searchProperty = "id"; 697 this.searchParameterType = Type.INT; 698 this.searchMapping = (String)job.getValue("internalIdColumnMapping"); 699 } 700 else 701 { 702 this.searchProperty = "name"; 703 this.searchParameterType = Type.STRING; 704 this.searchMapping = (String)job.getValue("nameColumnMapping"); 705 } 706 */ 689 this.itemList = (ItemList)job.getValue("memberOfList"); 707 690 708 691 this.addToUnlimited = Boolean.TRUE.equals(job.getValue("addToUnlimited")); … … 777 760 if (Boolean.TRUE.equals((Boolean)job.getValue("includeOthers"))) includes.add(Include.OTHERS); 778 761 779 itemQuery = idMethod.prepareQuery(dc, createQuery(itemType ));762 itemQuery = idMethod.prepareQuery(dc, createQuery(itemType, itemList)); 780 763 itemQuery.setIncludes(includes); 781 764 } … … 1039 1022 } 1040 1023 1024 /** 1025 If the current context is the "Members" tab for an item list we load 1026 the item list and will later require that all items to be annotated 1027 are members of that list. 1028 */ 1029 private ItemList getItemListFromContext(DbControl dc, GuiContext context) 1030 { 1031 ItemList list = null; 1032 String subcontext = context.getSubContext(); 1033 if (subcontext != null && subcontext.startsWith("listmembers")) 1034 { 1035 // If subcontext is: "listmembers.nnnn" nnn is the id of the item list 1036 int listId = Values.getInt(subcontext.split("\\.")[1]); 1037 list = ItemList.getById(dc, listId); 1038 // Reject lists with different type of member item (should not happen) 1039 if (list.getMemberType() != context.getItem()) list = null; 1040 } 1041 return list; 1042 } 1043 1041 1044 private RequestInformation getConfigureParserParameters(GuiContext context, boolean forJob) 1042 1045 { … … 1096 1099 if (forJob) 1097 1100 { 1101 ItemList list = getItemListFromContext(dc, context); 1102 if (list != null) 1103 { 1104 parameters.add(new PluginParameter<ItemList>( 1105 "memberOfList", "Member of list", 1106 "The plug-in will only update annotations for items if they are members of this list.", 1107 new ItemParameterType<>(ItemList.class, list, true, 1, Arrays.asList(list)) 1108 )); 1109 } 1110 1098 1111 ItemContext cc = sc.getCurrentContext(context.getItem()); 1099 1112 Set<Include> include = cc.getInclude(); … … 1343 1356 @return A query that searches items of the specified type. 1344 1357 */ 1345 private ItemQuery<?> createQuery(Item itemType )1346 { 1347 return itemType.getQuery();1358 private ItemQuery<?> createQuery(Item itemType, ItemList list) 1359 { 1360 return list != null && list.getMemberType() == itemType ? list.getMembers() : itemType.getQuery(); 1348 1361 } 1349 1362 -
trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/AnnotationIdMethod.java
r7591 r7593 183 183 public String toString() 184 184 { 185 return "[A] " +annotationType.getName();185 return annotationType.getName(); 186 186 } 187 187 // --------------------------
Note: See TracChangeset
for help on using the changeset viewer.