예제 #1
0
  /*
   * (non-Javadoc)
   *
   * @see ca.unb.cs.pcsf.db.PcsfSimpleDBAccess#setProcessDeploymentId(java.lang.String)
   */
  @Override
  public void setProcessDeploymentId(String collaborationId, String processDeploymentId) {
    logger.debug(LOGPRE + "setProcessDeploymentId() start" + LOGPRE);

    List<ReplaceableItem> items = new ArrayList<ReplaceableItem>();
    ReplaceableItem item = new ReplaceableItem(collaborationId);
    item.withAttributes(
        new ReplaceableAttribute(
            COLLABORATION_ATTRIBUTE_PROCESS_DEFINITION_ID, processDeploymentId, true));

    items.add(item);

    sdb.batchPutAttributes(new BatchPutAttributesRequest(DOMAIN_COLLABORATION, items));

    logger.debug(LOGPRE + "setProcessDeploymentId() end" + LOGPRE);
  }
예제 #2
0
  /*
   * (non-Javadoc)
   *
   * @see ca.unb.cs.pcsf.db.DBAccessService#putDataIntoDomain(java.lang.Object)
   */
  public void putDataIntoDomain(Object object) {
    logger.debug(LOGPRE + "putDataIntoDomain() start" + LOGPRE);

    if (object instanceof Participant) {
      Participant participant = (Participant) object;
      List<ReplaceableItem> items = new ArrayList<ReplaceableItem>();
      items.add(
          new ReplaceableItem(participant.getId())
              .withAttributes(
                  new ReplaceableAttribute(PARTICIPANT_ATTRIBUTE_NAME, participant.getName(), true),
                  new ReplaceableAttribute(
                      PARTICIPANT_ATTRIBUTE_EMAIL, participant.getEmail(), true),
                  new ReplaceableAttribute(
                      PARTICIPANT_ATTRIBUTE_COLLABORATION_ID,
                      participant.getCollaborationId(),
                      false),
                  new ReplaceableAttribute(
                      PARTICIPANT_ATTRIBUTE_IS_REG, participant.getIsReg(), true)));

      logger.info("Putting participant <" + participant.getName() + "> into domain...");
      sdb.batchPutAttributes(new BatchPutAttributesRequest(DOMAIN_PARTICIPANT, items));
    }

    if (object instanceof Creator) {
      Creator creator = (Creator) object;
      if (!isCreatorExist(creator.getName())) {
        List<ReplaceableItem> items = new ArrayList<ReplaceableItem>();
        items.add(
            new ReplaceableItem(creator.getId())
                .withAttributes(
                    new ReplaceableAttribute(CREATOR_ATTRIBUTE_NAME, creator.getName(), true),
                    new ReplaceableAttribute(
                        CREATOR_ATTRIBUTE_PASSWORD, creator.getPassword(), true),
                    new ReplaceableAttribute(CREATOR_ATTRIBUTE_EMAIL, creator.getEmail(), true)));

        logger.info("Putting creator <" + creator.getName() + "> into domain...");
        sdb.batchPutAttributes(new BatchPutAttributesRequest(DOMAIN_CREATOR, items));
      }
    }

    if (object instanceof Collaboration) {
      Collaboration collaboration = (Collaboration) object;

      if (!isCollaborationExist(collaboration.getName())) {
        List<ReplaceableItem> items = new ArrayList<ReplaceableItem>();
        ReplaceableItem item = new ReplaceableItem(collaboration.getId());
        item.withAttributes(
            new ReplaceableAttribute(COLLABORATION_ATTRIBUTE_NAME, collaboration.getName(), true),
            new ReplaceableAttribute(
                COLLABORATION_ATTRIBUTE_CREATOR_ID, collaboration.getCreatorId(), true),
            new ReplaceableAttribute(
                COLLABORATION_ATTRIBUTE_CURRENT_STATE, collaboration.getCurrentState(), true),
            new ReplaceableAttribute(
                COLLABORATION_ATTRIBUTE_WORKFLOW_MODEL, collaboration.getWorkflowModel(), true));

        List<Participant> participants = collaboration.getParticipants();
        for (Participant participant : participants)
          item.withAttributes(
              new ReplaceableAttribute(
                  COLLABORATION_ATTRIBUTE_PARTICIPANT, participant.getName(), true));

        items.add(item);

        logger.info("Putting collaboration <" + collaboration.getName() + "> into domain...");
        sdb.batchPutAttributes(new BatchPutAttributesRequest(DOMAIN_COLLABORATION, items));
      }
    }

    logger.debug(LOGPRE + "putDataIntoDomain() end" + LOGPRE);
  }