use of org.apache.cayenne.map.Procedure in project cayenne by apache.
the class ProcedureParameterErrorMsg method displayField.
public void displayField(ProjectController mediator, JFrame frame) {
Object object = super.validationFailure.getSource();
DataChannelDescriptor domain = (DataChannelDescriptor) mediator.getProject().getRootNode();
ProcedureParameter procedureParameter = (ProcedureParameter) object;
Procedure procedure = procedureParameter.getProcedure();
DataMap map = procedure.getDataMap();
// Race condition between the two events...?
// first display the stored procedure
// for whatever reason, other validators do not require this step
// (E.g. DbAttributeErrorMsg)
ProcedureDisplayEvent procedureEvent = new ProcedureDisplayEvent(frame, procedure, map, domain);
procedureEvent.setTabReset(true);
mediator.fireProcedureDisplayEvent(procedureEvent);
// now show the failed parameter
ProcedureParameterDisplayEvent event = new ProcedureParameterDisplayEvent(frame, procedureParameter, procedure, map, domain);
event.setTabReset(true);
mediator.fireProcedureParameterDisplayEvent(event);
}
use of org.apache.cayenne.map.Procedure in project cayenne by apache.
the class ProjectTreeView method procedureAdded.
public void procedureAdded(ProcedureEvent e) {
DefaultMutableTreeNode node = getProjectModel().getNodeForObjectPath(new Object[] { mediator.getProject().getRootNode(), e.getProcedure().getDataMap() });
if (node == null) {
return;
}
Procedure procedure = e.getProcedure();
DefaultMutableTreeNode currentNode = new DefaultMutableTreeNode(procedure, false);
positionNode(node, currentNode, Comparators.getDataMapChildrenComparator());
showNode(currentNode);
}
use of org.apache.cayenne.map.Procedure in project cayenne by apache.
the class CreateProcedureAction method performAction.
public void performAction(ActionEvent e) {
ProjectController mediator = getProjectController();
DataMap map = mediator.getCurrentDataMap();
Procedure procedure = new Procedure();
procedure.setName(NameBuilder.builder(procedure, map).name());
createProcedure(map, procedure);
application.getUndoManager().addEdit(new CreateProcedureUndoableEdit(map, procedure));
}
use of org.apache.cayenne.map.Procedure in project cayenne by apache.
the class RemoveAction method removeLastPathComponent.
/**
* Removes an object, depending on its type
*/
private UndoableEdit removeLastPathComponent(ConfigurationNode object, ConfigurationNode parentObject) {
UndoableEdit undo = null;
if (object instanceof DataMap) {
if (parentObject != null && parentObject instanceof DataNodeDescriptor) {
undo = new RemoveUndoableEdit(application, (DataNodeDescriptor) parentObject, (DataMap) object);
removeDataMapFromDataNode((DataNodeDescriptor) parentObject, (DataMap) object);
} else {
// Not under Data Node, remove completely
undo = new RemoveUndoableEdit(application, (DataMap) object);
removeDataMap((DataMap) object);
}
} else if (object instanceof DataNodeDescriptor) {
undo = new RemoveUndoableEdit(application, (DataNodeDescriptor) object);
removeDataNode((DataNodeDescriptor) object);
} else if (object instanceof DbEntity) {
undo = new RemoveUndoableEdit(((DbEntity) object).getDataMap(), (DbEntity) object);
removeDbEntity(((DbEntity) object).getDataMap(), (DbEntity) object);
} else if (object instanceof ObjEntity) {
undo = new RemoveUndoableEdit(((ObjEntity) object).getDataMap(), (ObjEntity) object);
removeObjEntity(((ObjEntity) object).getDataMap(), (ObjEntity) object);
} else if (object instanceof QueryDescriptor) {
undo = new RemoveUndoableEdit(((QueryDescriptor) object).getDataMap(), (QueryDescriptor) object);
removeQuery(((QueryDescriptor) object).getDataMap(), (QueryDescriptor) object);
} else if (object instanceof Procedure) {
undo = new RemoveUndoableEdit(((Procedure) object).getDataMap(), (Procedure) object);
removeProcedure(((Procedure) object).getDataMap(), (Procedure) object);
} else if (object instanceof Embeddable) {
undo = new RemoveUndoableEdit(((Embeddable) object).getDataMap(), (Embeddable) object);
removeEmbeddable(((Embeddable) object).getDataMap(), (Embeddable) object);
}
return undo;
}
use of org.apache.cayenne.map.Procedure in project cayenne by apache.
the class CatalogUpdateController method updateCatalog.
protected void updateCatalog() {
boolean doAll = isAllEntities();
String defaultCatalog = dataMap.getDefaultCatalog();
// set catalog for DbEntities
for (DbEntity entity : dataMap.getDbEntities()) {
if (doAll || Util.isEmptyString(entity.getCatalog())) {
if (!Util.nullSafeEquals(defaultCatalog, entity.getCatalog())) {
entity.setCatalog(defaultCatalog);
// any way to batch events, a big change will flood the app
// with entity events..?
mediator.fireDbEntityEvent(new EntityEvent(this, entity));
}
}
}
// set catalog for procedures...
for (Procedure procedure : dataMap.getProcedures()) {
if (doAll || Util.isEmptyString(procedure.getCatalog())) {
if (!Util.nullSafeEquals(defaultCatalog, procedure.getCatalog())) {
procedure.setCatalog(defaultCatalog);
// any way to batch events, a big change will flood the app
// with procedure events..?
mediator.fireProcedureEvent(new ProcedureEvent(this, procedure));
}
}
}
view.dispose();
}
Aggregations