@Override
  public ProcessStatus startSourceDocCreationOrUpdate(
      final String idNoSlash,
      final String projectSlug,
      final String iterationSlug,
      final Resource resource,
      final Set<String> extensions,
      final boolean copytrans) {

    HProjectIteration hProjectIteration =
        retrieveAndCheckIteration(projectSlug, iterationSlug, true);

    resourceUtils.validateExtensions(extensions); // gettext, comment

    String name =
        "SourceDocCreationOrUpdate: " + projectSlug + "-" + iterationSlug + "-" + idNoSlash;
    AsyncTaskHandle<HDocument> handle = new AsyncTaskHandle<HDocument>();
    Serializable taskId = asyncTaskHandleManager.registerTaskHandle(handle);
    documentServiceImpl.saveDocumentAsync(
        projectSlug, iterationSlug, resource, extensions, copytrans, true, handle);

    return getProcessStatus(taskId.toString()); // TODO Change to return 202
    // Accepted,
    // with a url to get the
    // progress
  }
  @Test
  public void testWhiteBlackListAnonymousObject() throws Exception {
    File serailizeFile = new File(temporaryFolder.getRoot(), "testclass.bin");
    ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(serailizeFile));
    try {
      Serializable object = EnclosingClass.anonymousObject;
      assertTrue(object.getClass().isAnonymousClass());
      outputStream.writeObject(object);
      outputStream.flush();
    } finally {
      outputStream.close();
    }

    // default
    String blackList = null;
    String whiteList = null;
    assertNull(readSerializedObject(whiteList, blackList, serailizeFile));

    // forbidden by specifying the enclosing class
    blackList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.EnclosingClass";
    Object result = readSerializedObject(whiteList, blackList, serailizeFile);
    assertTrue(result instanceof ClassNotFoundException);

    // do it in whiteList
    blackList = null;
    whiteList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.EnclosingClass";
    result = readSerializedObject(whiteList, blackList, serailizeFile);
    assertNull(result);
  }
Пример #3
0
  @Override
  public Data process(Data data) {

    if (key != null && n != null && n >= 0) {

      Map<String, Double> counts = new LinkedHashMap<String, Double>();

      Serializable val = data.get(key);
      if (val != null) {

        String str = val.toString();
        for (int i = 0; i < str.length() - n; i++) {
          String ngram = str.substring(i, i + n);

          Double freq = counts.get(ngram);
          if (freq != null) {
            freq = freq + 1.0d;
          } else {
            freq = 1.0d;
          }
          counts.put(ngram, freq);
        }

        for (String key : counts.keySet()) {
          data.put(key, counts.get(key));
        }

        log.debug("Added {} {}-grams to item", counts.size(), n);
      }
    }

    return data;
  }
 @Override
 public RepositoryFile createFile(
     Serializable parentFolderId,
     RepositoryFile file,
     IRepositoryFileData data,
     String versionMessage) {
   if (data instanceof NodeRepositoryFileData) {
     return repositoryFileAdapter.unmarshal(
         repoWebService.createFile(
             parentFolderId != null ? parentFolderId.toString() : null,
             repositoryFileAdapter.marshal(file),
             nodeRepositoryFileDataAdapter.marshal((NodeRepositoryFileData) data),
             versionMessage));
   } else if (data instanceof SimpleRepositoryFileData) {
     SimpleRepositoryFileData simpleData = (SimpleRepositoryFileData) data;
     return repositoryFileAdapter.unmarshal(
         repoWebService.createBinaryFile(
             parentFolderId != null ? parentFolderId.toString() : null,
             repositoryFileAdapter.marshal(file),
             SimpleRepositoryFileDataDto.convert(simpleData),
             versionMessage));
   } else {
     throw new IllegalArgumentException();
   }
 }
  protected Event serializeEvent(Event event, ClassLoader portletClassLoader) {

    Serializable value = event.getValue();

    if (value == null) {
      return event;
    }

    Class<?> valueClass = value.getClass();

    String valueClassName = valueClass.getName();

    try {
      Class<?> loadedValueClass = portletClassLoader.loadClass(valueClassName);

      if (loadedValueClass.equals(valueClass)) {
        return event;
      }
    } catch (ClassNotFoundException cnfe) {
      throw new RuntimeException(cnfe);
    }

    byte[] serializedValue = SerializableUtil.serialize(value);

    value = (Serializable) SerializableUtil.deserialize(serializedValue, portletClassLoader);

    return new EventImpl(event.getName(), event.getQName(), value);
  }
