Search in sources :

Example 16 with ObjectAlreadyExistsException

use of org.cristalise.kernel.common.ObjectAlreadyExistsException in project kernel by cristal-ise.

the class BulkImport method importItemPath.

public ItemPath importItemPath(ItemPath item, Object locker) throws PersistencyException {
    try {
        ItemPath itemPath = (ItemPath) importCluster.get(item, PATH + "/Item");
        Gateway.getLookupManager().add(itemPath);
        return itemPath;
    } catch (ObjectCannotBeUpdated | ObjectAlreadyExistsException | CannotManageException e) {
        Logger.error(e);
        throw new PersistencyException(e.getMessage());
    }
}
Also used : CannotManageException(org.cristalise.kernel.common.CannotManageException) ObjectCannotBeUpdated(org.cristalise.kernel.common.ObjectCannotBeUpdated) PersistencyException(org.cristalise.kernel.common.PersistencyException) ObjectAlreadyExistsException(org.cristalise.kernel.common.ObjectAlreadyExistsException) ItemPath(org.cristalise.kernel.lookup.ItemPath)

Example 17 with ObjectAlreadyExistsException

use of org.cristalise.kernel.common.ObjectAlreadyExistsException in project kernel by cristal-ise.

the class ModuleActivity method create.

@Override
public Path create(AgentPath agentPath, boolean reset) throws ObjectNotFoundException, ObjectCannotBeUpdated, CannotManageException, ObjectAlreadyExistsException, InvalidDataException {
    try {
        domainPath = Bootstrap.verifyResource(ns, name, version, type.getTypeCode(), itemPath, getResourceLocation(), reset);
        itemPath = domainPath.getItemPath();
    } catch (Exception e) {
        Logger.error(e);
        throw new CannotManageException("Exception verifying module resource " + ns + "/" + name);
    }
    actDef = LocalObjectLoader.getActDef(name, version);
    populateActivityDef();
    CollectionArrayList colls;
    try {
        colls = actDef.makeDescCollections();
    } catch (InvalidDataException e) {
        Logger.error(e);
        throw new CannotManageException("Could not create description collections for " + getName() + ".");
    }
    for (Collection<?> coll : colls.list) {
        try {
            Gateway.getStorage().put(itemPath, coll, null);
            // create last collection
            coll.setVersion(null);
            Gateway.getStorage().put(itemPath, coll, null);
        } catch (PersistencyException e) {
            Logger.error(e);
            throw new CannotManageException("Persistency exception storing description collections for " + getName() + ".");
        }
    }
    return domainPath;
}
Also used : CannotManageException(org.cristalise.kernel.common.CannotManageException) InvalidDataException(org.cristalise.kernel.common.InvalidDataException) PersistencyException(org.cristalise.kernel.common.PersistencyException) CollectionArrayList(org.cristalise.kernel.collection.CollectionArrayList) InvalidDataException(org.cristalise.kernel.common.InvalidDataException) ObjectNotFoundException(org.cristalise.kernel.common.ObjectNotFoundException) ObjectAlreadyExistsException(org.cristalise.kernel.common.ObjectAlreadyExistsException) PersistencyException(org.cristalise.kernel.common.PersistencyException) CannotManageException(org.cristalise.kernel.common.CannotManageException)

Example 18 with ObjectAlreadyExistsException

use of org.cristalise.kernel.common.ObjectAlreadyExistsException in project kernel by cristal-ise.

the class Script method makeDescCollections.

/**
 */
@Override
public CollectionArrayList makeDescCollections() throws InvalidDataException, ObjectNotFoundException {
    CollectionArrayList retArr = new CollectionArrayList();
    Dependency includeColl = new Dependency(INCLUDE);
    for (Script script : mIncludes) {
        try {
            includeColl.addMember(script.getItemPath());
        } catch (InvalidCollectionModification e) {
            throw new InvalidDataException("Could not add " + script.getName() + " to description collection. " + e.getMessage());
        } catch (ObjectAlreadyExistsException e) {
            throw new InvalidDataException("Script " + script.getName() + " included more than once.");
        }
    // 
    }
    retArr.put(includeColl);
    return retArr;
}
Also used : CompiledScript(javax.script.CompiledScript) InvalidDataException(org.cristalise.kernel.common.InvalidDataException) InvalidCollectionModification(org.cristalise.kernel.common.InvalidCollectionModification) Dependency(org.cristalise.kernel.collection.Dependency) CollectionArrayList(org.cristalise.kernel.collection.CollectionArrayList) ObjectAlreadyExistsException(org.cristalise.kernel.common.ObjectAlreadyExistsException)

Aggregations

ObjectAlreadyExistsException (org.cristalise.kernel.common.ObjectAlreadyExistsException)18 InvalidDataException (org.cristalise.kernel.common.InvalidDataException)8 CannotManageException (org.cristalise.kernel.common.CannotManageException)7 ObjectNotFoundException (org.cristalise.kernel.common.ObjectNotFoundException)7 PersistencyException (org.cristalise.kernel.common.PersistencyException)7 InvalidCollectionModification (org.cristalise.kernel.common.InvalidCollectionModification)5 DomainPath (org.cristalise.kernel.lookup.DomainPath)5 ItemPath (org.cristalise.kernel.lookup.ItemPath)5 AgentPath (org.cristalise.kernel.lookup.AgentPath)4 ObjectCannotBeUpdated (org.cristalise.kernel.common.ObjectCannotBeUpdated)3 ActiveEntity (org.cristalise.kernel.entity.agent.ActiveEntity)3 PropertyArrayList (org.cristalise.kernel.property.PropertyArrayList)3 IOException (java.io.IOException)2 CollectionArrayList (org.cristalise.kernel.collection.CollectionArrayList)2 Dependency (org.cristalise.kernel.collection.Dependency)2 TraceableEntity (org.cristalise.kernel.entity.TraceableEntity)2 InvalidItemPathException (org.cristalise.kernel.lookup.InvalidItemPathException)2 RolePath (org.cristalise.kernel.lookup.RolePath)2 CastorHashMap (org.cristalise.kernel.utils.CastorHashMap)2 MappingException (org.exolab.castor.mapping.MappingException)2