List of usage examples for java.lang.reflect InvocationTargetException getMessage
public String getMessage()
From source file:com.processing.core.PApplet.java
/** * Create an offscreen PGraphics object for drawing. This can be used * for bitmap or vector images drawing or rendering. * <UL>/*w w w. ja va 2 s .co m*/ * <LI>Do not use "new PGraphicsXxxx()", use this method. This method * ensures that internal variables are set up properly that tie the * new graphics context back to its parent PApplet. * <LI>The basic way to create bitmap images is to use the <A * HREF="http://processing.org/reference/saveFrame_.html">saveFrame()</A> * function. * <LI>If you want to create a really large scene and write that, * first make sure that you've allocated a lot of memory in the Preferences. * <LI>If you want to create images that are larger than the screen, * you should create your own PGraphics object, draw to that, and use * <A HREF="http://processing.org/reference/save_.html">save()</A>. * For now, it's best to use <A HREF="http://dev.processing.org/reference/everything/javadoc/processing/core/PGraphics3D.html">P3D</A> in this scenario. * P2D is currently disabled, and the JAVA2D default will give mixed * results. An example of using P3D: * <PRE> * * PGraphics big; * * void setup() { * big = createGraphics(3000, 3000, P3D); * * big.beginDraw(); * big.background(128); * big.line(20, 1800, 1800, 900); * // etc.. * big.endDraw(); * * // make sure the file is written to the sketch folder * big.save("big.tif"); * } * * </PRE> * <LI>It's important to always wrap drawing to createGraphics() with * beginDraw() and endDraw() (beginFrame() and endFrame() prior to * revision 0115). The reason is that the renderer needs to know when * drawing has stopped, so that it can update itself internally. * This also handles calling the defaults() method, for people familiar * with that. * <LI>It's not possible to use createGraphics() with the OPENGL renderer, * because it doesn't allow offscreen use. * <LI>With Processing 0115 and later, it's possible to write images in * formats other than the default .tga and .tiff. The exact formats and * background information can be found in the developer's reference for * <A HREF="http://dev.processing.org/reference/core/javadoc/processing/core/PImage.html#save(java.lang.String)">PImage.save()</A>. * </UL> */ public PGraphics createGraphics(int iwidth, int iheight, String irenderer) { PGraphics pg = null; if (irenderer.equals(JAVA2D)) { pg = new PGraphicsAndroid2D(); } else if (irenderer.equals(P2D)) { if (!g.isGL()) { throw new RuntimeException("createGraphics() with P2D requires size() to use P2D or P3D"); } pg = new PGraphics2D(); } else if (irenderer.equals(P3D)) { if (!g.isGL()) { throw new RuntimeException("createGraphics() with P3D or OPENGL requires size() to use P2D or P3D"); } pg = new PGraphics3D(); } else { Class<?> rendererClass = null; Constructor<?> constructor = null; try { // The context class loader doesn't work: //rendererClass = Thread.currentThread().getContextClassLoader().loadClass(irenderer); // even though it should, according to this discussion: // http://code.google.com/p/android/issues/detail?id=11101 // While the method that is not supposed to work, using the class loader, does: rendererClass = this.getClass().getClassLoader().loadClass(irenderer); } catch (ClassNotFoundException cnfe) { throw new RuntimeException("Missing renderer class"); } if (rendererClass != null) { try { constructor = rendererClass.getConstructor(new Class[] {}); } catch (NoSuchMethodException nsme) { throw new RuntimeException("Missing renderer constructor"); } if (constructor != null) { try { pg = (PGraphics) constructor.newInstance(); } catch (InvocationTargetException e) { e.printStackTrace(); throw new RuntimeException(e.getMessage()); } catch (IllegalAccessException e) { e.printStackTrace(); throw new RuntimeException(e.getMessage()); } catch (InstantiationException e) { e.printStackTrace(); throw new RuntimeException(e.getMessage()); } } } } pg.setParent(this); pg.setPrimary(false); pg.setSize(iwidth, iheight); return pg; }
From source file:org.jaffa.soa.dataaccess.DataTransformer.java
/** * Mould data from domain object and its related objects into a new JavaBean based * domain object graph, based on the defined mapping rules. * * @param source Source object to mould data from, typically extends Persistent * @param target Target object to mould data to, typically extends GraphDataObject * @param graph The mapping class with the rules of how to map this source object * @param filter Filter object that it is used to control what fields are populated or the target objects * @param objectPath The path of this object being processed. This identifies possible parent * and/or indexed entries where this object is contained. * @param includeKeys true if key fields should be included in results regardless of the filters * @param originalCriteria the original graph criteria. * @param handler Possible bean handler to be used when processing this source object graph * @throws ApplicationExceptions Thrown if one or more application logic errors are generated during moulding * @throws FrameworkException Thrown if any runtime moulding error has occured. *///w w w . j av a2 s . co m public static void buildGraphFromDomain(Object source, Object target, GraphMapping graph, MappingFilter filter, String objectPath, boolean includeKeys, GraphCriteria originalCriteria, ITransformationHandler handler) throws ApplicationExceptions, FrameworkException { if (graph == null) graph = MappingFactory.getInstance(target); boolean useQueryDomain = graph.getQueryDomainClass() != null && source.getClass().isAssignableFrom(graph.getQueryDomainClass()); //throw new InstantiationException("A GraphMapping must be supplied"); if (filter == null) filter = MappingFilter.getInstance(graph); try { // get list of target fileds to populate String[] tFields = graph.getDataFieldNames(); if (tFields != null && tFields.length != 0) for (int i = 0; i < tFields.length; i++) { // Try to map a source to a target String tName = tFields[i]; String fullName = tName; if (objectPath != null) fullName = objectPath + "." + fullName; if (filter == null || filter.isFieldIncluded(fullName) || (includeKeys && graph.isKeyField(tName))) { String sName = graph.getDomainFieldName(tName); AccessibleObject tAccessibleObject = graph.getDataMutator(tName); PropertyDescriptor tDesc = graph.getDataFieldDescriptor(tName); PropertyDescriptor sDesc = useQueryDomain ? graph.getQueryDomainFieldDescriptor(tName) : graph.getDomainFieldDescriptor(tName); if (useQueryDomain && sDesc == null) continue; // Based on validation in GraphMapping, that there is a // GraphObject descriptor with a setter, and a DO descriptor with a getter if (sDesc == null) log.error("No Getter for " + tName + " in path " + fullName); // incase getter is not public, make it available Method sm = sDesc.getReadMethod(); if (!sm.isAccessible()) sm.setAccessible(true); // Set the value if the source and target are the same datatype Class tClass = tDesc.getPropertyType(); Class sClass = sDesc.getPropertyType(); if (tClass.isAssignableFrom(sClass)) { // Get the value being copied Object sValue = sm.invoke(source, (Object[]) null); setValue(tAccessibleObject, target, sValue); if (log.isDebugEnabled()) log.debug("Set " + tName + " = " + sValue); // See if there is a datatype mapper for these classes } else if (DataTypeMapper.instance().isMappable(sClass, tClass)) { // Get the value being copied Object sValue = sm.invoke(source, (Object[]) null); if (sValue != null) { sValue = DataTypeMapper.instance().map(sValue, tClass); if (log.isDebugEnabled()) log.debug("Set " + tName + " = " + sValue); } setValue(tAccessibleObject, target, sValue); // See if target is a GraphObject, this could be a foreign object or one-to-one relationship... } else if (GraphDataObject.class.isAssignableFrom(tClass) && IPersistent.class.isAssignableFrom(sClass)) { // Get the mapper for the related GraphObject, if it has keys, it must be a foriegn object if (graph.isForeignField(tName)) { // look at foreign key fields, and make sure they are not null List foreignKeys = graph.getForeignKeys(tName); List foreignKeyValues = new ArrayList(); boolean nullKey = false; for (Iterator k = foreignKeys.iterator(); k.hasNext();) { String doProp = (String) k.next(); Object value = null; PropertyDescriptor doPd = graph.getRealDomainFieldDescriptor(doProp); if (doPd != null && doPd.getReadMethod() != null) { Method m = doPd.getReadMethod(); if (!m.isAccessible()) m.setAccessible(true); value = m.invoke(source, new Object[] {}); if (value == null) nullKey = true; foreignKeyValues.add(value); } else { throw new TransformException(TransformException.INVALID_FK_MAPPING, objectPath, doProp, graph.getDomainClassShortName()); } } if (nullKey) { if (log.isDebugEnabled()) log.debug("Did not create skeleton object '" + tClass.getName() + "': one or more foreign key values missing."); } else { // Create the foreign object if (log.isDebugEnabled()) log.debug("Creating foreign object - " + tClass.getName()); Object newGDO = newGraphDataObject(tClass); boolean createSkeleton = true; // Only retrieve related domain object and introspect if need if (filter.areSubFieldsIncluded(fullName)) { // read object and introspect all if (log.isDebugEnabled()) log.debug("Read foreign object '" + fullName + "' and mold"); try { Object sValue = sm.invoke(source, (Object[]) null); if (sValue != null) { DataTransformer.buildGraphFromDomain(sValue, newGDO, null, filter, fullName, true, originalCriteria, handler); createSkeleton = false; } } catch (InvocationTargetException e) { // If the foreign object is not found, create the skeleton if (e.getCause() != null && e.getCause() instanceof InvalidForeignKeyException) { if (log.isDebugEnabled()) log.debug( "All foreign keys present, but foreign object does not exist", e); } else throw e; } } if (createSkeleton) { // just set foreign keys from current object if (log.isDebugEnabled()) log.debug("Set keys on skeleton foreign object only"); GraphMapping graph2 = MappingFactory.getInstance(newGDO); Set keys = graph2.getKeyFields(); if (keys == null || keys.size() != foreignKeyValues.size()) { throw new TransformException(TransformException.MISMATCH_FK_MAPPING, objectPath, target.getClass().getName(), newGDO.getClass().getName()); } int k2 = 0; // Look through all the foreign keys on the skeleton object for (Iterator k = keys.iterator(); k.hasNext(); k2++) { String keyField = (String) k.next(); Object keyValue = foreignKeyValues.get(k2); AccessibleObject accessibleObject = graph2.getDataMutator(keyField); if (accessibleObject != null) { setValue(accessibleObject, newGDO, keyValue); } else { throw new TransformException(TransformException.CANT_SET_KEY_FIELD, objectPath, keyField, newGDO.getClass().getName()); } } } setValue(tAccessibleObject, target, newGDO); if (log.isDebugEnabled()) log.debug("Set " + tName + " = " + newGDO); } } else { // This is not a foreign object, must be a related object if (filter.areSubFieldsIncluded(fullName)) { // Create the related object if (log.isDebugEnabled()) log.debug("Creating One-To-One object - " + tClass.getName()); Object newGDO = newGraphDataObject(tClass); // read object and introspect all if (log.isDebugEnabled()) log.debug("Read related object '" + fullName + "' and mold"); Object sValue = sm.invoke(source, (Object[]) null); if (sValue != null) { DataTransformer.buildGraphFromDomain(sValue, newGDO, null, filter, fullName, false, originalCriteria, handler); setValue(tAccessibleObject, target, newGDO); if (log.isDebugEnabled()) log.debug("Set " + tName + " = " + newGDO); } else { if (log.isDebugEnabled()) log.debug("Related object '" + fullName + "' not found. Ignore it!"); } } else { if (log.isDebugEnabled()) log.debug("No subfields for object " + fullName + " included. Object not retrieved"); } } //END-related object // See if Target may be an array of GraphObject's } else if (tClass.isArray() && GraphDataObject.class.isAssignableFrom(tClass.getComponentType()) && filter.areSubFieldsIncluded(fullName)) { if (log.isDebugEnabled()) log.debug("Target is an array of GraphObject's"); if (sClass.isArray() && IPersistent.class.isAssignableFrom(sClass.getComponentType())) { if (log.isDebugEnabled()) { log.debug("Source is an array of Persistent Objects"); log.debug("Read related objects '" + fullName + "' and mold"); } Object[] sArray = findRelatedObjects(source, sClass, sm, handler, originalCriteria, fullName); if (sArray != null && sArray.length > 0) { Object[] tArray = (Object[]) Array.newInstance(tClass.getComponentType(), sArray.length); if (log.isDebugEnabled()) log.debug("Translate Array of Size " + sArray.length); for (int j = 0; j < sArray.length; j++) { Object newGDO = newGraphDataObject(tClass.getComponentType()); DataTransformer.buildGraphFromDomain(sArray[j], newGDO, null, filter, fullName, false, originalCriteria, handler); tArray[j] = newGDO; if (log.isDebugEnabled()) log.debug("Add to array [" + j + "] : " + newGDO); } setValue(tAccessibleObject, target, tArray); if (log.isDebugEnabled()) log.debug("Set Array " + tName); } else { if (log.isDebugEnabled()) log.debug("Source Array is empty! Do Nothing"); } } // source is DO array // Error... No way to map property } else { String err = "Can't Mold Property " + fullName + " from " + sClass.getName() + " to " + tClass.getName(); log.error(err); throw new RuntimeException(err); } } // is included in filtered fields } // Load flex fields // By default all the domain-mapped flex fields will be loaded; unless excluded by a rule if (source instanceof IFlexFields && target instanceof IFlexFields) { String fullName = (objectPath != null ? objectPath + '.' : "") + "flexBean"; if (filter == null || filter.isFieldIncluded(fullName)) { if (log.isDebugEnabled()) log.debug("Loading FlexBean " + fullName); FlexBean sFlexBean = ((IFlexFields) source).getFlexBean(); FlexBean tFlexBean = ((IFlexFields) target).getFlexBean(); if (sFlexBean != null && tFlexBean != null) { for (DynaProperty flexProperty : sFlexBean.getDynaClass().getDynaProperties()) { String name = flexProperty.getName(); Boolean include = filter.includeField(fullName + '.' + name); if (include != null ? include : ((FlexProperty) flexProperty).getFlexInfo() .getProperty("domain-mapping") != null) { Object value = sFlexBean.get(name); if (value != null) { if (log.isDebugEnabled()) log.debug("Loaded flex field '" + name + '=' + value + '\''); tFlexBean.set(name, value); } } } } } } // Clear changed fields on updated GraphObject if (target != null && target instanceof GraphDataObject) ((GraphDataObject) target).clearChanges(); // Invoke the handler if (handler != null) { if (log.isDebugEnabled()) { log.debug("Invoking the endBeanLoad on the handler"); } for (ITransformationHandler transformationHandler : handler.getTransformationHandlers()) { transformationHandler.endBeanLoad(objectPath, source, target, filter, originalCriteria); } } } catch (ApplicationException e) { throw new ApplicationExceptions(e); } catch (IllegalAccessException e) { TransformException me = new TransformException(TransformException.ACCESS_ERROR, objectPath, e.getMessage()); log.error(me.getLocalizedMessage(), e); throw me; } catch (InvocationTargetException e) { ApplicationExceptions appExps = ExceptionHelper.extractApplicationExceptions(e); if (appExps != null) throw appExps; FrameworkException fe = ExceptionHelper.extractFrameworkException(e); if (fe != null) throw fe; TransformException me = new TransformException(TransformException.INVOCATION_ERROR, objectPath, e); log.error(me.getLocalizedMessage(), me.getCause()); throw me; } catch (InstantiationException e) { TransformException me = new TransformException(TransformException.INSTANTICATION_ERROR, objectPath, e.getMessage()); log.error(me.getLocalizedMessage(), e); throw me; } }
From source file:org.talend.repository.imports.ImportItemUtil.java
private void importItemRecord(ResourcesManager manager, ItemRecord itemRecord, boolean overwrite, IPath destinationPath, final Set<String> overwriteDeletedItems, final Set<String> idDeletedBeforeImport, String contentType, final IProgressMonitor monitor) { monitor.subTask(Messages.getString("ImportItemWizardPage.Importing") + itemRecord.getItemName()); //$NON-NLS-1$ resolveItem(manager, itemRecord);//from w w w. j a va 2 s . c o m int num = 0; for (Object obj : itemRecord.getResourceSet().getResources()) { if (!(obj instanceof PropertiesProjectResourceImpl)) { if (obj instanceof XMIResourceImpl) { num++; if (num > 2) {// The is no explanation for this value and what is this loop for to I increased // it to // 2 so that metadata migration for 4.1 works try { throw new InvocationTargetException(new PersistenceException( "The source file of " + itemRecord.getLabel() + " has error,Please check it!")); } catch (InvocationTargetException e) { ExceptionHandler.process(e); } return; } } } } final Item item = itemRecord.getItem(); if (item != null) { ProxyRepositoryFactory repFactory = ProxyRepositoryFactory.getInstance(); ERepositoryObjectType itemType = ERepositoryObjectType.getItemType(item); IPath path = new Path(item.getState().getPath()); if (destinationPath != null && itemType.name().equals(contentType)) { path = destinationPath.append(path); } try { repFactory.createParentFoldersRecursively(ProjectManager.getInstance().getCurrentProject(), itemType, path, true); } catch (Exception e) { logError(e); path = new Path(""); //$NON-NLS-1$ } try { Item tmpItem = item; // delete existing items before importing, this should be done // once for a different id String id = itemRecord.getProperty().getId(); IRepositoryViewObject lastVersion = itemRecord.getExistingItemWithSameId(); if (lastVersion != null && overwrite && !itemRecord.isLocked() && (itemRecord.getState() == State.ID_EXISTED || itemRecord.getState() == State.NAME_EXISTED || itemRecord.getState() == State.NAME_AND_ID_EXISTED) && !deletedItems.contains(id)) { if (!overwriteDeletedItems.contains(id)) { // bug 10520. ERepositoryStatus status = repFactory.getStatus(lastVersion); if (status == ERepositoryStatus.DELETED) { repFactory.restoreObject(lastVersion, path); // restore first. } overwriteDeletedItems.add(id); } /* only delete when name exsit rather than id exist */ if (itemRecord.getState().equals(ItemRecord.State.NAME_EXISTED) || itemRecord.getState().equals(ItemRecord.State.NAME_AND_ID_EXISTED)) { if (!idDeletedBeforeImport.contains(id)) { // TDI-19535 (check if exists, delete all items with same id) List<IRepositoryViewObject> allVersionToDelete = repFactory.getAllVersion( ProjectManager.getInstance().getCurrentProject(), lastVersion.getId(), false); for (IRepositoryViewObject currentVersion : allVersionToDelete) { repFactory.forceDeleteObjectPhysical(lastVersion, currentVersion.getVersion()); } idDeletedBeforeImport.add(id); } } lastVersion = null; // List<IRepositoryObject> list = cache.findObjectsByItem(itemRecord); // if (!list.isEmpty()) { // // this code will delete all version of item with same // // id // repFactory.forceDeleteObjectPhysical(list.get(0)); // deletedItems.add(id); // } } User author = itemRecord.getProperty().getAuthor(); if (author != null) { if (!repFactory.setAuthorByLogin(tmpItem, author.getLogin())) { tmpItem.getProperty().setAuthor(null); // author will be // the logged // user in // create method } } if (item instanceof JobletProcessItem) { hasJoblets = true; } if (tmpItem instanceof ProcessItem && !statAndLogsSettingsReloaded && !implicitSettingsReloaded) { ProcessItem processItem = (ProcessItem) tmpItem; ParametersType paType = processItem.getProcess().getParameters(); boolean statsPSettingRemoved = false; // for commanline import project setting if (itemRecord.isRemoveProjectStatslog()) { if (paType != null) { String paramName = "STATANDLOG_USE_PROJECT_SETTINGS"; EList listParamType = paType.getElementParameter(); for (int j = 0; j < listParamType.size(); j++) { ElementParameterType pType = (ElementParameterType) listParamType.get(j); if (pType != null && paramName.equals(pType.getName())) { pType.setValue(Boolean.FALSE.toString()); statsPSettingRemoved = true; break; } } } } // 14446: item apply project setting param if use project setting String statslogUsePSetting = null; String implicitUsePSetting = null; if (paType != null) { EList listParamType = paType.getElementParameter(); for (int j = 0; j < listParamType.size(); j++) { ElementParameterType pType = (ElementParameterType) listParamType.get(j); if (pType != null) { if (!statsPSettingRemoved && "STATANDLOG_USE_PROJECT_SETTINGS".equals(pType.getName())) { statslogUsePSetting = pType.getValue(); } if ("IMPLICITCONTEXT_USE_PROJECT_SETTINGS".equals(pType.getName())) { implicitUsePSetting = pType.getValue(); } if (statsPSettingRemoved && implicitUsePSetting != null || !statsPSettingRemoved && implicitUsePSetting != null && statslogUsePSetting != null) { break; } } } } if (statslogUsePSetting != null && Boolean.parseBoolean(statslogUsePSetting) && !statAndLogsSettingsReloaded) { CorePlugin.getDefault().getDesignerCoreService().reloadParamFromProjectSettings(paType, "STATANDLOG_USE_PROJECT_SETTINGS"); statAndLogsSettingsReloaded = true; } if (implicitUsePSetting != null && Boolean.parseBoolean(implicitUsePSetting) && !implicitSettingsReloaded) { CorePlugin.getDefault().getDesignerCoreService().reloadParamFromProjectSettings(paType, "IMPLICITCONTEXT_USE_PROJECT_SETTINGS"); implicitSettingsReloaded = true; } } if (lastVersion == null || itemRecord.getState().equals(ItemRecord.State.ID_EXISTED)) { // import has not been developed to cope with migration in mind // so some model may not be able to load like the ConnectionItems // in that case items needs to be copied before migration // here we check that the loading of the item failed before calling the create method boolean isConnectionEmptyBeforeMigration = tmpItem instanceof ConnectionItem && ((ConnectionItem) tmpItem).getConnection().eResource() == null && !itemRecord.getMigrationTasksToApply().isEmpty(); repFactory.create(tmpItem, path, true); if (isConnectionEmptyBeforeMigration) {// copy the file before migration, this is bad because it // should not refer to Filesytem // but this is a quick hack and anyway the migration task only works on files // IPath itemPath = itemRecord.getPath().removeFileExtension().addFileExtension( // FileConstants.ITEM_EXTENSION); InputStream is = manager.getStream(itemRecord.getPath().removeFileExtension() .addFileExtension(FileConstants.ITEM_EXTENSION)); try { URI propertyResourceURI = EcoreUtil.getURI(((ConnectionItem) tmpItem).getProperty()); URI relativePlateformDestUri = propertyResourceURI.trimFileExtension() .appendFileExtension(FileConstants.ITEM_EXTENSION); URL fileURL = FileLocator.toFileURL(new java.net.URL( "platform:/resource" + relativePlateformDestUri.toPlatformString(true))); //$NON-NLS-1$ OutputStream os = new FileOutputStream(fileURL.getFile()); try { FileCopyUtils.copyStreams(is, os); } finally { os.close(); } } finally { is.close(); } } else { // connections from migrations (from 4.0.x or previous version) doesn't support reference or // screenshots // so no need to call this code. // It's needed to avoid to call the save method mainly just before or after the copy of the old // connection since it will copyScreenshotFile(manager, itemRecord); boolean haveRef = copyReferenceFiles(manager, tmpItem, itemRecord.getPath()); if (haveRef) { repFactory.save(tmpItem, true); } } repFactory.unloadResources(tmpItem.getProperty()); itemRecord.setImportPath(path.toPortableString()); itemRecord.setRepositoryType(itemType); itemRecord.setItemId(itemRecord.getProperty().getId()); itemRecord.setItemVersion(itemRecord.getProperty().getVersion()); itemRecord.setImported(true); cache.addToCache(tmpItem); } else if (VersionUtils.compareTo(lastVersion.getProperty().getVersion(), tmpItem.getProperty().getVersion()) < 0) { repFactory.forceCreate(tmpItem, path); itemRecord.setImportPath(path.toPortableString()); itemRecord.setItemId(itemRecord.getProperty().getId()); itemRecord.setRepositoryType(itemType); itemRecord.setItemVersion(itemRecord.getProperty().getVersion()); itemRecord.setImported(true); cache.addToCache(tmpItem); } else { PersistenceException e = new PersistenceException( Messages.getString("ImportItemUtil.persistenceException", tmpItem.getProperty())); //$NON-NLS-1$ itemRecord.addError(e.getMessage()); logError(e); } if (tmpItem != null) { RelationshipItemBuilder.getInstance().addOrUpdateItem(tmpItem, true); if (tmpItem.getState() != null) { if (itemType != null) { final Set<String> folders = restoreFolder.getFolders(itemType); if (folders != null) { for (String folderPath : folders) { if (folderPath != null && folderPath.equals(path.toString())) { FolderItem folderItem = repFactory.getFolderItem( ProjectManager.getInstance().getCurrentProject(), itemType, path); if (folderItem != null) { folderItem.getState().setDeleted(false); while (!(folderItem.getParent() instanceof Project)) { folderItem = (FolderItem) folderItem.getParent(); if (folderItem.getType() == FolderType.SYSTEM_FOLDER_LITERAL) { break; } folderItem.getState().setDeleted(false); } } break; } } } } } } } catch (Exception e) { itemRecord.addError(e.getMessage()); logError(e); } } String label = itemRecord.getLabel(); for (Resource resource : itemRecord.getResourceSet().getResources()) { // Due to the system of lazy loading for db repository of ByteArray, // it can't be unloaded just after create the item. if (!(resource instanceof ByteArrayResource)) { resource.unload(); } } TimeMeasure.step("importItemRecords", "Import item: " + label); applyMigrationTasks(itemRecord, monitor); TimeMeasure.step("importItemRecords", "applyMigrationTasks: " + label); }