/**
  * Return dependancy computing between this resource, and an other resource, asserting that this
  * resource is contained in this resource's dependant resources
  *
  * @param resource
  * @param dependancyScheme
  * @return
  */
 @Override
 public boolean optimisticallyDependsOf(FlexoResource resource, Date requestDate) {
   if (resource instanceof FlexoProcessResource) {
     FlexoProcessResource processRes = (FlexoProcessResource) resource;
     if (processRes.isLoaded()) {
       FlexoProcess concernedProcess = processRes.getResourceData();
       if (getGenerator() != null) {
         boolean iCanBeOptimistic = true;
         for (ComponentInstance ci :
             getGenerator().getComponentDefinition().getComponentInstances()) {
           if (ci instanceof OperationComponentInstance) {
             OperationNode operationNode = ((OperationComponentInstance) ci).getOperationNode();
             if (operationNode.getProcess() == concernedProcess) {
               if (!operationNode.getLastUpdate().before(requestDate)) {
                 iCanBeOptimistic = false;
               }
             }
           }
         }
         if (iCanBeOptimistic) {
           return false;
         }
       }
     }
   }
   return super.optimisticallyDependsOf(resource, requestDate);
 }
Example #2
0
 public static String nameForOperationNoExt(OperationNode operation, DGRepository repository) {
   return cleanFileName(
       repository.getName()
           + ".operation."
           + operation.getProcess().getName()
           + "."
           + operation.getAbstractActivityNode().getName()
           + "."
           + operation.getName());
 }
Example #3
0
  /**
   * Overrides insertElementAt
   *
   * @see
   *     org.openflexo.foundation.ie.widget.IESequence#insertElementAt(org.openflexo.foundation.ie.widget.IWidget,
   *     int)
   */
  @Override
  public void insertElementAt(ITabWidget o, int i) {
    super.insertElementAt(o, i);
    if (o instanceof IETabWidget) {

      // Generate process business data accessing method(s)
      for (OperationNode opNode :
          getComponentDefinition().getAllOperationNodesLinkedToThisComponent()) {
        ((IETabWidget) o)
            .getTabComponentDefinition()
            .getComponentDMEntity()
            .addOrUpdateAccessingBusinessDataMethod(opNode.getProcess());
      }

      registerTab((IETabWidget) o);
      setChanged();
      notifyObservers(new TabInserted((IETabWidget) o));
    }
  }
Example #4
0
  /**
   * Overrides removeFromInnerWidgets
   *
   * @see
   *     org.openflexo.foundation.ie.widget.IESequence#removeFromInnerWidgets(org.openflexo.foundation.ie.widget.IWidget,
   *     boolean)
   */
  @Override
  public void removeFromInnerWidgets(ITabWidget w, boolean deleteIfEmpty) {
    super.removeFromInnerWidgets(w, deleteIfEmpty);
    if (w instanceof IETabWidget) {

      // Remove generated method(s) for accessing process business data on the tab
      Set<FlexoProcess> componentDefinitionProcesses = new HashSet<FlexoProcess>();
      for (OperationNode opNode :
          getComponentDefinition().getAllOperationNodesLinkedToThisComponent()) {
        componentDefinitionProcesses.add(opNode.getProcess());
      }

      for (OperationComponentInstance operationComponentInstance :
          ((IETabWidget) w).getTabComponentDefinition().getAllOperationComponentInstances()) {
        if (operationComponentInstance.getComponentDefinition() != getComponentDefinition()) {
          for (OperationNode opNode :
              operationComponentInstance
                  .getComponentDefinition()
                  .getAllOperationNodesLinkedToThisComponent()) {
            componentDefinitionProcesses.remove(opNode.getProcess());
          }
        }
      }

      for (FlexoProcess process : componentDefinitionProcesses) {
        ((IETabWidget) w)
            .getTabComponentDefinition()
            .getComponentDMEntity()
            .removeAccessingBusinessDataMethod(process);
      }

      unregisterTab((IETabWidget) w);
      setChanged();
      notifyObservers(new TabRemoved((IETabWidget) w));
    }
  }
 /** @param component */
 public TabComponentInstance(TabComponentDefinition component, OperationNode operation) {
   super(component, operation.getProcess());
   setOperationNode(operation);
 }