use of org.cristalise.kernel.common.InvalidCollectionModification in project kernel by cristal-ise.
the class AggregationDescription method newInstance.
/**
* For each member get the {@link PropertyDescriptionList} of the member item and look for an explicit version
*/
@Override
public Aggregation newInstance() throws ObjectNotFoundException {
AggregationInstance newInstance = new AggregationInstance(getName());
for (int i = 0; i < size(); i++) {
AggregationMember mem = mMembers.list.get(i);
//
String descVer = getDescVer(mem);
PropertyDescriptionList pdList = PropertyUtility.getPropertyDescriptionOutcome(mem.getItemPath(), descVer, null);
if (pdList != null) {
// create the new props of the member object
try {
Vertex v = getLayout().getVertexById(mem.getID());
newInstance.addMember(null, PropertyUtility.convertTransitiveProperties(pdList), pdList.getClassProps(), v.getCentrePoint(), v.getWidth(), v.getHeight());
} catch (InvalidCollectionModification e) {
} catch (ObjectAlreadyExistsException e) {
}
} else {
Logger.error("AggregationDescription::newInstance() There is no PropertyDescription. Cannot instantiate. " + mem.getItemPath());
return null;
}
}
return newInstance;
}
use of org.cristalise.kernel.common.InvalidCollectionModification in project kernel by cristal-ise.
the class CreateItemFromDescription method initialiseItem.
/**
* @param agent
* @param descItemPath
* @param locker
* @param input
* @param newName
* @param descVer
* @param context
* @param newItemPath
* @param newItem
* @throws ObjectCannotBeUpdated
* @throws CannotManageException
* @throws InvalidDataException
* @throws ObjectAlreadyExistsException
* @throws PersistencyException
* @throws ObjectNotFoundException
*/
protected void initialiseItem(ItemOperations newItem, AgentPath agent, ItemPath descItemPath, PropertyArrayList initProps, String newName, String descVer, DomainPath context, ItemPath newItemPath, Object locker) throws ObjectCannotBeUpdated, CannotManageException, InvalidDataException, ObjectAlreadyExistsException, PersistencyException, ObjectNotFoundException {
// initialise it with its properties and workflow
Logger.msg(3, "CreateItemFromDescription.initialiseItem() - Initializing Item:" + newName);
try {
PropertyArrayList newProps = instantiateProperties(descItemPath, descVer, initProps, newName, agent, locker);
CollectionArrayList newColls = instantiateCollections(descItemPath, descVer, newProps, locker);
CompositeActivity newWorkflow = instantiateWorkflow(descItemPath, descVer, locker);
newItem.initialise(agent.getSystemKey(), Gateway.getMarshaller().marshall(newProps), Gateway.getMarshaller().marshall(newWorkflow), Gateway.getMarshaller().marshall(newColls));
} catch (MarshalException | ValidationException | AccessRightsException | IOException | MappingException | InvalidCollectionModification e) {
Logger.error(e);
Gateway.getLookupManager().delete(newItemPath);
throw new InvalidDataException("CreateItemFromDescription: Problem initializing new Item. See log: " + e.getMessage());
} catch (InvalidDataException | ObjectNotFoundException | PersistencyException e) {
Logger.error(e);
Gateway.getLookupManager().delete(newItemPath);
throw e;
}
// add its domain path
Logger.msg(3, "CreateItemFromDescription - Creating " + context);
context.setItemPath(newItemPath);
Gateway.getLookupManager().add(context);
}
use of org.cristalise.kernel.common.InvalidCollectionModification 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;
}
Aggregations