Search in sources :

Example 1 with ImportItem

use of org.cristalise.kernel.entity.imports.ImportItem in project kernel by cristal-ise.

the class CreateNewItem method runActivityLogic.

@Override
protected String runActivityLogic(AgentPath agent, ItemPath item, int transitionID, String requestData, Object locker) throws InvalidDataException, ObjectCannotBeUpdated, ObjectNotFoundException, CannotManageException, ObjectAlreadyExistsException, InvalidCollectionModification {
    try {
        ImportItem newItem = (ImportItem) Gateway.getMarshaller().unmarshall(requestData);
        newItem.create(agent, false);
        return requestData;
    } catch (MarshalException | ValidationException | IOException | MappingException e) {
        Logger.error(e);
        throw new InvalidDataException("CreateNewItem: Couldn't unmarshall new Item: " + requestData);
    } catch (PersistencyException e) {
        Logger.error(e);
        throw new InvalidDataException("CreateNewItem: " + e.getMessage());
    }
}
Also used : ImportItem(org.cristalise.kernel.entity.imports.ImportItem) MarshalException(org.exolab.castor.xml.MarshalException) ValidationException(org.exolab.castor.xml.ValidationException) InvalidDataException(org.cristalise.kernel.common.InvalidDataException) PersistencyException(org.cristalise.kernel.common.PersistencyException) IOException(java.io.IOException) MappingException(org.exolab.castor.mapping.MappingException)

Example 2 with ImportItem

use of org.cristalise.kernel.entity.imports.ImportItem in project kernel by cristal-ise.

the class Module method importItems.

/**
 * @param systemAgent
 * @param reset
 * @throws Exception
 */
private void importItems(AgentProxy systemAgent, boolean reset) throws Exception {
    for (ImportItem thisItem : imports.getItems()) {
        if (Bootstrap.shutdown)
            return;
        thisItem.setNamespace(ns);
        addItemToContents(thisItem.create(systemAgent.getPath(), reset));
    }
}
Also used : ImportItem(org.cristalise.kernel.entity.imports.ImportItem)

Aggregations

ImportItem (org.cristalise.kernel.entity.imports.ImportItem)2 IOException (java.io.IOException)1 InvalidDataException (org.cristalise.kernel.common.InvalidDataException)1 PersistencyException (org.cristalise.kernel.common.PersistencyException)1 MappingException (org.exolab.castor.mapping.MappingException)1 MarshalException (org.exolab.castor.xml.MarshalException)1 ValidationException (org.exolab.castor.xml.ValidationException)1