Пример #6
0
 /**
  * 比较两个结构相同Bean的不相同的字段
  *
  * @param entity 新实体
  * @param old 旧实体
  * @return 返回不相同字段集合
  */
 public List<Field> equalsBean(Serializable entity, Serializable old) {
   java.lang.reflect.Field[] fields = entity.getClass().getDeclaredFields();
   String methodName = "";
   ArrayList<Field> lst = new ArrayList<Field>();
   try {
     for (int i = 0; i < fields.length; i++) {
       methodName =
           "get"
               + fields[i].getName().substring(0, 1).toUpperCase()
               + fields[i].getName().substring(1);
       Method method = entity.getClass().getDeclaredMethod(methodName);
       Object newvalue = method.invoke(entity);
       Object oldvalue = method.invoke(old);
       if (newvalue != null && oldvalue != null) {
         if (!newvalue.equals(oldvalue)) {
           lst.add(new Field(fields[i].getName(), oldvalue, newvalue));
         }
       } else {
         if (newvalue != oldvalue) {
           lst.add(new Field(fields[i].getName(), oldvalue, newvalue));
         }
       }
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
   return lst;
 }
Пример #7
0
  @Override
  public Optional<AttributeValidationReport> validate(final Attribute attribute) {
    Preconditions.checkArgument(attribute != null, "The attribute cannot be null.");

    final String name = attribute.getName();

    for (final Serializable value : attribute.getValues()) {
      final BigDecimal bdValue;
      if (value instanceof Number) {
        bdValue = new BigDecimal(value.toString());
      } else {
        continue;
      }

      if (!checkRange(bdValue)) {
        final String violationMessage =
            String.format(
                "%s must be between %s and %s", name, min.toPlainString(), max.toPlainString());
        final AttributeValidationReportImpl report = new AttributeValidationReportImpl();
        report.addViolation(
            new ValidationViolationImpl(
                Collections.singleton(name), violationMessage, Severity.ERROR));
        return Optional.of(report);
      }
    }

    return Optional.empty();
  }
  protected Event serializeEvent(Event event, ClassLoader portletClassLoader) {

    Serializable value = event.getValue();

    if (value == null) {
      return event;
    }

    Class<?> valueClass = value.getClass();

    String valueClassName = valueClass.getName();

    try {
      Class<?> loadedValueClass = portletClassLoader.loadClass(valueClassName);

      if (loadedValueClass.equals(valueClass)) {
        return event;
      }
    } catch (ClassNotFoundException cnfe) {
      if (_log.isWarnEnabled()) {
        _log.warn(portletClassLoader.toString() + " does not contain " + valueClassName, cnfe);
      }
    }

    EventImpl eventImpl = (EventImpl) event;

    String base64Value = eventImpl.getBase64Value();

    value = (Serializable) Base64.stringToObject(base64Value, portletClassLoader);

    return new EventImpl(event.getName(), event.getQName(), value);
  }
Пример #9
0
 @Override
 public Serializable getCurrentFromResultSet(
     ResultSet rs, List<Column> columns, Model model, Serializable[] returnId, int[] returnPos)
     throws SQLException {
   Serializable id = null;
   Serializable value = null;
   int i = 0;
   for (Column column : columns) {
     i++;
     String key = column.getKey();
     Serializable v = column.getFromResultSet(rs, i);
     if (key.equals(model.MAIN_KEY)) {
       id = v;
     } else if (key.equals(model.COLL_TABLE_POS_KEY)) {
       // (the pos column is ignored, results are already ordered by id
       // then pos)
     } else if (key.equals(model.COLL_TABLE_VALUE_KEY)) {
       value = v;
     } else {
       throw new RuntimeException(key);
     }
   }
   Serializable prevId = returnId[0];
   returnId[0] = id;
   int pos = (id != null && !id.equals(prevId)) ? 0 : returnPos[0] + 1;
   returnPos[0] = pos;
   return value;
 }
Пример #10
0
  /** Corresponds to <element name="javaExecutable"> */
  private Element createJavaExecutableElement(Document doc, JavaTask t) {
    Element executableE =
        doc.createElementNS(Schemas.SCHEMA_LATEST.namespace, XMLTags.JAVA_EXECUTABLE.getXMLName());
    setAttribute(executableE, XMLAttributes.TASK_CLASS_NAME, t.getExecutableClassName(), true);

    // <ref name="javaParameters"/>
    try {
      Map<String, Serializable> args = t.getArguments();
      if ((args != null) && (args.size() > 0)) {
        // <element name="parameter">
        Element paramsE =
            doc.createElementNS(
                Schemas.SCHEMA_LATEST.namespace, XMLTags.TASK_PARAMETERS.getXMLName());
        for (String name : args.keySet()) {
          Serializable val = args.get(name);
          Element paramE =
              doc.createElementNS(
                  Schemas.SCHEMA_LATEST.namespace, XMLTags.TASK_PARAMETER.getXMLName());
          setAttribute(paramE, XMLAttributes.COMMON_NAME, name, true);
          setAttribute(paramE, XMLAttributes.COMMON_VALUE, val.toString(), true);
          paramsE.appendChild(paramE);
        }
        executableE.appendChild(paramsE);
      }
    } catch (Exception e) {
      logger.error("Could not add arguments for Java Executable element of task " + t.getName(), e);
    }
    return executableE;
  }
Пример #11
0
  @Override
  public Qrcode httpQrcode(ReqTicket reqTicket, String scene) {
    Serializable sceneValue = reqTicket.generateScene();
    String actionName = reqTicket.getActionName().toString();

    Ticket ticket = weixinProxy.httpTicket(reqTicket); // 通过参数获取ticket
    String qrcodeUrl = String.format(QRCODE_URL, ticket.getTicket());
    byte[] results = HttpClientUtil.httpGet(qrcodeUrl);
    Qrcode qrcode = new Qrcode();
    qrcode.setTicketId(ticket.getId());
    qrcode.setActionName(actionName);
    qrcode.setSceneValue(sceneValue.toString());
    qrcode.setSceneType(sceneValue.getClass().getName());
    qrcode.setName(weixinConfig.getName());
    qrcode.setSuffix(weixinConfig.getSuffix());
    qrcode.setBytes(results);
    qrcode.setSceneName(scene);
    if (log.isInfoEnabled()) {
      log.info(
          "返回二维码信息:{}",
          JSON.toJSONString(
              qrcode, SerializerFeature.PrettyFormat, SerializerFeature.WriteClassName));
    }
    return qrcode;
  }
Пример #12
0
  @Override
  public Map<String, String> saveOrUpdataReturnCasecadeID(
      String objectType, HttpServletRequest request) throws Exception {

    Map<String, String> map = QueryUtil.getRequestParameterMapNoAjax(request);
    Object targetObject = Class.forName(objectType).newInstance();
    String jsonString = map.get(this.getType(objectType).getSimpleName());
    String cascadeTypes = map.get("cascadeType");

    ObjectMapper mapper = new ObjectMapper();
    mapper.configure(DeserializationConfig.Feature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true);
    mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    Class<?> clazz = this.getType(objectType);
    targetObject = mapper.readValue(jsonString, clazz);
    Serializable id = this.commDao.saveOrUpdata(objectType, targetObject);

    Object target = this.findById(objectType, id.toString());

    Map<String, String> returenIDs = new HashMap<String, String>();
    returenIDs.put("id", id.toString());

    if (cascadeTypes != null) {
      String[] s = cascadeTypes.split(",");
      for (int i = 0; i < s.length; i++) {
        PropertyDescriptor pd = BeanUtils.getPropertyDescriptor(clazz, s[i]);
        Method method = pd.getReadMethod();
        Object childTarget = method.invoke(target);
        PropertyDescriptor pdID = BeanUtils.getPropertyDescriptor(pd.getPropertyType(), "id");
        String childTargetID = pdID.getReadMethod().invoke(childTarget).toString();
        returenIDs.put(s[i], childTargetID);
      }
    }

    return returenIDs;
  }
  @SuppressWarnings({"unchecked"})
  @Override
  public Resource convert(Object source) {
    if (null == repositoryMetadata || null == source) {
      return new Resource<Object>(source);
    }

    Serializable id = (Serializable) repositoryMetadata.entityMetadata().idAttribute().get(source);
    URI selfUri = buildUri(config.getBaseUri(), repositoryMetadata.name(), id.toString());

    Set<Link> links = new HashSet<Link>();
    for (Object attrName : entityMetadata.linkedAttributes().keySet()) {
      URI uri = buildUri(selfUri, attrName.toString());
      String rel =
          repositoryMetadata.rel() + "." + source.getClass().getSimpleName() + "." + attrName;
      links.add(new Link(uri.toString(), rel));
    }
    links.add(new Link(selfUri.toString(), "self"));

    Map<String, Object> entityDto = new HashMap<String, Object>();
    for (Map.Entry<String, AttributeMetadata> attrMeta :
        ((Map<String, AttributeMetadata>) entityMetadata.embeddedAttributes()).entrySet()) {
      String name = attrMeta.getKey();
      Object val;
      if (null != (val = attrMeta.getValue().get(source))) {
        entityDto.put(name, val);
      }
    }

    return new EntityResource(entityDto, links);
  }
Пример #14
0
  @Override
  public byte[] compress() {
    Serializable value = data.get();
    if (value instanceof ByteArrayWrapper) {
      return ((ByteArrayWrapper) value).getArray();
    }

    ByteArrayOutputStream byteOut = new ByteArrayOutputStream();

    try {
      ObjectOutputStream objOut = new ObjectOutputStream(byteOut);

      objOut.writeObject(value);
      objOut.flush();
      objOut.close();
    } catch (IOException e) {
      if (Spout.debugMode()) {
        Spout.getLogger()
            .log(
                Level.SEVERE,
                "Unable to serialize "
                    + value
                    + " (type: "
                    + (value != null ? value.getClass().getSimpleName() : "null")
                    + ")",
                e);
      }
      return null;
    }

    return byteOut.toByteArray();
  }
 @Override
 @Deprecated
 public List<RepositoryFile> getChildren(Serializable folderId, String filter) {
   return unmarshalFiles(
       repoWebService.getChildrenWithFilter(
           folderId.toString() != null ? folderId.toString() : null, filter));
 }
Пример #16
0
  public static String changeID(Serializable id, String dbName, String type) {

    if (type.equals("int")
        || type.equals("java.lang.Integer")
        || type.equals("java.lang.integer")
        || type.equalsIgnoreCase("integer")) {

      return id.toString();
    }
    if (type.equals("java.lang.Long")
        || type.equals("java.lang.long")
        || type.equalsIgnoreCase("long")) {

      return id.toString();
    }

    if (type.equals("java.lang.String") || type.equalsIgnoreCase("string")) {
      char stringDelimiter = SQLManager.getInstance().getDBAdapter(dbName).getStringDelimiter();

      return "" + stringDelimiter + id + stringDelimiter;
    } else {
      char stringDelimiter = SQLManager.getInstance().getDBAdapter(dbName).getStringDelimiter();

      return "" + stringDelimiter + id + stringDelimiter;
    }
  }
Пример #17
0
  @Override
  public boolean equals(Object other) {

    if (this == other) {
      return true;
    }
    if (other == null || !(other instanceof PropertyDiffDisplay)) {
      return false;
    }
    Serializable otherValue = ((PropertyDiffDisplay) other).getValue();
    Serializable otherStyleClass = ((PropertyDiffDisplay) other).getStyleClass();
    DifferenceType otherDifferenceType = ((PropertyDiffDisplay) other).getDifferenceType();
    if (value == null
        && otherValue == null
        && styleClass == null
        && otherStyleClass == null
        && differenceType.equals(otherDifferenceType)) {
      return true;
    }
    return differenceType.equals(otherDifferenceType)
        && (value == null
                && otherValue == null
                && styleClass != null
                && styleClass.equals(otherStyleClass)
            || styleClass == null
                && otherStyleClass == null
                && value != null
                && value.equals(otherValue)
            || value != null
                && value.equals(otherValue)
                && styleClass != null
                && styleClass.equals(otherStyleClass));
  }
 @Override
 public VersionSummary getVersionSummary(Serializable fileId, Serializable versionId) {
   return versionSummaryAdapter.unmarshal(
       repoWebService.getVersionSummary(
           fileId != null ? fileId.toString() : null,
           versionId != null ? versionId.toString() : null));
 }
 @Override
 public RepositoryFile getFileAtVersion(Serializable fileId, Serializable versionId) {
   return repositoryFileAdapter.unmarshal(
       repoWebService.getFileAtVersion(
           fileId != null ? fileId.toString() : null,
           versionId != null ? versionId.toString() : null));
 }
 @Override
 public List<RepositoryFile> getChildren(
     Serializable folderId, String filter, Boolean showHiddenFiles) {
   return unmarshalFiles(
       repoWebService.getChildrenWithFilterAndHidden(
           folderId.toString() != null ? folderId.toString() : null, filter, showHiddenFiles));
 }
  @Override
  protected Serializable extractSerializableFromMessage(ObjectMessage message) throws JMSException {
    Serializable bean = super.extractSerializableFromMessage(message);
    System.out.println("-------------KKOTA----------" + bean.getClass());
    beanConfigurerSupport.configureBean(bean);

    return bean;
  }
Пример #22
0
  private void verifyIfMessageIsAWrapper(Serializable message) {

    if (!(message instanceof MessageWrapper)) {
      logger.error(
          "Wrong type of message, should be MessageWrapper, received:" + message.getClass());
      throw new IllegalArgumentException(
          "Wrong type of message, should be MessageWrapper, received:" + message.getClass());
    }
  }
Пример #23
0
  public void testUidGeneration() {
    Serializable id = this.uidGenerator.generateUid();
    assertNotNull(id);

    Serializable id2 = this.uidGenerator.generateUid();
    assertNotNull(id2);

    assertFalse(id.equals(id2));
  }
Пример #24
0
 protected Node getCurrentNode() throws RemoteException, ShellException {
   Serializable current =
       shellServer.interpretVariable(shellClient.getId(), Variables.CURRENT_KEY);
   int nodeId = parseInt(current.toString().substring(1));
   try (Transaction tx = db.beginTx()) {
     Node nodeById = db.getNodeById(nodeId);
     tx.success();
     return nodeById;
   }
 }
Пример #25
0
 @Override
 public void run() {
   isAppenderThread.set(Boolean.TRUE); // LOG4J2-485
   while (!shutdown) {
     Serializable s;
     try {
       s = queue.take();
       if (s != null && s instanceof String && SHUTDOWN.equals(s.toString())) {
         shutdown = true;
         continue;
       }
     } catch (final InterruptedException ex) {
       break; // LOG4J2-830
     }
     final Log4jLogEvent event = Log4jLogEvent.deserialize(s);
     event.setEndOfBatch(queue.isEmpty());
     final boolean success = callAppenders(event);
     if (!success && errorAppender != null) {
       try {
         errorAppender.callAppender(event);
       } catch (final Exception ex) {
         // Silently accept the error.
       }
     }
   }
   // Process any remaining items in the queue.
   LOGGER.trace(
       "AsyncAppender.AsyncThread shutting down. Processing remaining {} queue events.",
       queue.size());
   int count = 0;
   int ignored = 0;
   while (!queue.isEmpty()) {
     try {
       final Serializable s = queue.take();
       if (Log4jLogEvent.canDeserialize(s)) {
         final Log4jLogEvent event = Log4jLogEvent.deserialize(s);
         event.setEndOfBatch(queue.isEmpty());
         callAppenders(event);
         count++;
       } else {
         ignored++;
         LOGGER.trace("Ignoring event of class {}", s.getClass().getName());
       }
     } catch (final InterruptedException ex) {
       // May have been interrupted to shut down.
       // Here we ignore interrupts and try to process all remaining events.
     }
   }
   LOGGER.trace(
       "AsyncAppender.AsyncThread stopped. Queue has {} events remaining. "
           + "Processed {} and ignored {} events since shutdown started.",
       queue.size(),
       count,
       ignored);
 }
Пример #26
0
  /**
   * 字段值重复性校验 唯一性验证URL示例:id=1&element=masterId&masterId=ABC&additional=referenceId &referenceId=XYZ
   * 处理额外补充参数,有些数据是通过两个字段共同决定唯一性,可以通过additional参数补充提供
   */
  public HttpHeaders checkUnique() {
    String element = this.getParameter("element");
    Assert.notNull(element);
    GroupPropertyFilter groupPropertyFilter = new GroupPropertyFilter();

    String value = getRequest().getParameter(element);
    if (!ExtStringUtils.hasChinese(value)) {
      value = ExtStringUtils.encodeUTF8(value);
    }

    groupPropertyFilter.and(new PropertyFilter(entityClass, "EQ_" + element, value));

    // 处理额外补充参数,有些数据是通过两个字段共同决定唯一性,可以通过additional参数补充提供
    String additionalName = getRequest().getParameter("additional");
    if (StringUtils.isNotBlank(additionalName)) {
      String additionalValue = getRequest().getParameter(additionalName);
      if (!ExtStringUtils.hasChinese(additionalValue)) {
        additionalValue = ExtStringUtils.encodeUTF8(additionalValue);
      }
      groupPropertyFilter.and(new PropertyFilter(entityClass, additionalName, additionalValue));
    }
    String additionalName2 = getRequest().getParameter("additional2");
    if (StringUtils.isNotBlank(additionalName2)) {
      String additionalValue2 = getRequest().getParameter(additionalName2);
      if (!ExtStringUtils.hasChinese(additionalValue2)) {
        additionalValue2 = ExtStringUtils.encodeUTF8(additionalValue2);
      }
      groupPropertyFilter.and(new PropertyFilter(entityClass, additionalName2, additionalValue2));
    }

    List<T> entities = getEntityService().findByFilters(groupPropertyFilter);
    if (entities == null || entities.size() == 0) { // 未查到重复数据
      this.setModel(Boolean.TRUE);
    } else {
      if (entities.size() == 1) { // 查询到一条重复数据
        String id = getRequest().getParameter("id");
        if (StringUtils.isNotBlank(id)) {
          Serializable entityId = entities.get(0).getId();
          logger.debug("Check Unique Entity ID = {}", entityId);
          if (id.equals(entityId.toString())) { // 查询到数据是当前更新数据,不算已存在
            this.setModel(Boolean.TRUE);
          } else { // 查询到数据不是当前更新数据,算已存在
            this.setModel(Boolean.FALSE);
          }
        } else { // 没有提供Sid主键,说明是创建记录,则算已存在
          this.setModel(Boolean.FALSE);
        }
      } else { // 查询到多余一条重复数据,说明数据库数据本身有问题
        this.setModel(Boolean.FALSE);
        throw new WebException("error.check.unique.duplicate: " + element + "=" + value);
      }
    }
    return buildDefaultHttpHeaders();
  }
Пример #27
0
 public static Serializable getNewInstance(Type t, Serializable value) {
   switch (t) {
     case IntType:
       return Integer.valueOf(value.toString());
     case StringType:
       return new String(value.toString());
     case DoubleType:
       return Double.valueOf(value.toString());
     default:
       throw new RuntimeException("Unable to instantiate type");
   }
 }
  @Override
  protected String applyInternal() throws Exception {
    // get all users in the system
    List<PersonInfo> personInfos =
        _personService
            .getPeople(null, null, null, new PagingRequest(Integer.MAX_VALUE, null))
            .getPage();

    Set<NodeRef> people = new HashSet<NodeRef>(personInfos.size());

    for (PersonInfo personInfo : personInfos) {
      people.add(personInfo.getNodeRef());
    }

    int count = 0;

    // iterate through all the users
    for (final NodeRef person : people) {
      // get the username from the node
      final Serializable username = nodeService.getProperty(person, ContentModel.PROP_USERNAME);

      // if no username, continue
      if (username == null) {
        continue;
      }

      // if it's the guest or admin, skip as well
      if (username.toString().equals("guest") || username.toString().equals("admin")) {
        continue;
      }

      // list all sites that the user is excplicit member in
      final List<SiteInfo> sites = _siteService.listSites(username.toString());

      // the user is member of 1 site or more, continue
      if (sites.size() > 0) {
        continue;
      }

      // if this point is reached, the user is not a member of any site, so it
      // should be deleted
      LOG.error("Deleting user '" + username + "', user is not a member of any site");

      _personService.deletePerson(username.toString());

      count++;
    }

    LOG.error(
        "Deleted " + count + " of " + people.size() + " users that wasn't a member in any sites.");

    return I18NUtil.getMessage(MSG_SUCCESS);
  }
Пример #29
0
  @Override
  public void populate(final Map<String, Serializable> propertiesMap) {

    super.populate(propertiesMap); // let base class handle primitives, etc.

    // correctly convert aggregate type
    if (propertiesMap.containsKey(AGGREGATE_TYPE_ID)) {
      Serializable value = propertiesMap.get(AGGREGATE_TYPE_ID);
      if (value != null) {
        setAggregateType(AggregationType.valueOf(value.toString()));
      }
    }
  }
 private String parseContents(List<Serializable> contents) {
   StringBuilder sb = new StringBuilder();
   for (Serializable content : contents) {
     if (content instanceof JAXBElement) {
       @SuppressWarnings("unchecked")
       Object o = ((JAXBElement<Object>) content).getValue();
       if (o instanceof DocParaType) {
         DocParaType para = (DocParaType) o;
         sb.append(parseContents(para.getContent())).append("\n");
       } else if (o instanceof DocSimpleSectType) {
         DocSimpleSectType simpleSect = (DocSimpleSectType) o;
         sb.append("\n@").append(simpleSect.getKind().value()).append(" ");
         List<Object> paraAndSimplesectseps = simpleSect.getParaAndSimplesectsep();
         for (Object o2 : paraAndSimplesectseps) {
           if (o2 instanceof DocParaType) {
             DocParaType para = (DocParaType) o2;
             sb.append(parseContents(para.getContent())).append("\n");
           } else {
             sb.append(" ");
           }
         }
       } else if (o instanceof DocParamListType) {
         DocParamListType paramlist = (DocParamListType) o;
         sb.append("\n@").append(paramlist.getKind().value());
         List<DocParamListItem> parameteritem = paramlist.getParameteritem();
         for (DocParamListItem listItem : parameteritem) {
           DescriptionType parameterdescription = listItem.getParameterdescription();
           if (parameterdescription != null) {
             sb.append(this.parseDescription(parameterdescription)).append("\n");
           }
           List<DocParamNameList> parameternamelist = listItem.getParameternamelist();
           for (DocParamNameList nameList : parameternamelist) {
             List<DocParamName> parametername = nameList.getParametername();
             for (DocParamName paramName : parametername) {
               sb.append(this.parseContents(paramName.getContent())).append("\n");
             }
             List<DocParamType> parametertype = nameList.getParametertype();
             for (DocParamType paramType : parametertype) {
               sb.append(this.parseContents(paramType.getContent())).append("\n");
             }
           }
         }
       } else if (o instanceof String) {
         sb.append(o.toString()).append("\n");
       }
     } else if (content instanceof String) {
       sb.append(content.toString()).append("\n");
     }
   }
   return sb.toString().trim();
 }