Changeset 7590
- Timestamp:
- Feb 18, 2019, 1:19:56 PM (5 years ago)
- Location:
- trunk/src/plugins/core/net/sf/basedb/plugins/batchimport
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/AbstractItemImporter.java
r7588 r7590 766 766 { 767 767 item = createItem(dc, data); 768 idMethod.setIdentifierOnNewItem(dc, item, identifier); 768 769 if (permissionTemplateMapper != null) updatePermissions(dc, (Shareable)item, data, true); 769 770 dc.saveItem(item); -
trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/AnnotationIdMethod.java
r7588 r7590 24 24 import java.util.List; 25 25 26 import net.sf.basedb.core.Annotatable; 27 import net.sf.basedb.core.Annotation; 26 28 import net.sf.basedb.core.AnnotationType; 27 29 import net.sf.basedb.core.BasicItem; … … 117 119 return query.list(dc); 118 120 } 121 122 /** 123 Set the annotation on a newly created item. 124 */ 125 @Override 126 public <I extends BasicItem> boolean setIdentifierOnNewItem(DbControl dc, I item, String identifier) 127 { 128 if (annotationType == null) 129 { 130 throw new NullPointerException("No annotation type has been specified for 'Annotation' identification method."); 131 } 132 Annotatable aItem = (Annotatable)item; 133 Type idType = annotationType.getValueType(); 134 Annotation annotation = aItem.getAnnotationSet().getAnnotation(annotationType); 135 boolean changed = annotation.setValueIfDifferent(idType.parseString(identifier), null); 136 return changed; 137 } 138 119 139 // --------------------------- 120 140 -
trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/IdMethod.java
r4513 r7590 80 80 public <I extends BasicItem> List<I> find(DbControl dc, ItemQuery<I> query, String identifier); 81 81 82 /** 83 Set the ID on a newly created item when this is not done by other regular 84 column mappers. The default implementation of this method does nothing. 85 @return TRUE if the identifier was set, FALSE if not 86 @since 3.15 87 */ 88 public default <I extends BasicItem> boolean setIdentifierOnNewItem(DbControl dc, I item, String identifier) 89 { 90 return false; 91 } 92 82 93 }
Note: See TracChangeset
for help on using the changeset viewer.