repo_name
stringlengths
7
104
file_path
stringlengths
13
198
context
stringlengths
67
7.15k
import_statement
stringlengths
16
4.43k
code
stringlengths
40
6.98k
prompt
stringlengths
227
8.27k
next_line
stringlengths
8
795
koen-serneels/HomeAutomation
src/main/java/be/error/rpi/dac/dimmer/builder/KnxDimmerProcessListener.java
// Path: src/main/java/be/error/rpi/config/RunConfig.java // public static RunConfig getInstance() { // if (runConfig == null) { // throw new IllegalStateException("Initialize first"); // } // return runConfig; // }
import tuwien.auto.calimero.GroupAddress; import tuwien.auto.calimero.process.ProcessEvent; import static be.error.rpi.config.RunConfig.getInstance; import static be.error.rpi.dac.dimmer.builder.DimDirection.UP; import static tuwien.auto.calimero.process.ProcessCommunicationBase.SCALING; import java.math.BigDecimal; import java.util.Optional; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import tuwien.auto.calimero.DetachEvent;
this.deactivateOnOtherUse = deactivateOnOtherUse; if (minDimVal.isPresent()) { this.minDimVal = minDimVal.get(); } setDimmer(dimmer); } @Override public void groupWrite(final ProcessEvent e) { try { if (deactivateOnOtherUse.isPresent() && e.getDestination().equals(deactivateOnOtherUse.get())) { this.suspendedForOtherUse = asBool(e); } if (suspendedForOtherUse) { dimmer.interrupt(); return; } if (dim.isPresent() && e.getDestination().equals(dim.get())) { dimmer.interrupt(); boolean b = asBool(e); if (b) { DimmerCommand dimmerCommand = new DimmerCommand(dimmer.getLastDimDirection() == UP ? new BigDecimal(minDimVal) : new BigDecimal(100), e.getSourceAddr()); dimmerCommand.setActicatedByPrecense(precenseDetectorLock.isPresent()); if (onOffOverride.isPresent()) {
// Path: src/main/java/be/error/rpi/config/RunConfig.java // public static RunConfig getInstance() { // if (runConfig == null) { // throw new IllegalStateException("Initialize first"); // } // return runConfig; // } // Path: src/main/java/be/error/rpi/dac/dimmer/builder/KnxDimmerProcessListener.java import tuwien.auto.calimero.GroupAddress; import tuwien.auto.calimero.process.ProcessEvent; import static be.error.rpi.config.RunConfig.getInstance; import static be.error.rpi.dac.dimmer.builder.DimDirection.UP; import static tuwien.auto.calimero.process.ProcessCommunicationBase.SCALING; import java.math.BigDecimal; import java.util.Optional; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import tuwien.auto.calimero.DetachEvent; this.deactivateOnOtherUse = deactivateOnOtherUse; if (minDimVal.isPresent()) { this.minDimVal = minDimVal.get(); } setDimmer(dimmer); } @Override public void groupWrite(final ProcessEvent e) { try { if (deactivateOnOtherUse.isPresent() && e.getDestination().equals(deactivateOnOtherUse.get())) { this.suspendedForOtherUse = asBool(e); } if (suspendedForOtherUse) { dimmer.interrupt(); return; } if (dim.isPresent() && e.getDestination().equals(dim.get())) { dimmer.interrupt(); boolean b = asBool(e); if (b) { DimmerCommand dimmerCommand = new DimmerCommand(dimmer.getLastDimDirection() == UP ? new BigDecimal(minDimVal) : new BigDecimal(100), e.getSourceAddr()); dimmerCommand.setActicatedByPrecense(precenseDetectorLock.isPresent()); if (onOffOverride.isPresent()) {
getInstance().getKnxConnectionFactory().runWithProcessCommunicator(pc -> pc.write(precenseDetectorLock.get(), true));
koen-serneels/HomeAutomation
src/main/java/be/error/rpi/adc/ObjectStatusUdpSender.java
// Path: src/main/java/be/error/rpi/adc/ObjectStatusTypeMapper.java // public enum ObjectStatusType { // OPEN((byte) 1), // CLOSED((byte) 2), // SHORT_CIRCUIT((byte) 3), // CIRCUIT_BREACH((byte) 4), // READ_ERROR((byte) 5); // // private byte id; // // ObjectStatusType(final byte id) { // this.id = id; // } // // public byte getId() { // return id; // } // }
import be.error.rpi.adc.ObjectStatusTypeMapper.ObjectStatusType; import static org.apache.commons.lang3.ArrayUtils.add; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.lang3.tuple.Pair;
/*- * #%L * Home Automation * %% * Copyright (C) 2016 - 2017 Koen Serneels * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ package be.error.rpi.adc; /** * @author Koen Serneels */ public class ObjectStatusUdpSender { private String host; private int port;
// Path: src/main/java/be/error/rpi/adc/ObjectStatusTypeMapper.java // public enum ObjectStatusType { // OPEN((byte) 1), // CLOSED((byte) 2), // SHORT_CIRCUIT((byte) 3), // CIRCUIT_BREACH((byte) 4), // READ_ERROR((byte) 5); // // private byte id; // // ObjectStatusType(final byte id) { // this.id = id; // } // // public byte getId() { // return id; // } // } // Path: src/main/java/be/error/rpi/adc/ObjectStatusUdpSender.java import be.error.rpi.adc.ObjectStatusTypeMapper.ObjectStatusType; import static org.apache.commons.lang3.ArrayUtils.add; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.lang3.tuple.Pair; /*- * #%L * Home Automation * %% * Copyright (C) 2016 - 2017 Koen Serneels * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ package be.error.rpi.adc; /** * @author Koen Serneels */ public class ObjectStatusUdpSender { private String host; private int port;
private Map<String, ObjectStatusType> mappers = new HashMap<>();
koen-serneels/HomeAutomation
src/main/java/be/error/rpi/heating/jobs/HeatingInfoPollerJob.java
// Path: src/main/java/be/error/rpi/config/RunConfig.java // public static RunConfig getInstance() { // if (runConfig == null) { // throw new IllegalStateException("Initialize first"); // } // return runConfig; // } // // Path: src/main/java/be/error/rpi/ebus/EbusCommand.java // public interface EbusCommand<R> { // // String[] getEbusCommands(); // // R convertResult(List<String> results); // // default boolean withResult() { // return false; // } // } // // Path: src/main/java/be/error/rpi/ebus/EbusdTcpCommunicatorImpl.java // public class EbusdTcpCommunicatorImpl implements EbusdTcpCommunicator { // private static final Logger logger = LoggerFactory.getLogger("ebusd"); // private final EbusDeviceAddress ebusDeviceAddress; // // public EbusdTcpCommunicatorImpl(final EbusDeviceAddress ebusDeviceAddress) { // this.ebusDeviceAddress = ebusDeviceAddress; // } // // public List<String> send(EbusCommand ebusCommand) throws Exception { // try (Socket clientSocket = new Socket(getInstance().getEbusdIp(), getInstance().getEbusdPort())) { // List<String> results = new ArrayList<>(); // DataOutputStream out = new DataOutputStream(clientSocket.getOutputStream()); // BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); // // for (String command : ebusCommand.getEbusCommands()) { // String toSend = "hex -s " + ebusDeviceAddress.getEbusAddressPrefix() + " " + command; // logger.debug("Writing to ebus: " + toSend); // out.writeBytes(toSend + "\n"); // String result = in.readLine(); // logger.debug(" Result:" + result); // if (!ebusCommand.withResult() && !result.equals("00")) { // logger.error("Command hex " + command + " resulted in " + result + " should have been 00"); // } // results.add(result); // in.readLine(); // sleep(200); // } // out.close(); // in.close(); // return results; // } // } // }
import org.slf4j.LoggerFactory; import tuwien.auto.calimero.GroupAddress; import be.error.rpi.ebus.EbusCommand; import be.error.rpi.ebus.EbusdTcpCommunicatorImpl; import static be.error.rpi.config.RunConfig.getInstance; import java.math.BigDecimal; import java.util.List; import java.util.Map.Entry; import org.apache.commons.lang3.ArrayUtils; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.slf4j.Logger;
/*- * #%L * Home Automation * %% * Copyright (C) 2016 - 2017 Koen Serneels * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ package be.error.rpi.heating.jobs; public class HeatingInfoPollerJob implements Job { public static String JOB_CONFIG_KEY = "jobconfig"; private static final Logger logger = LoggerFactory.getLogger("heating"); @Override public void execute(final JobExecutionContext context) throws JobExecutionException { try { logger.debug("Status poller job starting..."); JobConfig jobConfig = (JobConfig) context.getJobDetail().getJobDataMap().get(JOB_CONFIG_KEY);
// Path: src/main/java/be/error/rpi/config/RunConfig.java // public static RunConfig getInstance() { // if (runConfig == null) { // throw new IllegalStateException("Initialize first"); // } // return runConfig; // } // // Path: src/main/java/be/error/rpi/ebus/EbusCommand.java // public interface EbusCommand<R> { // // String[] getEbusCommands(); // // R convertResult(List<String> results); // // default boolean withResult() { // return false; // } // } // // Path: src/main/java/be/error/rpi/ebus/EbusdTcpCommunicatorImpl.java // public class EbusdTcpCommunicatorImpl implements EbusdTcpCommunicator { // private static final Logger logger = LoggerFactory.getLogger("ebusd"); // private final EbusDeviceAddress ebusDeviceAddress; // // public EbusdTcpCommunicatorImpl(final EbusDeviceAddress ebusDeviceAddress) { // this.ebusDeviceAddress = ebusDeviceAddress; // } // // public List<String> send(EbusCommand ebusCommand) throws Exception { // try (Socket clientSocket = new Socket(getInstance().getEbusdIp(), getInstance().getEbusdPort())) { // List<String> results = new ArrayList<>(); // DataOutputStream out = new DataOutputStream(clientSocket.getOutputStream()); // BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); // // for (String command : ebusCommand.getEbusCommands()) { // String toSend = "hex -s " + ebusDeviceAddress.getEbusAddressPrefix() + " " + command; // logger.debug("Writing to ebus: " + toSend); // out.writeBytes(toSend + "\n"); // String result = in.readLine(); // logger.debug(" Result:" + result); // if (!ebusCommand.withResult() && !result.equals("00")) { // logger.error("Command hex " + command + " resulted in " + result + " should have been 00"); // } // results.add(result); // in.readLine(); // sleep(200); // } // out.close(); // in.close(); // return results; // } // } // } // Path: src/main/java/be/error/rpi/heating/jobs/HeatingInfoPollerJob.java import org.slf4j.LoggerFactory; import tuwien.auto.calimero.GroupAddress; import be.error.rpi.ebus.EbusCommand; import be.error.rpi.ebus.EbusdTcpCommunicatorImpl; import static be.error.rpi.config.RunConfig.getInstance; import java.math.BigDecimal; import java.util.List; import java.util.Map.Entry; import org.apache.commons.lang3.ArrayUtils; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.slf4j.Logger; /*- * #%L * Home Automation * %% * Copyright (C) 2016 - 2017 Koen Serneels * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ package be.error.rpi.heating.jobs; public class HeatingInfoPollerJob implements Job { public static String JOB_CONFIG_KEY = "jobconfig"; private static final Logger logger = LoggerFactory.getLogger("heating"); @Override public void execute(final JobExecutionContext context) throws JobExecutionException { try { logger.debug("Status poller job starting..."); JobConfig jobConfig = (JobConfig) context.getJobDetail().getJobDataMap().get(JOB_CONFIG_KEY);
for (Entry<EbusCommand<?>, GroupAddress> entry : jobConfig.getEbusCommands().entrySet()) {
koen-serneels/HomeAutomation
src/main/java/be/error/rpi/heating/jobs/HeatingInfoPollerJob.java
// Path: src/main/java/be/error/rpi/config/RunConfig.java // public static RunConfig getInstance() { // if (runConfig == null) { // throw new IllegalStateException("Initialize first"); // } // return runConfig; // } // // Path: src/main/java/be/error/rpi/ebus/EbusCommand.java // public interface EbusCommand<R> { // // String[] getEbusCommands(); // // R convertResult(List<String> results); // // default boolean withResult() { // return false; // } // } // // Path: src/main/java/be/error/rpi/ebus/EbusdTcpCommunicatorImpl.java // public class EbusdTcpCommunicatorImpl implements EbusdTcpCommunicator { // private static final Logger logger = LoggerFactory.getLogger("ebusd"); // private final EbusDeviceAddress ebusDeviceAddress; // // public EbusdTcpCommunicatorImpl(final EbusDeviceAddress ebusDeviceAddress) { // this.ebusDeviceAddress = ebusDeviceAddress; // } // // public List<String> send(EbusCommand ebusCommand) throws Exception { // try (Socket clientSocket = new Socket(getInstance().getEbusdIp(), getInstance().getEbusdPort())) { // List<String> results = new ArrayList<>(); // DataOutputStream out = new DataOutputStream(clientSocket.getOutputStream()); // BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); // // for (String command : ebusCommand.getEbusCommands()) { // String toSend = "hex -s " + ebusDeviceAddress.getEbusAddressPrefix() + " " + command; // logger.debug("Writing to ebus: " + toSend); // out.writeBytes(toSend + "\n"); // String result = in.readLine(); // logger.debug(" Result:" + result); // if (!ebusCommand.withResult() && !result.equals("00")) { // logger.error("Command hex " + command + " resulted in " + result + " should have been 00"); // } // results.add(result); // in.readLine(); // sleep(200); // } // out.close(); // in.close(); // return results; // } // } // }
import org.slf4j.LoggerFactory; import tuwien.auto.calimero.GroupAddress; import be.error.rpi.ebus.EbusCommand; import be.error.rpi.ebus.EbusdTcpCommunicatorImpl; import static be.error.rpi.config.RunConfig.getInstance; import java.math.BigDecimal; import java.util.List; import java.util.Map.Entry; import org.apache.commons.lang3.ArrayUtils; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.slf4j.Logger;
/*- * #%L * Home Automation * %% * Copyright (C) 2016 - 2017 Koen Serneels * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ package be.error.rpi.heating.jobs; public class HeatingInfoPollerJob implements Job { public static String JOB_CONFIG_KEY = "jobconfig"; private static final Logger logger = LoggerFactory.getLogger("heating"); @Override public void execute(final JobExecutionContext context) throws JobExecutionException { try { logger.debug("Status poller job starting..."); JobConfig jobConfig = (JobConfig) context.getJobDetail().getJobDataMap().get(JOB_CONFIG_KEY); for (Entry<EbusCommand<?>, GroupAddress> entry : jobConfig.getEbusCommands().entrySet()) { logger.debug("Requesting status with command " + entry.getKey().getEbusCommands());
// Path: src/main/java/be/error/rpi/config/RunConfig.java // public static RunConfig getInstance() { // if (runConfig == null) { // throw new IllegalStateException("Initialize first"); // } // return runConfig; // } // // Path: src/main/java/be/error/rpi/ebus/EbusCommand.java // public interface EbusCommand<R> { // // String[] getEbusCommands(); // // R convertResult(List<String> results); // // default boolean withResult() { // return false; // } // } // // Path: src/main/java/be/error/rpi/ebus/EbusdTcpCommunicatorImpl.java // public class EbusdTcpCommunicatorImpl implements EbusdTcpCommunicator { // private static final Logger logger = LoggerFactory.getLogger("ebusd"); // private final EbusDeviceAddress ebusDeviceAddress; // // public EbusdTcpCommunicatorImpl(final EbusDeviceAddress ebusDeviceAddress) { // this.ebusDeviceAddress = ebusDeviceAddress; // } // // public List<String> send(EbusCommand ebusCommand) throws Exception { // try (Socket clientSocket = new Socket(getInstance().getEbusdIp(), getInstance().getEbusdPort())) { // List<String> results = new ArrayList<>(); // DataOutputStream out = new DataOutputStream(clientSocket.getOutputStream()); // BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); // // for (String command : ebusCommand.getEbusCommands()) { // String toSend = "hex -s " + ebusDeviceAddress.getEbusAddressPrefix() + " " + command; // logger.debug("Writing to ebus: " + toSend); // out.writeBytes(toSend + "\n"); // String result = in.readLine(); // logger.debug(" Result:" + result); // if (!ebusCommand.withResult() && !result.equals("00")) { // logger.error("Command hex " + command + " resulted in " + result + " should have been 00"); // } // results.add(result); // in.readLine(); // sleep(200); // } // out.close(); // in.close(); // return results; // } // } // } // Path: src/main/java/be/error/rpi/heating/jobs/HeatingInfoPollerJob.java import org.slf4j.LoggerFactory; import tuwien.auto.calimero.GroupAddress; import be.error.rpi.ebus.EbusCommand; import be.error.rpi.ebus.EbusdTcpCommunicatorImpl; import static be.error.rpi.config.RunConfig.getInstance; import java.math.BigDecimal; import java.util.List; import java.util.Map.Entry; import org.apache.commons.lang3.ArrayUtils; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.slf4j.Logger; /*- * #%L * Home Automation * %% * Copyright (C) 2016 - 2017 Koen Serneels * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ package be.error.rpi.heating.jobs; public class HeatingInfoPollerJob implements Job { public static String JOB_CONFIG_KEY = "jobconfig"; private static final Logger logger = LoggerFactory.getLogger("heating"); @Override public void execute(final JobExecutionContext context) throws JobExecutionException { try { logger.debug("Status poller job starting..."); JobConfig jobConfig = (JobConfig) context.getJobDetail().getJobDataMap().get(JOB_CONFIG_KEY); for (Entry<EbusCommand<?>, GroupAddress> entry : jobConfig.getEbusCommands().entrySet()) { logger.debug("Requesting status with command " + entry.getKey().getEbusCommands());
List<String> result = new EbusdTcpCommunicatorImpl(jobConfig.getEbusDeviceAddress()).send(entry.getKey());
koen-serneels/HomeAutomation
src/main/java/be/error/rpi/heating/jobs/HeatingInfoPollerJob.java
// Path: src/main/java/be/error/rpi/config/RunConfig.java // public static RunConfig getInstance() { // if (runConfig == null) { // throw new IllegalStateException("Initialize first"); // } // return runConfig; // } // // Path: src/main/java/be/error/rpi/ebus/EbusCommand.java // public interface EbusCommand<R> { // // String[] getEbusCommands(); // // R convertResult(List<String> results); // // default boolean withResult() { // return false; // } // } // // Path: src/main/java/be/error/rpi/ebus/EbusdTcpCommunicatorImpl.java // public class EbusdTcpCommunicatorImpl implements EbusdTcpCommunicator { // private static final Logger logger = LoggerFactory.getLogger("ebusd"); // private final EbusDeviceAddress ebusDeviceAddress; // // public EbusdTcpCommunicatorImpl(final EbusDeviceAddress ebusDeviceAddress) { // this.ebusDeviceAddress = ebusDeviceAddress; // } // // public List<String> send(EbusCommand ebusCommand) throws Exception { // try (Socket clientSocket = new Socket(getInstance().getEbusdIp(), getInstance().getEbusdPort())) { // List<String> results = new ArrayList<>(); // DataOutputStream out = new DataOutputStream(clientSocket.getOutputStream()); // BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); // // for (String command : ebusCommand.getEbusCommands()) { // String toSend = "hex -s " + ebusDeviceAddress.getEbusAddressPrefix() + " " + command; // logger.debug("Writing to ebus: " + toSend); // out.writeBytes(toSend + "\n"); // String result = in.readLine(); // logger.debug(" Result:" + result); // if (!ebusCommand.withResult() && !result.equals("00")) { // logger.error("Command hex " + command + " resulted in " + result + " should have been 00"); // } // results.add(result); // in.readLine(); // sleep(200); // } // out.close(); // in.close(); // return results; // } // } // }
import org.slf4j.LoggerFactory; import tuwien.auto.calimero.GroupAddress; import be.error.rpi.ebus.EbusCommand; import be.error.rpi.ebus.EbusdTcpCommunicatorImpl; import static be.error.rpi.config.RunConfig.getInstance; import java.math.BigDecimal; import java.util.List; import java.util.Map.Entry; import org.apache.commons.lang3.ArrayUtils; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.slf4j.Logger;
/*- * #%L * Home Automation * %% * Copyright (C) 2016 - 2017 Koen Serneels * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ package be.error.rpi.heating.jobs; public class HeatingInfoPollerJob implements Job { public static String JOB_CONFIG_KEY = "jobconfig"; private static final Logger logger = LoggerFactory.getLogger("heating"); @Override public void execute(final JobExecutionContext context) throws JobExecutionException { try { logger.debug("Status poller job starting..."); JobConfig jobConfig = (JobConfig) context.getJobDetail().getJobDataMap().get(JOB_CONFIG_KEY); for (Entry<EbusCommand<?>, GroupAddress> entry : jobConfig.getEbusCommands().entrySet()) { logger.debug("Requesting status with command " + entry.getKey().getEbusCommands()); List<String> result = new EbusdTcpCommunicatorImpl(jobConfig.getEbusDeviceAddress()).send(entry.getKey()); logger.debug("Result for command " + entry.getKey().getEbusCommands() + " -> " + ArrayUtils.toString(result, "")); Object converted = entry.getKey().convertResult(result); logger.debug("Sending result " + converted + " to GA: " + entry.getValue()); if (converted instanceof Float) {
// Path: src/main/java/be/error/rpi/config/RunConfig.java // public static RunConfig getInstance() { // if (runConfig == null) { // throw new IllegalStateException("Initialize first"); // } // return runConfig; // } // // Path: src/main/java/be/error/rpi/ebus/EbusCommand.java // public interface EbusCommand<R> { // // String[] getEbusCommands(); // // R convertResult(List<String> results); // // default boolean withResult() { // return false; // } // } // // Path: src/main/java/be/error/rpi/ebus/EbusdTcpCommunicatorImpl.java // public class EbusdTcpCommunicatorImpl implements EbusdTcpCommunicator { // private static final Logger logger = LoggerFactory.getLogger("ebusd"); // private final EbusDeviceAddress ebusDeviceAddress; // // public EbusdTcpCommunicatorImpl(final EbusDeviceAddress ebusDeviceAddress) { // this.ebusDeviceAddress = ebusDeviceAddress; // } // // public List<String> send(EbusCommand ebusCommand) throws Exception { // try (Socket clientSocket = new Socket(getInstance().getEbusdIp(), getInstance().getEbusdPort())) { // List<String> results = new ArrayList<>(); // DataOutputStream out = new DataOutputStream(clientSocket.getOutputStream()); // BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); // // for (String command : ebusCommand.getEbusCommands()) { // String toSend = "hex -s " + ebusDeviceAddress.getEbusAddressPrefix() + " " + command; // logger.debug("Writing to ebus: " + toSend); // out.writeBytes(toSend + "\n"); // String result = in.readLine(); // logger.debug(" Result:" + result); // if (!ebusCommand.withResult() && !result.equals("00")) { // logger.error("Command hex " + command + " resulted in " + result + " should have been 00"); // } // results.add(result); // in.readLine(); // sleep(200); // } // out.close(); // in.close(); // return results; // } // } // } // Path: src/main/java/be/error/rpi/heating/jobs/HeatingInfoPollerJob.java import org.slf4j.LoggerFactory; import tuwien.auto.calimero.GroupAddress; import be.error.rpi.ebus.EbusCommand; import be.error.rpi.ebus.EbusdTcpCommunicatorImpl; import static be.error.rpi.config.RunConfig.getInstance; import java.math.BigDecimal; import java.util.List; import java.util.Map.Entry; import org.apache.commons.lang3.ArrayUtils; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.slf4j.Logger; /*- * #%L * Home Automation * %% * Copyright (C) 2016 - 2017 Koen Serneels * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ package be.error.rpi.heating.jobs; public class HeatingInfoPollerJob implements Job { public static String JOB_CONFIG_KEY = "jobconfig"; private static final Logger logger = LoggerFactory.getLogger("heating"); @Override public void execute(final JobExecutionContext context) throws JobExecutionException { try { logger.debug("Status poller job starting..."); JobConfig jobConfig = (JobConfig) context.getJobDetail().getJobDataMap().get(JOB_CONFIG_KEY); for (Entry<EbusCommand<?>, GroupAddress> entry : jobConfig.getEbusCommands().entrySet()) { logger.debug("Requesting status with command " + entry.getKey().getEbusCommands()); List<String> result = new EbusdTcpCommunicatorImpl(jobConfig.getEbusDeviceAddress()).send(entry.getKey()); logger.debug("Result for command " + entry.getKey().getEbusCommands() + " -> " + ArrayUtils.toString(result, "")); Object converted = entry.getKey().convertResult(result); logger.debug("Sending result " + converted + " to GA: " + entry.getValue()); if (converted instanceof Float) {
getInstance().getKnxConnectionFactory().runWithProcessCommunicator(pc -> pc.write(entry.getValue(), (Float) converted, false));
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/NFSeCancelamento.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/NFSePedidoCancelamento.java // public class NFSePedidoCancelamento { // // @XStreamAlias("InfPedidoCancelamento") // @NotNull // private NFSeInfPedidoCancelamento infPedidoCancelamento; // // public NFSePedidoCancelamento(NFSeInfPedidoCancelamento infPedidoCancelamento) { // this.infPedidoCancelamento = infPedidoCancelamento; // } // // public NFSeInfPedidoCancelamento getInfPedidoCancelamento() { // return infPedidoCancelamento; // } // }
import javax.validation.constraints.NotNull; import com.pablodomingos.classes.rps.NFSePedidoCancelamento; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
package com.pablodomingos.classes.rps.servicos; @XStreamAlias("CancelarNfseEnvio") public class NFSeCancelamento extends AbstractService{ @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd"; @XStreamAlias("Pedido") @NotNull
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/NFSePedidoCancelamento.java // public class NFSePedidoCancelamento { // // @XStreamAlias("InfPedidoCancelamento") // @NotNull // private NFSeInfPedidoCancelamento infPedidoCancelamento; // // public NFSePedidoCancelamento(NFSeInfPedidoCancelamento infPedidoCancelamento) { // this.infPedidoCancelamento = infPedidoCancelamento; // } // // public NFSeInfPedidoCancelamento getInfPedidoCancelamento() { // return infPedidoCancelamento; // } // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/NFSeCancelamento.java import javax.validation.constraints.NotNull; import com.pablodomingos.classes.rps.NFSePedidoCancelamento; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute; package com.pablodomingos.classes.rps.servicos; @XStreamAlias("CancelarNfseEnvio") public class NFSeCancelamento extends AbstractService{ @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd"; @XStreamAlias("Pedido") @NotNull
private NFSePedidoCancelamento pedido;
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/assinatura/CertificadoConfig.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/enums/NFSeAmbiente.java // public enum NFSeAmbiente { // // HOMOLOGACAO(1, "Homolocacao"), // PRODUCAO(2, "Producao"); // // private int codigo; // private String descricao; // // NFSeAmbiente(int codigo, String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return String.valueOf(this.codigo); // } // // public String getDescricao() { // return this.descricao; // } // // public static NFSeAmbiente fromInt(int codigo) { // if (codigo > 1 && codigo < 2) { // for (NFSeAmbiente tipo : NFSeAmbiente.values()) { // if (tipo.getCodigo().equals(String.valueOf(codigo))) { // return tipo; // } // } // } // return null; // } // // @Override // public String toString() { // return String.valueOf(codigo); // } // }
import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.nio.file.Paths; import java.security.KeyStore; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.Provider; import java.security.Security; import java.security.cert.CertificateException; import java.util.Arrays; import com.pablodomingos.classes.rps.enums.NFSeAmbiente;
package com.pablodomingos.assinatura; public class CertificadoConfig { private TipoCertificado tipoCertificado; private String senhaCertificado; private String aliasCertificado; private String caminhoParaCertificado; private String caminhoParaCadeiaCertificado; private KeyStore keyStoreCertificado;
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/enums/NFSeAmbiente.java // public enum NFSeAmbiente { // // HOMOLOGACAO(1, "Homolocacao"), // PRODUCAO(2, "Producao"); // // private int codigo; // private String descricao; // // NFSeAmbiente(int codigo, String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return String.valueOf(this.codigo); // } // // public String getDescricao() { // return this.descricao; // } // // public static NFSeAmbiente fromInt(int codigo) { // if (codigo > 1 && codigo < 2) { // for (NFSeAmbiente tipo : NFSeAmbiente.values()) { // if (tipo.getCodigo().equals(String.valueOf(codigo))) { // return tipo; // } // } // } // return null; // } // // @Override // public String toString() { // return String.valueOf(codigo); // } // } // Path: nfse-bh/src/main/java/com/pablodomingos/assinatura/CertificadoConfig.java import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.nio.file.Paths; import java.security.KeyStore; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.Provider; import java.security.Security; import java.security.cert.CertificateException; import java.util.Arrays; import com.pablodomingos.classes.rps.enums.NFSeAmbiente; package com.pablodomingos.assinatura; public class CertificadoConfig { private TipoCertificado tipoCertificado; private String senhaCertificado; private String aliasCertificado; private String caminhoParaCertificado; private String caminhoParaCadeiaCertificado; private KeyStore keyStoreCertificado;
private NFSeAmbiente ambiente;
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/MensagemRetorno.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsIdentificacao.java // public class RpsIdentificacao { // // @XStreamAlias("Numero") // @NotNull // @Pattern(regexp = "\\d+") // @Size(min=1, max=15) // private String numero; // // @XStreamAlias("Serie") // @NotNull // private RpsSerie serie = RpsSerie.A; // // @XStreamAlias("Tipo") // @NotNull // private RpsTipo tipo = RpsTipo.RPS; // // public RpsIdentificacao(String numero) { // this.numero = numero; // } // // public String getNumero() { // return numero; // } // // public RpsSerie getSerie() { // return serie; // } // // public void setSerie(RpsSerie serie) { // this.serie = serie; // } // // public RpsTipo getTipo() { // return tipo; // } // // public void setTipo(RpsTipo tipo) { // this.tipo = tipo; // } // // }
import com.pablodomingos.classes.rps.RpsIdentificacao; import com.thoughtworks.xstream.annotations.XStreamAlias;
package com.pablodomingos.classes.rps.servicos; @XStreamAlias("MensagemRetorno") public class MensagemRetorno { @XStreamAlias("Mensagem") private String mensagem; @XStreamAlias("Codigo") private String codigo; @XStreamAlias("IdentificacaoRps")
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsIdentificacao.java // public class RpsIdentificacao { // // @XStreamAlias("Numero") // @NotNull // @Pattern(regexp = "\\d+") // @Size(min=1, max=15) // private String numero; // // @XStreamAlias("Serie") // @NotNull // private RpsSerie serie = RpsSerie.A; // // @XStreamAlias("Tipo") // @NotNull // private RpsTipo tipo = RpsTipo.RPS; // // public RpsIdentificacao(String numero) { // this.numero = numero; // } // // public String getNumero() { // return numero; // } // // public RpsSerie getSerie() { // return serie; // } // // public void setSerie(RpsSerie serie) { // this.serie = serie; // } // // public RpsTipo getTipo() { // return tipo; // } // // public void setTipo(RpsTipo tipo) { // this.tipo = tipo; // } // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/MensagemRetorno.java import com.pablodomingos.classes.rps.RpsIdentificacao; import com.thoughtworks.xstream.annotations.XStreamAlias; package com.pablodomingos.classes.rps.servicos; @XStreamAlias("MensagemRetorno") public class MensagemRetorno { @XStreamAlias("Mensagem") private String mensagem; @XStreamAlias("Codigo") private String codigo; @XStreamAlias("IdentificacaoRps")
private RpsIdentificacao rpsIdentificacao;
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/GerarNFSeResposta.java
// Path: nfse-bh/src/main/java/com/pablodomingos/conversores/LocalDateTimeConversor.java // public class LocalDateTimeConversor implements SingleValueConverter { // // @SuppressWarnings("rawtypes") // public boolean canConvert(Class classe) { // return classe.equals(LocalDateTime.class); // } // // private String getConverted(LocalDateTime source) { // if (source == null) { // throw new IllegalArgumentException("Data nao pode ser nula"); // } // return DateTimeFormatter.ISO_DATE_TIME.format(source); // } // // public String toString(Object obj) { // return getConverted((LocalDateTime) obj); // } // // public LocalDateTime fromString(String dateString) { // return LocalDateTime.parse(dateString, DateTimeFormatter.ISO_DATE_TIME); // } // // }
import java.time.LocalDateTime; import com.pablodomingos.conversores.LocalDateTimeConversor; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute; import com.thoughtworks.xstream.annotations.XStreamConverter;
package com.pablodomingos.classes.rps.servicos; @XStreamAlias("GerarNfseResposta") public class GerarNFSeResposta { @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd"; @XStreamAlias("NumeroLote") private Long numeroLote; @XStreamAlias("DataRecebimento")
// Path: nfse-bh/src/main/java/com/pablodomingos/conversores/LocalDateTimeConversor.java // public class LocalDateTimeConversor implements SingleValueConverter { // // @SuppressWarnings("rawtypes") // public boolean canConvert(Class classe) { // return classe.equals(LocalDateTime.class); // } // // private String getConverted(LocalDateTime source) { // if (source == null) { // throw new IllegalArgumentException("Data nao pode ser nula"); // } // return DateTimeFormatter.ISO_DATE_TIME.format(source); // } // // public String toString(Object obj) { // return getConverted((LocalDateTime) obj); // } // // public LocalDateTime fromString(String dateString) { // return LocalDateTime.parse(dateString, DateTimeFormatter.ISO_DATE_TIME); // } // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/GerarNFSeResposta.java import java.time.LocalDateTime; import com.pablodomingos.conversores.LocalDateTimeConversor; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute; import com.thoughtworks.xstream.annotations.XStreamConverter; package com.pablodomingos.classes.rps.servicos; @XStreamAlias("GerarNfseResposta") public class GerarNFSeResposta { @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd"; @XStreamAlias("NumeroLote") private Long numeroLote; @XStreamAlias("DataRecebimento")
@XStreamConverter(LocalDateTimeConversor.class)
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/LoteRpsConsultaSituacao.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsPrestador.java // public class RpsPrestador { // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min = 1, max = 15) // private String inscricaoMunicipal; // // public RpsPrestador(PrestadorBuilder builder) { // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // }
import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.RpsPrestador; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
package com.pablodomingos.classes.rps.servicos; @XStreamAlias("ConsultarSituacaoLoteRpsEnvio") public class LoteRpsConsultaSituacao extends AbstractService{ @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd"; @XStreamAlias("Prestador") @NotNull
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsPrestador.java // public class RpsPrestador { // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min = 1, max = 15) // private String inscricaoMunicipal; // // public RpsPrestador(PrestadorBuilder builder) { // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/LoteRpsConsultaSituacao.java import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.RpsPrestador; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute; package com.pablodomingos.classes.rps.servicos; @XStreamAlias("ConsultarSituacaoLoteRpsEnvio") public class LoteRpsConsultaSituacao extends AbstractService{ @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd"; @XStreamAlias("Prestador") @NotNull
private RpsPrestador prestador;
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsTomadorContato.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/TomadorContatoBuilder.java // public class TomadorContatoBuilder extends AbstractBuilder<RpsTomadorContato>{ // // // private String telefone; // private String email; // // public TomadorContatoBuilder() {} // // public TomadorContatoBuilder comTelefone(String telefone) { // this.telefone = telefone; // return this; // } // // public TomadorContatoBuilder comEmail(String email) { // this.email = email; // return this; // } // // @Override // protected RpsTomadorContato buildInternal() { // return new RpsTomadorContato(this); // } // // public String getTelefone() { // return telefone; // } // // public String getEmail() { // return email; // } // }
import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.builders.TomadorContatoBuilder; import com.thoughtworks.xstream.annotations.XStreamAlias;
package com.pablodomingos.classes.rps; public class RpsTomadorContato { @XStreamAlias("Telefone") @Pattern(regexp = "\\d+") @Size(min=10, max=11) private String telefone; @XStreamAlias("Email") @Pattern(regexp = "^(.+)@(.+)$") @Size(min=1, max=80) private String email;
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/TomadorContatoBuilder.java // public class TomadorContatoBuilder extends AbstractBuilder<RpsTomadorContato>{ // // // private String telefone; // private String email; // // public TomadorContatoBuilder() {} // // public TomadorContatoBuilder comTelefone(String telefone) { // this.telefone = telefone; // return this; // } // // public TomadorContatoBuilder comEmail(String email) { // this.email = email; // return this; // } // // @Override // protected RpsTomadorContato buildInternal() { // return new RpsTomadorContato(this); // } // // public String getTelefone() { // return telefone; // } // // public String getEmail() { // return email; // } // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsTomadorContato.java import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.builders.TomadorContatoBuilder; import com.thoughtworks.xstream.annotations.XStreamAlias; package com.pablodomingos.classes.rps; public class RpsTomadorContato { @XStreamAlias("Telefone") @Pattern(regexp = "\\d+") @Size(min=10, max=11) private String telefone; @XStreamAlias("Email") @Pattern(regexp = "^(.+)@(.+)$") @Size(min=1, max=80) private String email;
public RpsTomadorContato(TomadorContatoBuilder builder){
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/NFSeIdentificacao.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/IdentificacaoNFSeBuilder.java // public class IdentificacaoNFSeBuilder extends AbstractBuilder<NFSeIdentificacao>{ // // private String numero; // private String cnpj; // private String inscricaoMunicipal; // private String codigoMunicipioIbge; // // public IdentificacaoNFSeBuilder() {} // // public IdentificacaoNFSeBuilder comNumero(String numero){ // this.numero = numero; // return this; // } // // public IdentificacaoNFSeBuilder comCnpj(String cnpj){ // this.cnpj = cnpj; // return this; // } // // public IdentificacaoNFSeBuilder comInscricaoMunicipal(String inscricaoMunicipal){ // this.inscricaoMunicipal = inscricaoMunicipal; // return this; // } // // public IdentificacaoNFSeBuilder comCodigoMunicipioIbge(String codigoMunicipioIbge){ // this.codigoMunicipioIbge = codigoMunicipioIbge; // return this; // } // // @Override // protected NFSeIdentificacao buildInternal() { // return new NFSeIdentificacao(this); // } // // public String getNumero() { // return numero; // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // public String getCodigoMunicipioIbge() { // return codigoMunicipioIbge; // } // // }
import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import org.hibernate.validator.constraints.br.CNPJ; import com.pablodomingos.classes.rps.builders.IdentificacaoNFSeBuilder; import com.thoughtworks.xstream.annotations.XStreamAlias;
package com.pablodomingos.classes.rps; public class NFSeIdentificacao { @XStreamAlias("Numero") @NotNull @Pattern(regexp = "\\d+") @Size(min=1, max=15) private String numero; @XStreamAlias("Cnpj") @NotNull @CNPJ private String cnpj; @XStreamAlias("InscricaoMunicipal") @Size(min = 1, max = 15) private String inscricaoMunicipal; @XStreamAlias("CodigoMunicipio") @NotNull @Pattern(regexp = "\\d+") @Size(min = 1, max = 7) private String codigoMunicipioIbge;
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/IdentificacaoNFSeBuilder.java // public class IdentificacaoNFSeBuilder extends AbstractBuilder<NFSeIdentificacao>{ // // private String numero; // private String cnpj; // private String inscricaoMunicipal; // private String codigoMunicipioIbge; // // public IdentificacaoNFSeBuilder() {} // // public IdentificacaoNFSeBuilder comNumero(String numero){ // this.numero = numero; // return this; // } // // public IdentificacaoNFSeBuilder comCnpj(String cnpj){ // this.cnpj = cnpj; // return this; // } // // public IdentificacaoNFSeBuilder comInscricaoMunicipal(String inscricaoMunicipal){ // this.inscricaoMunicipal = inscricaoMunicipal; // return this; // } // // public IdentificacaoNFSeBuilder comCodigoMunicipioIbge(String codigoMunicipioIbge){ // this.codigoMunicipioIbge = codigoMunicipioIbge; // return this; // } // // @Override // protected NFSeIdentificacao buildInternal() { // return new NFSeIdentificacao(this); // } // // public String getNumero() { // return numero; // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // public String getCodigoMunicipioIbge() { // return codigoMunicipioIbge; // } // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/NFSeIdentificacao.java import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import org.hibernate.validator.constraints.br.CNPJ; import com.pablodomingos.classes.rps.builders.IdentificacaoNFSeBuilder; import com.thoughtworks.xstream.annotations.XStreamAlias; package com.pablodomingos.classes.rps; public class NFSeIdentificacao { @XStreamAlias("Numero") @NotNull @Pattern(regexp = "\\d+") @Size(min=1, max=15) private String numero; @XStreamAlias("Cnpj") @NotNull @CNPJ private String cnpj; @XStreamAlias("InscricaoMunicipal") @Size(min = 1, max = 15) private String inscricaoMunicipal; @XStreamAlias("CodigoMunicipio") @NotNull @Pattern(regexp = "\\d+") @Size(min = 1, max = 7) private String codigoMunicipioIbge;
public NFSeIdentificacao(IdentificacaoNFSeBuilder builder) {
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/NFSeConsulta.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/PeriodoEmissao.java // public class PeriodoEmissao { // @XStreamAlias("DataInicial") // @XStreamConverter(LocalDateConversor.class) // @NotNull // private LocalDate dataInicial; // // @XStreamAlias("DataFinal") // @XStreamConverter(LocalDateConversor.class) // @NotNull // private LocalDate dataFinal; // // public PeriodoEmissao(LocalDate dataInicial, LocalDate dataFinal) { // this.dataInicial = dataInicial; // if (dataFinal.isAfter(LocalDate.now())) { // throw new DateTimeException("Data final nao pode ser maior que a atual"); // } // this.dataFinal = dataFinal; // } // // public LocalDate getDataInicial() { // return dataInicial; // } // // public LocalDate getDataFinal() { // return dataFinal; // } // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsIntermediario.java // public class RpsIntermediario { // // @XStreamAlias("RazaoSocial") // @NotNull // @Size(min = 1, max = 115) // private String nome; // // @XStreamAlias("CpfCnpj") // @NotNull // private RpsIntermediarioCpfCnpj cpfCnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min=1, max=15) // private String inscricaoMunicipal; // // public RpsIntermediario(IntermediarioBuilder builder){ // // this.nome = builder.getNome(); // this.cpfCnpj = builder.getCpfCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // // } // // public String getNome() { // return nome; // } // // public RpsIntermediarioCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsPrestador.java // public class RpsPrestador { // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min = 1, max = 15) // private String inscricaoMunicipal; // // public RpsPrestador(PrestadorBuilder builder) { // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsTomadorIdentificacao.java // public class RpsTomadorIdentificacao { // // @XStreamAlias("CpfCnpj") // private RpsTomadorCpfCnpj cpfCnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min=1, max=15) // private String inscricaoMunicipal; // // public RpsTomadorIdentificacao(TomadorIdentificacaoBuilder builder) { // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // this.cpfCnpj = builder.getCpfCnpj(); // } // // public RpsTomadorCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // }
import java.time.LocalDate; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.PeriodoEmissao; import com.pablodomingos.classes.rps.RpsIntermediario; import com.pablodomingos.classes.rps.RpsPrestador; import com.pablodomingos.classes.rps.RpsTomadorIdentificacao; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
package com.pablodomingos.classes.rps.servicos; @XStreamAlias("ConsultarNfseEnvio") public class NFSeConsulta extends AbstractService{ @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd"; @XStreamAlias("Prestador") @NotNull
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/PeriodoEmissao.java // public class PeriodoEmissao { // @XStreamAlias("DataInicial") // @XStreamConverter(LocalDateConversor.class) // @NotNull // private LocalDate dataInicial; // // @XStreamAlias("DataFinal") // @XStreamConverter(LocalDateConversor.class) // @NotNull // private LocalDate dataFinal; // // public PeriodoEmissao(LocalDate dataInicial, LocalDate dataFinal) { // this.dataInicial = dataInicial; // if (dataFinal.isAfter(LocalDate.now())) { // throw new DateTimeException("Data final nao pode ser maior que a atual"); // } // this.dataFinal = dataFinal; // } // // public LocalDate getDataInicial() { // return dataInicial; // } // // public LocalDate getDataFinal() { // return dataFinal; // } // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsIntermediario.java // public class RpsIntermediario { // // @XStreamAlias("RazaoSocial") // @NotNull // @Size(min = 1, max = 115) // private String nome; // // @XStreamAlias("CpfCnpj") // @NotNull // private RpsIntermediarioCpfCnpj cpfCnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min=1, max=15) // private String inscricaoMunicipal; // // public RpsIntermediario(IntermediarioBuilder builder){ // // this.nome = builder.getNome(); // this.cpfCnpj = builder.getCpfCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // // } // // public String getNome() { // return nome; // } // // public RpsIntermediarioCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsPrestador.java // public class RpsPrestador { // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min = 1, max = 15) // private String inscricaoMunicipal; // // public RpsPrestador(PrestadorBuilder builder) { // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsTomadorIdentificacao.java // public class RpsTomadorIdentificacao { // // @XStreamAlias("CpfCnpj") // private RpsTomadorCpfCnpj cpfCnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min=1, max=15) // private String inscricaoMunicipal; // // public RpsTomadorIdentificacao(TomadorIdentificacaoBuilder builder) { // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // this.cpfCnpj = builder.getCpfCnpj(); // } // // public RpsTomadorCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/NFSeConsulta.java import java.time.LocalDate; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.PeriodoEmissao; import com.pablodomingos.classes.rps.RpsIntermediario; import com.pablodomingos.classes.rps.RpsPrestador; import com.pablodomingos.classes.rps.RpsTomadorIdentificacao; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute; package com.pablodomingos.classes.rps.servicos; @XStreamAlias("ConsultarNfseEnvio") public class NFSeConsulta extends AbstractService{ @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd"; @XStreamAlias("Prestador") @NotNull
private RpsPrestador prestador;
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/NFSeConsulta.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/PeriodoEmissao.java // public class PeriodoEmissao { // @XStreamAlias("DataInicial") // @XStreamConverter(LocalDateConversor.class) // @NotNull // private LocalDate dataInicial; // // @XStreamAlias("DataFinal") // @XStreamConverter(LocalDateConversor.class) // @NotNull // private LocalDate dataFinal; // // public PeriodoEmissao(LocalDate dataInicial, LocalDate dataFinal) { // this.dataInicial = dataInicial; // if (dataFinal.isAfter(LocalDate.now())) { // throw new DateTimeException("Data final nao pode ser maior que a atual"); // } // this.dataFinal = dataFinal; // } // // public LocalDate getDataInicial() { // return dataInicial; // } // // public LocalDate getDataFinal() { // return dataFinal; // } // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsIntermediario.java // public class RpsIntermediario { // // @XStreamAlias("RazaoSocial") // @NotNull // @Size(min = 1, max = 115) // private String nome; // // @XStreamAlias("CpfCnpj") // @NotNull // private RpsIntermediarioCpfCnpj cpfCnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min=1, max=15) // private String inscricaoMunicipal; // // public RpsIntermediario(IntermediarioBuilder builder){ // // this.nome = builder.getNome(); // this.cpfCnpj = builder.getCpfCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // // } // // public String getNome() { // return nome; // } // // public RpsIntermediarioCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsPrestador.java // public class RpsPrestador { // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min = 1, max = 15) // private String inscricaoMunicipal; // // public RpsPrestador(PrestadorBuilder builder) { // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsTomadorIdentificacao.java // public class RpsTomadorIdentificacao { // // @XStreamAlias("CpfCnpj") // private RpsTomadorCpfCnpj cpfCnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min=1, max=15) // private String inscricaoMunicipal; // // public RpsTomadorIdentificacao(TomadorIdentificacaoBuilder builder) { // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // this.cpfCnpj = builder.getCpfCnpj(); // } // // public RpsTomadorCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // }
import java.time.LocalDate; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.PeriodoEmissao; import com.pablodomingos.classes.rps.RpsIntermediario; import com.pablodomingos.classes.rps.RpsPrestador; import com.pablodomingos.classes.rps.RpsTomadorIdentificacao; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
package com.pablodomingos.classes.rps.servicos; @XStreamAlias("ConsultarNfseEnvio") public class NFSeConsulta extends AbstractService{ @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd"; @XStreamAlias("Prestador") @NotNull private RpsPrestador prestador; @XStreamAlias("NumeroNfse") @Size(min = 15, max = 15) private String numeroNFSe;
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/PeriodoEmissao.java // public class PeriodoEmissao { // @XStreamAlias("DataInicial") // @XStreamConverter(LocalDateConversor.class) // @NotNull // private LocalDate dataInicial; // // @XStreamAlias("DataFinal") // @XStreamConverter(LocalDateConversor.class) // @NotNull // private LocalDate dataFinal; // // public PeriodoEmissao(LocalDate dataInicial, LocalDate dataFinal) { // this.dataInicial = dataInicial; // if (dataFinal.isAfter(LocalDate.now())) { // throw new DateTimeException("Data final nao pode ser maior que a atual"); // } // this.dataFinal = dataFinal; // } // // public LocalDate getDataInicial() { // return dataInicial; // } // // public LocalDate getDataFinal() { // return dataFinal; // } // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsIntermediario.java // public class RpsIntermediario { // // @XStreamAlias("RazaoSocial") // @NotNull // @Size(min = 1, max = 115) // private String nome; // // @XStreamAlias("CpfCnpj") // @NotNull // private RpsIntermediarioCpfCnpj cpfCnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min=1, max=15) // private String inscricaoMunicipal; // // public RpsIntermediario(IntermediarioBuilder builder){ // // this.nome = builder.getNome(); // this.cpfCnpj = builder.getCpfCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // // } // // public String getNome() { // return nome; // } // // public RpsIntermediarioCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsPrestador.java // public class RpsPrestador { // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min = 1, max = 15) // private String inscricaoMunicipal; // // public RpsPrestador(PrestadorBuilder builder) { // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsTomadorIdentificacao.java // public class RpsTomadorIdentificacao { // // @XStreamAlias("CpfCnpj") // private RpsTomadorCpfCnpj cpfCnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min=1, max=15) // private String inscricaoMunicipal; // // public RpsTomadorIdentificacao(TomadorIdentificacaoBuilder builder) { // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // this.cpfCnpj = builder.getCpfCnpj(); // } // // public RpsTomadorCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/NFSeConsulta.java import java.time.LocalDate; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.PeriodoEmissao; import com.pablodomingos.classes.rps.RpsIntermediario; import com.pablodomingos.classes.rps.RpsPrestador; import com.pablodomingos.classes.rps.RpsTomadorIdentificacao; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute; package com.pablodomingos.classes.rps.servicos; @XStreamAlias("ConsultarNfseEnvio") public class NFSeConsulta extends AbstractService{ @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd"; @XStreamAlias("Prestador") @NotNull private RpsPrestador prestador; @XStreamAlias("NumeroNfse") @Size(min = 15, max = 15) private String numeroNFSe;
@XStreamAlias("PeriodoEmissao")
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/NFSeConsulta.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/PeriodoEmissao.java // public class PeriodoEmissao { // @XStreamAlias("DataInicial") // @XStreamConverter(LocalDateConversor.class) // @NotNull // private LocalDate dataInicial; // // @XStreamAlias("DataFinal") // @XStreamConverter(LocalDateConversor.class) // @NotNull // private LocalDate dataFinal; // // public PeriodoEmissao(LocalDate dataInicial, LocalDate dataFinal) { // this.dataInicial = dataInicial; // if (dataFinal.isAfter(LocalDate.now())) { // throw new DateTimeException("Data final nao pode ser maior que a atual"); // } // this.dataFinal = dataFinal; // } // // public LocalDate getDataInicial() { // return dataInicial; // } // // public LocalDate getDataFinal() { // return dataFinal; // } // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsIntermediario.java // public class RpsIntermediario { // // @XStreamAlias("RazaoSocial") // @NotNull // @Size(min = 1, max = 115) // private String nome; // // @XStreamAlias("CpfCnpj") // @NotNull // private RpsIntermediarioCpfCnpj cpfCnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min=1, max=15) // private String inscricaoMunicipal; // // public RpsIntermediario(IntermediarioBuilder builder){ // // this.nome = builder.getNome(); // this.cpfCnpj = builder.getCpfCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // // } // // public String getNome() { // return nome; // } // // public RpsIntermediarioCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsPrestador.java // public class RpsPrestador { // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min = 1, max = 15) // private String inscricaoMunicipal; // // public RpsPrestador(PrestadorBuilder builder) { // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsTomadorIdentificacao.java // public class RpsTomadorIdentificacao { // // @XStreamAlias("CpfCnpj") // private RpsTomadorCpfCnpj cpfCnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min=1, max=15) // private String inscricaoMunicipal; // // public RpsTomadorIdentificacao(TomadorIdentificacaoBuilder builder) { // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // this.cpfCnpj = builder.getCpfCnpj(); // } // // public RpsTomadorCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // }
import java.time.LocalDate; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.PeriodoEmissao; import com.pablodomingos.classes.rps.RpsIntermediario; import com.pablodomingos.classes.rps.RpsPrestador; import com.pablodomingos.classes.rps.RpsTomadorIdentificacao; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
package com.pablodomingos.classes.rps.servicos; @XStreamAlias("ConsultarNfseEnvio") public class NFSeConsulta extends AbstractService{ @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd"; @XStreamAlias("Prestador") @NotNull private RpsPrestador prestador; @XStreamAlias("NumeroNfse") @Size(min = 15, max = 15) private String numeroNFSe; @XStreamAlias("PeriodoEmissao") @NotNull private PeriodoEmissao periodoEmissao; @XStreamAlias("Tomador")
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/PeriodoEmissao.java // public class PeriodoEmissao { // @XStreamAlias("DataInicial") // @XStreamConverter(LocalDateConversor.class) // @NotNull // private LocalDate dataInicial; // // @XStreamAlias("DataFinal") // @XStreamConverter(LocalDateConversor.class) // @NotNull // private LocalDate dataFinal; // // public PeriodoEmissao(LocalDate dataInicial, LocalDate dataFinal) { // this.dataInicial = dataInicial; // if (dataFinal.isAfter(LocalDate.now())) { // throw new DateTimeException("Data final nao pode ser maior que a atual"); // } // this.dataFinal = dataFinal; // } // // public LocalDate getDataInicial() { // return dataInicial; // } // // public LocalDate getDataFinal() { // return dataFinal; // } // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsIntermediario.java // public class RpsIntermediario { // // @XStreamAlias("RazaoSocial") // @NotNull // @Size(min = 1, max = 115) // private String nome; // // @XStreamAlias("CpfCnpj") // @NotNull // private RpsIntermediarioCpfCnpj cpfCnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min=1, max=15) // private String inscricaoMunicipal; // // public RpsIntermediario(IntermediarioBuilder builder){ // // this.nome = builder.getNome(); // this.cpfCnpj = builder.getCpfCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // // } // // public String getNome() { // return nome; // } // // public RpsIntermediarioCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsPrestador.java // public class RpsPrestador { // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min = 1, max = 15) // private String inscricaoMunicipal; // // public RpsPrestador(PrestadorBuilder builder) { // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsTomadorIdentificacao.java // public class RpsTomadorIdentificacao { // // @XStreamAlias("CpfCnpj") // private RpsTomadorCpfCnpj cpfCnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min=1, max=15) // private String inscricaoMunicipal; // // public RpsTomadorIdentificacao(TomadorIdentificacaoBuilder builder) { // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // this.cpfCnpj = builder.getCpfCnpj(); // } // // public RpsTomadorCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/NFSeConsulta.java import java.time.LocalDate; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.PeriodoEmissao; import com.pablodomingos.classes.rps.RpsIntermediario; import com.pablodomingos.classes.rps.RpsPrestador; import com.pablodomingos.classes.rps.RpsTomadorIdentificacao; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute; package com.pablodomingos.classes.rps.servicos; @XStreamAlias("ConsultarNfseEnvio") public class NFSeConsulta extends AbstractService{ @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd"; @XStreamAlias("Prestador") @NotNull private RpsPrestador prestador; @XStreamAlias("NumeroNfse") @Size(min = 15, max = 15) private String numeroNFSe; @XStreamAlias("PeriodoEmissao") @NotNull private PeriodoEmissao periodoEmissao; @XStreamAlias("Tomador")
private RpsTomadorIdentificacao tomador;
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/NFSeConsulta.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/PeriodoEmissao.java // public class PeriodoEmissao { // @XStreamAlias("DataInicial") // @XStreamConverter(LocalDateConversor.class) // @NotNull // private LocalDate dataInicial; // // @XStreamAlias("DataFinal") // @XStreamConverter(LocalDateConversor.class) // @NotNull // private LocalDate dataFinal; // // public PeriodoEmissao(LocalDate dataInicial, LocalDate dataFinal) { // this.dataInicial = dataInicial; // if (dataFinal.isAfter(LocalDate.now())) { // throw new DateTimeException("Data final nao pode ser maior que a atual"); // } // this.dataFinal = dataFinal; // } // // public LocalDate getDataInicial() { // return dataInicial; // } // // public LocalDate getDataFinal() { // return dataFinal; // } // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsIntermediario.java // public class RpsIntermediario { // // @XStreamAlias("RazaoSocial") // @NotNull // @Size(min = 1, max = 115) // private String nome; // // @XStreamAlias("CpfCnpj") // @NotNull // private RpsIntermediarioCpfCnpj cpfCnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min=1, max=15) // private String inscricaoMunicipal; // // public RpsIntermediario(IntermediarioBuilder builder){ // // this.nome = builder.getNome(); // this.cpfCnpj = builder.getCpfCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // // } // // public String getNome() { // return nome; // } // // public RpsIntermediarioCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsPrestador.java // public class RpsPrestador { // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min = 1, max = 15) // private String inscricaoMunicipal; // // public RpsPrestador(PrestadorBuilder builder) { // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsTomadorIdentificacao.java // public class RpsTomadorIdentificacao { // // @XStreamAlias("CpfCnpj") // private RpsTomadorCpfCnpj cpfCnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min=1, max=15) // private String inscricaoMunicipal; // // public RpsTomadorIdentificacao(TomadorIdentificacaoBuilder builder) { // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // this.cpfCnpj = builder.getCpfCnpj(); // } // // public RpsTomadorCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // }
import java.time.LocalDate; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.PeriodoEmissao; import com.pablodomingos.classes.rps.RpsIntermediario; import com.pablodomingos.classes.rps.RpsPrestador; import com.pablodomingos.classes.rps.RpsTomadorIdentificacao; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
package com.pablodomingos.classes.rps.servicos; @XStreamAlias("ConsultarNfseEnvio") public class NFSeConsulta extends AbstractService{ @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd"; @XStreamAlias("Prestador") @NotNull private RpsPrestador prestador; @XStreamAlias("NumeroNfse") @Size(min = 15, max = 15) private String numeroNFSe; @XStreamAlias("PeriodoEmissao") @NotNull private PeriodoEmissao periodoEmissao; @XStreamAlias("Tomador") private RpsTomadorIdentificacao tomador; @XStreamAlias("IntermediarioServico")
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/PeriodoEmissao.java // public class PeriodoEmissao { // @XStreamAlias("DataInicial") // @XStreamConverter(LocalDateConversor.class) // @NotNull // private LocalDate dataInicial; // // @XStreamAlias("DataFinal") // @XStreamConverter(LocalDateConversor.class) // @NotNull // private LocalDate dataFinal; // // public PeriodoEmissao(LocalDate dataInicial, LocalDate dataFinal) { // this.dataInicial = dataInicial; // if (dataFinal.isAfter(LocalDate.now())) { // throw new DateTimeException("Data final nao pode ser maior que a atual"); // } // this.dataFinal = dataFinal; // } // // public LocalDate getDataInicial() { // return dataInicial; // } // // public LocalDate getDataFinal() { // return dataFinal; // } // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsIntermediario.java // public class RpsIntermediario { // // @XStreamAlias("RazaoSocial") // @NotNull // @Size(min = 1, max = 115) // private String nome; // // @XStreamAlias("CpfCnpj") // @NotNull // private RpsIntermediarioCpfCnpj cpfCnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min=1, max=15) // private String inscricaoMunicipal; // // public RpsIntermediario(IntermediarioBuilder builder){ // // this.nome = builder.getNome(); // this.cpfCnpj = builder.getCpfCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // // } // // public String getNome() { // return nome; // } // // public RpsIntermediarioCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsPrestador.java // public class RpsPrestador { // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min = 1, max = 15) // private String inscricaoMunicipal; // // public RpsPrestador(PrestadorBuilder builder) { // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsTomadorIdentificacao.java // public class RpsTomadorIdentificacao { // // @XStreamAlias("CpfCnpj") // private RpsTomadorCpfCnpj cpfCnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min=1, max=15) // private String inscricaoMunicipal; // // public RpsTomadorIdentificacao(TomadorIdentificacaoBuilder builder) { // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // this.cpfCnpj = builder.getCpfCnpj(); // } // // public RpsTomadorCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/NFSeConsulta.java import java.time.LocalDate; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.PeriodoEmissao; import com.pablodomingos.classes.rps.RpsIntermediario; import com.pablodomingos.classes.rps.RpsPrestador; import com.pablodomingos.classes.rps.RpsTomadorIdentificacao; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute; package com.pablodomingos.classes.rps.servicos; @XStreamAlias("ConsultarNfseEnvio") public class NFSeConsulta extends AbstractService{ @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd"; @XStreamAlias("Prestador") @NotNull private RpsPrestador prestador; @XStreamAlias("NumeroNfse") @Size(min = 15, max = 15) private String numeroNFSe; @XStreamAlias("PeriodoEmissao") @NotNull private PeriodoEmissao periodoEmissao; @XStreamAlias("Tomador") private RpsTomadorIdentificacao tomador; @XStreamAlias("IntermediarioServico")
private RpsIntermediario intermediario;
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/RpsConsulta.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsIdentificacao.java // public class RpsIdentificacao { // // @XStreamAlias("Numero") // @NotNull // @Pattern(regexp = "\\d+") // @Size(min=1, max=15) // private String numero; // // @XStreamAlias("Serie") // @NotNull // private RpsSerie serie = RpsSerie.A; // // @XStreamAlias("Tipo") // @NotNull // private RpsTipo tipo = RpsTipo.RPS; // // public RpsIdentificacao(String numero) { // this.numero = numero; // } // // public String getNumero() { // return numero; // } // // public RpsSerie getSerie() { // return serie; // } // // public void setSerie(RpsSerie serie) { // this.serie = serie; // } // // public RpsTipo getTipo() { // return tipo; // } // // public void setTipo(RpsTipo tipo) { // this.tipo = tipo; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsPrestador.java // public class RpsPrestador { // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min = 1, max = 15) // private String inscricaoMunicipal; // // public RpsPrestador(PrestadorBuilder builder) { // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // }
import javax.validation.constraints.NotNull; import com.pablodomingos.classes.rps.RpsIdentificacao; import com.pablodomingos.classes.rps.RpsPrestador; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
package com.pablodomingos.classes.rps.servicos; @XStreamAlias("ConsultarNfseRpsEnvio") public class RpsConsulta extends AbstractService{ @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd"; @XStreamAlias("IdentificacaoRps") @NotNull
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsIdentificacao.java // public class RpsIdentificacao { // // @XStreamAlias("Numero") // @NotNull // @Pattern(regexp = "\\d+") // @Size(min=1, max=15) // private String numero; // // @XStreamAlias("Serie") // @NotNull // private RpsSerie serie = RpsSerie.A; // // @XStreamAlias("Tipo") // @NotNull // private RpsTipo tipo = RpsTipo.RPS; // // public RpsIdentificacao(String numero) { // this.numero = numero; // } // // public String getNumero() { // return numero; // } // // public RpsSerie getSerie() { // return serie; // } // // public void setSerie(RpsSerie serie) { // this.serie = serie; // } // // public RpsTipo getTipo() { // return tipo; // } // // public void setTipo(RpsTipo tipo) { // this.tipo = tipo; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsPrestador.java // public class RpsPrestador { // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min = 1, max = 15) // private String inscricaoMunicipal; // // public RpsPrestador(PrestadorBuilder builder) { // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/RpsConsulta.java import javax.validation.constraints.NotNull; import com.pablodomingos.classes.rps.RpsIdentificacao; import com.pablodomingos.classes.rps.RpsPrestador; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute; package com.pablodomingos.classes.rps.servicos; @XStreamAlias("ConsultarNfseRpsEnvio") public class RpsConsulta extends AbstractService{ @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd"; @XStreamAlias("IdentificacaoRps") @NotNull
private RpsIdentificacao identificacaoRps;
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/RpsConsulta.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsIdentificacao.java // public class RpsIdentificacao { // // @XStreamAlias("Numero") // @NotNull // @Pattern(regexp = "\\d+") // @Size(min=1, max=15) // private String numero; // // @XStreamAlias("Serie") // @NotNull // private RpsSerie serie = RpsSerie.A; // // @XStreamAlias("Tipo") // @NotNull // private RpsTipo tipo = RpsTipo.RPS; // // public RpsIdentificacao(String numero) { // this.numero = numero; // } // // public String getNumero() { // return numero; // } // // public RpsSerie getSerie() { // return serie; // } // // public void setSerie(RpsSerie serie) { // this.serie = serie; // } // // public RpsTipo getTipo() { // return tipo; // } // // public void setTipo(RpsTipo tipo) { // this.tipo = tipo; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsPrestador.java // public class RpsPrestador { // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min = 1, max = 15) // private String inscricaoMunicipal; // // public RpsPrestador(PrestadorBuilder builder) { // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // }
import javax.validation.constraints.NotNull; import com.pablodomingos.classes.rps.RpsIdentificacao; import com.pablodomingos.classes.rps.RpsPrestador; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
package com.pablodomingos.classes.rps.servicos; @XStreamAlias("ConsultarNfseRpsEnvio") public class RpsConsulta extends AbstractService{ @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd"; @XStreamAlias("IdentificacaoRps") @NotNull private RpsIdentificacao identificacaoRps; @XStreamAlias("Prestador") @NotNull
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsIdentificacao.java // public class RpsIdentificacao { // // @XStreamAlias("Numero") // @NotNull // @Pattern(regexp = "\\d+") // @Size(min=1, max=15) // private String numero; // // @XStreamAlias("Serie") // @NotNull // private RpsSerie serie = RpsSerie.A; // // @XStreamAlias("Tipo") // @NotNull // private RpsTipo tipo = RpsTipo.RPS; // // public RpsIdentificacao(String numero) { // this.numero = numero; // } // // public String getNumero() { // return numero; // } // // public RpsSerie getSerie() { // return serie; // } // // public void setSerie(RpsSerie serie) { // this.serie = serie; // } // // public RpsTipo getTipo() { // return tipo; // } // // public void setTipo(RpsTipo tipo) { // this.tipo = tipo; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsPrestador.java // public class RpsPrestador { // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min = 1, max = 15) // private String inscricaoMunicipal; // // public RpsPrestador(PrestadorBuilder builder) { // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/RpsConsulta.java import javax.validation.constraints.NotNull; import com.pablodomingos.classes.rps.RpsIdentificacao; import com.pablodomingos.classes.rps.RpsPrestador; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute; package com.pablodomingos.classes.rps.servicos; @XStreamAlias("ConsultarNfseRpsEnvio") public class RpsConsulta extends AbstractService{ @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd"; @XStreamAlias("IdentificacaoRps") @NotNull private RpsIdentificacao identificacaoRps; @XStreamAlias("Prestador") @NotNull
private RpsPrestador prestador;
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/TomadorIdentificacaoBuilder.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsTomadorCpfCnpj.java // public class RpsTomadorCpfCnpj { // // @XStreamAlias("Cnpj") // @CNPJ // @Size(min = 14, max = 14) // private String cnpj; // // @XStreamAlias("Cpf") // @CPF // @Size(min = 11, max = 11) // private String cpf; // // public RpsTomadorCpfCnpj(TomadorCpfCnpjBuilder builder) { // // this.cpf = builder.getCpf(); // this.cnpj = builder.getCnpj(); // // } // // public String getDocumento() { // if (this.cpf != null) { // return this.cpf; // } else { // return this.cnpj; // } // } // // public String getCnpj() { // return cnpj; // } // // public String getCpf() { // return cpf; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsTomadorIdentificacao.java // public class RpsTomadorIdentificacao { // // @XStreamAlias("CpfCnpj") // private RpsTomadorCpfCnpj cpfCnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min=1, max=15) // private String inscricaoMunicipal; // // public RpsTomadorIdentificacao(TomadorIdentificacaoBuilder builder) { // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // this.cpfCnpj = builder.getCpfCnpj(); // } // // public RpsTomadorCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // }
import com.pablodomingos.classes.rps.RpsTomadorCpfCnpj; import com.pablodomingos.classes.rps.RpsTomadorIdentificacao;
package com.pablodomingos.classes.rps.builders; public class TomadorIdentificacaoBuilder extends AbstractBuilder<RpsTomadorIdentificacao>{ private String inscricaoMunicipal;
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsTomadorCpfCnpj.java // public class RpsTomadorCpfCnpj { // // @XStreamAlias("Cnpj") // @CNPJ // @Size(min = 14, max = 14) // private String cnpj; // // @XStreamAlias("Cpf") // @CPF // @Size(min = 11, max = 11) // private String cpf; // // public RpsTomadorCpfCnpj(TomadorCpfCnpjBuilder builder) { // // this.cpf = builder.getCpf(); // this.cnpj = builder.getCnpj(); // // } // // public String getDocumento() { // if (this.cpf != null) { // return this.cpf; // } else { // return this.cnpj; // } // } // // public String getCnpj() { // return cnpj; // } // // public String getCpf() { // return cpf; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsTomadorIdentificacao.java // public class RpsTomadorIdentificacao { // // @XStreamAlias("CpfCnpj") // private RpsTomadorCpfCnpj cpfCnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min=1, max=15) // private String inscricaoMunicipal; // // public RpsTomadorIdentificacao(TomadorIdentificacaoBuilder builder) { // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // this.cpfCnpj = builder.getCpfCnpj(); // } // // public RpsTomadorCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/TomadorIdentificacaoBuilder.java import com.pablodomingos.classes.rps.RpsTomadorCpfCnpj; import com.pablodomingos.classes.rps.RpsTomadorIdentificacao; package com.pablodomingos.classes.rps.builders; public class TomadorIdentificacaoBuilder extends AbstractBuilder<RpsTomadorIdentificacao>{ private String inscricaoMunicipal;
private RpsTomadorCpfCnpj cpfCnpj;
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/PeriodoEmissao.java
// Path: nfse-bh/src/main/java/com/pablodomingos/conversores/LocalDateConversor.java // public class LocalDateConversor implements SingleValueConverter { // // @SuppressWarnings("rawtypes") // public boolean canConvert(Class classe) { // return classe.equals(LocalDate.class); // } // // private String getConverted(LocalDate source) { // if (source == null) { // throw new IllegalArgumentException("Data nao pode ser nula"); // } // DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // return format.format(source); // } // // public String toString(Object obj) { // return getConverted((LocalDate) obj); // } // // public LocalDate fromString(String dateString) { // DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // return LocalDate.parse(dateString, format); // } // // }
import java.time.DateTimeException; import java.time.LocalDate; import javax.validation.constraints.NotNull; import com.pablodomingos.conversores.LocalDateConversor; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamConverter;
package com.pablodomingos.classes.rps; public class PeriodoEmissao { @XStreamAlias("DataInicial")
// Path: nfse-bh/src/main/java/com/pablodomingos/conversores/LocalDateConversor.java // public class LocalDateConversor implements SingleValueConverter { // // @SuppressWarnings("rawtypes") // public boolean canConvert(Class classe) { // return classe.equals(LocalDate.class); // } // // private String getConverted(LocalDate source) { // if (source == null) { // throw new IllegalArgumentException("Data nao pode ser nula"); // } // DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // return format.format(source); // } // // public String toString(Object obj) { // return getConverted((LocalDate) obj); // } // // public LocalDate fromString(String dateString) { // DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // return LocalDate.parse(dateString, format); // } // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/PeriodoEmissao.java import java.time.DateTimeException; import java.time.LocalDate; import javax.validation.constraints.NotNull; import com.pablodomingos.conversores.LocalDateConversor; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamConverter; package com.pablodomingos.classes.rps; public class PeriodoEmissao { @XStreamAlias("DataInicial")
@XStreamConverter(LocalDateConversor.class)
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsTomadorEndereco.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/TomadorEnderecoBuilder.java // public class TomadorEnderecoBuilder extends AbstractBuilder<RpsTomadorEndereco>{ // // // private String logradouro; // private String numero; // private String complemento; // private String bairro; // private String codigoMunicipio; // private String uf; // private String cep; // // public TomadorEnderecoBuilder() {} // // public TomadorEnderecoBuilder comLogradouro(String logradouro) { // this.logradouro = logradouro; // return this; // } // // public TomadorEnderecoBuilder comNumeroEndereco(String numero) { // this.numero = numero; // return this; // } // // public TomadorEnderecoBuilder comComplemento(String complemento) { // this.complemento = complemento; // return this; // } // // public TomadorEnderecoBuilder comBairro(String bairro) { // this.bairro = bairro; // return this; // } // // public TomadorEnderecoBuilder comCodigoMunicipio(String codigoMunicipio) { // this.codigoMunicipio = codigoMunicipio; // return this; // } // // public TomadorEnderecoBuilder comUf(String uf) { // this.uf = uf; // return this; // } // // public TomadorEnderecoBuilder comCep(String cep) { // this.cep = cep; // return this; // } // // @Override // protected RpsTomadorEndereco buildInternal() { // return new RpsTomadorEndereco(this); // } // // public String getLogradouro() { // return logradouro; // } // // public String getNumero() { // return numero; // } // // public String getComplemento() { // return complemento; // } // // public String getBairro() { // return bairro; // } // // public String getCodigoMunicipio() { // return codigoMunicipio; // } // // public String getUf() { // return uf; // } // // public String getCep() { // return cep; // } // }
import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.builders.TomadorEnderecoBuilder; import com.thoughtworks.xstream.annotations.XStreamAlias;
@NotNull @Size(min=1, max=10) private String numero; @XStreamAlias("Complemento") @Size(min=1, max=60) private String complemento; @XStreamAlias("Bairro") @NotNull @Size(min=1, max=60) private String bairro; @XStreamAlias("CodigoMunicipio") @NotNull @Pattern(regexp = "\\d+") @Size(min=1, max=7) private String codigoMunicipio; @XStreamAlias("Uf") @NotNull @Size(min=2, max=2) private String uf; @XStreamAlias("Cep") @NotNull @Pattern(regexp = "\\d+") @Size(min=8, max=8) private String cep;
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/TomadorEnderecoBuilder.java // public class TomadorEnderecoBuilder extends AbstractBuilder<RpsTomadorEndereco>{ // // // private String logradouro; // private String numero; // private String complemento; // private String bairro; // private String codigoMunicipio; // private String uf; // private String cep; // // public TomadorEnderecoBuilder() {} // // public TomadorEnderecoBuilder comLogradouro(String logradouro) { // this.logradouro = logradouro; // return this; // } // // public TomadorEnderecoBuilder comNumeroEndereco(String numero) { // this.numero = numero; // return this; // } // // public TomadorEnderecoBuilder comComplemento(String complemento) { // this.complemento = complemento; // return this; // } // // public TomadorEnderecoBuilder comBairro(String bairro) { // this.bairro = bairro; // return this; // } // // public TomadorEnderecoBuilder comCodigoMunicipio(String codigoMunicipio) { // this.codigoMunicipio = codigoMunicipio; // return this; // } // // public TomadorEnderecoBuilder comUf(String uf) { // this.uf = uf; // return this; // } // // public TomadorEnderecoBuilder comCep(String cep) { // this.cep = cep; // return this; // } // // @Override // protected RpsTomadorEndereco buildInternal() { // return new RpsTomadorEndereco(this); // } // // public String getLogradouro() { // return logradouro; // } // // public String getNumero() { // return numero; // } // // public String getComplemento() { // return complemento; // } // // public String getBairro() { // return bairro; // } // // public String getCodigoMunicipio() { // return codigoMunicipio; // } // // public String getUf() { // return uf; // } // // public String getCep() { // return cep; // } // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsTomadorEndereco.java import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.builders.TomadorEnderecoBuilder; import com.thoughtworks.xstream.annotations.XStreamAlias; @NotNull @Size(min=1, max=10) private String numero; @XStreamAlias("Complemento") @Size(min=1, max=60) private String complemento; @XStreamAlias("Bairro") @NotNull @Size(min=1, max=60) private String bairro; @XStreamAlias("CodigoMunicipio") @NotNull @Pattern(regexp = "\\d+") @Size(min=1, max=7) private String codigoMunicipio; @XStreamAlias("Uf") @NotNull @Size(min=2, max=2) private String uf; @XStreamAlias("Cep") @NotNull @Pattern(regexp = "\\d+") @Size(min=8, max=8) private String cep;
public RpsTomadorEndereco(TomadorEnderecoBuilder builder){
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsIdentificacao.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/enums/RpsSerie.java // @XStreamConverter(EnumToStringConverter.class) // public enum RpsSerie { // // NFE, A, U; // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/enums/RpsTipo.java // @XStreamConverter(EnumToStringConverter.class) // public enum RpsTipo { // // RPS(1, "Recibo Provisorio de Servicos"), // MISTA(2, "RPS Nota Fiscal Conjugada (Mista)"), // CUPOM(3, "Cupom"); // // private int codigo; // private String descricao; // // RpsTipo(int codigo, String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return String.valueOf(this.codigo); // } // // public String getDescricao() { // return this.descricao; // } // // public static RpsTipo fromInt(int codigo) { // if (codigo > 0 && codigo < 4) { // for (RpsTipo tipo : RpsTipo.values()) { // if (tipo.getCodigo().equals(String.valueOf(codigo))) { // return tipo; // } // } // } // return null; // } // // @Override // public String toString() { // return String.valueOf(codigo); // } // }
import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.enums.RpsSerie; import com.pablodomingos.classes.rps.enums.RpsTipo; import com.thoughtworks.xstream.annotations.XStreamAlias;
package com.pablodomingos.classes.rps; public class RpsIdentificacao { @XStreamAlias("Numero") @NotNull @Pattern(regexp = "\\d+") @Size(min=1, max=15) private String numero; @XStreamAlias("Serie") @NotNull
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/enums/RpsSerie.java // @XStreamConverter(EnumToStringConverter.class) // public enum RpsSerie { // // NFE, A, U; // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/enums/RpsTipo.java // @XStreamConverter(EnumToStringConverter.class) // public enum RpsTipo { // // RPS(1, "Recibo Provisorio de Servicos"), // MISTA(2, "RPS Nota Fiscal Conjugada (Mista)"), // CUPOM(3, "Cupom"); // // private int codigo; // private String descricao; // // RpsTipo(int codigo, String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return String.valueOf(this.codigo); // } // // public String getDescricao() { // return this.descricao; // } // // public static RpsTipo fromInt(int codigo) { // if (codigo > 0 && codigo < 4) { // for (RpsTipo tipo : RpsTipo.values()) { // if (tipo.getCodigo().equals(String.valueOf(codigo))) { // return tipo; // } // } // } // return null; // } // // @Override // public String toString() { // return String.valueOf(codigo); // } // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsIdentificacao.java import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.enums.RpsSerie; import com.pablodomingos.classes.rps.enums.RpsTipo; import com.thoughtworks.xstream.annotations.XStreamAlias; package com.pablodomingos.classes.rps; public class RpsIdentificacao { @XStreamAlias("Numero") @NotNull @Pattern(regexp = "\\d+") @Size(min=1, max=15) private String numero; @XStreamAlias("Serie") @NotNull
private RpsSerie serie = RpsSerie.A;
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsIdentificacao.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/enums/RpsSerie.java // @XStreamConverter(EnumToStringConverter.class) // public enum RpsSerie { // // NFE, A, U; // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/enums/RpsTipo.java // @XStreamConverter(EnumToStringConverter.class) // public enum RpsTipo { // // RPS(1, "Recibo Provisorio de Servicos"), // MISTA(2, "RPS Nota Fiscal Conjugada (Mista)"), // CUPOM(3, "Cupom"); // // private int codigo; // private String descricao; // // RpsTipo(int codigo, String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return String.valueOf(this.codigo); // } // // public String getDescricao() { // return this.descricao; // } // // public static RpsTipo fromInt(int codigo) { // if (codigo > 0 && codigo < 4) { // for (RpsTipo tipo : RpsTipo.values()) { // if (tipo.getCodigo().equals(String.valueOf(codigo))) { // return tipo; // } // } // } // return null; // } // // @Override // public String toString() { // return String.valueOf(codigo); // } // }
import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.enums.RpsSerie; import com.pablodomingos.classes.rps.enums.RpsTipo; import com.thoughtworks.xstream.annotations.XStreamAlias;
package com.pablodomingos.classes.rps; public class RpsIdentificacao { @XStreamAlias("Numero") @NotNull @Pattern(regexp = "\\d+") @Size(min=1, max=15) private String numero; @XStreamAlias("Serie") @NotNull private RpsSerie serie = RpsSerie.A; @XStreamAlias("Tipo") @NotNull
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/enums/RpsSerie.java // @XStreamConverter(EnumToStringConverter.class) // public enum RpsSerie { // // NFE, A, U; // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/enums/RpsTipo.java // @XStreamConverter(EnumToStringConverter.class) // public enum RpsTipo { // // RPS(1, "Recibo Provisorio de Servicos"), // MISTA(2, "RPS Nota Fiscal Conjugada (Mista)"), // CUPOM(3, "Cupom"); // // private int codigo; // private String descricao; // // RpsTipo(int codigo, String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return String.valueOf(this.codigo); // } // // public String getDescricao() { // return this.descricao; // } // // public static RpsTipo fromInt(int codigo) { // if (codigo > 0 && codigo < 4) { // for (RpsTipo tipo : RpsTipo.values()) { // if (tipo.getCodigo().equals(String.valueOf(codigo))) { // return tipo; // } // } // } // return null; // } // // @Override // public String toString() { // return String.valueOf(codigo); // } // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsIdentificacao.java import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.enums.RpsSerie; import com.pablodomingos.classes.rps.enums.RpsTipo; import com.thoughtworks.xstream.annotations.XStreamAlias; package com.pablodomingos.classes.rps; public class RpsIdentificacao { @XStreamAlias("Numero") @NotNull @Pattern(regexp = "\\d+") @Size(min=1, max=15) private String numero; @XStreamAlias("Serie") @NotNull private RpsSerie serie = RpsSerie.A; @XStreamAlias("Tipo") @NotNull
private RpsTipo tipo = RpsTipo.RPS;
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsIntermediario.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/IntermediarioBuilder.java // public class IntermediarioBuilder extends AbstractBuilder<RpsIntermediario>{ // // // private RpsIntermediarioCpfCnpj cpfCnpj; // private String nome; // private String inscricaoMunicipal; // // // public IntermediarioBuilder(String documento, String nome) { // this.cpfCnpj = new IntermediarioCpfCnpjBuilder().comDocumento(documento).build(); // this.nome = nome; // } // // public IntermediarioBuilder comInscricaoMunicipal(String inscricaoMunicipal){ // this.inscricaoMunicipal = inscricaoMunicipal; // return this; // } // // @Override // protected RpsIntermediario buildInternal() { // return new RpsIntermediario(this); // } // // public RpsIntermediarioCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // public String getNome() { // return nome; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // }
import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.builders.IntermediarioBuilder; import com.thoughtworks.xstream.annotations.XStreamAlias;
package com.pablodomingos.classes.rps; public class RpsIntermediario { @XStreamAlias("RazaoSocial") @NotNull @Size(min = 1, max = 115) private String nome; @XStreamAlias("CpfCnpj") @NotNull private RpsIntermediarioCpfCnpj cpfCnpj; @XStreamAlias("InscricaoMunicipal") @Size(min=1, max=15) private String inscricaoMunicipal;
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/IntermediarioBuilder.java // public class IntermediarioBuilder extends AbstractBuilder<RpsIntermediario>{ // // // private RpsIntermediarioCpfCnpj cpfCnpj; // private String nome; // private String inscricaoMunicipal; // // // public IntermediarioBuilder(String documento, String nome) { // this.cpfCnpj = new IntermediarioCpfCnpjBuilder().comDocumento(documento).build(); // this.nome = nome; // } // // public IntermediarioBuilder comInscricaoMunicipal(String inscricaoMunicipal){ // this.inscricaoMunicipal = inscricaoMunicipal; // return this; // } // // @Override // protected RpsIntermediario buildInternal() { // return new RpsIntermediario(this); // } // // public RpsIntermediarioCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // public String getNome() { // return nome; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsIntermediario.java import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.builders.IntermediarioBuilder; import com.thoughtworks.xstream.annotations.XStreamAlias; package com.pablodomingos.classes.rps; public class RpsIntermediario { @XStreamAlias("RazaoSocial") @NotNull @Size(min = 1, max = 115) private String nome; @XStreamAlias("CpfCnpj") @NotNull private RpsIntermediarioCpfCnpj cpfCnpj; @XStreamAlias("InscricaoMunicipal") @Size(min=1, max=15) private String inscricaoMunicipal;
public RpsIntermediario(IntermediarioBuilder builder){
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/ConsultarLoteRpsResposta.java
// Path: nfse-bh/src/main/java/com/pablodomingos/webservices/pbh/Nfse.java // public interface Nfse extends java.rmi.Remote { // public com.pablodomingos.webservices.pbh.Output cancelarNfse(com.pablodomingos.webservices.pbh.Input parameters) throws java.rmi.RemoteException; // public com.pablodomingos.webservices.pbh.Output consultarLoteRps(com.pablodomingos.webservices.pbh.Input parameters) throws java.rmi.RemoteException; // public com.pablodomingos.webservices.pbh.Output consultarNfse(com.pablodomingos.webservices.pbh.Input parameters) throws java.rmi.RemoteException; // public com.pablodomingos.webservices.pbh.Output consultarNfsePorFaixa(com.pablodomingos.webservices.pbh.Input parameters) throws java.rmi.RemoteException; // public com.pablodomingos.webservices.pbh.Output consultarNfsePorRps(com.pablodomingos.webservices.pbh.Input parameters) throws java.rmi.RemoteException; // public com.pablodomingos.webservices.pbh.Output consultarSituacaoLoteRps(com.pablodomingos.webservices.pbh.Input parameters) throws java.rmi.RemoteException; // public com.pablodomingos.webservices.pbh.Output recepcionarLoteRps(com.pablodomingos.webservices.pbh.Input parameters) throws java.rmi.RemoteException; // public com.pablodomingos.webservices.pbh.Output gerarNfse(com.pablodomingos.webservices.pbh.Input parameters) throws java.rmi.RemoteException; // }
import com.pablodomingos.webservices.pbh.Nfse; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
package com.pablodomingos.classes.rps.servicos; @XStreamAlias("ConsultarLoteRpsResposta") public class ConsultarLoteRpsResposta { @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd"; @XStreamAlias("ListaMensagemRetornoLote") private ListaMensagemRetorno listaMensagemRetornoLote; @XStreamAlias("ListaMensagemRetorno") private ListaMensagemRetorno listaMensagemRetorno; @XStreamAlias("ListaNfse") private ListaNfse listaNfse; public static ConsultarLoteRpsResposta toPojo(String xml) { XStream xstream = new XStream(); xstream.setMode(XStream.NO_REFERENCES); xstream.autodetectAnnotations(true); xstream.ignoreUnknownElements(); xstream.alias("ConsultarLoteRpsResposta", ConsultarLoteRpsResposta.class);
// Path: nfse-bh/src/main/java/com/pablodomingos/webservices/pbh/Nfse.java // public interface Nfse extends java.rmi.Remote { // public com.pablodomingos.webservices.pbh.Output cancelarNfse(com.pablodomingos.webservices.pbh.Input parameters) throws java.rmi.RemoteException; // public com.pablodomingos.webservices.pbh.Output consultarLoteRps(com.pablodomingos.webservices.pbh.Input parameters) throws java.rmi.RemoteException; // public com.pablodomingos.webservices.pbh.Output consultarNfse(com.pablodomingos.webservices.pbh.Input parameters) throws java.rmi.RemoteException; // public com.pablodomingos.webservices.pbh.Output consultarNfsePorFaixa(com.pablodomingos.webservices.pbh.Input parameters) throws java.rmi.RemoteException; // public com.pablodomingos.webservices.pbh.Output consultarNfsePorRps(com.pablodomingos.webservices.pbh.Input parameters) throws java.rmi.RemoteException; // public com.pablodomingos.webservices.pbh.Output consultarSituacaoLoteRps(com.pablodomingos.webservices.pbh.Input parameters) throws java.rmi.RemoteException; // public com.pablodomingos.webservices.pbh.Output recepcionarLoteRps(com.pablodomingos.webservices.pbh.Input parameters) throws java.rmi.RemoteException; // public com.pablodomingos.webservices.pbh.Output gerarNfse(com.pablodomingos.webservices.pbh.Input parameters) throws java.rmi.RemoteException; // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/ConsultarLoteRpsResposta.java import com.pablodomingos.webservices.pbh.Nfse; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute; package com.pablodomingos.classes.rps.servicos; @XStreamAlias("ConsultarLoteRpsResposta") public class ConsultarLoteRpsResposta { @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd"; @XStreamAlias("ListaMensagemRetornoLote") private ListaMensagemRetorno listaMensagemRetornoLote; @XStreamAlias("ListaMensagemRetorno") private ListaMensagemRetorno listaMensagemRetorno; @XStreamAlias("ListaNfse") private ListaNfse listaNfse; public static ConsultarLoteRpsResposta toPojo(String xml) { XStream xstream = new XStream(); xstream.setMode(XStream.NO_REFERENCES); xstream.autodetectAnnotations(true); xstream.ignoreUnknownElements(); xstream.alias("ConsultarLoteRpsResposta", ConsultarLoteRpsResposta.class);
xstream.alias("Nfse", Nfse.class);
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsTomador.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/TomadorBuilder.java // public class TomadorBuilder extends AbstractBuilder<RpsTomador> { // // private RpsTomadorCpfCnpj cpfCnpj; // RpsTomadorIdentificacao tomadorIdentificacao; // private String inscricaoMunicipal; // private String nome; // private RpsTomadorContato contato; // private RpsTomadorEndereco endereco; // // public TomadorBuilder(String documento) { // this.cpfCnpj = new TomadorCpfCnpjBuilder() // .comDocumento(documento).build(); // } // // public TomadorBuilder comInscricaoMunicipal(String inscricaoMunicipal) { // this.inscricaoMunicipal = inscricaoMunicipal; // return this; // } // // public TomadorBuilder comNome(String nome) { // this.nome = nome; // return this; // } // // public TomadorBuilder comContato(RpsTomadorContato contato) { // this.contato = contato; // return this; // } // // public TomadorBuilder comEndereco(RpsTomadorEndereco endereco){ // this.endereco = endereco; // return this; // } // // public TomadorBuilder comEndereco(TomadorEnderecoBuilder endereco){ // this.endereco = new RpsTomadorEndereco(endereco); // return this; // } // // @Override // protected RpsTomador buildInternal() { // return new RpsTomador(this); // } // // public RpsTomadorCpfCnpj getTomadorCpfCnpj() { // return this.cpfCnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // public String getNome() { // return nome; // } // // public RpsTomadorContato getContato() { // return contato; // } // // public RpsTomadorEndereco getEndereco() { // return endereco; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/TomadorIdentificacaoBuilder.java // public class TomadorIdentificacaoBuilder extends AbstractBuilder<RpsTomadorIdentificacao>{ // // // private String inscricaoMunicipal; // private RpsTomadorCpfCnpj cpfCnpj; // // public TomadorIdentificacaoBuilder() {} // // public TomadorIdentificacaoBuilder comInscricaoMunicipal(String inscricaoMunicipal) { // this.inscricaoMunicipal = inscricaoMunicipal; // return this; // } // // public TomadorIdentificacaoBuilder comCpfCnpj(RpsTomadorCpfCnpj cpfCnpj) { // this.cpfCnpj = cpfCnpj; // return this; // } // // @Override // protected RpsTomadorIdentificacao buildInternal() { // return new RpsTomadorIdentificacao(this); // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // public RpsTomadorCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // // }
import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.builders.TomadorBuilder; import com.pablodomingos.classes.rps.builders.TomadorIdentificacaoBuilder; import com.thoughtworks.xstream.annotations.XStreamAlias;
package com.pablodomingos.classes.rps; public class RpsTomador { @XStreamAlias("IdentificacaoTomador") private RpsTomadorIdentificacao identificacaoTomador; @XStreamAlias("RazaoSocial") @Size(min = 1, max = 115) private String nome; @XStreamAlias("Endereco") @NotNull private RpsTomadorEndereco endereco; @XStreamAlias("Contato") private RpsTomadorContato contato;
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/TomadorBuilder.java // public class TomadorBuilder extends AbstractBuilder<RpsTomador> { // // private RpsTomadorCpfCnpj cpfCnpj; // RpsTomadorIdentificacao tomadorIdentificacao; // private String inscricaoMunicipal; // private String nome; // private RpsTomadorContato contato; // private RpsTomadorEndereco endereco; // // public TomadorBuilder(String documento) { // this.cpfCnpj = new TomadorCpfCnpjBuilder() // .comDocumento(documento).build(); // } // // public TomadorBuilder comInscricaoMunicipal(String inscricaoMunicipal) { // this.inscricaoMunicipal = inscricaoMunicipal; // return this; // } // // public TomadorBuilder comNome(String nome) { // this.nome = nome; // return this; // } // // public TomadorBuilder comContato(RpsTomadorContato contato) { // this.contato = contato; // return this; // } // // public TomadorBuilder comEndereco(RpsTomadorEndereco endereco){ // this.endereco = endereco; // return this; // } // // public TomadorBuilder comEndereco(TomadorEnderecoBuilder endereco){ // this.endereco = new RpsTomadorEndereco(endereco); // return this; // } // // @Override // protected RpsTomador buildInternal() { // return new RpsTomador(this); // } // // public RpsTomadorCpfCnpj getTomadorCpfCnpj() { // return this.cpfCnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // public String getNome() { // return nome; // } // // public RpsTomadorContato getContato() { // return contato; // } // // public RpsTomadorEndereco getEndereco() { // return endereco; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/TomadorIdentificacaoBuilder.java // public class TomadorIdentificacaoBuilder extends AbstractBuilder<RpsTomadorIdentificacao>{ // // // private String inscricaoMunicipal; // private RpsTomadorCpfCnpj cpfCnpj; // // public TomadorIdentificacaoBuilder() {} // // public TomadorIdentificacaoBuilder comInscricaoMunicipal(String inscricaoMunicipal) { // this.inscricaoMunicipal = inscricaoMunicipal; // return this; // } // // public TomadorIdentificacaoBuilder comCpfCnpj(RpsTomadorCpfCnpj cpfCnpj) { // this.cpfCnpj = cpfCnpj; // return this; // } // // @Override // protected RpsTomadorIdentificacao buildInternal() { // return new RpsTomadorIdentificacao(this); // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // public RpsTomadorCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsTomador.java import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.builders.TomadorBuilder; import com.pablodomingos.classes.rps.builders.TomadorIdentificacaoBuilder; import com.thoughtworks.xstream.annotations.XStreamAlias; package com.pablodomingos.classes.rps; public class RpsTomador { @XStreamAlias("IdentificacaoTomador") private RpsTomadorIdentificacao identificacaoTomador; @XStreamAlias("RazaoSocial") @Size(min = 1, max = 115) private String nome; @XStreamAlias("Endereco") @NotNull private RpsTomadorEndereco endereco; @XStreamAlias("Contato") private RpsTomadorContato contato;
public RpsTomador(TomadorBuilder builder) {
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsTomador.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/TomadorBuilder.java // public class TomadorBuilder extends AbstractBuilder<RpsTomador> { // // private RpsTomadorCpfCnpj cpfCnpj; // RpsTomadorIdentificacao tomadorIdentificacao; // private String inscricaoMunicipal; // private String nome; // private RpsTomadorContato contato; // private RpsTomadorEndereco endereco; // // public TomadorBuilder(String documento) { // this.cpfCnpj = new TomadorCpfCnpjBuilder() // .comDocumento(documento).build(); // } // // public TomadorBuilder comInscricaoMunicipal(String inscricaoMunicipal) { // this.inscricaoMunicipal = inscricaoMunicipal; // return this; // } // // public TomadorBuilder comNome(String nome) { // this.nome = nome; // return this; // } // // public TomadorBuilder comContato(RpsTomadorContato contato) { // this.contato = contato; // return this; // } // // public TomadorBuilder comEndereco(RpsTomadorEndereco endereco){ // this.endereco = endereco; // return this; // } // // public TomadorBuilder comEndereco(TomadorEnderecoBuilder endereco){ // this.endereco = new RpsTomadorEndereco(endereco); // return this; // } // // @Override // protected RpsTomador buildInternal() { // return new RpsTomador(this); // } // // public RpsTomadorCpfCnpj getTomadorCpfCnpj() { // return this.cpfCnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // public String getNome() { // return nome; // } // // public RpsTomadorContato getContato() { // return contato; // } // // public RpsTomadorEndereco getEndereco() { // return endereco; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/TomadorIdentificacaoBuilder.java // public class TomadorIdentificacaoBuilder extends AbstractBuilder<RpsTomadorIdentificacao>{ // // // private String inscricaoMunicipal; // private RpsTomadorCpfCnpj cpfCnpj; // // public TomadorIdentificacaoBuilder() {} // // public TomadorIdentificacaoBuilder comInscricaoMunicipal(String inscricaoMunicipal) { // this.inscricaoMunicipal = inscricaoMunicipal; // return this; // } // // public TomadorIdentificacaoBuilder comCpfCnpj(RpsTomadorCpfCnpj cpfCnpj) { // this.cpfCnpj = cpfCnpj; // return this; // } // // @Override // protected RpsTomadorIdentificacao buildInternal() { // return new RpsTomadorIdentificacao(this); // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // public RpsTomadorCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // // }
import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.builders.TomadorBuilder; import com.pablodomingos.classes.rps.builders.TomadorIdentificacaoBuilder; import com.thoughtworks.xstream.annotations.XStreamAlias;
package com.pablodomingos.classes.rps; public class RpsTomador { @XStreamAlias("IdentificacaoTomador") private RpsTomadorIdentificacao identificacaoTomador; @XStreamAlias("RazaoSocial") @Size(min = 1, max = 115) private String nome; @XStreamAlias("Endereco") @NotNull private RpsTomadorEndereco endereco; @XStreamAlias("Contato") private RpsTomadorContato contato; public RpsTomador(TomadorBuilder builder) {
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/TomadorBuilder.java // public class TomadorBuilder extends AbstractBuilder<RpsTomador> { // // private RpsTomadorCpfCnpj cpfCnpj; // RpsTomadorIdentificacao tomadorIdentificacao; // private String inscricaoMunicipal; // private String nome; // private RpsTomadorContato contato; // private RpsTomadorEndereco endereco; // // public TomadorBuilder(String documento) { // this.cpfCnpj = new TomadorCpfCnpjBuilder() // .comDocumento(documento).build(); // } // // public TomadorBuilder comInscricaoMunicipal(String inscricaoMunicipal) { // this.inscricaoMunicipal = inscricaoMunicipal; // return this; // } // // public TomadorBuilder comNome(String nome) { // this.nome = nome; // return this; // } // // public TomadorBuilder comContato(RpsTomadorContato contato) { // this.contato = contato; // return this; // } // // public TomadorBuilder comEndereco(RpsTomadorEndereco endereco){ // this.endereco = endereco; // return this; // } // // public TomadorBuilder comEndereco(TomadorEnderecoBuilder endereco){ // this.endereco = new RpsTomadorEndereco(endereco); // return this; // } // // @Override // protected RpsTomador buildInternal() { // return new RpsTomador(this); // } // // public RpsTomadorCpfCnpj getTomadorCpfCnpj() { // return this.cpfCnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // public String getNome() { // return nome; // } // // public RpsTomadorContato getContato() { // return contato; // } // // public RpsTomadorEndereco getEndereco() { // return endereco; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/TomadorIdentificacaoBuilder.java // public class TomadorIdentificacaoBuilder extends AbstractBuilder<RpsTomadorIdentificacao>{ // // // private String inscricaoMunicipal; // private RpsTomadorCpfCnpj cpfCnpj; // // public TomadorIdentificacaoBuilder() {} // // public TomadorIdentificacaoBuilder comInscricaoMunicipal(String inscricaoMunicipal) { // this.inscricaoMunicipal = inscricaoMunicipal; // return this; // } // // public TomadorIdentificacaoBuilder comCpfCnpj(RpsTomadorCpfCnpj cpfCnpj) { // this.cpfCnpj = cpfCnpj; // return this; // } // // @Override // protected RpsTomadorIdentificacao buildInternal() { // return new RpsTomadorIdentificacao(this); // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // public RpsTomadorCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsTomador.java import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.builders.TomadorBuilder; import com.pablodomingos.classes.rps.builders.TomadorIdentificacaoBuilder; import com.thoughtworks.xstream.annotations.XStreamAlias; package com.pablodomingos.classes.rps; public class RpsTomador { @XStreamAlias("IdentificacaoTomador") private RpsTomadorIdentificacao identificacaoTomador; @XStreamAlias("RazaoSocial") @Size(min = 1, max = 115) private String nome; @XStreamAlias("Endereco") @NotNull private RpsTomadorEndereco endereco; @XStreamAlias("Contato") private RpsTomadorContato contato; public RpsTomador(TomadorBuilder builder) {
RpsTomadorIdentificacao tomadorIdentificacao = new TomadorIdentificacaoBuilder()
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/PedidoCancelamentoInfBuilder.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/NFSeIdentificacao.java // public class NFSeIdentificacao { // // @XStreamAlias("Numero") // @NotNull // @Pattern(regexp = "\\d+") // @Size(min=1, max=15) // private String numero; // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min = 1, max = 15) // private String inscricaoMunicipal; // // @XStreamAlias("CodigoMunicipio") // @NotNull // @Pattern(regexp = "\\d+") // @Size(min = 1, max = 7) // private String codigoMunicipioIbge; // // public NFSeIdentificacao(IdentificacaoNFSeBuilder builder) { // this.numero = builder.getNumero(); // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // this.codigoMunicipioIbge = builder.getCodigoMunicipioIbge(); // } // // public String getNumero() { // return numero; // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // public String getCodigoMunicipioIbge() { // return codigoMunicipioIbge; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/NFSeInfPedidoCancelamento.java // public class NFSeInfPedidoCancelamento { // // @XStreamAlias("Id") // @NotNull // @XStreamAsAttribute // private String id; // // @XStreamAlias("IdentificacaoNfse") // @NotNull // private NFSeIdentificacao nfseIdentificacao; // // @XStreamAlias("CodigoCancelamento") // @NotNull // private CodigoCancelamento codigoCancelamento; // // public NFSeInfPedidoCancelamento(PedidoCancelamentoInfBuilder builder) { // this.id = builder.getId(); // this.nfseIdentificacao = builder.getNfseIdentificacao(); // this.codigoCancelamento = builder.getCodigoCancelamento(); // } // // public String getId() { // return id; // } // // public NFSeIdentificacao getNfseIdentificacao() { // return nfseIdentificacao; // } // // public CodigoCancelamento getCodigoCancelamento() { // return codigoCancelamento; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/enums/CodigoCancelamento.java // @XStreamConverter(EnumToStringConverter.class) // public enum CodigoCancelamento { // //Bh nao aceita cancelar via webservice NFSe com erro na emissao // //ERRO_NA_EMISSAO(1, "Erro na emissao"), // SERVICO_NAO_CONCLUIDO(2, "Servico cao concluido"); // // private int codigo; // private String descricao; // // CodigoCancelamento(int cod, String descricao) { // this.codigo = cod; // this.descricao = descricao; // } // // public String getDescricao() { // return this.descricao; // } // // @Override // public String toString() { // return String.valueOf(codigo); // } // // // }
import java.util.UUID; import com.pablodomingos.classes.rps.NFSeIdentificacao; import com.pablodomingos.classes.rps.NFSeInfPedidoCancelamento; import com.pablodomingos.classes.rps.enums.CodigoCancelamento;
package com.pablodomingos.classes.rps.builders; public class PedidoCancelamentoInfBuilder extends AbstractBuilder<NFSeInfPedidoCancelamento>{ private String id;
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/NFSeIdentificacao.java // public class NFSeIdentificacao { // // @XStreamAlias("Numero") // @NotNull // @Pattern(regexp = "\\d+") // @Size(min=1, max=15) // private String numero; // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min = 1, max = 15) // private String inscricaoMunicipal; // // @XStreamAlias("CodigoMunicipio") // @NotNull // @Pattern(regexp = "\\d+") // @Size(min = 1, max = 7) // private String codigoMunicipioIbge; // // public NFSeIdentificacao(IdentificacaoNFSeBuilder builder) { // this.numero = builder.getNumero(); // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // this.codigoMunicipioIbge = builder.getCodigoMunicipioIbge(); // } // // public String getNumero() { // return numero; // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // public String getCodigoMunicipioIbge() { // return codigoMunicipioIbge; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/NFSeInfPedidoCancelamento.java // public class NFSeInfPedidoCancelamento { // // @XStreamAlias("Id") // @NotNull // @XStreamAsAttribute // private String id; // // @XStreamAlias("IdentificacaoNfse") // @NotNull // private NFSeIdentificacao nfseIdentificacao; // // @XStreamAlias("CodigoCancelamento") // @NotNull // private CodigoCancelamento codigoCancelamento; // // public NFSeInfPedidoCancelamento(PedidoCancelamentoInfBuilder builder) { // this.id = builder.getId(); // this.nfseIdentificacao = builder.getNfseIdentificacao(); // this.codigoCancelamento = builder.getCodigoCancelamento(); // } // // public String getId() { // return id; // } // // public NFSeIdentificacao getNfseIdentificacao() { // return nfseIdentificacao; // } // // public CodigoCancelamento getCodigoCancelamento() { // return codigoCancelamento; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/enums/CodigoCancelamento.java // @XStreamConverter(EnumToStringConverter.class) // public enum CodigoCancelamento { // //Bh nao aceita cancelar via webservice NFSe com erro na emissao // //ERRO_NA_EMISSAO(1, "Erro na emissao"), // SERVICO_NAO_CONCLUIDO(2, "Servico cao concluido"); // // private int codigo; // private String descricao; // // CodigoCancelamento(int cod, String descricao) { // this.codigo = cod; // this.descricao = descricao; // } // // public String getDescricao() { // return this.descricao; // } // // @Override // public String toString() { // return String.valueOf(codigo); // } // // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/PedidoCancelamentoInfBuilder.java import java.util.UUID; import com.pablodomingos.classes.rps.NFSeIdentificacao; import com.pablodomingos.classes.rps.NFSeInfPedidoCancelamento; import com.pablodomingos.classes.rps.enums.CodigoCancelamento; package com.pablodomingos.classes.rps.builders; public class PedidoCancelamentoInfBuilder extends AbstractBuilder<NFSeInfPedidoCancelamento>{ private String id;
private NFSeIdentificacao nfseIdentificacao;
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/PedidoCancelamentoInfBuilder.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/NFSeIdentificacao.java // public class NFSeIdentificacao { // // @XStreamAlias("Numero") // @NotNull // @Pattern(regexp = "\\d+") // @Size(min=1, max=15) // private String numero; // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min = 1, max = 15) // private String inscricaoMunicipal; // // @XStreamAlias("CodigoMunicipio") // @NotNull // @Pattern(regexp = "\\d+") // @Size(min = 1, max = 7) // private String codigoMunicipioIbge; // // public NFSeIdentificacao(IdentificacaoNFSeBuilder builder) { // this.numero = builder.getNumero(); // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // this.codigoMunicipioIbge = builder.getCodigoMunicipioIbge(); // } // // public String getNumero() { // return numero; // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // public String getCodigoMunicipioIbge() { // return codigoMunicipioIbge; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/NFSeInfPedidoCancelamento.java // public class NFSeInfPedidoCancelamento { // // @XStreamAlias("Id") // @NotNull // @XStreamAsAttribute // private String id; // // @XStreamAlias("IdentificacaoNfse") // @NotNull // private NFSeIdentificacao nfseIdentificacao; // // @XStreamAlias("CodigoCancelamento") // @NotNull // private CodigoCancelamento codigoCancelamento; // // public NFSeInfPedidoCancelamento(PedidoCancelamentoInfBuilder builder) { // this.id = builder.getId(); // this.nfseIdentificacao = builder.getNfseIdentificacao(); // this.codigoCancelamento = builder.getCodigoCancelamento(); // } // // public String getId() { // return id; // } // // public NFSeIdentificacao getNfseIdentificacao() { // return nfseIdentificacao; // } // // public CodigoCancelamento getCodigoCancelamento() { // return codigoCancelamento; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/enums/CodigoCancelamento.java // @XStreamConverter(EnumToStringConverter.class) // public enum CodigoCancelamento { // //Bh nao aceita cancelar via webservice NFSe com erro na emissao // //ERRO_NA_EMISSAO(1, "Erro na emissao"), // SERVICO_NAO_CONCLUIDO(2, "Servico cao concluido"); // // private int codigo; // private String descricao; // // CodigoCancelamento(int cod, String descricao) { // this.codigo = cod; // this.descricao = descricao; // } // // public String getDescricao() { // return this.descricao; // } // // @Override // public String toString() { // return String.valueOf(codigo); // } // // // }
import java.util.UUID; import com.pablodomingos.classes.rps.NFSeIdentificacao; import com.pablodomingos.classes.rps.NFSeInfPedidoCancelamento; import com.pablodomingos.classes.rps.enums.CodigoCancelamento;
package com.pablodomingos.classes.rps.builders; public class PedidoCancelamentoInfBuilder extends AbstractBuilder<NFSeInfPedidoCancelamento>{ private String id; private NFSeIdentificacao nfseIdentificacao;
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/NFSeIdentificacao.java // public class NFSeIdentificacao { // // @XStreamAlias("Numero") // @NotNull // @Pattern(regexp = "\\d+") // @Size(min=1, max=15) // private String numero; // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min = 1, max = 15) // private String inscricaoMunicipal; // // @XStreamAlias("CodigoMunicipio") // @NotNull // @Pattern(regexp = "\\d+") // @Size(min = 1, max = 7) // private String codigoMunicipioIbge; // // public NFSeIdentificacao(IdentificacaoNFSeBuilder builder) { // this.numero = builder.getNumero(); // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // this.codigoMunicipioIbge = builder.getCodigoMunicipioIbge(); // } // // public String getNumero() { // return numero; // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // public String getCodigoMunicipioIbge() { // return codigoMunicipioIbge; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/NFSeInfPedidoCancelamento.java // public class NFSeInfPedidoCancelamento { // // @XStreamAlias("Id") // @NotNull // @XStreamAsAttribute // private String id; // // @XStreamAlias("IdentificacaoNfse") // @NotNull // private NFSeIdentificacao nfseIdentificacao; // // @XStreamAlias("CodigoCancelamento") // @NotNull // private CodigoCancelamento codigoCancelamento; // // public NFSeInfPedidoCancelamento(PedidoCancelamentoInfBuilder builder) { // this.id = builder.getId(); // this.nfseIdentificacao = builder.getNfseIdentificacao(); // this.codigoCancelamento = builder.getCodigoCancelamento(); // } // // public String getId() { // return id; // } // // public NFSeIdentificacao getNfseIdentificacao() { // return nfseIdentificacao; // } // // public CodigoCancelamento getCodigoCancelamento() { // return codigoCancelamento; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/enums/CodigoCancelamento.java // @XStreamConverter(EnumToStringConverter.class) // public enum CodigoCancelamento { // //Bh nao aceita cancelar via webservice NFSe com erro na emissao // //ERRO_NA_EMISSAO(1, "Erro na emissao"), // SERVICO_NAO_CONCLUIDO(2, "Servico cao concluido"); // // private int codigo; // private String descricao; // // CodigoCancelamento(int cod, String descricao) { // this.codigo = cod; // this.descricao = descricao; // } // // public String getDescricao() { // return this.descricao; // } // // @Override // public String toString() { // return String.valueOf(codigo); // } // // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/PedidoCancelamentoInfBuilder.java import java.util.UUID; import com.pablodomingos.classes.rps.NFSeIdentificacao; import com.pablodomingos.classes.rps.NFSeInfPedidoCancelamento; import com.pablodomingos.classes.rps.enums.CodigoCancelamento; package com.pablodomingos.classes.rps.builders; public class PedidoCancelamentoInfBuilder extends AbstractBuilder<NFSeInfPedidoCancelamento>{ private String id; private NFSeIdentificacao nfseIdentificacao;
private CodigoCancelamento codigoCancelamento;
pablopdomingos/nfse
nfse-bh/src/test/java/com/pablodomingos/classes/rps/RpsIntermediarioTest.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/IntermediarioBuilder.java // public class IntermediarioBuilder extends AbstractBuilder<RpsIntermediario>{ // // // private RpsIntermediarioCpfCnpj cpfCnpj; // private String nome; // private String inscricaoMunicipal; // // // public IntermediarioBuilder(String documento, String nome) { // this.cpfCnpj = new IntermediarioCpfCnpjBuilder().comDocumento(documento).build(); // this.nome = nome; // } // // public IntermediarioBuilder comInscricaoMunicipal(String inscricaoMunicipal){ // this.inscricaoMunicipal = inscricaoMunicipal; // return this; // } // // @Override // protected RpsIntermediario buildInternal() { // return new RpsIntermediario(this); // } // // public RpsIntermediarioCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // public String getNome() { // return nome; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // }
import javax.validation.ConstraintViolationException; import org.junit.Test; import com.pablodomingos.classes.rps.builders.IntermediarioBuilder;
package com.pablodomingos.classes.rps; public class RpsIntermediarioTest { @Test(expected = ConstraintViolationException.class) public void naoDevePermitirDocumentoInvalido() throws Exception { try {
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/IntermediarioBuilder.java // public class IntermediarioBuilder extends AbstractBuilder<RpsIntermediario>{ // // // private RpsIntermediarioCpfCnpj cpfCnpj; // private String nome; // private String inscricaoMunicipal; // // // public IntermediarioBuilder(String documento, String nome) { // this.cpfCnpj = new IntermediarioCpfCnpjBuilder().comDocumento(documento).build(); // this.nome = nome; // } // // public IntermediarioBuilder comInscricaoMunicipal(String inscricaoMunicipal){ // this.inscricaoMunicipal = inscricaoMunicipal; // return this; // } // // @Override // protected RpsIntermediario buildInternal() { // return new RpsIntermediario(this); // } // // public RpsIntermediarioCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // public String getNome() { // return nome; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // Path: nfse-bh/src/test/java/com/pablodomingos/classes/rps/RpsIntermediarioTest.java import javax.validation.ConstraintViolationException; import org.junit.Test; import com.pablodomingos.classes.rps.builders.IntermediarioBuilder; package com.pablodomingos.classes.rps; public class RpsIntermediarioTest { @Test(expected = ConstraintViolationException.class) public void naoDevePermitirDocumentoInvalido() throws Exception { try {
new IntermediarioBuilder("12345678901", "Intermediario Teste").build();
pablopdomingos/nfse
nfse-bh/src/test/java/com/pablodomingos/classes/rps/RpsTomadorContatoTest.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/TomadorContatoBuilder.java // public class TomadorContatoBuilder extends AbstractBuilder<RpsTomadorContato>{ // // // private String telefone; // private String email; // // public TomadorContatoBuilder() {} // // public TomadorContatoBuilder comTelefone(String telefone) { // this.telefone = telefone; // return this; // } // // public TomadorContatoBuilder comEmail(String email) { // this.email = email; // return this; // } // // @Override // protected RpsTomadorContato buildInternal() { // return new RpsTomadorContato(this); // } // // public String getTelefone() { // return telefone; // } // // public String getEmail() { // return email; // } // }
import javax.validation.ConstraintViolationException; import org.junit.Test; import com.pablodomingos.classes.rps.builders.TomadorContatoBuilder;
package com.pablodomingos.classes.rps; public class RpsTomadorContatoTest { @Test(expected = ConstraintViolationException.class) public void naoDevePermitirTelefoneComTamanhoInvalido() throws Exception { try {
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/TomadorContatoBuilder.java // public class TomadorContatoBuilder extends AbstractBuilder<RpsTomadorContato>{ // // // private String telefone; // private String email; // // public TomadorContatoBuilder() {} // // public TomadorContatoBuilder comTelefone(String telefone) { // this.telefone = telefone; // return this; // } // // public TomadorContatoBuilder comEmail(String email) { // this.email = email; // return this; // } // // @Override // protected RpsTomadorContato buildInternal() { // return new RpsTomadorContato(this); // } // // public String getTelefone() { // return telefone; // } // // public String getEmail() { // return email; // } // } // Path: nfse-bh/src/test/java/com/pablodomingos/classes/rps/RpsTomadorContatoTest.java import javax.validation.ConstraintViolationException; import org.junit.Test; import com.pablodomingos.classes.rps.builders.TomadorContatoBuilder; package com.pablodomingos.classes.rps; public class RpsTomadorContatoTest { @Test(expected = ConstraintViolationException.class) public void naoDevePermitirTelefoneComTamanhoInvalido() throws Exception { try {
new TomadorContatoBuilder().comTelefone("").build();
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsServico.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/ServicoBuilder.java // public class ServicoBuilder extends AbstractBuilder<RpsServico>{ // // private RpsValores valores; // private String codigoItemListaServico; // private String codigoCnae; // private String codigoTributacaoMunicipio; // private String discriminacao; // private String codigoMunicipio; // // public ServicoBuilder(RpsValores valores, String codigoItemListaServico) { // this.valores = valores; // this.codigoItemListaServico = codigoItemListaServico; // } // // public ServicoBuilder comCodigoCnae(Integer codigoCnae) { // return comCodigoCnae(Integer.toString(codigoCnae)); // } // // public ServicoBuilder comCodigoCnae(String codigoCnae) { // this.codigoCnae = codigoCnae; // return this; // } // // public ServicoBuilder comDiscriminacao(String discriminacao) { // this.discriminacao = discriminacao; // return this; // } // // public ServicoBuilder comCodigoMunicipio(Integer codigoMunicipio) { // return comCodigoMunicipio(Integer.toString(codigoMunicipio)); // } // // public ServicoBuilder comCodigoMunicipio(String codigoMunicipio) { // this.codigoMunicipio = codigoMunicipio; // return this; // } // // public ServicoBuilder comCodigoTributacaoMunicipio(String codigoTributacaoMunicipio) { // this.codigoTributacaoMunicipio = codigoTributacaoMunicipio; // return this; // } // // @Override // protected RpsServico buildInternal() { // return new RpsServico(this); // } // // public RpsValores getValores() { // return valores; // } // // public String getCodigoItemListaServico() { // return codigoItemListaServico; // } // // public String getCodigoCnae() { // return codigoCnae; // } // // public String getCodigoTributacaoMunicipio() { // return codigoTributacaoMunicipio; // } // // public String getDiscriminacao() { // return discriminacao; // } // // public String getCodigoMunicipio() { // return codigoMunicipio; // } // // }
import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.builders.ServicoBuilder; import com.thoughtworks.xstream.annotations.XStreamAlias;
package com.pablodomingos.classes.rps; public class RpsServico { @XStreamAlias("Valores") @NotNull private RpsValores valores; @XStreamAlias("ItemListaServico") @NotNull @Size(min = 1, max = 5) private String codigoItemListaServico; @XStreamAlias("CodigoCnae") @Pattern(regexp = "\\d+") @Size(min = 1, max = 7) private String codigoCnae; @XStreamAlias("CodigoTributacaoMunicipio") @Size(min = 1, max = 20) private String codigoTributacaoMunicipio; @XStreamAlias("Discriminacao") @NotNull @Size(min = 1, max = 2000) private String discriminacao; @XStreamAlias("CodigoMunicipio") @NotNull @Pattern(regexp = "\\d+") @Size(min = 1, max = 7) private String codigoMunicipioIbge;
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/ServicoBuilder.java // public class ServicoBuilder extends AbstractBuilder<RpsServico>{ // // private RpsValores valores; // private String codigoItemListaServico; // private String codigoCnae; // private String codigoTributacaoMunicipio; // private String discriminacao; // private String codigoMunicipio; // // public ServicoBuilder(RpsValores valores, String codigoItemListaServico) { // this.valores = valores; // this.codigoItemListaServico = codigoItemListaServico; // } // // public ServicoBuilder comCodigoCnae(Integer codigoCnae) { // return comCodigoCnae(Integer.toString(codigoCnae)); // } // // public ServicoBuilder comCodigoCnae(String codigoCnae) { // this.codigoCnae = codigoCnae; // return this; // } // // public ServicoBuilder comDiscriminacao(String discriminacao) { // this.discriminacao = discriminacao; // return this; // } // // public ServicoBuilder comCodigoMunicipio(Integer codigoMunicipio) { // return comCodigoMunicipio(Integer.toString(codigoMunicipio)); // } // // public ServicoBuilder comCodigoMunicipio(String codigoMunicipio) { // this.codigoMunicipio = codigoMunicipio; // return this; // } // // public ServicoBuilder comCodigoTributacaoMunicipio(String codigoTributacaoMunicipio) { // this.codigoTributacaoMunicipio = codigoTributacaoMunicipio; // return this; // } // // @Override // protected RpsServico buildInternal() { // return new RpsServico(this); // } // // public RpsValores getValores() { // return valores; // } // // public String getCodigoItemListaServico() { // return codigoItemListaServico; // } // // public String getCodigoCnae() { // return codigoCnae; // } // // public String getCodigoTributacaoMunicipio() { // return codigoTributacaoMunicipio; // } // // public String getDiscriminacao() { // return discriminacao; // } // // public String getCodigoMunicipio() { // return codigoMunicipio; // } // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsServico.java import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.builders.ServicoBuilder; import com.thoughtworks.xstream.annotations.XStreamAlias; package com.pablodomingos.classes.rps; public class RpsServico { @XStreamAlias("Valores") @NotNull private RpsValores valores; @XStreamAlias("ItemListaServico") @NotNull @Size(min = 1, max = 5) private String codigoItemListaServico; @XStreamAlias("CodigoCnae") @Pattern(regexp = "\\d+") @Size(min = 1, max = 7) private String codigoCnae; @XStreamAlias("CodigoTributacaoMunicipio") @Size(min = 1, max = 20) private String codigoTributacaoMunicipio; @XStreamAlias("Discriminacao") @NotNull @Size(min = 1, max = 2000) private String discriminacao; @XStreamAlias("CodigoMunicipio") @NotNull @Pattern(regexp = "\\d+") @Size(min = 1, max = 7) private String codigoMunicipioIbge;
public RpsServico(ServicoBuilder builder) {
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsTomadorIdentificacao.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/TomadorIdentificacaoBuilder.java // public class TomadorIdentificacaoBuilder extends AbstractBuilder<RpsTomadorIdentificacao>{ // // // private String inscricaoMunicipal; // private RpsTomadorCpfCnpj cpfCnpj; // // public TomadorIdentificacaoBuilder() {} // // public TomadorIdentificacaoBuilder comInscricaoMunicipal(String inscricaoMunicipal) { // this.inscricaoMunicipal = inscricaoMunicipal; // return this; // } // // public TomadorIdentificacaoBuilder comCpfCnpj(RpsTomadorCpfCnpj cpfCnpj) { // this.cpfCnpj = cpfCnpj; // return this; // } // // @Override // protected RpsTomadorIdentificacao buildInternal() { // return new RpsTomadorIdentificacao(this); // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // public RpsTomadorCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // // }
import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.builders.TomadorIdentificacaoBuilder; import com.thoughtworks.xstream.annotations.XStreamAlias;
package com.pablodomingos.classes.rps; public class RpsTomadorIdentificacao { @XStreamAlias("CpfCnpj") private RpsTomadorCpfCnpj cpfCnpj; @XStreamAlias("InscricaoMunicipal") @Size(min=1, max=15) private String inscricaoMunicipal;
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/TomadorIdentificacaoBuilder.java // public class TomadorIdentificacaoBuilder extends AbstractBuilder<RpsTomadorIdentificacao>{ // // // private String inscricaoMunicipal; // private RpsTomadorCpfCnpj cpfCnpj; // // public TomadorIdentificacaoBuilder() {} // // public TomadorIdentificacaoBuilder comInscricaoMunicipal(String inscricaoMunicipal) { // this.inscricaoMunicipal = inscricaoMunicipal; // return this; // } // // public TomadorIdentificacaoBuilder comCpfCnpj(RpsTomadorCpfCnpj cpfCnpj) { // this.cpfCnpj = cpfCnpj; // return this; // } // // @Override // protected RpsTomadorIdentificacao buildInternal() { // return new RpsTomadorIdentificacao(this); // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // public RpsTomadorCpfCnpj getCpfCnpj() { // return cpfCnpj; // } // // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsTomadorIdentificacao.java import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.builders.TomadorIdentificacaoBuilder; import com.thoughtworks.xstream.annotations.XStreamAlias; package com.pablodomingos.classes.rps; public class RpsTomadorIdentificacao { @XStreamAlias("CpfCnpj") private RpsTomadorCpfCnpj cpfCnpj; @XStreamAlias("InscricaoMunicipal") @Size(min=1, max=15) private String inscricaoMunicipal;
public RpsTomadorIdentificacao(TomadorIdentificacaoBuilder builder) {
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/LoteRpsBuilder.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/LoteRps.java // public class LoteRps { // // // @XStreamAlias("Id") // @NotNull // @XStreamAsAttribute // private String id; // // @XStreamAlias("versao") // @NotNull // @XStreamAsAttribute // private LoteRpsVersao versao; // // @XStreamAlias("NumeroLote") // @NotNull // @Pattern(regexp = "\\d+") // @Size(min=1, max=15) // private String numeroLote; // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // @Size(min = 14, max = 14) // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @NotNull // @Size(min=1, max=15) // private String inscricaoMunicipal; // // @XStreamAlias("QuantidadeRps") // @NotNull // private int quantidadeRps; // // @XStreamAlias("ListaRps") // @NotNull // private final List<Rps> listaRps; // // public LoteRps(LoteRpsBuilder builder) { // this.id = builder.getId(); // this.versao = builder.getVersao(); // this.numeroLote = builder.getNumeroLote(); // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // this.quantidadeRps = builder.getQuantidadeRps(); // this.listaRps = builder.getListaRps(); // } // // public String getId() { // return id; // } // // public LoteRpsVersao getVersao() { // return versao; // } // // public String getNumeroLote() { // return numeroLote; // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // public Integer getQuantidadeRps() { // return quantidadeRps; // } // // public List<Rps> getRps() { // return Collections.unmodifiableList(listaRps); // } // // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/Rps.java // @XStreamAlias("Rps") // public class Rps { // // @XStreamAlias("InfRps") // private RpsInfo rpsInfo; // // public Rps(RpsInfo rpsInfo) { // // this.rpsInfo = rpsInfo; // // } // // public RpsInfo getRpsInfo() { // return rpsInfo; // } // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/enums/LoteRpsVersao.java // @XStreamConverter(EnumToStringConverter.class) // public enum LoteRpsVersao { // // V1_00{ // @Override // public String toString() { // return "1.00"; // } // }, // V2_00{ // @Override // public String toString() { // return "2.00"; // } // }, // V2_01{ // @Override // public String toString() { // return "2.01"; // } // }, // V2_02{ // @Override // public String toString() { // return "2.02"; // } // }, // V2_03{ // @Override // public String toString() { // return "2.03"; // } // }; // }
import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; import com.pablodomingos.classes.rps.LoteRps; import com.pablodomingos.classes.rps.Rps; import com.pablodomingos.classes.rps.enums.LoteRpsVersao;
package com.pablodomingos.classes.rps.builders; public class LoteRpsBuilder extends AbstractBuilder<LoteRps>{ private String id;
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/LoteRps.java // public class LoteRps { // // // @XStreamAlias("Id") // @NotNull // @XStreamAsAttribute // private String id; // // @XStreamAlias("versao") // @NotNull // @XStreamAsAttribute // private LoteRpsVersao versao; // // @XStreamAlias("NumeroLote") // @NotNull // @Pattern(regexp = "\\d+") // @Size(min=1, max=15) // private String numeroLote; // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // @Size(min = 14, max = 14) // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @NotNull // @Size(min=1, max=15) // private String inscricaoMunicipal; // // @XStreamAlias("QuantidadeRps") // @NotNull // private int quantidadeRps; // // @XStreamAlias("ListaRps") // @NotNull // private final List<Rps> listaRps; // // public LoteRps(LoteRpsBuilder builder) { // this.id = builder.getId(); // this.versao = builder.getVersao(); // this.numeroLote = builder.getNumeroLote(); // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // this.quantidadeRps = builder.getQuantidadeRps(); // this.listaRps = builder.getListaRps(); // } // // public String getId() { // return id; // } // // public LoteRpsVersao getVersao() { // return versao; // } // // public String getNumeroLote() { // return numeroLote; // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // public Integer getQuantidadeRps() { // return quantidadeRps; // } // // public List<Rps> getRps() { // return Collections.unmodifiableList(listaRps); // } // // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/Rps.java // @XStreamAlias("Rps") // public class Rps { // // @XStreamAlias("InfRps") // private RpsInfo rpsInfo; // // public Rps(RpsInfo rpsInfo) { // // this.rpsInfo = rpsInfo; // // } // // public RpsInfo getRpsInfo() { // return rpsInfo; // } // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/enums/LoteRpsVersao.java // @XStreamConverter(EnumToStringConverter.class) // public enum LoteRpsVersao { // // V1_00{ // @Override // public String toString() { // return "1.00"; // } // }, // V2_00{ // @Override // public String toString() { // return "2.00"; // } // }, // V2_01{ // @Override // public String toString() { // return "2.01"; // } // }, // V2_02{ // @Override // public String toString() { // return "2.02"; // } // }, // V2_03{ // @Override // public String toString() { // return "2.03"; // } // }; // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/LoteRpsBuilder.java import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; import com.pablodomingos.classes.rps.LoteRps; import com.pablodomingos.classes.rps.Rps; import com.pablodomingos.classes.rps.enums.LoteRpsVersao; package com.pablodomingos.classes.rps.builders; public class LoteRpsBuilder extends AbstractBuilder<LoteRps>{ private String id;
private LoteRpsVersao versao;
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/LoteRpsBuilder.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/LoteRps.java // public class LoteRps { // // // @XStreamAlias("Id") // @NotNull // @XStreamAsAttribute // private String id; // // @XStreamAlias("versao") // @NotNull // @XStreamAsAttribute // private LoteRpsVersao versao; // // @XStreamAlias("NumeroLote") // @NotNull // @Pattern(regexp = "\\d+") // @Size(min=1, max=15) // private String numeroLote; // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // @Size(min = 14, max = 14) // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @NotNull // @Size(min=1, max=15) // private String inscricaoMunicipal; // // @XStreamAlias("QuantidadeRps") // @NotNull // private int quantidadeRps; // // @XStreamAlias("ListaRps") // @NotNull // private final List<Rps> listaRps; // // public LoteRps(LoteRpsBuilder builder) { // this.id = builder.getId(); // this.versao = builder.getVersao(); // this.numeroLote = builder.getNumeroLote(); // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // this.quantidadeRps = builder.getQuantidadeRps(); // this.listaRps = builder.getListaRps(); // } // // public String getId() { // return id; // } // // public LoteRpsVersao getVersao() { // return versao; // } // // public String getNumeroLote() { // return numeroLote; // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // public Integer getQuantidadeRps() { // return quantidadeRps; // } // // public List<Rps> getRps() { // return Collections.unmodifiableList(listaRps); // } // // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/Rps.java // @XStreamAlias("Rps") // public class Rps { // // @XStreamAlias("InfRps") // private RpsInfo rpsInfo; // // public Rps(RpsInfo rpsInfo) { // // this.rpsInfo = rpsInfo; // // } // // public RpsInfo getRpsInfo() { // return rpsInfo; // } // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/enums/LoteRpsVersao.java // @XStreamConverter(EnumToStringConverter.class) // public enum LoteRpsVersao { // // V1_00{ // @Override // public String toString() { // return "1.00"; // } // }, // V2_00{ // @Override // public String toString() { // return "2.00"; // } // }, // V2_01{ // @Override // public String toString() { // return "2.01"; // } // }, // V2_02{ // @Override // public String toString() { // return "2.02"; // } // }, // V2_03{ // @Override // public String toString() { // return "2.03"; // } // }; // }
import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; import com.pablodomingos.classes.rps.LoteRps; import com.pablodomingos.classes.rps.Rps; import com.pablodomingos.classes.rps.enums.LoteRpsVersao;
package com.pablodomingos.classes.rps.builders; public class LoteRpsBuilder extends AbstractBuilder<LoteRps>{ private String id; private LoteRpsVersao versao; private String numeroLote; private String cnpj; private String inscricaoMunicipal; private int quantidadeRps;
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/LoteRps.java // public class LoteRps { // // // @XStreamAlias("Id") // @NotNull // @XStreamAsAttribute // private String id; // // @XStreamAlias("versao") // @NotNull // @XStreamAsAttribute // private LoteRpsVersao versao; // // @XStreamAlias("NumeroLote") // @NotNull // @Pattern(regexp = "\\d+") // @Size(min=1, max=15) // private String numeroLote; // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // @Size(min = 14, max = 14) // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @NotNull // @Size(min=1, max=15) // private String inscricaoMunicipal; // // @XStreamAlias("QuantidadeRps") // @NotNull // private int quantidadeRps; // // @XStreamAlias("ListaRps") // @NotNull // private final List<Rps> listaRps; // // public LoteRps(LoteRpsBuilder builder) { // this.id = builder.getId(); // this.versao = builder.getVersao(); // this.numeroLote = builder.getNumeroLote(); // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // this.quantidadeRps = builder.getQuantidadeRps(); // this.listaRps = builder.getListaRps(); // } // // public String getId() { // return id; // } // // public LoteRpsVersao getVersao() { // return versao; // } // // public String getNumeroLote() { // return numeroLote; // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // public Integer getQuantidadeRps() { // return quantidadeRps; // } // // public List<Rps> getRps() { // return Collections.unmodifiableList(listaRps); // } // // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/Rps.java // @XStreamAlias("Rps") // public class Rps { // // @XStreamAlias("InfRps") // private RpsInfo rpsInfo; // // public Rps(RpsInfo rpsInfo) { // // this.rpsInfo = rpsInfo; // // } // // public RpsInfo getRpsInfo() { // return rpsInfo; // } // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/enums/LoteRpsVersao.java // @XStreamConverter(EnumToStringConverter.class) // public enum LoteRpsVersao { // // V1_00{ // @Override // public String toString() { // return "1.00"; // } // }, // V2_00{ // @Override // public String toString() { // return "2.00"; // } // }, // V2_01{ // @Override // public String toString() { // return "2.01"; // } // }, // V2_02{ // @Override // public String toString() { // return "2.02"; // } // }, // V2_03{ // @Override // public String toString() { // return "2.03"; // } // }; // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/LoteRpsBuilder.java import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; import com.pablodomingos.classes.rps.LoteRps; import com.pablodomingos.classes.rps.Rps; import com.pablodomingos.classes.rps.enums.LoteRpsVersao; package com.pablodomingos.classes.rps.builders; public class LoteRpsBuilder extends AbstractBuilder<LoteRps>{ private String id; private LoteRpsVersao versao; private String numeroLote; private String cnpj; private String inscricaoMunicipal; private int quantidadeRps;
private final List<Rps> listaRps;
pablopdomingos/nfse
nfse-bh/src/test/java/com/pablodomingos/classes/rps/RpsTomadorCpfCnpjTest.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/TomadorCpfCnpjBuilder.java // public class TomadorCpfCnpjBuilder extends AbstractBuilder<RpsTomadorCpfCnpj>{ // // // private String cpf; // private String cnpj; // // public TomadorCpfCnpjBuilder() {} // // public TomadorCpfCnpjBuilder comDocumento(String documento) { // if(documento.length() == 11){ // this.cpf = documento; // }else{ // this.cnpj = documento; // } // return this; // } // // @Override // protected RpsTomadorCpfCnpj buildInternal() { // return new RpsTomadorCpfCnpj(this); // } // // public String getCpf() { // return cpf; // } // // public String getCnpj() { // return cnpj; // } // // }
import javax.validation.ConstraintViolationException; import org.junit.Assert; import org.junit.Test; import com.pablodomingos.classes.rps.builders.TomadorCpfCnpjBuilder;
package com.pablodomingos.classes.rps; public class RpsTomadorCpfCnpjTest { @Test(expected = ConstraintViolationException.class) public void naoDevePermitirDocumentoComTamanhoInvalido() throws Exception { try {
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/TomadorCpfCnpjBuilder.java // public class TomadorCpfCnpjBuilder extends AbstractBuilder<RpsTomadorCpfCnpj>{ // // // private String cpf; // private String cnpj; // // public TomadorCpfCnpjBuilder() {} // // public TomadorCpfCnpjBuilder comDocumento(String documento) { // if(documento.length() == 11){ // this.cpf = documento; // }else{ // this.cnpj = documento; // } // return this; // } // // @Override // protected RpsTomadorCpfCnpj buildInternal() { // return new RpsTomadorCpfCnpj(this); // } // // public String getCpf() { // return cpf; // } // // public String getCnpj() { // return cnpj; // } // // } // Path: nfse-bh/src/test/java/com/pablodomingos/classes/rps/RpsTomadorCpfCnpjTest.java import javax.validation.ConstraintViolationException; import org.junit.Assert; import org.junit.Test; import com.pablodomingos.classes.rps.builders.TomadorCpfCnpjBuilder; package com.pablodomingos.classes.rps; public class RpsTomadorCpfCnpjTest { @Test(expected = ConstraintViolationException.class) public void naoDevePermitirDocumentoComTamanhoInvalido() throws Exception { try {
new TomadorCpfCnpjBuilder().comDocumento("1234567890").build();
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/EnviarLoteRpsResposta.java
// Path: nfse-bh/src/main/java/com/pablodomingos/conversores/LocalDateTimeConversor.java // public class LocalDateTimeConversor implements SingleValueConverter { // // @SuppressWarnings("rawtypes") // public boolean canConvert(Class classe) { // return classe.equals(LocalDateTime.class); // } // // private String getConverted(LocalDateTime source) { // if (source == null) { // throw new IllegalArgumentException("Data nao pode ser nula"); // } // return DateTimeFormatter.ISO_DATE_TIME.format(source); // } // // public String toString(Object obj) { // return getConverted((LocalDateTime) obj); // } // // public LocalDateTime fromString(String dateString) { // return LocalDateTime.parse(dateString, DateTimeFormatter.ISO_DATE_TIME); // } // // }
import java.time.LocalDateTime; import com.pablodomingos.conversores.LocalDateTimeConversor; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute; import com.thoughtworks.xstream.annotations.XStreamConverter;
package com.pablodomingos.classes.rps.servicos; @XStreamAlias("EnviarLoteRpsResposta") public class EnviarLoteRpsResposta { @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd"; @XStreamAlias("NumeroLote") private Long numeroLote; @XStreamAlias("DataRecebimento")
// Path: nfse-bh/src/main/java/com/pablodomingos/conversores/LocalDateTimeConversor.java // public class LocalDateTimeConversor implements SingleValueConverter { // // @SuppressWarnings("rawtypes") // public boolean canConvert(Class classe) { // return classe.equals(LocalDateTime.class); // } // // private String getConverted(LocalDateTime source) { // if (source == null) { // throw new IllegalArgumentException("Data nao pode ser nula"); // } // return DateTimeFormatter.ISO_DATE_TIME.format(source); // } // // public String toString(Object obj) { // return getConverted((LocalDateTime) obj); // } // // public LocalDateTime fromString(String dateString) { // return LocalDateTime.parse(dateString, DateTimeFormatter.ISO_DATE_TIME); // } // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/EnviarLoteRpsResposta.java import java.time.LocalDateTime; import com.pablodomingos.conversores.LocalDateTimeConversor; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute; import com.thoughtworks.xstream.annotations.XStreamConverter; package com.pablodomingos.classes.rps.servicos; @XStreamAlias("EnviarLoteRpsResposta") public class EnviarLoteRpsResposta { @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd"; @XStreamAlias("NumeroLote") private Long numeroLote; @XStreamAlias("DataRecebimento")
@XStreamConverter(LocalDateTimeConversor.class)
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/RpsEnvio.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/LoteRps.java // public class LoteRps { // // // @XStreamAlias("Id") // @NotNull // @XStreamAsAttribute // private String id; // // @XStreamAlias("versao") // @NotNull // @XStreamAsAttribute // private LoteRpsVersao versao; // // @XStreamAlias("NumeroLote") // @NotNull // @Pattern(regexp = "\\d+") // @Size(min=1, max=15) // private String numeroLote; // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // @Size(min = 14, max = 14) // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @NotNull // @Size(min=1, max=15) // private String inscricaoMunicipal; // // @XStreamAlias("QuantidadeRps") // @NotNull // private int quantidadeRps; // // @XStreamAlias("ListaRps") // @NotNull // private final List<Rps> listaRps; // // public LoteRps(LoteRpsBuilder builder) { // this.id = builder.getId(); // this.versao = builder.getVersao(); // this.numeroLote = builder.getNumeroLote(); // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // this.quantidadeRps = builder.getQuantidadeRps(); // this.listaRps = builder.getListaRps(); // } // // public String getId() { // return id; // } // // public LoteRpsVersao getVersao() { // return versao; // } // // public String getNumeroLote() { // return numeroLote; // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // public Integer getQuantidadeRps() { // return quantidadeRps; // } // // public List<Rps> getRps() { // return Collections.unmodifiableList(listaRps); // } // // // }
import com.pablodomingos.classes.rps.LoteRps; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
package com.pablodomingos.classes.rps.servicos; @XStreamAlias("GerarNfseEnvio") public class RpsEnvio extends AbstractService{ @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd";
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/LoteRps.java // public class LoteRps { // // // @XStreamAlias("Id") // @NotNull // @XStreamAsAttribute // private String id; // // @XStreamAlias("versao") // @NotNull // @XStreamAsAttribute // private LoteRpsVersao versao; // // @XStreamAlias("NumeroLote") // @NotNull // @Pattern(regexp = "\\d+") // @Size(min=1, max=15) // private String numeroLote; // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // @Size(min = 14, max = 14) // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @NotNull // @Size(min=1, max=15) // private String inscricaoMunicipal; // // @XStreamAlias("QuantidadeRps") // @NotNull // private int quantidadeRps; // // @XStreamAlias("ListaRps") // @NotNull // private final List<Rps> listaRps; // // public LoteRps(LoteRpsBuilder builder) { // this.id = builder.getId(); // this.versao = builder.getVersao(); // this.numeroLote = builder.getNumeroLote(); // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // this.quantidadeRps = builder.getQuantidadeRps(); // this.listaRps = builder.getListaRps(); // } // // public String getId() { // return id; // } // // public LoteRpsVersao getVersao() { // return versao; // } // // public String getNumeroLote() { // return numeroLote; // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // public Integer getQuantidadeRps() { // return quantidadeRps; // } // // public List<Rps> getRps() { // return Collections.unmodifiableList(listaRps); // } // // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/RpsEnvio.java import com.pablodomingos.classes.rps.LoteRps; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute; package com.pablodomingos.classes.rps.servicos; @XStreamAlias("GerarNfseEnvio") public class RpsEnvio extends AbstractService{ @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd";
@XStreamAlias("LoteRps")
pablopdomingos/nfse
nfse-bh/src/test/java/com/pablodomingos/classes/rps/RpsTomadorTest.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/TomadorBuilder.java // public class TomadorBuilder extends AbstractBuilder<RpsTomador> { // // private RpsTomadorCpfCnpj cpfCnpj; // RpsTomadorIdentificacao tomadorIdentificacao; // private String inscricaoMunicipal; // private String nome; // private RpsTomadorContato contato; // private RpsTomadorEndereco endereco; // // public TomadorBuilder(String documento) { // this.cpfCnpj = new TomadorCpfCnpjBuilder() // .comDocumento(documento).build(); // } // // public TomadorBuilder comInscricaoMunicipal(String inscricaoMunicipal) { // this.inscricaoMunicipal = inscricaoMunicipal; // return this; // } // // public TomadorBuilder comNome(String nome) { // this.nome = nome; // return this; // } // // public TomadorBuilder comContato(RpsTomadorContato contato) { // this.contato = contato; // return this; // } // // public TomadorBuilder comEndereco(RpsTomadorEndereco endereco){ // this.endereco = endereco; // return this; // } // // public TomadorBuilder comEndereco(TomadorEnderecoBuilder endereco){ // this.endereco = new RpsTomadorEndereco(endereco); // return this; // } // // @Override // protected RpsTomador buildInternal() { // return new RpsTomador(this); // } // // public RpsTomadorCpfCnpj getTomadorCpfCnpj() { // return this.cpfCnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // public String getNome() { // return nome; // } // // public RpsTomadorContato getContato() { // return contato; // } // // public RpsTomadorEndereco getEndereco() { // return endereco; // } // // }
import javax.validation.ConstraintViolationException; import org.junit.Test; import com.pablodomingos.classes.rps.builders.TomadorBuilder;
package com.pablodomingos.classes.rps; public class RpsTomadorTest { @Test(expected = ConstraintViolationException.class) public void naoDevePermitirNomeComTamanhoInvalido() throws Exception { try {
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/TomadorBuilder.java // public class TomadorBuilder extends AbstractBuilder<RpsTomador> { // // private RpsTomadorCpfCnpj cpfCnpj; // RpsTomadorIdentificacao tomadorIdentificacao; // private String inscricaoMunicipal; // private String nome; // private RpsTomadorContato contato; // private RpsTomadorEndereco endereco; // // public TomadorBuilder(String documento) { // this.cpfCnpj = new TomadorCpfCnpjBuilder() // .comDocumento(documento).build(); // } // // public TomadorBuilder comInscricaoMunicipal(String inscricaoMunicipal) { // this.inscricaoMunicipal = inscricaoMunicipal; // return this; // } // // public TomadorBuilder comNome(String nome) { // this.nome = nome; // return this; // } // // public TomadorBuilder comContato(RpsTomadorContato contato) { // this.contato = contato; // return this; // } // // public TomadorBuilder comEndereco(RpsTomadorEndereco endereco){ // this.endereco = endereco; // return this; // } // // public TomadorBuilder comEndereco(TomadorEnderecoBuilder endereco){ // this.endereco = new RpsTomadorEndereco(endereco); // return this; // } // // @Override // protected RpsTomador buildInternal() { // return new RpsTomador(this); // } // // public RpsTomadorCpfCnpj getTomadorCpfCnpj() { // return this.cpfCnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // public String getNome() { // return nome; // } // // public RpsTomadorContato getContato() { // return contato; // } // // public RpsTomadorEndereco getEndereco() { // return endereco; // } // // } // Path: nfse-bh/src/test/java/com/pablodomingos/classes/rps/RpsTomadorTest.java import javax.validation.ConstraintViolationException; import org.junit.Test; import com.pablodomingos.classes.rps.builders.TomadorBuilder; package com.pablodomingos.classes.rps; public class RpsTomadorTest { @Test(expected = ConstraintViolationException.class) public void naoDevePermitirNomeComTamanhoInvalido() throws Exception { try {
new TomadorBuilder("12345678909")
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/LoteRpsConsulta.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsPrestador.java // public class RpsPrestador { // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min = 1, max = 15) // private String inscricaoMunicipal; // // public RpsPrestador(PrestadorBuilder builder) { // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // }
import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.RpsPrestador; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
package com.pablodomingos.classes.rps.servicos; @XStreamAlias("ConsultarLoteRpsEnvio") public class LoteRpsConsulta extends AbstractService{ @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd"; @XStreamAlias("Prestador") @NotNull
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsPrestador.java // public class RpsPrestador { // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @Size(min = 1, max = 15) // private String inscricaoMunicipal; // // public RpsPrestador(PrestadorBuilder builder) { // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/LoteRpsConsulta.java import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.RpsPrestador; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute; package com.pablodomingos.classes.rps.servicos; @XStreamAlias("ConsultarLoteRpsEnvio") public class LoteRpsConsulta extends AbstractService{ @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd"; @XStreamAlias("Prestador") @NotNull
private RpsPrestador prestador;
pablopdomingos/nfse
nfse-bh/src/test/java/com/pablodomingos/classes/rps/RpsValoresTest.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/ValoresBuilder.java // public class ValoresBuilder extends AbstractBuilder<RpsValores> { // // private Double valorServicos = 0.0; // private Double valorDeducoes; // private Double valorPis; // private Double valorCofins; // private Double valorInss; // private Double valorIr; // private Double valorCsll; // private IssRetido issRetido = IssRetido.NAO; // private Double outrasRetencoes; // private Double aliquota = 0.0; // private Double descontoIncondicionado; // private Double descontoCondicionado; // // public ValoresBuilder(Double valorServicos, Double aliquota) { // this.aliquota = DoubleUtil.arredondarDuasCasas(aliquota / 100.0); // this.valorServicos = DoubleUtil.arredondarDuasCasas(valorServicos); // } // // public ValoresBuilder comValorDeducoes(Double valorDeducoes) { // this.valorDeducoes = DoubleUtil.arredondarDuasCasas(valorDeducoes); // return this; // } // // public ValoresBuilder comValorPis(Double valorPis) { // this.valorPis = DoubleUtil.arredondarDuasCasas(valorPis); // return this; // } // // public ValoresBuilder comValorCofins(Double valorCofins) { // this.valorCofins = DoubleUtil.arredondarDuasCasas(valorCofins); // return this; // } // // public ValoresBuilder comValorInss(Double valorInss) { // this.valorInss = DoubleUtil.arredondarDuasCasas(valorInss); // return this; // } // // public ValoresBuilder comValorIr(Double valorIr) { // this.valorIr = DoubleUtil.arredondarDuasCasas(valorIr); // return this; // } // // public ValoresBuilder comValorCsll(Double valorCsll) { // this.valorCsll = DoubleUtil.arredondarDuasCasas(valorCsll); // return this; // } // // public ValoresBuilder comOutrasRetencoes(Double outrasRetencoes) { // this.outrasRetencoes = DoubleUtil.arredondarDuasCasas(outrasRetencoes); // return this; // } // // public ValoresBuilder comDescontoIncondicionado(Double descontoIncondicionado) { // this.descontoIncondicionado = DoubleUtil.arredondarDuasCasas(descontoIncondicionado); // return this; // } // // public ValoresBuilder comDescontoCondicionado(Double descontoCondicionado) { // this.descontoCondicionado = DoubleUtil.arredondarDuasCasas(descontoCondicionado); // return this; // } // // public ValoresBuilder comIssRetido(boolean issRetido) { // this.issRetido = issRetido ? IssRetido.SIM : IssRetido.NAO; // return this; // } // // @Override // protected RpsValores buildInternal() { // return new RpsValores(this); // } // // public Double getValorServicos() { // return valorServicos; // } // // public Double getValorDeducoes() { // return valorDeducoes; // } // // public Double getValorPis() { // return valorPis; // } // // public Double getValorCofins() { // return valorCofins; // } // // public Double getValorInss() { // return valorInss; // } // // public Double getValorIr() { // return valorIr; // } // // public Double getValorCsll() { // return valorCsll; // } // // public IssRetido getIssRetido() { // return issRetido; // } // // public Double getOutrasRetencoes() { // return outrasRetencoes; // } // // public Double getAliquota() { // return aliquota; // } // // public Double getDescontoIncondicionado() { // return descontoIncondicionado; // } // // public Double getDescontoCondicionado() { // return descontoCondicionado; // } // // }
import javax.validation.ConstraintViolationException; import org.junit.Assert; import org.junit.Test; import com.pablodomingos.classes.rps.builders.ValoresBuilder;
package com.pablodomingos.classes.rps; public class RpsValoresTest { @Test(expected = ConstraintViolationException.class) public void naoDevePermitirValorMenorOuIgualZeroParaServico() throws Exception { try {
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/ValoresBuilder.java // public class ValoresBuilder extends AbstractBuilder<RpsValores> { // // private Double valorServicos = 0.0; // private Double valorDeducoes; // private Double valorPis; // private Double valorCofins; // private Double valorInss; // private Double valorIr; // private Double valorCsll; // private IssRetido issRetido = IssRetido.NAO; // private Double outrasRetencoes; // private Double aliquota = 0.0; // private Double descontoIncondicionado; // private Double descontoCondicionado; // // public ValoresBuilder(Double valorServicos, Double aliquota) { // this.aliquota = DoubleUtil.arredondarDuasCasas(aliquota / 100.0); // this.valorServicos = DoubleUtil.arredondarDuasCasas(valorServicos); // } // // public ValoresBuilder comValorDeducoes(Double valorDeducoes) { // this.valorDeducoes = DoubleUtil.arredondarDuasCasas(valorDeducoes); // return this; // } // // public ValoresBuilder comValorPis(Double valorPis) { // this.valorPis = DoubleUtil.arredondarDuasCasas(valorPis); // return this; // } // // public ValoresBuilder comValorCofins(Double valorCofins) { // this.valorCofins = DoubleUtil.arredondarDuasCasas(valorCofins); // return this; // } // // public ValoresBuilder comValorInss(Double valorInss) { // this.valorInss = DoubleUtil.arredondarDuasCasas(valorInss); // return this; // } // // public ValoresBuilder comValorIr(Double valorIr) { // this.valorIr = DoubleUtil.arredondarDuasCasas(valorIr); // return this; // } // // public ValoresBuilder comValorCsll(Double valorCsll) { // this.valorCsll = DoubleUtil.arredondarDuasCasas(valorCsll); // return this; // } // // public ValoresBuilder comOutrasRetencoes(Double outrasRetencoes) { // this.outrasRetencoes = DoubleUtil.arredondarDuasCasas(outrasRetencoes); // return this; // } // // public ValoresBuilder comDescontoIncondicionado(Double descontoIncondicionado) { // this.descontoIncondicionado = DoubleUtil.arredondarDuasCasas(descontoIncondicionado); // return this; // } // // public ValoresBuilder comDescontoCondicionado(Double descontoCondicionado) { // this.descontoCondicionado = DoubleUtil.arredondarDuasCasas(descontoCondicionado); // return this; // } // // public ValoresBuilder comIssRetido(boolean issRetido) { // this.issRetido = issRetido ? IssRetido.SIM : IssRetido.NAO; // return this; // } // // @Override // protected RpsValores buildInternal() { // return new RpsValores(this); // } // // public Double getValorServicos() { // return valorServicos; // } // // public Double getValorDeducoes() { // return valorDeducoes; // } // // public Double getValorPis() { // return valorPis; // } // // public Double getValorCofins() { // return valorCofins; // } // // public Double getValorInss() { // return valorInss; // } // // public Double getValorIr() { // return valorIr; // } // // public Double getValorCsll() { // return valorCsll; // } // // public IssRetido getIssRetido() { // return issRetido; // } // // public Double getOutrasRetencoes() { // return outrasRetencoes; // } // // public Double getAliquota() { // return aliquota; // } // // public Double getDescontoIncondicionado() { // return descontoIncondicionado; // } // // public Double getDescontoCondicionado() { // return descontoCondicionado; // } // // } // Path: nfse-bh/src/test/java/com/pablodomingos/classes/rps/RpsValoresTest.java import javax.validation.ConstraintViolationException; import org.junit.Assert; import org.junit.Test; import com.pablodomingos.classes.rps.builders.ValoresBuilder; package com.pablodomingos.classes.rps; public class RpsValoresTest { @Test(expected = ConstraintViolationException.class) public void naoDevePermitirValorMenorOuIgualZeroParaServico() throws Exception { try {
new ValoresBuilder(-1.00, 1.0).build();
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/NFSeInfPedidoCancelamento.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/PedidoCancelamentoInfBuilder.java // public class PedidoCancelamentoInfBuilder extends AbstractBuilder<NFSeInfPedidoCancelamento>{ // // private String id; // private NFSeIdentificacao nfseIdentificacao; // private CodigoCancelamento codigoCancelamento; // // public PedidoCancelamentoInfBuilder() { // this.id = UUID.randomUUID().toString(); // } // // public PedidoCancelamentoInfBuilder comId(String id){ // this.id = id; // return this; // } // // public PedidoCancelamentoInfBuilder comNFSeIdentificacao(NFSeIdentificacao nfseIdentificacao){ // this.nfseIdentificacao = nfseIdentificacao; // return this; // } // // public PedidoCancelamentoInfBuilder comCodigoCancelamento(CodigoCancelamento codigoCancelamento){ // this.codigoCancelamento = codigoCancelamento; // return this; // } // // @Override // protected NFSeInfPedidoCancelamento buildInternal() { // return new NFSeInfPedidoCancelamento(this); // } // // public String getId() { // return id; // } // // public NFSeIdentificacao getNfseIdentificacao() { // return nfseIdentificacao; // } // // public CodigoCancelamento getCodigoCancelamento() { // return codigoCancelamento; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/enums/CodigoCancelamento.java // @XStreamConverter(EnumToStringConverter.class) // public enum CodigoCancelamento { // //Bh nao aceita cancelar via webservice NFSe com erro na emissao // //ERRO_NA_EMISSAO(1, "Erro na emissao"), // SERVICO_NAO_CONCLUIDO(2, "Servico cao concluido"); // // private int codigo; // private String descricao; // // CodigoCancelamento(int cod, String descricao) { // this.codigo = cod; // this.descricao = descricao; // } // // public String getDescricao() { // return this.descricao; // } // // @Override // public String toString() { // return String.valueOf(codigo); // } // // // }
import javax.validation.constraints.NotNull; import com.pablodomingos.classes.rps.builders.PedidoCancelamentoInfBuilder; import com.pablodomingos.classes.rps.enums.CodigoCancelamento; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
package com.pablodomingos.classes.rps; public class NFSeInfPedidoCancelamento { @XStreamAlias("Id") @NotNull @XStreamAsAttribute private String id; @XStreamAlias("IdentificacaoNfse") @NotNull private NFSeIdentificacao nfseIdentificacao;
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/PedidoCancelamentoInfBuilder.java // public class PedidoCancelamentoInfBuilder extends AbstractBuilder<NFSeInfPedidoCancelamento>{ // // private String id; // private NFSeIdentificacao nfseIdentificacao; // private CodigoCancelamento codigoCancelamento; // // public PedidoCancelamentoInfBuilder() { // this.id = UUID.randomUUID().toString(); // } // // public PedidoCancelamentoInfBuilder comId(String id){ // this.id = id; // return this; // } // // public PedidoCancelamentoInfBuilder comNFSeIdentificacao(NFSeIdentificacao nfseIdentificacao){ // this.nfseIdentificacao = nfseIdentificacao; // return this; // } // // public PedidoCancelamentoInfBuilder comCodigoCancelamento(CodigoCancelamento codigoCancelamento){ // this.codigoCancelamento = codigoCancelamento; // return this; // } // // @Override // protected NFSeInfPedidoCancelamento buildInternal() { // return new NFSeInfPedidoCancelamento(this); // } // // public String getId() { // return id; // } // // public NFSeIdentificacao getNfseIdentificacao() { // return nfseIdentificacao; // } // // public CodigoCancelamento getCodigoCancelamento() { // return codigoCancelamento; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/enums/CodigoCancelamento.java // @XStreamConverter(EnumToStringConverter.class) // public enum CodigoCancelamento { // //Bh nao aceita cancelar via webservice NFSe com erro na emissao // //ERRO_NA_EMISSAO(1, "Erro na emissao"), // SERVICO_NAO_CONCLUIDO(2, "Servico cao concluido"); // // private int codigo; // private String descricao; // // CodigoCancelamento(int cod, String descricao) { // this.codigo = cod; // this.descricao = descricao; // } // // public String getDescricao() { // return this.descricao; // } // // @Override // public String toString() { // return String.valueOf(codigo); // } // // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/NFSeInfPedidoCancelamento.java import javax.validation.constraints.NotNull; import com.pablodomingos.classes.rps.builders.PedidoCancelamentoInfBuilder; import com.pablodomingos.classes.rps.enums.CodigoCancelamento; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute; package com.pablodomingos.classes.rps; public class NFSeInfPedidoCancelamento { @XStreamAlias("Id") @NotNull @XStreamAsAttribute private String id; @XStreamAlias("IdentificacaoNfse") @NotNull private NFSeIdentificacao nfseIdentificacao;
@XStreamAlias("CodigoCancelamento")
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/NFSeInfPedidoCancelamento.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/PedidoCancelamentoInfBuilder.java // public class PedidoCancelamentoInfBuilder extends AbstractBuilder<NFSeInfPedidoCancelamento>{ // // private String id; // private NFSeIdentificacao nfseIdentificacao; // private CodigoCancelamento codigoCancelamento; // // public PedidoCancelamentoInfBuilder() { // this.id = UUID.randomUUID().toString(); // } // // public PedidoCancelamentoInfBuilder comId(String id){ // this.id = id; // return this; // } // // public PedidoCancelamentoInfBuilder comNFSeIdentificacao(NFSeIdentificacao nfseIdentificacao){ // this.nfseIdentificacao = nfseIdentificacao; // return this; // } // // public PedidoCancelamentoInfBuilder comCodigoCancelamento(CodigoCancelamento codigoCancelamento){ // this.codigoCancelamento = codigoCancelamento; // return this; // } // // @Override // protected NFSeInfPedidoCancelamento buildInternal() { // return new NFSeInfPedidoCancelamento(this); // } // // public String getId() { // return id; // } // // public NFSeIdentificacao getNfseIdentificacao() { // return nfseIdentificacao; // } // // public CodigoCancelamento getCodigoCancelamento() { // return codigoCancelamento; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/enums/CodigoCancelamento.java // @XStreamConverter(EnumToStringConverter.class) // public enum CodigoCancelamento { // //Bh nao aceita cancelar via webservice NFSe com erro na emissao // //ERRO_NA_EMISSAO(1, "Erro na emissao"), // SERVICO_NAO_CONCLUIDO(2, "Servico cao concluido"); // // private int codigo; // private String descricao; // // CodigoCancelamento(int cod, String descricao) { // this.codigo = cod; // this.descricao = descricao; // } // // public String getDescricao() { // return this.descricao; // } // // @Override // public String toString() { // return String.valueOf(codigo); // } // // // }
import javax.validation.constraints.NotNull; import com.pablodomingos.classes.rps.builders.PedidoCancelamentoInfBuilder; import com.pablodomingos.classes.rps.enums.CodigoCancelamento; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
package com.pablodomingos.classes.rps; public class NFSeInfPedidoCancelamento { @XStreamAlias("Id") @NotNull @XStreamAsAttribute private String id; @XStreamAlias("IdentificacaoNfse") @NotNull private NFSeIdentificacao nfseIdentificacao; @XStreamAlias("CodigoCancelamento") @NotNull private CodigoCancelamento codigoCancelamento;
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/PedidoCancelamentoInfBuilder.java // public class PedidoCancelamentoInfBuilder extends AbstractBuilder<NFSeInfPedidoCancelamento>{ // // private String id; // private NFSeIdentificacao nfseIdentificacao; // private CodigoCancelamento codigoCancelamento; // // public PedidoCancelamentoInfBuilder() { // this.id = UUID.randomUUID().toString(); // } // // public PedidoCancelamentoInfBuilder comId(String id){ // this.id = id; // return this; // } // // public PedidoCancelamentoInfBuilder comNFSeIdentificacao(NFSeIdentificacao nfseIdentificacao){ // this.nfseIdentificacao = nfseIdentificacao; // return this; // } // // public PedidoCancelamentoInfBuilder comCodigoCancelamento(CodigoCancelamento codigoCancelamento){ // this.codigoCancelamento = codigoCancelamento; // return this; // } // // @Override // protected NFSeInfPedidoCancelamento buildInternal() { // return new NFSeInfPedidoCancelamento(this); // } // // public String getId() { // return id; // } // // public NFSeIdentificacao getNfseIdentificacao() { // return nfseIdentificacao; // } // // public CodigoCancelamento getCodigoCancelamento() { // return codigoCancelamento; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/enums/CodigoCancelamento.java // @XStreamConverter(EnumToStringConverter.class) // public enum CodigoCancelamento { // //Bh nao aceita cancelar via webservice NFSe com erro na emissao // //ERRO_NA_EMISSAO(1, "Erro na emissao"), // SERVICO_NAO_CONCLUIDO(2, "Servico cao concluido"); // // private int codigo; // private String descricao; // // CodigoCancelamento(int cod, String descricao) { // this.codigo = cod; // this.descricao = descricao; // } // // public String getDescricao() { // return this.descricao; // } // // @Override // public String toString() { // return String.valueOf(codigo); // } // // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/NFSeInfPedidoCancelamento.java import javax.validation.constraints.NotNull; import com.pablodomingos.classes.rps.builders.PedidoCancelamentoInfBuilder; import com.pablodomingos.classes.rps.enums.CodigoCancelamento; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute; package com.pablodomingos.classes.rps; public class NFSeInfPedidoCancelamento { @XStreamAlias("Id") @NotNull @XStreamAsAttribute private String id; @XStreamAlias("IdentificacaoNfse") @NotNull private NFSeIdentificacao nfseIdentificacao; @XStreamAlias("CodigoCancelamento") @NotNull private CodigoCancelamento codigoCancelamento;
public NFSeInfPedidoCancelamento(PedidoCancelamentoInfBuilder builder) {
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsPrestador.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/PrestadorBuilder.java // public class PrestadorBuilder extends AbstractBuilder<RpsPrestador>{ // // private String cnpj; // private String inscricaoMunicipal; // // public PrestadorBuilder(String cnpj) { // this.cnpj = cnpj; // } // // public PrestadorBuilder comInscricaoMunicipal(String inscricaoMunicipal) { // this.inscricaoMunicipal = inscricaoMunicipal; // return this; // } // // @Override // protected RpsPrestador buildInternal() { // return new RpsPrestador(this); // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // // }
import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import org.hibernate.validator.constraints.br.CNPJ; import com.pablodomingos.classes.rps.builders.PrestadorBuilder; import com.thoughtworks.xstream.annotations.XStreamAlias;
package com.pablodomingos.classes.rps; public class RpsPrestador { @XStreamAlias("Cnpj") @NotNull @CNPJ private String cnpj; @XStreamAlias("InscricaoMunicipal") @Size(min = 1, max = 15) private String inscricaoMunicipal;
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/PrestadorBuilder.java // public class PrestadorBuilder extends AbstractBuilder<RpsPrestador>{ // // private String cnpj; // private String inscricaoMunicipal; // // public PrestadorBuilder(String cnpj) { // this.cnpj = cnpj; // } // // public PrestadorBuilder comInscricaoMunicipal(String inscricaoMunicipal) { // this.inscricaoMunicipal = inscricaoMunicipal; // return this; // } // // @Override // protected RpsPrestador buildInternal() { // return new RpsPrestador(this); // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsPrestador.java import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import org.hibernate.validator.constraints.br.CNPJ; import com.pablodomingos.classes.rps.builders.PrestadorBuilder; import com.thoughtworks.xstream.annotations.XStreamAlias; package com.pablodomingos.classes.rps; public class RpsPrestador { @XStreamAlias("Cnpj") @NotNull @CNPJ private String cnpj; @XStreamAlias("InscricaoMunicipal") @Size(min = 1, max = 15) private String inscricaoMunicipal;
public RpsPrestador(PrestadorBuilder builder) {
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/LoteRps.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/LoteRpsBuilder.java // public class LoteRpsBuilder extends AbstractBuilder<LoteRps>{ // // // private String id; // private LoteRpsVersao versao; // private String numeroLote; // private String cnpj; // private String inscricaoMunicipal; // private int quantidadeRps; // private final List<Rps> listaRps; // // public LoteRpsBuilder(String numeroLote) { // this.numeroLote = numeroLote; // this.versao = LoteRpsVersao.V1_00; // this.listaRps = new ArrayList<Rps>(); // this.id = UUID.randomUUID().toString(); // } // // public LoteRpsBuilder comId(String id) { // this.id = id; // return this; // } // // public LoteRpsBuilder comVersao(LoteRpsVersao versao) { // this.versao = versao; // return this; // } // // public LoteRpsBuilder comCnpj(String cnpj) { // this.cnpj = cnpj; // return this; // } // // public LoteRpsBuilder comInscricaoMunicipal(String inscricaoMunicipal) { // this.inscricaoMunicipal = inscricaoMunicipal; // return this; // } // // public LoteRpsBuilder addRps(List<Rps> rps) { // this.listaRps.addAll(rps); // this.quantidadeRps = listaRps.size(); // return this; // } // // public LoteRpsBuilder addRps(Rps... rps) { // addRps(Arrays.asList(rps)); // return this; // } // // @Override // protected LoteRps buildInternal() { // return new LoteRps(this); // } // // public String getId() { // return this.id; // } // // public LoteRpsVersao getVersao() { // return this.versao; // } // // public String getNumeroLote() { // return this.numeroLote; // } // // public String getCnpj() { // return this.cnpj; // } // // public String getInscricaoMunicipal() { // return this.inscricaoMunicipal; // } // // public int getQuantidadeRps() { // return this.quantidadeRps; // } // // public List<Rps> getListaRps() { // return this.listaRps; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/enums/LoteRpsVersao.java // @XStreamConverter(EnumToStringConverter.class) // public enum LoteRpsVersao { // // V1_00{ // @Override // public String toString() { // return "1.00"; // } // }, // V2_00{ // @Override // public String toString() { // return "2.00"; // } // }, // V2_01{ // @Override // public String toString() { // return "2.01"; // } // }, // V2_02{ // @Override // public String toString() { // return "2.02"; // } // }, // V2_03{ // @Override // public String toString() { // return "2.03"; // } // }; // }
import java.util.Collections; import java.util.List; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import org.hibernate.validator.constraints.br.CNPJ; import com.pablodomingos.classes.rps.builders.LoteRpsBuilder; import com.pablodomingos.classes.rps.enums.LoteRpsVersao; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
package com.pablodomingos.classes.rps; public class LoteRps { @XStreamAlias("Id") @NotNull @XStreamAsAttribute private String id; @XStreamAlias("versao") @NotNull @XStreamAsAttribute
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/LoteRpsBuilder.java // public class LoteRpsBuilder extends AbstractBuilder<LoteRps>{ // // // private String id; // private LoteRpsVersao versao; // private String numeroLote; // private String cnpj; // private String inscricaoMunicipal; // private int quantidadeRps; // private final List<Rps> listaRps; // // public LoteRpsBuilder(String numeroLote) { // this.numeroLote = numeroLote; // this.versao = LoteRpsVersao.V1_00; // this.listaRps = new ArrayList<Rps>(); // this.id = UUID.randomUUID().toString(); // } // // public LoteRpsBuilder comId(String id) { // this.id = id; // return this; // } // // public LoteRpsBuilder comVersao(LoteRpsVersao versao) { // this.versao = versao; // return this; // } // // public LoteRpsBuilder comCnpj(String cnpj) { // this.cnpj = cnpj; // return this; // } // // public LoteRpsBuilder comInscricaoMunicipal(String inscricaoMunicipal) { // this.inscricaoMunicipal = inscricaoMunicipal; // return this; // } // // public LoteRpsBuilder addRps(List<Rps> rps) { // this.listaRps.addAll(rps); // this.quantidadeRps = listaRps.size(); // return this; // } // // public LoteRpsBuilder addRps(Rps... rps) { // addRps(Arrays.asList(rps)); // return this; // } // // @Override // protected LoteRps buildInternal() { // return new LoteRps(this); // } // // public String getId() { // return this.id; // } // // public LoteRpsVersao getVersao() { // return this.versao; // } // // public String getNumeroLote() { // return this.numeroLote; // } // // public String getCnpj() { // return this.cnpj; // } // // public String getInscricaoMunicipal() { // return this.inscricaoMunicipal; // } // // public int getQuantidadeRps() { // return this.quantidadeRps; // } // // public List<Rps> getListaRps() { // return this.listaRps; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/enums/LoteRpsVersao.java // @XStreamConverter(EnumToStringConverter.class) // public enum LoteRpsVersao { // // V1_00{ // @Override // public String toString() { // return "1.00"; // } // }, // V2_00{ // @Override // public String toString() { // return "2.00"; // } // }, // V2_01{ // @Override // public String toString() { // return "2.01"; // } // }, // V2_02{ // @Override // public String toString() { // return "2.02"; // } // }, // V2_03{ // @Override // public String toString() { // return "2.03"; // } // }; // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/LoteRps.java import java.util.Collections; import java.util.List; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import org.hibernate.validator.constraints.br.CNPJ; import com.pablodomingos.classes.rps.builders.LoteRpsBuilder; import com.pablodomingos.classes.rps.enums.LoteRpsVersao; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute; package com.pablodomingos.classes.rps; public class LoteRps { @XStreamAlias("Id") @NotNull @XStreamAsAttribute private String id; @XStreamAlias("versao") @NotNull @XStreamAsAttribute
private LoteRpsVersao versao;
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/LoteRps.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/LoteRpsBuilder.java // public class LoteRpsBuilder extends AbstractBuilder<LoteRps>{ // // // private String id; // private LoteRpsVersao versao; // private String numeroLote; // private String cnpj; // private String inscricaoMunicipal; // private int quantidadeRps; // private final List<Rps> listaRps; // // public LoteRpsBuilder(String numeroLote) { // this.numeroLote = numeroLote; // this.versao = LoteRpsVersao.V1_00; // this.listaRps = new ArrayList<Rps>(); // this.id = UUID.randomUUID().toString(); // } // // public LoteRpsBuilder comId(String id) { // this.id = id; // return this; // } // // public LoteRpsBuilder comVersao(LoteRpsVersao versao) { // this.versao = versao; // return this; // } // // public LoteRpsBuilder comCnpj(String cnpj) { // this.cnpj = cnpj; // return this; // } // // public LoteRpsBuilder comInscricaoMunicipal(String inscricaoMunicipal) { // this.inscricaoMunicipal = inscricaoMunicipal; // return this; // } // // public LoteRpsBuilder addRps(List<Rps> rps) { // this.listaRps.addAll(rps); // this.quantidadeRps = listaRps.size(); // return this; // } // // public LoteRpsBuilder addRps(Rps... rps) { // addRps(Arrays.asList(rps)); // return this; // } // // @Override // protected LoteRps buildInternal() { // return new LoteRps(this); // } // // public String getId() { // return this.id; // } // // public LoteRpsVersao getVersao() { // return this.versao; // } // // public String getNumeroLote() { // return this.numeroLote; // } // // public String getCnpj() { // return this.cnpj; // } // // public String getInscricaoMunicipal() { // return this.inscricaoMunicipal; // } // // public int getQuantidadeRps() { // return this.quantidadeRps; // } // // public List<Rps> getListaRps() { // return this.listaRps; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/enums/LoteRpsVersao.java // @XStreamConverter(EnumToStringConverter.class) // public enum LoteRpsVersao { // // V1_00{ // @Override // public String toString() { // return "1.00"; // } // }, // V2_00{ // @Override // public String toString() { // return "2.00"; // } // }, // V2_01{ // @Override // public String toString() { // return "2.01"; // } // }, // V2_02{ // @Override // public String toString() { // return "2.02"; // } // }, // V2_03{ // @Override // public String toString() { // return "2.03"; // } // }; // }
import java.util.Collections; import java.util.List; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import org.hibernate.validator.constraints.br.CNPJ; import com.pablodomingos.classes.rps.builders.LoteRpsBuilder; import com.pablodomingos.classes.rps.enums.LoteRpsVersao; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
package com.pablodomingos.classes.rps; public class LoteRps { @XStreamAlias("Id") @NotNull @XStreamAsAttribute private String id; @XStreamAlias("versao") @NotNull @XStreamAsAttribute private LoteRpsVersao versao; @XStreamAlias("NumeroLote") @NotNull @Pattern(regexp = "\\d+") @Size(min=1, max=15) private String numeroLote; @XStreamAlias("Cnpj") @NotNull @CNPJ @Size(min = 14, max = 14) private String cnpj; @XStreamAlias("InscricaoMunicipal") @NotNull @Size(min=1, max=15) private String inscricaoMunicipal; @XStreamAlias("QuantidadeRps") @NotNull private int quantidadeRps; @XStreamAlias("ListaRps") @NotNull private final List<Rps> listaRps;
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/LoteRpsBuilder.java // public class LoteRpsBuilder extends AbstractBuilder<LoteRps>{ // // // private String id; // private LoteRpsVersao versao; // private String numeroLote; // private String cnpj; // private String inscricaoMunicipal; // private int quantidadeRps; // private final List<Rps> listaRps; // // public LoteRpsBuilder(String numeroLote) { // this.numeroLote = numeroLote; // this.versao = LoteRpsVersao.V1_00; // this.listaRps = new ArrayList<Rps>(); // this.id = UUID.randomUUID().toString(); // } // // public LoteRpsBuilder comId(String id) { // this.id = id; // return this; // } // // public LoteRpsBuilder comVersao(LoteRpsVersao versao) { // this.versao = versao; // return this; // } // // public LoteRpsBuilder comCnpj(String cnpj) { // this.cnpj = cnpj; // return this; // } // // public LoteRpsBuilder comInscricaoMunicipal(String inscricaoMunicipal) { // this.inscricaoMunicipal = inscricaoMunicipal; // return this; // } // // public LoteRpsBuilder addRps(List<Rps> rps) { // this.listaRps.addAll(rps); // this.quantidadeRps = listaRps.size(); // return this; // } // // public LoteRpsBuilder addRps(Rps... rps) { // addRps(Arrays.asList(rps)); // return this; // } // // @Override // protected LoteRps buildInternal() { // return new LoteRps(this); // } // // public String getId() { // return this.id; // } // // public LoteRpsVersao getVersao() { // return this.versao; // } // // public String getNumeroLote() { // return this.numeroLote; // } // // public String getCnpj() { // return this.cnpj; // } // // public String getInscricaoMunicipal() { // return this.inscricaoMunicipal; // } // // public int getQuantidadeRps() { // return this.quantidadeRps; // } // // public List<Rps> getListaRps() { // return this.listaRps; // } // // } // // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/enums/LoteRpsVersao.java // @XStreamConverter(EnumToStringConverter.class) // public enum LoteRpsVersao { // // V1_00{ // @Override // public String toString() { // return "1.00"; // } // }, // V2_00{ // @Override // public String toString() { // return "2.00"; // } // }, // V2_01{ // @Override // public String toString() { // return "2.01"; // } // }, // V2_02{ // @Override // public String toString() { // return "2.02"; // } // }, // V2_03{ // @Override // public String toString() { // return "2.03"; // } // }; // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/LoteRps.java import java.util.Collections; import java.util.List; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import org.hibernate.validator.constraints.br.CNPJ; import com.pablodomingos.classes.rps.builders.LoteRpsBuilder; import com.pablodomingos.classes.rps.enums.LoteRpsVersao; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute; package com.pablodomingos.classes.rps; public class LoteRps { @XStreamAlias("Id") @NotNull @XStreamAsAttribute private String id; @XStreamAlias("versao") @NotNull @XStreamAsAttribute private LoteRpsVersao versao; @XStreamAlias("NumeroLote") @NotNull @Pattern(regexp = "\\d+") @Size(min=1, max=15) private String numeroLote; @XStreamAlias("Cnpj") @NotNull @CNPJ @Size(min = 14, max = 14) private String cnpj; @XStreamAlias("InscricaoMunicipal") @NotNull @Size(min=1, max=15) private String inscricaoMunicipal; @XStreamAlias("QuantidadeRps") @NotNull private int quantidadeRps; @XStreamAlias("ListaRps") @NotNull private final List<Rps> listaRps;
public LoteRps(LoteRpsBuilder builder) {
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsDadosContrucaoCivil.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/ConstrucaoCivilBuilder.java // public class ConstrucaoCivilBuilder extends AbstractBuilder<RpsDadosContrucaoCivil>{ // // private String codigoObra; // private String art; // // public ConstrucaoCivilBuilder(String codigoObra, String art) { // this.codigoObra = codigoObra; // this.art = art; // } // // @Override // protected RpsDadosContrucaoCivil buildInternal() { // return new RpsDadosContrucaoCivil(this); // } // // public String getCodigoObra() { // return codigoObra; // } // // public String getArt() { // return art; // } // // }
import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.builders.ConstrucaoCivilBuilder; import com.thoughtworks.xstream.annotations.XStreamAlias;
package com.pablodomingos.classes.rps; public class RpsDadosContrucaoCivil { @XStreamAlias("CodigoObra") @NotNull @Size(min=1, max=15) private String codigoObra; @XStreamAlias("Art") @NotNull @Size(min=1, max=15) private String art;
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/ConstrucaoCivilBuilder.java // public class ConstrucaoCivilBuilder extends AbstractBuilder<RpsDadosContrucaoCivil>{ // // private String codigoObra; // private String art; // // public ConstrucaoCivilBuilder(String codigoObra, String art) { // this.codigoObra = codigoObra; // this.art = art; // } // // @Override // protected RpsDadosContrucaoCivil buildInternal() { // return new RpsDadosContrucaoCivil(this); // } // // public String getCodigoObra() { // return codigoObra; // } // // public String getArt() { // return art; // } // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsDadosContrucaoCivil.java import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import com.pablodomingos.classes.rps.builders.ConstrucaoCivilBuilder; import com.thoughtworks.xstream.annotations.XStreamAlias; package com.pablodomingos.classes.rps; public class RpsDadosContrucaoCivil { @XStreamAlias("CodigoObra") @NotNull @Size(min=1, max=15) private String codigoObra; @XStreamAlias("Art") @NotNull @Size(min=1, max=15) private String art;
public RpsDadosContrucaoCivil(ConstrucaoCivilBuilder builder) {
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsIntermediarioCpfCnpj.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/IntermediarioCpfCnpjBuilder.java // public class IntermediarioCpfCnpjBuilder extends AbstractBuilder<RpsIntermediarioCpfCnpj>{ // // // private String cpf; // private String cnpj; // // // public IntermediarioCpfCnpjBuilder(){} // // public IntermediarioCpfCnpjBuilder comDocumento(String documento) { // if(documento.length() == 11){ // this.cpf = documento; // }else{ // this.cnpj = documento; // } // return this; // } // // @Override // protected RpsIntermediarioCpfCnpj buildInternal() { // return new RpsIntermediarioCpfCnpj(this); // } // // public String getCpf() { // return cpf; // } // // public String getCnpj() { // return cnpj; // } // // // }
import org.hibernate.validator.constraints.br.CNPJ; import org.hibernate.validator.constraints.br.CPF; import com.pablodomingos.classes.rps.builders.IntermediarioCpfCnpjBuilder; import com.thoughtworks.xstream.annotations.XStreamAlias;
package com.pablodomingos.classes.rps; public class RpsIntermediarioCpfCnpj { @XStreamAlias("Cnpj") @CNPJ private String cnpj; @XStreamAlias("Cpf") @CPF private String cpf;
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/IntermediarioCpfCnpjBuilder.java // public class IntermediarioCpfCnpjBuilder extends AbstractBuilder<RpsIntermediarioCpfCnpj>{ // // // private String cpf; // private String cnpj; // // // public IntermediarioCpfCnpjBuilder(){} // // public IntermediarioCpfCnpjBuilder comDocumento(String documento) { // if(documento.length() == 11){ // this.cpf = documento; // }else{ // this.cnpj = documento; // } // return this; // } // // @Override // protected RpsIntermediarioCpfCnpj buildInternal() { // return new RpsIntermediarioCpfCnpj(this); // } // // public String getCpf() { // return cpf; // } // // public String getCnpj() { // return cnpj; // } // // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsIntermediarioCpfCnpj.java import org.hibernate.validator.constraints.br.CNPJ; import org.hibernate.validator.constraints.br.CPF; import com.pablodomingos.classes.rps.builders.IntermediarioCpfCnpjBuilder; import com.thoughtworks.xstream.annotations.XStreamAlias; package com.pablodomingos.classes.rps; public class RpsIntermediarioCpfCnpj { @XStreamAlias("Cnpj") @CNPJ private String cnpj; @XStreamAlias("Cpf") @CPF private String cpf;
public RpsIntermediarioCpfCnpj(IntermediarioCpfCnpjBuilder builder) {
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsTomadorCpfCnpj.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/TomadorCpfCnpjBuilder.java // public class TomadorCpfCnpjBuilder extends AbstractBuilder<RpsTomadorCpfCnpj>{ // // // private String cpf; // private String cnpj; // // public TomadorCpfCnpjBuilder() {} // // public TomadorCpfCnpjBuilder comDocumento(String documento) { // if(documento.length() == 11){ // this.cpf = documento; // }else{ // this.cnpj = documento; // } // return this; // } // // @Override // protected RpsTomadorCpfCnpj buildInternal() { // return new RpsTomadorCpfCnpj(this); // } // // public String getCpf() { // return cpf; // } // // public String getCnpj() { // return cnpj; // } // // }
import javax.validation.constraints.Size; import org.hibernate.validator.constraints.br.CNPJ; import org.hibernate.validator.constraints.br.CPF; import com.pablodomingos.classes.rps.builders.TomadorCpfCnpjBuilder; import com.thoughtworks.xstream.annotations.XStreamAlias;
package com.pablodomingos.classes.rps; public class RpsTomadorCpfCnpj { @XStreamAlias("Cnpj") @CNPJ @Size(min = 14, max = 14) private String cnpj; @XStreamAlias("Cpf") @CPF @Size(min = 11, max = 11) private String cpf;
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/TomadorCpfCnpjBuilder.java // public class TomadorCpfCnpjBuilder extends AbstractBuilder<RpsTomadorCpfCnpj>{ // // // private String cpf; // private String cnpj; // // public TomadorCpfCnpjBuilder() {} // // public TomadorCpfCnpjBuilder comDocumento(String documento) { // if(documento.length() == 11){ // this.cpf = documento; // }else{ // this.cnpj = documento; // } // return this; // } // // @Override // protected RpsTomadorCpfCnpj buildInternal() { // return new RpsTomadorCpfCnpj(this); // } // // public String getCpf() { // return cpf; // } // // public String getCnpj() { // return cnpj; // } // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/RpsTomadorCpfCnpj.java import javax.validation.constraints.Size; import org.hibernate.validator.constraints.br.CNPJ; import org.hibernate.validator.constraints.br.CPF; import com.pablodomingos.classes.rps.builders.TomadorCpfCnpjBuilder; import com.thoughtworks.xstream.annotations.XStreamAlias; package com.pablodomingos.classes.rps; public class RpsTomadorCpfCnpj { @XStreamAlias("Cnpj") @CNPJ @Size(min = 14, max = 14) private String cnpj; @XStreamAlias("Cpf") @CPF @Size(min = 11, max = 11) private String cpf;
public RpsTomadorCpfCnpj(TomadorCpfCnpjBuilder builder) {
pablopdomingos/nfse
nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/LoteRpsEnvio.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/LoteRps.java // public class LoteRps { // // // @XStreamAlias("Id") // @NotNull // @XStreamAsAttribute // private String id; // // @XStreamAlias("versao") // @NotNull // @XStreamAsAttribute // private LoteRpsVersao versao; // // @XStreamAlias("NumeroLote") // @NotNull // @Pattern(regexp = "\\d+") // @Size(min=1, max=15) // private String numeroLote; // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // @Size(min = 14, max = 14) // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @NotNull // @Size(min=1, max=15) // private String inscricaoMunicipal; // // @XStreamAlias("QuantidadeRps") // @NotNull // private int quantidadeRps; // // @XStreamAlias("ListaRps") // @NotNull // private final List<Rps> listaRps; // // public LoteRps(LoteRpsBuilder builder) { // this.id = builder.getId(); // this.versao = builder.getVersao(); // this.numeroLote = builder.getNumeroLote(); // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // this.quantidadeRps = builder.getQuantidadeRps(); // this.listaRps = builder.getListaRps(); // } // // public String getId() { // return id; // } // // public LoteRpsVersao getVersao() { // return versao; // } // // public String getNumeroLote() { // return numeroLote; // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // public Integer getQuantidadeRps() { // return quantidadeRps; // } // // public List<Rps> getRps() { // return Collections.unmodifiableList(listaRps); // } // // // }
import com.pablodomingos.classes.rps.LoteRps; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
package com.pablodomingos.classes.rps.servicos; @XStreamAlias("EnviarLoteRpsEnvio") public class LoteRpsEnvio extends AbstractService{ @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd";
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/LoteRps.java // public class LoteRps { // // // @XStreamAlias("Id") // @NotNull // @XStreamAsAttribute // private String id; // // @XStreamAlias("versao") // @NotNull // @XStreamAsAttribute // private LoteRpsVersao versao; // // @XStreamAlias("NumeroLote") // @NotNull // @Pattern(regexp = "\\d+") // @Size(min=1, max=15) // private String numeroLote; // // @XStreamAlias("Cnpj") // @NotNull // @CNPJ // @Size(min = 14, max = 14) // private String cnpj; // // @XStreamAlias("InscricaoMunicipal") // @NotNull // @Size(min=1, max=15) // private String inscricaoMunicipal; // // @XStreamAlias("QuantidadeRps") // @NotNull // private int quantidadeRps; // // @XStreamAlias("ListaRps") // @NotNull // private final List<Rps> listaRps; // // public LoteRps(LoteRpsBuilder builder) { // this.id = builder.getId(); // this.versao = builder.getVersao(); // this.numeroLote = builder.getNumeroLote(); // this.cnpj = builder.getCnpj(); // this.inscricaoMunicipal = builder.getInscricaoMunicipal(); // this.quantidadeRps = builder.getQuantidadeRps(); // this.listaRps = builder.getListaRps(); // } // // public String getId() { // return id; // } // // public LoteRpsVersao getVersao() { // return versao; // } // // public String getNumeroLote() { // return numeroLote; // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // public Integer getQuantidadeRps() { // return quantidadeRps; // } // // public List<Rps> getRps() { // return Collections.unmodifiableList(listaRps); // } // // // } // Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/servicos/LoteRpsEnvio.java import com.pablodomingos.classes.rps.LoteRps; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute; package com.pablodomingos.classes.rps.servicos; @XStreamAlias("EnviarLoteRpsEnvio") public class LoteRpsEnvio extends AbstractService{ @XStreamAlias("xmlns") @XStreamAsAttribute private String xmlns = "http://www.abrasf.org.br/nfse.xsd";
@XStreamAlias("LoteRps")
pablopdomingos/nfse
nfse-bh/src/test/java/com/pablodomingos/classes/rps/RpsPrestadorTest.java
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/PrestadorBuilder.java // public class PrestadorBuilder extends AbstractBuilder<RpsPrestador>{ // // private String cnpj; // private String inscricaoMunicipal; // // public PrestadorBuilder(String cnpj) { // this.cnpj = cnpj; // } // // public PrestadorBuilder comInscricaoMunicipal(String inscricaoMunicipal) { // this.inscricaoMunicipal = inscricaoMunicipal; // return this; // } // // @Override // protected RpsPrestador buildInternal() { // return new RpsPrestador(this); // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // // }
import javax.validation.ConstraintViolationException; import org.junit.Test; import com.pablodomingos.classes.rps.builders.PrestadorBuilder;
package com.pablodomingos.classes.rps; public class RpsPrestadorTest { @Test(expected = ConstraintViolationException.class) public void naoDevePermitirCnpjInvalido() throws Exception {
// Path: nfse-bh/src/main/java/com/pablodomingos/classes/rps/builders/PrestadorBuilder.java // public class PrestadorBuilder extends AbstractBuilder<RpsPrestador>{ // // private String cnpj; // private String inscricaoMunicipal; // // public PrestadorBuilder(String cnpj) { // this.cnpj = cnpj; // } // // public PrestadorBuilder comInscricaoMunicipal(String inscricaoMunicipal) { // this.inscricaoMunicipal = inscricaoMunicipal; // return this; // } // // @Override // protected RpsPrestador buildInternal() { // return new RpsPrestador(this); // } // // public String getCnpj() { // return cnpj; // } // // public String getInscricaoMunicipal() { // return inscricaoMunicipal; // } // // // } // Path: nfse-bh/src/test/java/com/pablodomingos/classes/rps/RpsPrestadorTest.java import javax.validation.ConstraintViolationException; import org.junit.Test; import com.pablodomingos.classes.rps.builders.PrestadorBuilder; package com.pablodomingos.classes.rps; public class RpsPrestadorTest { @Test(expected = ConstraintViolationException.class) public void naoDevePermitirCnpjInvalido() throws Exception {
new PrestadorBuilder("12345678901231").build();
ANierbeck/Karaf-Cassandra
Karaf-Cassandra-Embedded/src/main/java/de/nierbeck/cassandra/admin/shell/StopService.java
// Path: Karaf-Cassandra-Embedded/src/main/java/de/nierbeck/cassandra/embedded/CassandraService.java // public interface CassandraService { // // /** // * @return - true or false depending on the state of the embedded Cassandra // * instance. // */ // boolean isRunning(); // // /** // * @return - the port the embedded Cassandra is using. // */ // Integer getPort(); // // /** // * stops the embedded Cassandra instance if running. // */ // void stop(); // // /** // * starts the embedded Cassndra instance if it isn't running. // */ // void start(); // // /** // * cleans the keyspaces available to the embedded instance. Beware data is // * not available after cleaning the keyspaces. // */ // void cleanUp(); // // }
import org.apache.karaf.shell.api.action.Action; import org.apache.karaf.shell.api.action.Command; import org.apache.karaf.shell.api.action.lifecycle.Reference; import org.apache.karaf.shell.api.action.lifecycle.Service; import de.nierbeck.cassandra.embedded.CassandraService;
/* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.admin.shell; @Command(scope = "cassandra-admin", name = "stop", description = "Connect to cassandra server") @Service public class StopService implements Action { @Reference
// Path: Karaf-Cassandra-Embedded/src/main/java/de/nierbeck/cassandra/embedded/CassandraService.java // public interface CassandraService { // // /** // * @return - true or false depending on the state of the embedded Cassandra // * instance. // */ // boolean isRunning(); // // /** // * @return - the port the embedded Cassandra is using. // */ // Integer getPort(); // // /** // * stops the embedded Cassandra instance if running. // */ // void stop(); // // /** // * starts the embedded Cassndra instance if it isn't running. // */ // void start(); // // /** // * cleans the keyspaces available to the embedded instance. Beware data is // * not available after cleaning the keyspaces. // */ // void cleanUp(); // // } // Path: Karaf-Cassandra-Embedded/src/main/java/de/nierbeck/cassandra/admin/shell/StopService.java import org.apache.karaf.shell.api.action.Action; import org.apache.karaf.shell.api.action.Command; import org.apache.karaf.shell.api.action.lifecycle.Reference; import org.apache.karaf.shell.api.action.lifecycle.Service; import de.nierbeck.cassandra.embedded.CassandraService; /* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.admin.shell; @Command(scope = "cassandra-admin", name = "stop", description = "Connect to cassandra server") @Service public class StopService implements Action { @Reference
CassandraService cassandraServer;
ANierbeck/Karaf-Cassandra
Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/completion/InsertCompleter.java
// Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/SessionParameter.java // public interface SessionParameter { // // public static final String CASSANDRA_CLUSTER = "cassandra.cluster"; // public static final String CASSANDRA_SESSION = "cassandra.session"; // // }
import de.nierbeck.cassandra.embedded.shell.SessionParameter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.SortedSet; import org.apache.karaf.shell.api.action.lifecycle.Service; import org.apache.karaf.shell.api.console.CommandLine; import org.apache.karaf.shell.api.console.Completer; import org.apache.karaf.shell.api.console.Session; import org.apache.karaf.shell.support.completers.ArgumentCommandLine; import org.apache.karaf.shell.support.completers.StringsCompleter; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Row;
/* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.embedded.shell.cql.completion; @Service public class InsertCompleter implements Completer { StringsCompleter delegate = new StringsCompleter(false); public int complete(Session session, CommandLine commandLine, List<String> candidates) { if (session != null) { com.datastax.driver.core.Session cassandraSession = (com.datastax.driver.core.Session) session
// Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/SessionParameter.java // public interface SessionParameter { // // public static final String CASSANDRA_CLUSTER = "cassandra.cluster"; // public static final String CASSANDRA_SESSION = "cassandra.session"; // // } // Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/completion/InsertCompleter.java import de.nierbeck.cassandra.embedded.shell.SessionParameter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.SortedSet; import org.apache.karaf.shell.api.action.lifecycle.Service; import org.apache.karaf.shell.api.console.CommandLine; import org.apache.karaf.shell.api.console.Completer; import org.apache.karaf.shell.api.console.Session; import org.apache.karaf.shell.support.completers.ArgumentCommandLine; import org.apache.karaf.shell.support.completers.StringsCompleter; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Row; /* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.embedded.shell.cql.completion; @Service public class InsertCompleter implements Completer { StringsCompleter delegate = new StringsCompleter(false); public int complete(Session session, CommandLine commandLine, List<String> candidates) { if (session != null) { com.datastax.driver.core.Session cassandraSession = (com.datastax.driver.core.Session) session
.get(SessionParameter.CASSANDRA_SESSION);
ANierbeck/Karaf-Cassandra
Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/CreateCommand.java
// Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/SessionParameter.java // public interface SessionParameter { // // public static final String CASSANDRA_CLUSTER = "cassandra.cluster"; // public static final String CASSANDRA_SESSION = "cassandra.session"; // // } // // Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/completion/CreateCompleter.java // @Service // public class CreateCompleter implements Completer { // // StringsCompleter delegate = new StringsCompleter(false); // // public int complete(Session session, CommandLine commandLine, // List<String> candidates) { // if (session != null) { // // com.datastax.driver.core.Session cassandraSession = (com.datastax.driver.core.Session) session // .get(SessionParameter.CASSANDRA_SESSION); // // if (cassandraSession == null) { // System.err // .println("No active session found--run the connect command first"); // return 0; // } // // if (commandLine instanceof ArgumentCommandLine) { // delegate.getStrings().add(commandLine.getCursorArgument()); // // } else { // // /* // * CREATE ( KEYSPACE | SCHEMA ) IF NOT EXISTS keyspace_name WITH // * REPLICATION = map AND DURABLE_WRITES = ( true | false ) // */ // // /* // * CREATE TABLE IF NOT EXISTS keyspace_name.table_name // * (column_definition, column_definition, ...) WITH property AND // * property ... // */ // // List<String> arguments = Arrays.asList(commandLine // .getArguments()); // int cursorArgumentIndex = commandLine.getCursorArgumentIndex(); // // if (cursorArgumentIndex <= 1) { // delegate.getStrings().add("KEYSPACE"); // delegate.getStrings().add("TABLE"); // } // // if (cursorArgumentIndex >= 2) { // // String prevArg = commandLine.getArguments()[1]; // switch (prevArg) { // case "TABLE": // int index = arguments.indexOf("TABLE"); // if (arguments.contains("TABLE") // && arguments.size() > index + 1) { // delegate.getStrings().add(arguments.get(index + 1)); // } // delegate.getStrings().add("TABLE"); // delegate.getStrings().remove("KEYSPACE"); // delegate.getStrings().add("("); // delegate.getStrings().add(")"); // delegate.getStrings().add("PRIMARY KEY"); // break; // case "KEYSPACE": // default: // if (cursorArgumentIndex == 2) { // delegate.getStrings().clear(); // delegate.getStrings().add("IF NOT EXISTS"); // } else if (cursorArgumentIndex > 2) { // delegate.getStrings().clear(); // index = arguments.indexOf("KEYSPACE"); // if (arguments.contains("KEYSPACE") // && arguments.size() > index + 1) { // delegate.getStrings().add( // arguments.get(index + 1)); // } // delegate.getStrings().add("WITH REPLICATION = {"); // delegate.getStrings().add("'class' :"); // delegate.getStrings().add("'SimpleStrategy'"); // delegate.getStrings().add(","); // delegate.getStrings().add("'replication_factor' :"); // delegate.getStrings().add("}"); // } // break; // } // } // } // } // return delegate.complete(session, commandLine, candidates); // // } // // }
import de.nierbeck.cassandra.embedded.shell.cql.completion.CreateCompleter; import java.util.List; import org.apache.karaf.shell.api.action.Action; import org.apache.karaf.shell.api.action.Argument; import org.apache.karaf.shell.api.action.Command; import org.apache.karaf.shell.api.action.Completion; import org.apache.karaf.shell.api.action.Parsing; import org.apache.karaf.shell.api.action.lifecycle.Reference; import org.apache.karaf.shell.api.action.lifecycle.Service; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Session; import de.nierbeck.cassandra.embedded.shell.SessionParameter;
/* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.embedded.shell.cql; @Command(scope = "cassandra:cqlsh", name = "CREATE", description = "execute USE cql commands") @Parsing(CqlParser.class) @Service public class CreateCommand implements Action { @Reference protected org.apache.karaf.shell.api.console.Session session; @Argument(name = "create", description = "CREATE table or keyspaces", required = true, multiValued = true)
// Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/SessionParameter.java // public interface SessionParameter { // // public static final String CASSANDRA_CLUSTER = "cassandra.cluster"; // public static final String CASSANDRA_SESSION = "cassandra.session"; // // } // // Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/completion/CreateCompleter.java // @Service // public class CreateCompleter implements Completer { // // StringsCompleter delegate = new StringsCompleter(false); // // public int complete(Session session, CommandLine commandLine, // List<String> candidates) { // if (session != null) { // // com.datastax.driver.core.Session cassandraSession = (com.datastax.driver.core.Session) session // .get(SessionParameter.CASSANDRA_SESSION); // // if (cassandraSession == null) { // System.err // .println("No active session found--run the connect command first"); // return 0; // } // // if (commandLine instanceof ArgumentCommandLine) { // delegate.getStrings().add(commandLine.getCursorArgument()); // // } else { // // /* // * CREATE ( KEYSPACE | SCHEMA ) IF NOT EXISTS keyspace_name WITH // * REPLICATION = map AND DURABLE_WRITES = ( true | false ) // */ // // /* // * CREATE TABLE IF NOT EXISTS keyspace_name.table_name // * (column_definition, column_definition, ...) WITH property AND // * property ... // */ // // List<String> arguments = Arrays.asList(commandLine // .getArguments()); // int cursorArgumentIndex = commandLine.getCursorArgumentIndex(); // // if (cursorArgumentIndex <= 1) { // delegate.getStrings().add("KEYSPACE"); // delegate.getStrings().add("TABLE"); // } // // if (cursorArgumentIndex >= 2) { // // String prevArg = commandLine.getArguments()[1]; // switch (prevArg) { // case "TABLE": // int index = arguments.indexOf("TABLE"); // if (arguments.contains("TABLE") // && arguments.size() > index + 1) { // delegate.getStrings().add(arguments.get(index + 1)); // } // delegate.getStrings().add("TABLE"); // delegate.getStrings().remove("KEYSPACE"); // delegate.getStrings().add("("); // delegate.getStrings().add(")"); // delegate.getStrings().add("PRIMARY KEY"); // break; // case "KEYSPACE": // default: // if (cursorArgumentIndex == 2) { // delegate.getStrings().clear(); // delegate.getStrings().add("IF NOT EXISTS"); // } else if (cursorArgumentIndex > 2) { // delegate.getStrings().clear(); // index = arguments.indexOf("KEYSPACE"); // if (arguments.contains("KEYSPACE") // && arguments.size() > index + 1) { // delegate.getStrings().add( // arguments.get(index + 1)); // } // delegate.getStrings().add("WITH REPLICATION = {"); // delegate.getStrings().add("'class' :"); // delegate.getStrings().add("'SimpleStrategy'"); // delegate.getStrings().add(","); // delegate.getStrings().add("'replication_factor' :"); // delegate.getStrings().add("}"); // } // break; // } // } // } // } // return delegate.complete(session, commandLine, candidates); // // } // // } // Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/CreateCommand.java import de.nierbeck.cassandra.embedded.shell.cql.completion.CreateCompleter; import java.util.List; import org.apache.karaf.shell.api.action.Action; import org.apache.karaf.shell.api.action.Argument; import org.apache.karaf.shell.api.action.Command; import org.apache.karaf.shell.api.action.Completion; import org.apache.karaf.shell.api.action.Parsing; import org.apache.karaf.shell.api.action.lifecycle.Reference; import org.apache.karaf.shell.api.action.lifecycle.Service; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Session; import de.nierbeck.cassandra.embedded.shell.SessionParameter; /* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.embedded.shell.cql; @Command(scope = "cassandra:cqlsh", name = "CREATE", description = "execute USE cql commands") @Parsing(CqlParser.class) @Service public class CreateCommand implements Action { @Reference protected org.apache.karaf.shell.api.console.Session session; @Argument(name = "create", description = "CREATE table or keyspaces", required = true, multiValued = true)
@Completion(CreateCompleter.class)
ANierbeck/Karaf-Cassandra
Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/CreateCommand.java
// Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/SessionParameter.java // public interface SessionParameter { // // public static final String CASSANDRA_CLUSTER = "cassandra.cluster"; // public static final String CASSANDRA_SESSION = "cassandra.session"; // // } // // Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/completion/CreateCompleter.java // @Service // public class CreateCompleter implements Completer { // // StringsCompleter delegate = new StringsCompleter(false); // // public int complete(Session session, CommandLine commandLine, // List<String> candidates) { // if (session != null) { // // com.datastax.driver.core.Session cassandraSession = (com.datastax.driver.core.Session) session // .get(SessionParameter.CASSANDRA_SESSION); // // if (cassandraSession == null) { // System.err // .println("No active session found--run the connect command first"); // return 0; // } // // if (commandLine instanceof ArgumentCommandLine) { // delegate.getStrings().add(commandLine.getCursorArgument()); // // } else { // // /* // * CREATE ( KEYSPACE | SCHEMA ) IF NOT EXISTS keyspace_name WITH // * REPLICATION = map AND DURABLE_WRITES = ( true | false ) // */ // // /* // * CREATE TABLE IF NOT EXISTS keyspace_name.table_name // * (column_definition, column_definition, ...) WITH property AND // * property ... // */ // // List<String> arguments = Arrays.asList(commandLine // .getArguments()); // int cursorArgumentIndex = commandLine.getCursorArgumentIndex(); // // if (cursorArgumentIndex <= 1) { // delegate.getStrings().add("KEYSPACE"); // delegate.getStrings().add("TABLE"); // } // // if (cursorArgumentIndex >= 2) { // // String prevArg = commandLine.getArguments()[1]; // switch (prevArg) { // case "TABLE": // int index = arguments.indexOf("TABLE"); // if (arguments.contains("TABLE") // && arguments.size() > index + 1) { // delegate.getStrings().add(arguments.get(index + 1)); // } // delegate.getStrings().add("TABLE"); // delegate.getStrings().remove("KEYSPACE"); // delegate.getStrings().add("("); // delegate.getStrings().add(")"); // delegate.getStrings().add("PRIMARY KEY"); // break; // case "KEYSPACE": // default: // if (cursorArgumentIndex == 2) { // delegate.getStrings().clear(); // delegate.getStrings().add("IF NOT EXISTS"); // } else if (cursorArgumentIndex > 2) { // delegate.getStrings().clear(); // index = arguments.indexOf("KEYSPACE"); // if (arguments.contains("KEYSPACE") // && arguments.size() > index + 1) { // delegate.getStrings().add( // arguments.get(index + 1)); // } // delegate.getStrings().add("WITH REPLICATION = {"); // delegate.getStrings().add("'class' :"); // delegate.getStrings().add("'SimpleStrategy'"); // delegate.getStrings().add(","); // delegate.getStrings().add("'replication_factor' :"); // delegate.getStrings().add("}"); // } // break; // } // } // } // } // return delegate.complete(session, commandLine, candidates); // // } // // }
import de.nierbeck.cassandra.embedded.shell.cql.completion.CreateCompleter; import java.util.List; import org.apache.karaf.shell.api.action.Action; import org.apache.karaf.shell.api.action.Argument; import org.apache.karaf.shell.api.action.Command; import org.apache.karaf.shell.api.action.Completion; import org.apache.karaf.shell.api.action.Parsing; import org.apache.karaf.shell.api.action.lifecycle.Reference; import org.apache.karaf.shell.api.action.lifecycle.Service; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Session; import de.nierbeck.cassandra.embedded.shell.SessionParameter;
/* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.embedded.shell.cql; @Command(scope = "cassandra:cqlsh", name = "CREATE", description = "execute USE cql commands") @Parsing(CqlParser.class) @Service public class CreateCommand implements Action { @Reference protected org.apache.karaf.shell.api.console.Session session; @Argument(name = "create", description = "CREATE table or keyspaces", required = true, multiValued = true) @Completion(CreateCompleter.class) private List<String> create; public Object execute() throws Exception { Session session = (Session) this.session
// Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/SessionParameter.java // public interface SessionParameter { // // public static final String CASSANDRA_CLUSTER = "cassandra.cluster"; // public static final String CASSANDRA_SESSION = "cassandra.session"; // // } // // Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/completion/CreateCompleter.java // @Service // public class CreateCompleter implements Completer { // // StringsCompleter delegate = new StringsCompleter(false); // // public int complete(Session session, CommandLine commandLine, // List<String> candidates) { // if (session != null) { // // com.datastax.driver.core.Session cassandraSession = (com.datastax.driver.core.Session) session // .get(SessionParameter.CASSANDRA_SESSION); // // if (cassandraSession == null) { // System.err // .println("No active session found--run the connect command first"); // return 0; // } // // if (commandLine instanceof ArgumentCommandLine) { // delegate.getStrings().add(commandLine.getCursorArgument()); // // } else { // // /* // * CREATE ( KEYSPACE | SCHEMA ) IF NOT EXISTS keyspace_name WITH // * REPLICATION = map AND DURABLE_WRITES = ( true | false ) // */ // // /* // * CREATE TABLE IF NOT EXISTS keyspace_name.table_name // * (column_definition, column_definition, ...) WITH property AND // * property ... // */ // // List<String> arguments = Arrays.asList(commandLine // .getArguments()); // int cursorArgumentIndex = commandLine.getCursorArgumentIndex(); // // if (cursorArgumentIndex <= 1) { // delegate.getStrings().add("KEYSPACE"); // delegate.getStrings().add("TABLE"); // } // // if (cursorArgumentIndex >= 2) { // // String prevArg = commandLine.getArguments()[1]; // switch (prevArg) { // case "TABLE": // int index = arguments.indexOf("TABLE"); // if (arguments.contains("TABLE") // && arguments.size() > index + 1) { // delegate.getStrings().add(arguments.get(index + 1)); // } // delegate.getStrings().add("TABLE"); // delegate.getStrings().remove("KEYSPACE"); // delegate.getStrings().add("("); // delegate.getStrings().add(")"); // delegate.getStrings().add("PRIMARY KEY"); // break; // case "KEYSPACE": // default: // if (cursorArgumentIndex == 2) { // delegate.getStrings().clear(); // delegate.getStrings().add("IF NOT EXISTS"); // } else if (cursorArgumentIndex > 2) { // delegate.getStrings().clear(); // index = arguments.indexOf("KEYSPACE"); // if (arguments.contains("KEYSPACE") // && arguments.size() > index + 1) { // delegate.getStrings().add( // arguments.get(index + 1)); // } // delegate.getStrings().add("WITH REPLICATION = {"); // delegate.getStrings().add("'class' :"); // delegate.getStrings().add("'SimpleStrategy'"); // delegate.getStrings().add(","); // delegate.getStrings().add("'replication_factor' :"); // delegate.getStrings().add("}"); // } // break; // } // } // } // } // return delegate.complete(session, commandLine, candidates); // // } // // } // Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/CreateCommand.java import de.nierbeck.cassandra.embedded.shell.cql.completion.CreateCompleter; import java.util.List; import org.apache.karaf.shell.api.action.Action; import org.apache.karaf.shell.api.action.Argument; import org.apache.karaf.shell.api.action.Command; import org.apache.karaf.shell.api.action.Completion; import org.apache.karaf.shell.api.action.Parsing; import org.apache.karaf.shell.api.action.lifecycle.Reference; import org.apache.karaf.shell.api.action.lifecycle.Service; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Session; import de.nierbeck.cassandra.embedded.shell.SessionParameter; /* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.embedded.shell.cql; @Command(scope = "cassandra:cqlsh", name = "CREATE", description = "execute USE cql commands") @Parsing(CqlParser.class) @Service public class CreateCommand implements Action { @Reference protected org.apache.karaf.shell.api.console.Session session; @Argument(name = "create", description = "CREATE table or keyspaces", required = true, multiValued = true) @Completion(CreateCompleter.class) private List<String> create; public Object execute() throws Exception { Session session = (Session) this.session
.get(SessionParameter.CASSANDRA_SESSION);
ANierbeck/Karaf-Cassandra
Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/completion/SelectsCompleter.java
// Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/SessionParameter.java // public interface SessionParameter { // // public static final String CASSANDRA_CLUSTER = "cassandra.cluster"; // public static final String CASSANDRA_SESSION = "cassandra.session"; // // }
import de.nierbeck.cassandra.embedded.shell.SessionParameter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.SortedSet; import org.apache.karaf.shell.api.action.lifecycle.Service; import org.apache.karaf.shell.api.console.CommandLine; import org.apache.karaf.shell.api.console.Completer; import org.apache.karaf.shell.api.console.Session; import org.apache.karaf.shell.support.completers.ArgumentCommandLine; import org.apache.karaf.shell.support.completers.StringsCompleter; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Row;
/* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.embedded.shell.cql.completion; @Service public class SelectsCompleter implements Completer { StringsCompleter delegate = new StringsCompleter(false); public int complete(Session session, CommandLine commandLine, List<String> candidates) { if (session != null) { com.datastax.driver.core.Session cassandraSession = (com.datastax.driver.core.Session) session
// Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/SessionParameter.java // public interface SessionParameter { // // public static final String CASSANDRA_CLUSTER = "cassandra.cluster"; // public static final String CASSANDRA_SESSION = "cassandra.session"; // // } // Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/completion/SelectsCompleter.java import de.nierbeck.cassandra.embedded.shell.SessionParameter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.SortedSet; import org.apache.karaf.shell.api.action.lifecycle.Service; import org.apache.karaf.shell.api.console.CommandLine; import org.apache.karaf.shell.api.console.Completer; import org.apache.karaf.shell.api.console.Session; import org.apache.karaf.shell.support.completers.ArgumentCommandLine; import org.apache.karaf.shell.support.completers.StringsCompleter; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Row; /* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.embedded.shell.cql.completion; @Service public class SelectsCompleter implements Completer { StringsCompleter delegate = new StringsCompleter(false); public int complete(Session session, CommandLine commandLine, List<String> candidates) { if (session != null) { com.datastax.driver.core.Session cassandraSession = (com.datastax.driver.core.Session) session
.get(SessionParameter.CASSANDRA_SESSION);
ANierbeck/Karaf-Cassandra
Karaf-Cassandra-Embedded/src/main/java/de/nierbeck/cassandra/embedded/impl/Activator.java
// Path: Karaf-Cassandra-Embedded/src/main/java/de/nierbeck/cassandra/embedded/CassandraService.java // public interface CassandraService { // // /** // * @return - true or false depending on the state of the embedded Cassandra // * instance. // */ // boolean isRunning(); // // /** // * @return - the port the embedded Cassandra is using. // */ // Integer getPort(); // // /** // * stops the embedded Cassandra instance if running. // */ // void stop(); // // /** // * starts the embedded Cassndra instance if it isn't running. // */ // void start(); // // /** // * cleans the keyspaces available to the embedded instance. Beware data is // * not available after cleaning the keyspaces. // */ // void cleanUp(); // // }
import java.util.Dictionary; import java.util.Hashtable; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; import org.osgi.service.cm.ManagedService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import de.nierbeck.cassandra.embedded.CassandraService;
/* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.embedded.impl; public class Activator implements BundleActivator{ static Logger log = LoggerFactory.getLogger(Activator.class); private OsgiEmbeddedCassandra cassandra; private ServiceRegistration<?> cassandraService; @SuppressWarnings("unchecked") @Override public void start(BundleContext context) throws Exception { cassandra = new OsgiEmbeddedCassandra(context); @SuppressWarnings("rawtypes") Dictionary props = new Hashtable(); props.put("service.pid", "de.nierbeck.cassandra.embedded"); cassandraService = context.registerService(new String[] { ManagedService.class.getName(),
// Path: Karaf-Cassandra-Embedded/src/main/java/de/nierbeck/cassandra/embedded/CassandraService.java // public interface CassandraService { // // /** // * @return - true or false depending on the state of the embedded Cassandra // * instance. // */ // boolean isRunning(); // // /** // * @return - the port the embedded Cassandra is using. // */ // Integer getPort(); // // /** // * stops the embedded Cassandra instance if running. // */ // void stop(); // // /** // * starts the embedded Cassndra instance if it isn't running. // */ // void start(); // // /** // * cleans the keyspaces available to the embedded instance. Beware data is // * not available after cleaning the keyspaces. // */ // void cleanUp(); // // } // Path: Karaf-Cassandra-Embedded/src/main/java/de/nierbeck/cassandra/embedded/impl/Activator.java import java.util.Dictionary; import java.util.Hashtable; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; import org.osgi.service.cm.ManagedService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import de.nierbeck.cassandra.embedded.CassandraService; /* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.embedded.impl; public class Activator implements BundleActivator{ static Logger log = LoggerFactory.getLogger(Activator.class); private OsgiEmbeddedCassandra cassandra; private ServiceRegistration<?> cassandraService; @SuppressWarnings("unchecked") @Override public void start(BundleContext context) throws Exception { cassandra = new OsgiEmbeddedCassandra(context); @SuppressWarnings("rawtypes") Dictionary props = new Hashtable(); props.put("service.pid", "de.nierbeck.cassandra.embedded"); cassandraService = context.registerService(new String[] { ManagedService.class.getName(),
CassandraService.class.getName() },
ANierbeck/Karaf-Cassandra
Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/completion/CreateCompleter.java
// Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/SessionParameter.java // public interface SessionParameter { // // public static final String CASSANDRA_CLUSTER = "cassandra.cluster"; // public static final String CASSANDRA_SESSION = "cassandra.session"; // // }
import java.util.Arrays; import java.util.List; import org.apache.karaf.shell.api.action.lifecycle.Service; import org.apache.karaf.shell.api.console.CommandLine; import org.apache.karaf.shell.api.console.Completer; import org.apache.karaf.shell.api.console.Session; import org.apache.karaf.shell.support.completers.ArgumentCommandLine; import org.apache.karaf.shell.support.completers.StringsCompleter; import de.nierbeck.cassandra.embedded.shell.SessionParameter;
/* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.embedded.shell.cql.completion; @Service public class CreateCompleter implements Completer { StringsCompleter delegate = new StringsCompleter(false); public int complete(Session session, CommandLine commandLine, List<String> candidates) { if (session != null) { com.datastax.driver.core.Session cassandraSession = (com.datastax.driver.core.Session) session
// Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/SessionParameter.java // public interface SessionParameter { // // public static final String CASSANDRA_CLUSTER = "cassandra.cluster"; // public static final String CASSANDRA_SESSION = "cassandra.session"; // // } // Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/completion/CreateCompleter.java import java.util.Arrays; import java.util.List; import org.apache.karaf.shell.api.action.lifecycle.Service; import org.apache.karaf.shell.api.console.CommandLine; import org.apache.karaf.shell.api.console.Completer; import org.apache.karaf.shell.api.console.Session; import org.apache.karaf.shell.support.completers.ArgumentCommandLine; import org.apache.karaf.shell.support.completers.StringsCompleter; import de.nierbeck.cassandra.embedded.shell.SessionParameter; /* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.embedded.shell.cql.completion; @Service public class CreateCompleter implements Completer { StringsCompleter delegate = new StringsCompleter(false); public int complete(Session session, CommandLine commandLine, List<String> candidates) { if (session != null) { com.datastax.driver.core.Session cassandraSession = (com.datastax.driver.core.Session) session
.get(SessionParameter.CASSANDRA_SESSION);
ANierbeck/Karaf-Cassandra
Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/DropCommand.java
// Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/SessionParameter.java // public interface SessionParameter { // // public static final String CASSANDRA_CLUSTER = "cassandra.cluster"; // public static final String CASSANDRA_SESSION = "cassandra.session"; // // } // // Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/completion/DropCompleter.java // @Service // public class DropCompleter implements Completer { // // StringsCompleter delegate = new StringsCompleter(false); // // public int complete(Session session, CommandLine commandLine, // List<String> candidates) { // if (session != null) { // // com.datastax.driver.core.Session cassandraSession = (com.datastax.driver.core.Session) session // .get(SessionParameter.CASSANDRA_SESSION); // // if (cassandraSession == null) { // System.err // .println("No active session found--run the connect command first"); // return 0; // } // // if (commandLine instanceof ArgumentCommandLine) { // delegate.getStrings().add(commandLine.getCursorArgument()); // // } else { // /* // * DROP ( KEYSPACE | SCHEMA ) IF EXISTS keyspace_name // */ // // /* // * DROP TABLE IF EXISTS keyspace_name.table_name // */ // // List<String> arguments = Arrays.asList(commandLine // .getArguments()); // int cursorArgumentIndex = commandLine.getCursorArgumentIndex(); // String validArgument; // if (cursorArgumentIndex > 1) // validArgument = arguments.get(cursorArgumentIndex -1); // else // validArgument = arguments.get(0); // // if (cursorArgumentIndex <= 1) { // delegate.getStrings().add("KEYSPACE"); // delegate.getStrings().add("SCHEMA"); // // alternative drop a table // delegate.getStrings().add("TABLE"); // } else if (cursorArgumentIndex >= 2) { // delegate.getStrings().clear(); // if (cursorArgumentIndex == 2) // delegate.getStrings().add("IF EXISTS"); // // // tables are needed. // if (validArgument.equalsIgnoreCase("KEYSPACE") // || validArgument.equalsIgnoreCase("SCHEMA") // || cassandraSession.getLoggedKeyspace() == null) { // CompleterCommons.completeKeySpace(delegate, // cassandraSession); // } else { // String keyspace = cassandraSession.getLoggedKeyspace(); // ResultSet execute = cassandraSession // .execute(String // .format("select columnfamily_name from system.schema_columnfamilies where keyspace_name = '%s';", // keyspace)); // for (Row row : execute) { // String table = row.getString("columnfamily_name"); // delegate.getStrings().add(table); // } // } // } // } // } // return delegate.complete(session, commandLine, candidates); // // } // // }
import de.nierbeck.cassandra.embedded.shell.cql.completion.DropCompleter; import java.util.List; import org.apache.karaf.shell.api.action.Action; import org.apache.karaf.shell.api.action.Argument; import org.apache.karaf.shell.api.action.Command; import org.apache.karaf.shell.api.action.Completion; import org.apache.karaf.shell.api.action.Parsing; import org.apache.karaf.shell.api.action.lifecycle.Reference; import org.apache.karaf.shell.api.action.lifecycle.Service; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Session; import de.nierbeck.cassandra.embedded.shell.SessionParameter;
/* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.embedded.shell.cql; @Command(scope = "cassandra:cqlsh", name = "DROP", description = "execute USE cql commands") @Parsing(CqlParser.class) @Service public class DropCommand implements Action { @Reference protected org.apache.karaf.shell.api.console.Session session; @Argument(name = "drop", description = "DROP keyspaces/schema", required = true, multiValued = true)
// Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/SessionParameter.java // public interface SessionParameter { // // public static final String CASSANDRA_CLUSTER = "cassandra.cluster"; // public static final String CASSANDRA_SESSION = "cassandra.session"; // // } // // Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/completion/DropCompleter.java // @Service // public class DropCompleter implements Completer { // // StringsCompleter delegate = new StringsCompleter(false); // // public int complete(Session session, CommandLine commandLine, // List<String> candidates) { // if (session != null) { // // com.datastax.driver.core.Session cassandraSession = (com.datastax.driver.core.Session) session // .get(SessionParameter.CASSANDRA_SESSION); // // if (cassandraSession == null) { // System.err // .println("No active session found--run the connect command first"); // return 0; // } // // if (commandLine instanceof ArgumentCommandLine) { // delegate.getStrings().add(commandLine.getCursorArgument()); // // } else { // /* // * DROP ( KEYSPACE | SCHEMA ) IF EXISTS keyspace_name // */ // // /* // * DROP TABLE IF EXISTS keyspace_name.table_name // */ // // List<String> arguments = Arrays.asList(commandLine // .getArguments()); // int cursorArgumentIndex = commandLine.getCursorArgumentIndex(); // String validArgument; // if (cursorArgumentIndex > 1) // validArgument = arguments.get(cursorArgumentIndex -1); // else // validArgument = arguments.get(0); // // if (cursorArgumentIndex <= 1) { // delegate.getStrings().add("KEYSPACE"); // delegate.getStrings().add("SCHEMA"); // // alternative drop a table // delegate.getStrings().add("TABLE"); // } else if (cursorArgumentIndex >= 2) { // delegate.getStrings().clear(); // if (cursorArgumentIndex == 2) // delegate.getStrings().add("IF EXISTS"); // // // tables are needed. // if (validArgument.equalsIgnoreCase("KEYSPACE") // || validArgument.equalsIgnoreCase("SCHEMA") // || cassandraSession.getLoggedKeyspace() == null) { // CompleterCommons.completeKeySpace(delegate, // cassandraSession); // } else { // String keyspace = cassandraSession.getLoggedKeyspace(); // ResultSet execute = cassandraSession // .execute(String // .format("select columnfamily_name from system.schema_columnfamilies where keyspace_name = '%s';", // keyspace)); // for (Row row : execute) { // String table = row.getString("columnfamily_name"); // delegate.getStrings().add(table); // } // } // } // } // } // return delegate.complete(session, commandLine, candidates); // // } // // } // Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/DropCommand.java import de.nierbeck.cassandra.embedded.shell.cql.completion.DropCompleter; import java.util.List; import org.apache.karaf.shell.api.action.Action; import org.apache.karaf.shell.api.action.Argument; import org.apache.karaf.shell.api.action.Command; import org.apache.karaf.shell.api.action.Completion; import org.apache.karaf.shell.api.action.Parsing; import org.apache.karaf.shell.api.action.lifecycle.Reference; import org.apache.karaf.shell.api.action.lifecycle.Service; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Session; import de.nierbeck.cassandra.embedded.shell.SessionParameter; /* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.embedded.shell.cql; @Command(scope = "cassandra:cqlsh", name = "DROP", description = "execute USE cql commands") @Parsing(CqlParser.class) @Service public class DropCommand implements Action { @Reference protected org.apache.karaf.shell.api.console.Session session; @Argument(name = "drop", description = "DROP keyspaces/schema", required = true, multiValued = true)
@Completion(DropCompleter.class)
ANierbeck/Karaf-Cassandra
Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/DropCommand.java
// Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/SessionParameter.java // public interface SessionParameter { // // public static final String CASSANDRA_CLUSTER = "cassandra.cluster"; // public static final String CASSANDRA_SESSION = "cassandra.session"; // // } // // Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/completion/DropCompleter.java // @Service // public class DropCompleter implements Completer { // // StringsCompleter delegate = new StringsCompleter(false); // // public int complete(Session session, CommandLine commandLine, // List<String> candidates) { // if (session != null) { // // com.datastax.driver.core.Session cassandraSession = (com.datastax.driver.core.Session) session // .get(SessionParameter.CASSANDRA_SESSION); // // if (cassandraSession == null) { // System.err // .println("No active session found--run the connect command first"); // return 0; // } // // if (commandLine instanceof ArgumentCommandLine) { // delegate.getStrings().add(commandLine.getCursorArgument()); // // } else { // /* // * DROP ( KEYSPACE | SCHEMA ) IF EXISTS keyspace_name // */ // // /* // * DROP TABLE IF EXISTS keyspace_name.table_name // */ // // List<String> arguments = Arrays.asList(commandLine // .getArguments()); // int cursorArgumentIndex = commandLine.getCursorArgumentIndex(); // String validArgument; // if (cursorArgumentIndex > 1) // validArgument = arguments.get(cursorArgumentIndex -1); // else // validArgument = arguments.get(0); // // if (cursorArgumentIndex <= 1) { // delegate.getStrings().add("KEYSPACE"); // delegate.getStrings().add("SCHEMA"); // // alternative drop a table // delegate.getStrings().add("TABLE"); // } else if (cursorArgumentIndex >= 2) { // delegate.getStrings().clear(); // if (cursorArgumentIndex == 2) // delegate.getStrings().add("IF EXISTS"); // // // tables are needed. // if (validArgument.equalsIgnoreCase("KEYSPACE") // || validArgument.equalsIgnoreCase("SCHEMA") // || cassandraSession.getLoggedKeyspace() == null) { // CompleterCommons.completeKeySpace(delegate, // cassandraSession); // } else { // String keyspace = cassandraSession.getLoggedKeyspace(); // ResultSet execute = cassandraSession // .execute(String // .format("select columnfamily_name from system.schema_columnfamilies where keyspace_name = '%s';", // keyspace)); // for (Row row : execute) { // String table = row.getString("columnfamily_name"); // delegate.getStrings().add(table); // } // } // } // } // } // return delegate.complete(session, commandLine, candidates); // // } // // }
import de.nierbeck.cassandra.embedded.shell.cql.completion.DropCompleter; import java.util.List; import org.apache.karaf.shell.api.action.Action; import org.apache.karaf.shell.api.action.Argument; import org.apache.karaf.shell.api.action.Command; import org.apache.karaf.shell.api.action.Completion; import org.apache.karaf.shell.api.action.Parsing; import org.apache.karaf.shell.api.action.lifecycle.Reference; import org.apache.karaf.shell.api.action.lifecycle.Service; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Session; import de.nierbeck.cassandra.embedded.shell.SessionParameter;
/* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.embedded.shell.cql; @Command(scope = "cassandra:cqlsh", name = "DROP", description = "execute USE cql commands") @Parsing(CqlParser.class) @Service public class DropCommand implements Action { @Reference protected org.apache.karaf.shell.api.console.Session session; @Argument(name = "drop", description = "DROP keyspaces/schema", required = true, multiValued = true) @Completion(DropCompleter.class) private List<String> drop; public Object execute() throws Exception { Session session = (Session) this.session
// Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/SessionParameter.java // public interface SessionParameter { // // public static final String CASSANDRA_CLUSTER = "cassandra.cluster"; // public static final String CASSANDRA_SESSION = "cassandra.session"; // // } // // Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/completion/DropCompleter.java // @Service // public class DropCompleter implements Completer { // // StringsCompleter delegate = new StringsCompleter(false); // // public int complete(Session session, CommandLine commandLine, // List<String> candidates) { // if (session != null) { // // com.datastax.driver.core.Session cassandraSession = (com.datastax.driver.core.Session) session // .get(SessionParameter.CASSANDRA_SESSION); // // if (cassandraSession == null) { // System.err // .println("No active session found--run the connect command first"); // return 0; // } // // if (commandLine instanceof ArgumentCommandLine) { // delegate.getStrings().add(commandLine.getCursorArgument()); // // } else { // /* // * DROP ( KEYSPACE | SCHEMA ) IF EXISTS keyspace_name // */ // // /* // * DROP TABLE IF EXISTS keyspace_name.table_name // */ // // List<String> arguments = Arrays.asList(commandLine // .getArguments()); // int cursorArgumentIndex = commandLine.getCursorArgumentIndex(); // String validArgument; // if (cursorArgumentIndex > 1) // validArgument = arguments.get(cursorArgumentIndex -1); // else // validArgument = arguments.get(0); // // if (cursorArgumentIndex <= 1) { // delegate.getStrings().add("KEYSPACE"); // delegate.getStrings().add("SCHEMA"); // // alternative drop a table // delegate.getStrings().add("TABLE"); // } else if (cursorArgumentIndex >= 2) { // delegate.getStrings().clear(); // if (cursorArgumentIndex == 2) // delegate.getStrings().add("IF EXISTS"); // // // tables are needed. // if (validArgument.equalsIgnoreCase("KEYSPACE") // || validArgument.equalsIgnoreCase("SCHEMA") // || cassandraSession.getLoggedKeyspace() == null) { // CompleterCommons.completeKeySpace(delegate, // cassandraSession); // } else { // String keyspace = cassandraSession.getLoggedKeyspace(); // ResultSet execute = cassandraSession // .execute(String // .format("select columnfamily_name from system.schema_columnfamilies where keyspace_name = '%s';", // keyspace)); // for (Row row : execute) { // String table = row.getString("columnfamily_name"); // delegate.getStrings().add(table); // } // } // } // } // } // return delegate.complete(session, commandLine, candidates); // // } // // } // Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/DropCommand.java import de.nierbeck.cassandra.embedded.shell.cql.completion.DropCompleter; import java.util.List; import org.apache.karaf.shell.api.action.Action; import org.apache.karaf.shell.api.action.Argument; import org.apache.karaf.shell.api.action.Command; import org.apache.karaf.shell.api.action.Completion; import org.apache.karaf.shell.api.action.Parsing; import org.apache.karaf.shell.api.action.lifecycle.Reference; import org.apache.karaf.shell.api.action.lifecycle.Service; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Session; import de.nierbeck.cassandra.embedded.shell.SessionParameter; /* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.embedded.shell.cql; @Command(scope = "cassandra:cqlsh", name = "DROP", description = "execute USE cql commands") @Parsing(CqlParser.class) @Service public class DropCommand implements Action { @Reference protected org.apache.karaf.shell.api.console.Session session; @Argument(name = "drop", description = "DROP keyspaces/schema", required = true, multiValued = true) @Completion(DropCompleter.class) private List<String> drop; public Object execute() throws Exception { Session session = (Session) this.session
.get(SessionParameter.CASSANDRA_SESSION);
ANierbeck/Karaf-Cassandra
Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/UseCommand.java
// Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/SessionParameter.java // public interface SessionParameter { // // public static final String CASSANDRA_CLUSTER = "cassandra.cluster"; // public static final String CASSANDRA_SESSION = "cassandra.session"; // // } // // Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/completion/KeySpaceCompleter.java // @Service // public class KeySpaceCompleter implements Completer { // // // public int complete(Session session, CommandLine commandLine, // List<String> candidates) { // StringsCompleter delegate = new StringsCompleter(); // // com.datastax.driver.core.Session cassandraSession = (com.datastax.driver.core.Session) session // .get(SessionParameter.CASSANDRA_SESSION); // // if (cassandraSession == null) { // System.err // .println("No active session found--run the connect command first"); // return 0; // // return delegate.complete(session, commandLine, candidates); // } // // CompleterCommons.completeKeySpace(delegate, cassandraSession); // // return delegate.complete(session, commandLine, candidates); // } // // }
import org.apache.karaf.shell.api.action.Action; import org.apache.karaf.shell.api.action.Argument; import org.apache.karaf.shell.api.action.Command; import org.apache.karaf.shell.api.action.Completion; import org.apache.karaf.shell.api.action.Parsing; import org.apache.karaf.shell.api.action.lifecycle.Reference; import org.apache.karaf.shell.api.action.lifecycle.Service; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Session; import de.nierbeck.cassandra.embedded.shell.SessionParameter; import de.nierbeck.cassandra.embedded.shell.cql.completion.KeySpaceCompleter;
/* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.embedded.shell.cql; @Command(scope = "cassandra:cqlsh", name = "USE", description = "execute USE cql commands") @Parsing(CqlParser.class) @Service public class UseCommand implements Action { @Reference protected org.apache.karaf.shell.api.console.Session session; @Argument(name = "keyspace", description = "keyspace to USE", required = true, multiValued = false)
// Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/SessionParameter.java // public interface SessionParameter { // // public static final String CASSANDRA_CLUSTER = "cassandra.cluster"; // public static final String CASSANDRA_SESSION = "cassandra.session"; // // } // // Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/completion/KeySpaceCompleter.java // @Service // public class KeySpaceCompleter implements Completer { // // // public int complete(Session session, CommandLine commandLine, // List<String> candidates) { // StringsCompleter delegate = new StringsCompleter(); // // com.datastax.driver.core.Session cassandraSession = (com.datastax.driver.core.Session) session // .get(SessionParameter.CASSANDRA_SESSION); // // if (cassandraSession == null) { // System.err // .println("No active session found--run the connect command first"); // return 0; // // return delegate.complete(session, commandLine, candidates); // } // // CompleterCommons.completeKeySpace(delegate, cassandraSession); // // return delegate.complete(session, commandLine, candidates); // } // // } // Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/UseCommand.java import org.apache.karaf.shell.api.action.Action; import org.apache.karaf.shell.api.action.Argument; import org.apache.karaf.shell.api.action.Command; import org.apache.karaf.shell.api.action.Completion; import org.apache.karaf.shell.api.action.Parsing; import org.apache.karaf.shell.api.action.lifecycle.Reference; import org.apache.karaf.shell.api.action.lifecycle.Service; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Session; import de.nierbeck.cassandra.embedded.shell.SessionParameter; import de.nierbeck.cassandra.embedded.shell.cql.completion.KeySpaceCompleter; /* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.embedded.shell.cql; @Command(scope = "cassandra:cqlsh", name = "USE", description = "execute USE cql commands") @Parsing(CqlParser.class) @Service public class UseCommand implements Action { @Reference protected org.apache.karaf.shell.api.console.Session session; @Argument(name = "keyspace", description = "keyspace to USE", required = true, multiValued = false)
@Completion(caseSensitive = false, value = KeySpaceCompleter.class)
ANierbeck/Karaf-Cassandra
Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/UseCommand.java
// Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/SessionParameter.java // public interface SessionParameter { // // public static final String CASSANDRA_CLUSTER = "cassandra.cluster"; // public static final String CASSANDRA_SESSION = "cassandra.session"; // // } // // Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/completion/KeySpaceCompleter.java // @Service // public class KeySpaceCompleter implements Completer { // // // public int complete(Session session, CommandLine commandLine, // List<String> candidates) { // StringsCompleter delegate = new StringsCompleter(); // // com.datastax.driver.core.Session cassandraSession = (com.datastax.driver.core.Session) session // .get(SessionParameter.CASSANDRA_SESSION); // // if (cassandraSession == null) { // System.err // .println("No active session found--run the connect command first"); // return 0; // // return delegate.complete(session, commandLine, candidates); // } // // CompleterCommons.completeKeySpace(delegate, cassandraSession); // // return delegate.complete(session, commandLine, candidates); // } // // }
import org.apache.karaf.shell.api.action.Action; import org.apache.karaf.shell.api.action.Argument; import org.apache.karaf.shell.api.action.Command; import org.apache.karaf.shell.api.action.Completion; import org.apache.karaf.shell.api.action.Parsing; import org.apache.karaf.shell.api.action.lifecycle.Reference; import org.apache.karaf.shell.api.action.lifecycle.Service; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Session; import de.nierbeck.cassandra.embedded.shell.SessionParameter; import de.nierbeck.cassandra.embedded.shell.cql.completion.KeySpaceCompleter;
/* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.embedded.shell.cql; @Command(scope = "cassandra:cqlsh", name = "USE", description = "execute USE cql commands") @Parsing(CqlParser.class) @Service public class UseCommand implements Action { @Reference protected org.apache.karaf.shell.api.console.Session session; @Argument(name = "keyspace", description = "keyspace to USE", required = true, multiValued = false) @Completion(caseSensitive = false, value = KeySpaceCompleter.class) private String keyspace; public Object execute() throws Exception { Session session = (Session) this.session
// Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/SessionParameter.java // public interface SessionParameter { // // public static final String CASSANDRA_CLUSTER = "cassandra.cluster"; // public static final String CASSANDRA_SESSION = "cassandra.session"; // // } // // Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/completion/KeySpaceCompleter.java // @Service // public class KeySpaceCompleter implements Completer { // // // public int complete(Session session, CommandLine commandLine, // List<String> candidates) { // StringsCompleter delegate = new StringsCompleter(); // // com.datastax.driver.core.Session cassandraSession = (com.datastax.driver.core.Session) session // .get(SessionParameter.CASSANDRA_SESSION); // // if (cassandraSession == null) { // System.err // .println("No active session found--run the connect command first"); // return 0; // // return delegate.complete(session, commandLine, candidates); // } // // CompleterCommons.completeKeySpace(delegate, cassandraSession); // // return delegate.complete(session, commandLine, candidates); // } // // } // Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/UseCommand.java import org.apache.karaf.shell.api.action.Action; import org.apache.karaf.shell.api.action.Argument; import org.apache.karaf.shell.api.action.Command; import org.apache.karaf.shell.api.action.Completion; import org.apache.karaf.shell.api.action.Parsing; import org.apache.karaf.shell.api.action.lifecycle.Reference; import org.apache.karaf.shell.api.action.lifecycle.Service; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Session; import de.nierbeck.cassandra.embedded.shell.SessionParameter; import de.nierbeck.cassandra.embedded.shell.cql.completion.KeySpaceCompleter; /* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.embedded.shell.cql; @Command(scope = "cassandra:cqlsh", name = "USE", description = "execute USE cql commands") @Parsing(CqlParser.class) @Service public class UseCommand implements Action { @Reference protected org.apache.karaf.shell.api.console.Session session; @Argument(name = "keyspace", description = "keyspace to USE", required = true, multiValued = false) @Completion(caseSensitive = false, value = KeySpaceCompleter.class) private String keyspace; public Object execute() throws Exception { Session session = (Session) this.session
.get(SessionParameter.CASSANDRA_SESSION);
ANierbeck/Karaf-Cassandra
Karaf-Cassandra-Embedded/src/main/java/de/nierbeck/cassandra/admin/shell/CleanupKeyspace.java
// Path: Karaf-Cassandra-Embedded/src/main/java/de/nierbeck/cassandra/embedded/CassandraService.java // public interface CassandraService { // // /** // * @return - true or false depending on the state of the embedded Cassandra // * instance. // */ // boolean isRunning(); // // /** // * @return - the port the embedded Cassandra is using. // */ // Integer getPort(); // // /** // * stops the embedded Cassandra instance if running. // */ // void stop(); // // /** // * starts the embedded Cassndra instance if it isn't running. // */ // void start(); // // /** // * cleans the keyspaces available to the embedded instance. Beware data is // * not available after cleaning the keyspaces. // */ // void cleanUp(); // // }
import org.apache.karaf.shell.api.action.Action; import org.apache.karaf.shell.api.action.Command; import org.apache.karaf.shell.api.action.lifecycle.Reference; import org.apache.karaf.shell.api.action.lifecycle.Service; import de.nierbeck.cassandra.embedded.CassandraService;
/* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.admin.shell; @Command(scope = "cassandra-admin", name = "cleanup", description = "Cleans the keyspace of the embedded Cassandra server.") @Service public class CleanupKeyspace implements Action { @Reference
// Path: Karaf-Cassandra-Embedded/src/main/java/de/nierbeck/cassandra/embedded/CassandraService.java // public interface CassandraService { // // /** // * @return - true or false depending on the state of the embedded Cassandra // * instance. // */ // boolean isRunning(); // // /** // * @return - the port the embedded Cassandra is using. // */ // Integer getPort(); // // /** // * stops the embedded Cassandra instance if running. // */ // void stop(); // // /** // * starts the embedded Cassndra instance if it isn't running. // */ // void start(); // // /** // * cleans the keyspaces available to the embedded instance. Beware data is // * not available after cleaning the keyspaces. // */ // void cleanUp(); // // } // Path: Karaf-Cassandra-Embedded/src/main/java/de/nierbeck/cassandra/admin/shell/CleanupKeyspace.java import org.apache.karaf.shell.api.action.Action; import org.apache.karaf.shell.api.action.Command; import org.apache.karaf.shell.api.action.lifecycle.Reference; import org.apache.karaf.shell.api.action.lifecycle.Service; import de.nierbeck.cassandra.embedded.CassandraService; /* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.admin.shell; @Command(scope = "cassandra-admin", name = "cleanup", description = "Cleans the keyspace of the embedded Cassandra server.") @Service public class CleanupKeyspace implements Action { @Reference
CassandraService cassandraServer;
ANierbeck/Karaf-Cassandra
Karaf-Cassandra-Embedded/src/main/java/de/nierbeck/cassandra/admin/shell/IsServiceRunning.java
// Path: Karaf-Cassandra-Embedded/src/main/java/de/nierbeck/cassandra/embedded/CassandraService.java // public interface CassandraService { // // /** // * @return - true or false depending on the state of the embedded Cassandra // * instance. // */ // boolean isRunning(); // // /** // * @return - the port the embedded Cassandra is using. // */ // Integer getPort(); // // /** // * stops the embedded Cassandra instance if running. // */ // void stop(); // // /** // * starts the embedded Cassndra instance if it isn't running. // */ // void start(); // // /** // * cleans the keyspaces available to the embedded instance. Beware data is // * not available after cleaning the keyspaces. // */ // void cleanUp(); // // }
import org.apache.karaf.shell.api.action.Action; import org.apache.karaf.shell.api.action.Command; import org.apache.karaf.shell.api.action.lifecycle.Reference; import org.apache.karaf.shell.api.action.lifecycle.Service; import de.nierbeck.cassandra.embedded.CassandraService;
/* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.admin.shell; @Command(scope = "cassandra-admin", name = "isRunning", description = "Connect to cassandra server") @Service public class IsServiceRunning implements Action { @Reference
// Path: Karaf-Cassandra-Embedded/src/main/java/de/nierbeck/cassandra/embedded/CassandraService.java // public interface CassandraService { // // /** // * @return - true or false depending on the state of the embedded Cassandra // * instance. // */ // boolean isRunning(); // // /** // * @return - the port the embedded Cassandra is using. // */ // Integer getPort(); // // /** // * stops the embedded Cassandra instance if running. // */ // void stop(); // // /** // * starts the embedded Cassndra instance if it isn't running. // */ // void start(); // // /** // * cleans the keyspaces available to the embedded instance. Beware data is // * not available after cleaning the keyspaces. // */ // void cleanUp(); // // } // Path: Karaf-Cassandra-Embedded/src/main/java/de/nierbeck/cassandra/admin/shell/IsServiceRunning.java import org.apache.karaf.shell.api.action.Action; import org.apache.karaf.shell.api.action.Command; import org.apache.karaf.shell.api.action.lifecycle.Reference; import org.apache.karaf.shell.api.action.lifecycle.Service; import de.nierbeck.cassandra.embedded.CassandraService; /* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.admin.shell; @Command(scope = "cassandra-admin", name = "isRunning", description = "Connect to cassandra server") @Service public class IsServiceRunning implements Action { @Reference
CassandraService cassandraServer;
ANierbeck/Karaf-Cassandra
Karaf-Cassandra-ITest/src/test/java/de/nierbeck/cassandra/itest/CassandraReconfigureTest.java
// Path: Karaf-Cassandra-Embedded/src/main/java/de/nierbeck/cassandra/embedded/CassandraService.java // public interface CassandraService { // // /** // * @return - true or false depending on the state of the embedded Cassandra // * instance. // */ // boolean isRunning(); // // /** // * @return - the port the embedded Cassandra is using. // */ // Integer getPort(); // // /** // * stops the embedded Cassandra instance if running. // */ // void stop(); // // /** // * starts the embedded Cassndra instance if it isn't running. // */ // void start(); // // /** // * cleans the keyspaces available to the embedded instance. Beware data is // * not available after cleaning the keyspaces. // */ // void cleanUp(); // // }
import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; import org.ops4j.pax.exam.spi.reactors.PerClass; import org.osgi.service.cm.Configuration; import org.osgi.service.cm.ConfigurationAdmin; import de.nierbeck.cassandra.embedded.CassandraService; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; import static org.junit.Assert.assertThat; import java.io.File; import java.net.URI; import java.util.Dictionary; import java.util.Hashtable; import javax.inject.Inject; import org.junit.Ignore; import org.junit.Test;
/* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.itest; @RunWith(PaxExam.class) @ExamReactorStrategy(PerClass.class) @Ignore("Ignore right now due to timing issues") public class CassandraReconfigureTest extends TestBase{ @Inject private ConfigurationAdmin cm; @Test public void shouldHaveBundleContext() { assertThat(bc, is(notNullValue())); } @Test public void reconfigureEmbeddedCassandra() throws Exception { logger.info("Re-Configuring Embedded Cassandra"); File yamlFile = new File("etc/cassandra.yaml");
// Path: Karaf-Cassandra-Embedded/src/main/java/de/nierbeck/cassandra/embedded/CassandraService.java // public interface CassandraService { // // /** // * @return - true or false depending on the state of the embedded Cassandra // * instance. // */ // boolean isRunning(); // // /** // * @return - the port the embedded Cassandra is using. // */ // Integer getPort(); // // /** // * stops the embedded Cassandra instance if running. // */ // void stop(); // // /** // * starts the embedded Cassndra instance if it isn't running. // */ // void start(); // // /** // * cleans the keyspaces available to the embedded instance. Beware data is // * not available after cleaning the keyspaces. // */ // void cleanUp(); // // } // Path: Karaf-Cassandra-ITest/src/test/java/de/nierbeck/cassandra/itest/CassandraReconfigureTest.java import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; import org.ops4j.pax.exam.spi.reactors.PerClass; import org.osgi.service.cm.Configuration; import org.osgi.service.cm.ConfigurationAdmin; import de.nierbeck.cassandra.embedded.CassandraService; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; import static org.junit.Assert.assertThat; import java.io.File; import java.net.URI; import java.util.Dictionary; import java.util.Hashtable; import javax.inject.Inject; import org.junit.Ignore; import org.junit.Test; /* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.itest; @RunWith(PaxExam.class) @ExamReactorStrategy(PerClass.class) @Ignore("Ignore right now due to timing issues") public class CassandraReconfigureTest extends TestBase{ @Inject private ConfigurationAdmin cm; @Test public void shouldHaveBundleContext() { assertThat(bc, is(notNullValue())); } @Test public void reconfigureEmbeddedCassandra() throws Exception { logger.info("Re-Configuring Embedded Cassandra"); File yamlFile = new File("etc/cassandra.yaml");
CassandraService service = getOsgiService(CassandraService.class, null, 120000);
ANierbeck/Karaf-Cassandra
Karaf-Cassandra-ITest/src/test/java/de/nierbeck/cassandra/itest/TestBase.java
// Path: Karaf-Cassandra-Embedded/src/main/java/de/nierbeck/cassandra/embedded/CassandraService.java // public interface CassandraService { // // /** // * @return - true or false depending on the state of the embedded Cassandra // * instance. // */ // boolean isRunning(); // // /** // * @return - the port the embedded Cassandra is using. // */ // Integer getPort(); // // /** // * stops the embedded Cassandra instance if running. // */ // void stop(); // // /** // * starts the embedded Cassndra instance if it isn't running. // */ // void start(); // // /** // * cleans the keyspaces available to the embedded instance. Beware data is // * not available after cleaning the keyspaces. // */ // void cleanUp(); // // }
import static org.ops4j.pax.exam.CoreOptions.junitBundles; import static org.ops4j.pax.exam.CoreOptions.maven; import static org.ops4j.pax.exam.CoreOptions.options; import static org.ops4j.pax.exam.MavenUtils.asInProject; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.PrintStream; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Dictionary; import java.util.Enumeration; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.FutureTask; import java.util.concurrent.TimeUnit; import javax.inject.Inject; import org.apache.karaf.features.BootFinished; import org.apache.karaf.features.FeaturesService; import org.apache.karaf.shell.api.console.Session; import org.apache.karaf.shell.api.console.SessionFactory; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.ops4j.pax.exam.Configuration; import org.ops4j.pax.exam.Option; import org.ops4j.pax.exam.karaf.options.KarafDistributionOption; import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel; import org.ops4j.pax.exam.options.MavenArtifactUrlReference; import org.ops4j.pax.exam.options.MavenUrlReference; import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; import org.osgi.framework.Filter; import org.osgi.framework.FrameworkUtil; import org.osgi.framework.InvalidSyntaxException; import org.osgi.framework.ServiceReference; import org.osgi.util.tracker.ServiceTracker; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import de.nierbeck.cassandra.embedded.CassandraService;
/* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.itest; public class TestBase { protected final Logger logger = LoggerFactory.getLogger(getClass()); @Inject protected BundleContext bc; @Inject protected FeaturesService featuresService; /** * To make sure the tests run only when the boot features are fully * installed */ @Inject protected BootFinished bootFinished; @Inject protected SessionFactory sessionFactory; @Inject
// Path: Karaf-Cassandra-Embedded/src/main/java/de/nierbeck/cassandra/embedded/CassandraService.java // public interface CassandraService { // // /** // * @return - true or false depending on the state of the embedded Cassandra // * instance. // */ // boolean isRunning(); // // /** // * @return - the port the embedded Cassandra is using. // */ // Integer getPort(); // // /** // * stops the embedded Cassandra instance if running. // */ // void stop(); // // /** // * starts the embedded Cassndra instance if it isn't running. // */ // void start(); // // /** // * cleans the keyspaces available to the embedded instance. Beware data is // * not available after cleaning the keyspaces. // */ // void cleanUp(); // // } // Path: Karaf-Cassandra-ITest/src/test/java/de/nierbeck/cassandra/itest/TestBase.java import static org.ops4j.pax.exam.CoreOptions.junitBundles; import static org.ops4j.pax.exam.CoreOptions.maven; import static org.ops4j.pax.exam.CoreOptions.options; import static org.ops4j.pax.exam.MavenUtils.asInProject; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.PrintStream; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Dictionary; import java.util.Enumeration; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.FutureTask; import java.util.concurrent.TimeUnit; import javax.inject.Inject; import org.apache.karaf.features.BootFinished; import org.apache.karaf.features.FeaturesService; import org.apache.karaf.shell.api.console.Session; import org.apache.karaf.shell.api.console.SessionFactory; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.ops4j.pax.exam.Configuration; import org.ops4j.pax.exam.Option; import org.ops4j.pax.exam.karaf.options.KarafDistributionOption; import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel; import org.ops4j.pax.exam.options.MavenArtifactUrlReference; import org.ops4j.pax.exam.options.MavenUrlReference; import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; import org.osgi.framework.Filter; import org.osgi.framework.FrameworkUtil; import org.osgi.framework.InvalidSyntaxException; import org.osgi.framework.ServiceReference; import org.osgi.util.tracker.ServiceTracker; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import de.nierbeck.cassandra.embedded.CassandraService; /* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.itest; public class TestBase { protected final Logger logger = LoggerFactory.getLogger(getClass()); @Inject protected BundleContext bc; @Inject protected FeaturesService featuresService; /** * To make sure the tests run only when the boot features are fully * installed */ @Inject protected BootFinished bootFinished; @Inject protected SessionFactory sessionFactory; @Inject
protected CassandraService cassandraService;
ANierbeck/Karaf-Cassandra
Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/completion/KeySpaceCompleter.java
// Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/SessionParameter.java // public interface SessionParameter { // // public static final String CASSANDRA_CLUSTER = "cassandra.cluster"; // public static final String CASSANDRA_SESSION = "cassandra.session"; // // }
import java.util.List; import org.apache.karaf.shell.api.action.lifecycle.Service; import org.apache.karaf.shell.api.console.CommandLine; import org.apache.karaf.shell.api.console.Completer; import org.apache.karaf.shell.api.console.Session; import org.apache.karaf.shell.support.completers.StringsCompleter; import de.nierbeck.cassandra.embedded.shell.SessionParameter;
/* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.embedded.shell.cql.completion; @Service public class KeySpaceCompleter implements Completer { public int complete(Session session, CommandLine commandLine, List<String> candidates) { StringsCompleter delegate = new StringsCompleter(); com.datastax.driver.core.Session cassandraSession = (com.datastax.driver.core.Session) session
// Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/SessionParameter.java // public interface SessionParameter { // // public static final String CASSANDRA_CLUSTER = "cassandra.cluster"; // public static final String CASSANDRA_SESSION = "cassandra.session"; // // } // Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/completion/KeySpaceCompleter.java import java.util.List; import org.apache.karaf.shell.api.action.lifecycle.Service; import org.apache.karaf.shell.api.console.CommandLine; import org.apache.karaf.shell.api.console.Completer; import org.apache.karaf.shell.api.console.Session; import org.apache.karaf.shell.support.completers.StringsCompleter; import de.nierbeck.cassandra.embedded.shell.SessionParameter; /* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.embedded.shell.cql.completion; @Service public class KeySpaceCompleter implements Completer { public int complete(Session session, CommandLine commandLine, List<String> candidates) { StringsCompleter delegate = new StringsCompleter(); com.datastax.driver.core.Session cassandraSession = (com.datastax.driver.core.Session) session
.get(SessionParameter.CASSANDRA_SESSION);
ANierbeck/Karaf-Cassandra
Karaf-Cassandra-Embedded/src/main/java/de/nierbeck/cassandra/admin/shell/StartService.java
// Path: Karaf-Cassandra-Embedded/src/main/java/de/nierbeck/cassandra/embedded/CassandraService.java // public interface CassandraService { // // /** // * @return - true or false depending on the state of the embedded Cassandra // * instance. // */ // boolean isRunning(); // // /** // * @return - the port the embedded Cassandra is using. // */ // Integer getPort(); // // /** // * stops the embedded Cassandra instance if running. // */ // void stop(); // // /** // * starts the embedded Cassndra instance if it isn't running. // */ // void start(); // // /** // * cleans the keyspaces available to the embedded instance. Beware data is // * not available after cleaning the keyspaces. // */ // void cleanUp(); // // }
import org.apache.karaf.shell.api.action.Action; import org.apache.karaf.shell.api.action.Command; import org.apache.karaf.shell.api.action.lifecycle.Reference; import org.apache.karaf.shell.api.action.lifecycle.Service; import de.nierbeck.cassandra.embedded.CassandraService;
/* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.admin.shell; @Command(scope = "cassandra-admin", name = "start", description = "Connect to cassandra server") @Service public class StartService implements Action { @Reference
// Path: Karaf-Cassandra-Embedded/src/main/java/de/nierbeck/cassandra/embedded/CassandraService.java // public interface CassandraService { // // /** // * @return - true or false depending on the state of the embedded Cassandra // * instance. // */ // boolean isRunning(); // // /** // * @return - the port the embedded Cassandra is using. // */ // Integer getPort(); // // /** // * stops the embedded Cassandra instance if running. // */ // void stop(); // // /** // * starts the embedded Cassndra instance if it isn't running. // */ // void start(); // // /** // * cleans the keyspaces available to the embedded instance. Beware data is // * not available after cleaning the keyspaces. // */ // void cleanUp(); // // } // Path: Karaf-Cassandra-Embedded/src/main/java/de/nierbeck/cassandra/admin/shell/StartService.java import org.apache.karaf.shell.api.action.Action; import org.apache.karaf.shell.api.action.Command; import org.apache.karaf.shell.api.action.lifecycle.Reference; import org.apache.karaf.shell.api.action.lifecycle.Service; import de.nierbeck.cassandra.embedded.CassandraService; /* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.admin.shell; @Command(scope = "cassandra-admin", name = "start", description = "Connect to cassandra server") @Service public class StartService implements Action { @Reference
CassandraService cassandraServer;
ANierbeck/Karaf-Cassandra
Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/completion/DropCompleter.java
// Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/SessionParameter.java // public interface SessionParameter { // // public static final String CASSANDRA_CLUSTER = "cassandra.cluster"; // public static final String CASSANDRA_SESSION = "cassandra.session"; // // }
import java.util.Arrays; import java.util.List; import org.apache.karaf.shell.api.action.lifecycle.Service; import org.apache.karaf.shell.api.console.CommandLine; import org.apache.karaf.shell.api.console.Completer; import org.apache.karaf.shell.api.console.Session; import org.apache.karaf.shell.support.completers.ArgumentCommandLine; import org.apache.karaf.shell.support.completers.StringsCompleter; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Row; import de.nierbeck.cassandra.embedded.shell.SessionParameter;
/* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.embedded.shell.cql.completion; @Service public class DropCompleter implements Completer { StringsCompleter delegate = new StringsCompleter(false); public int complete(Session session, CommandLine commandLine, List<String> candidates) { if (session != null) { com.datastax.driver.core.Session cassandraSession = (com.datastax.driver.core.Session) session
// Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/SessionParameter.java // public interface SessionParameter { // // public static final String CASSANDRA_CLUSTER = "cassandra.cluster"; // public static final String CASSANDRA_SESSION = "cassandra.session"; // // } // Path: Karaf-Cassandra-Shell/src/main/java/de/nierbeck/cassandra/embedded/shell/cql/completion/DropCompleter.java import java.util.Arrays; import java.util.List; import org.apache.karaf.shell.api.action.lifecycle.Service; import org.apache.karaf.shell.api.console.CommandLine; import org.apache.karaf.shell.api.console.Completer; import org.apache.karaf.shell.api.console.Session; import org.apache.karaf.shell.support.completers.ArgumentCommandLine; import org.apache.karaf.shell.support.completers.StringsCompleter; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Row; import de.nierbeck.cassandra.embedded.shell.SessionParameter; /* * Copyright 2015 Achim Nierbeck * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package de.nierbeck.cassandra.embedded.shell.cql.completion; @Service public class DropCompleter implements Completer { StringsCompleter delegate = new StringsCompleter(false); public int complete(Session session, CommandLine commandLine, List<String> candidates) { if (session != null) { com.datastax.driver.core.Session cassandraSession = (com.datastax.driver.core.Session) session
.get(SessionParameter.CASSANDRA_SESSION);
PC-Logix/OpenFM
src/main/java/pcl/OpenFM/ClientProxy.java
// Path: src/main/java/pcl/OpenFM/TileEntity/RadioRenderer.java // public class RadioRenderer extends TileEntitySpecialRenderer { // // public Integer ticks = 0; // public String text = null; // String output = ""; // int count = 0; // @Override // public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) { // TileEntityRadio radio = (TileEntityRadio) tileEntity; // // float light = tileEntity.getWorldObj().getLightBrightnessForSkyBlocks(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, 15); // OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, light, light); // // RenderManager renderMan = RenderManager.instance; // // GL11.glPushMatrix(); // // int dir = tileEntity.getBlockMetadata(); // GL11.glNormal3f(0, 1, 0); // if (dir == 1) { // GL11.glTranslatef((float)x +.501F, (float)y + .72F, (float)z - .01F); // GL11.glRotatef(0F, 0F, 1F, 0F); // } else if (dir == 2) { // GL11.glTranslatef((float)x + 1.01f, (float)y + .72F, (float)z + .5F); // GL11.glRotatef(270F, 0F, 1F, 0F); // } else if (dir == 3) { // GL11.glTranslatef((float)x + .5f, (float)y + .72F, (float)z + 1.01F); // GL11.glRotatef(180F, 0F, 1F, 0F); // } else if (dir == 4) { // GL11.glTranslatef((float)x - .01f, (float)y + .72F, (float)z + .5f); // GL11.glRotatef(90, 0F, 1F, 0F); // } // // GL11.glScalef(-0.016666668F, -0.016666668F, 0.016666668F); // GL11.glDisable(GL11.GL_LIGHTING); // GL11.glEnable(GL11.GL_BLEND); // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // ++this.ticks; // if (this.ticks > 20) { // if (radio.getScreenText().length() > 6) { // output = scrollText(radio.getScreenText()); // } else { // output = radio.getScreenText(); // } // } // renderMan.getFontRenderer().drawString(output, -37 / 2, 0, radio.getScreenColor()); // GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); // GL11.glEnable(GL11.GL_LIGHTING); // GL11.glPopMatrix(); // } // // public String scrollText(String text) { // FontRenderer fontRenderer = RenderManager.instance.getFontRenderer(); // text = " " + text + " "; // if (text.length() > count + 6) { // output = text.substring(count, count + 6); // if (fontRenderer.getStringWidth(output) / 6 < 5) { // output = text.substring(count, count + 7); // } // count++; // this.ticks = 0; // if (count > text.length()) { // count = 0; // } // } else { // count = 0; // } // return output; // } // // }
import cpw.mods.fml.client.registry.ClientRegistry; import pcl.OpenFM.TileEntity.RadioRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
package pcl.OpenFM; public class ClientProxy extends CommonProxy { public void registerRenderers() {
// Path: src/main/java/pcl/OpenFM/TileEntity/RadioRenderer.java // public class RadioRenderer extends TileEntitySpecialRenderer { // // public Integer ticks = 0; // public String text = null; // String output = ""; // int count = 0; // @Override // public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) { // TileEntityRadio radio = (TileEntityRadio) tileEntity; // // float light = tileEntity.getWorldObj().getLightBrightnessForSkyBlocks(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, 15); // OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, light, light); // // RenderManager renderMan = RenderManager.instance; // // GL11.glPushMatrix(); // // int dir = tileEntity.getBlockMetadata(); // GL11.glNormal3f(0, 1, 0); // if (dir == 1) { // GL11.glTranslatef((float)x +.501F, (float)y + .72F, (float)z - .01F); // GL11.glRotatef(0F, 0F, 1F, 0F); // } else if (dir == 2) { // GL11.glTranslatef((float)x + 1.01f, (float)y + .72F, (float)z + .5F); // GL11.glRotatef(270F, 0F, 1F, 0F); // } else if (dir == 3) { // GL11.glTranslatef((float)x + .5f, (float)y + .72F, (float)z + 1.01F); // GL11.glRotatef(180F, 0F, 1F, 0F); // } else if (dir == 4) { // GL11.glTranslatef((float)x - .01f, (float)y + .72F, (float)z + .5f); // GL11.glRotatef(90, 0F, 1F, 0F); // } // // GL11.glScalef(-0.016666668F, -0.016666668F, 0.016666668F); // GL11.glDisable(GL11.GL_LIGHTING); // GL11.glEnable(GL11.GL_BLEND); // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // ++this.ticks; // if (this.ticks > 20) { // if (radio.getScreenText().length() > 6) { // output = scrollText(radio.getScreenText()); // } else { // output = radio.getScreenText(); // } // } // renderMan.getFontRenderer().drawString(output, -37 / 2, 0, radio.getScreenColor()); // GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); // GL11.glEnable(GL11.GL_LIGHTING); // GL11.glPopMatrix(); // } // // public String scrollText(String text) { // FontRenderer fontRenderer = RenderManager.instance.getFontRenderer(); // text = " " + text + " "; // if (text.length() > count + 6) { // output = text.substring(count, count + 6); // if (fontRenderer.getStringWidth(output) / 6 < 5) { // output = text.substring(count, count + 7); // } // count++; // this.ticks = 0; // if (count > text.length()) { // count = 0; // } // } else { // count = 0; // } // return output; // } // // } // Path: src/main/java/pcl/OpenFM/ClientProxy.java import cpw.mods.fml.client.registry.ClientRegistry; import pcl.OpenFM.TileEntity.RadioRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; package pcl.OpenFM; public class ClientProxy extends CommonProxy { public void registerRenderers() {
TileEntitySpecialRenderer radioRenderer = new RadioRenderer();
PC-Logix/OpenFM
src/main/java/pcl/OpenFM/TileEntity/MemoryCardSlot.java
// Path: src/main/java/pcl/OpenFM/Items/ItemMemoryCard.java // public class ItemMemoryCard extends Item { // public ItemMemoryCard() { // setMaxStackSize(1); // setUnlocalizedName("OpenFM.MemoryCard"); // setTextureName("openfm:ItemMemoryCard"); // } // }
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import pcl.OpenFM.Items.ItemMemoryCard;
/** * */ package pcl.OpenFM.TileEntity; /** * @author Caitlyn * */ public class MemoryCardSlot extends Slot { public MemoryCardSlot(IInventory par1iInventory, int par2, int par3, int par4) { super(par1iInventory, par2, par3, par4); } public boolean isItemValid(ItemStack itemstack) {
// Path: src/main/java/pcl/OpenFM/Items/ItemMemoryCard.java // public class ItemMemoryCard extends Item { // public ItemMemoryCard() { // setMaxStackSize(1); // setUnlocalizedName("OpenFM.MemoryCard"); // setTextureName("openfm:ItemMemoryCard"); // } // } // Path: src/main/java/pcl/OpenFM/TileEntity/MemoryCardSlot.java import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import pcl.OpenFM.Items.ItemMemoryCard; /** * */ package pcl.OpenFM.TileEntity; /** * @author Caitlyn * */ public class MemoryCardSlot extends Slot { public MemoryCardSlot(IInventory par1iInventory, int par2, int par3, int par4) { super(par1iInventory, par2, par3, par4); } public boolean isItemValid(ItemStack itemstack) {
if (itemstack.getItem() instanceof ItemMemoryCard) {
PC-Logix/OpenFM
src/main/java/pcl/OpenFM/Handler/CardSlot.java
// Path: src/main/java/pcl/OpenFM/Items/ItemMemoryCard.java // public class ItemMemoryCard extends Item { // public ItemMemoryCard() { // setMaxStackSize(1); // setUnlocalizedName("OpenFM.MemoryCard"); // setTextureName("openfm:ItemMemoryCard"); // } // }
import net.minecraft.item.ItemStack; import pcl.OpenFM.Items.ItemMemoryCard; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot;
/** * */ package pcl.OpenFM.Handler; /** * @author Caitlyn * */ public class CardSlot extends Slot { public CardSlot(IInventory par1iInventory, int par2, int par3, int par4) { super(par1iInventory, par2, par3, par4); } @Override public boolean isItemValid(ItemStack itemstack) {
// Path: src/main/java/pcl/OpenFM/Items/ItemMemoryCard.java // public class ItemMemoryCard extends Item { // public ItemMemoryCard() { // setMaxStackSize(1); // setUnlocalizedName("OpenFM.MemoryCard"); // setTextureName("openfm:ItemMemoryCard"); // } // } // Path: src/main/java/pcl/OpenFM/Handler/CardSlot.java import net.minecraft.item.ItemStack; import pcl.OpenFM.Items.ItemMemoryCard; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; /** * */ package pcl.OpenFM.Handler; /** * @author Caitlyn * */ public class CardSlot extends Slot { public CardSlot(IInventory par1iInventory, int par2, int par3, int par4) { super(par1iInventory, par2, par3, par4); } @Override public boolean isItemValid(ItemStack itemstack) {
if (itemstack.getItem() instanceof ItemMemoryCard) {
PC-Logix/OpenFM
src/main/java/pcl/OpenFM/Block/BlockSpeaker.java
// Path: src/main/java/pcl/OpenFM/TileEntity/TileEntitySpeaker.java // @Optional.InterfaceList(value={ // @Optional.Interface(iface = "li.cil.oc.api.network.Environment", modid = "OpenComputers") // }) // public class TileEntitySpeaker extends TileEntity implements Environment { // // protected Node node; // // @Optional.Method(modid = "OpenComputers") // @Override // public Node node() { // if (node == null) node = Network.newNode(this, Visibility.Network).create(); // return node; // } // // @Optional.Method(modid = "OpenComputers") // @Override // public void onChunkUnload() { // super.onChunkUnload(); // if (node != null) // node.remove(); // } // // @Optional.Method(modid = "OpenComputers") // @Override // public void invalidate() { // super.invalidate(); // if (node != null) // node.remove(); // } // // @Optional.Method(modid = "OpenComputers") // @Override // public void onConnect(final Node node) { // // TODO Auto-generated method stub // } // // @Optional.Method(modid = "OpenComputers") // @Override // public void onMessage(Message message) { // // TODO Auto-generated method stub // } // // @Optional.Method(modid = "OpenComputers") // @Override // public void onDisconnect(Node node) { // // TODO Auto-generated method stub // // } // // @Optional.Method(modid = "OpenComputers") // @Override // public void readFromNBT(NBTTagCompound nbt) { // super.readFromNBT(nbt); // if (node != null && node.host() == this) { // node.load(nbt.getCompoundTag("oc:node")); // } // } // // @Optional.Method(modid = "OpenComputers") // @Override // public void writeToNBT(NBTTagCompound nbt) { // super.writeToNBT(nbt); // if (node != null && node.host() == this) { // final NBTTagCompound nodeNbt = new NBTTagCompound(); // node.save(nodeNbt); // nbt.setTag("oc:node", nodeNbt); // } // } // // @Optional.Method(modid = "OpenComputers") // @Override // public void updateEntity() { // super.updateEntity(); // if (node != null && node.network() == null) { // Network.joinOrCreateNetwork(this); // } // } // }
import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import pcl.OpenFM.TileEntity.TileEntitySpeaker; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly;
case 2: if (meta == 1) { return rearIcon; } return sideIcon; case 3: if (meta == 0 || meta == 3) { return rearIcon; } return sideIcon; case 4: if (meta == 4) { return rearIcon; } return sideIcon; case 5: if (meta == 2) { return rearIcon; } return sideIcon; } return sideIcon; } public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { int dir = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 0x3; world.setBlockMetadataWithNotify(x, y, z, dir + 1, 2); } public TileEntity createNewTileEntity(World world, int metadata) {
// Path: src/main/java/pcl/OpenFM/TileEntity/TileEntitySpeaker.java // @Optional.InterfaceList(value={ // @Optional.Interface(iface = "li.cil.oc.api.network.Environment", modid = "OpenComputers") // }) // public class TileEntitySpeaker extends TileEntity implements Environment { // // protected Node node; // // @Optional.Method(modid = "OpenComputers") // @Override // public Node node() { // if (node == null) node = Network.newNode(this, Visibility.Network).create(); // return node; // } // // @Optional.Method(modid = "OpenComputers") // @Override // public void onChunkUnload() { // super.onChunkUnload(); // if (node != null) // node.remove(); // } // // @Optional.Method(modid = "OpenComputers") // @Override // public void invalidate() { // super.invalidate(); // if (node != null) // node.remove(); // } // // @Optional.Method(modid = "OpenComputers") // @Override // public void onConnect(final Node node) { // // TODO Auto-generated method stub // } // // @Optional.Method(modid = "OpenComputers") // @Override // public void onMessage(Message message) { // // TODO Auto-generated method stub // } // // @Optional.Method(modid = "OpenComputers") // @Override // public void onDisconnect(Node node) { // // TODO Auto-generated method stub // // } // // @Optional.Method(modid = "OpenComputers") // @Override // public void readFromNBT(NBTTagCompound nbt) { // super.readFromNBT(nbt); // if (node != null && node.host() == this) { // node.load(nbt.getCompoundTag("oc:node")); // } // } // // @Optional.Method(modid = "OpenComputers") // @Override // public void writeToNBT(NBTTagCompound nbt) { // super.writeToNBT(nbt); // if (node != null && node.host() == this) { // final NBTTagCompound nodeNbt = new NBTTagCompound(); // node.save(nodeNbt); // nbt.setTag("oc:node", nodeNbt); // } // } // // @Optional.Method(modid = "OpenComputers") // @Override // public void updateEntity() { // super.updateEntity(); // if (node != null && node.network() == null) { // Network.joinOrCreateNetwork(this); // } // } // } // Path: src/main/java/pcl/OpenFM/Block/BlockSpeaker.java import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import pcl.OpenFM.TileEntity.TileEntitySpeaker; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; case 2: if (meta == 1) { return rearIcon; } return sideIcon; case 3: if (meta == 0 || meta == 3) { return rearIcon; } return sideIcon; case 4: if (meta == 4) { return rearIcon; } return sideIcon; case 5: if (meta == 2) { return rearIcon; } return sideIcon; } return sideIcon; } public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { int dir = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 0x3; world.setBlockMetadataWithNotify(x, y, z, dir + 1, 2); } public TileEntity createNewTileEntity(World world, int metadata) {
return new TileEntitySpeaker();
PC-Logix/OpenFM
src/main/java/pcl/OpenFM/GUI/OFMConfigGUI.java
// Path: src/main/java/pcl/OpenFM/BuildInfo.java // public class BuildInfo { // public static final String modName = "OpenFM"; // public static final String modID = "openfm"; // // public static final String versionNumber = "@VERSION@"; // public static final String buildNumber = "@BUILD@"; // // public static int getBuildNumber() { // if (buildNumber.equals("@" + "BUILD" + "@")) // return 0; // return Integer.parseInt(buildNumber); // } // // public static boolean isDevelopmentEnvironment() { // return getBuildNumber() == 0; // } // } // // Path: src/main/java/pcl/OpenFM/OFMConfiguration.java // public class OFMConfiguration { // // // All config values // public static String defaultURL = "StreamURL"; // public static boolean enableMUD = true; // public static boolean enableStreams = true; // public static Integer maxSpeakers = 10; // public static Configuration config; // // // Called by OpenFM preInit() // public static void init(File configFile) { // // config = new Configuration(configFile); // // try { // config.load(); // defaultURL = config.get("general", "defaultURL", defaultURL, "The default stream of the player.").getString(); // enableMUD = config.get("general", "enableMUD", enableMUD, "Automatically check for mod updates.").getBoolean(); // enableStreams = config.get("general", "enableStreams", enableStreams, "Should we try to play streams at all? If false streams will not work in game. (Client side only)").getBoolean(); // maxSpeakers = config.get("general", "maxSpeakers", maxSpeakers, "Maximum speakers that can be attached to a radio, higher numbers may cause performance issues").getInt(10); // } catch(Exception e) { // OpenFM.logger.error("OpenFM encountered a problem with loading the config file."); // } finally { // if (config.hasChanged()) { // config.save(); // } // } // } // // public static void sync() { // if (config.hasChanged()) { // config.save(); // } // } // // public static ConfigCategory getCategory(String name) { // // TODO Auto-generated method stub // return config.getCategory(name.toLowerCase()).setLanguageKey(name.toLowerCase().replace(" ", "")); // } // }
import pcl.OpenFM.BuildInfo; import pcl.OpenFM.OFMConfiguration; import cpw.mods.fml.client.config.GuiConfig; import net.minecraft.client.gui.GuiScreen; import net.minecraftforge.common.config.ConfigElement; import net.minecraftforge.common.config.Configuration;
package pcl.OpenFM.GUI; public class OFMConfigGUI extends GuiConfig { @SuppressWarnings({ "unchecked", "rawtypes" }) public OFMConfigGUI(GuiScreen parent) {
// Path: src/main/java/pcl/OpenFM/BuildInfo.java // public class BuildInfo { // public static final String modName = "OpenFM"; // public static final String modID = "openfm"; // // public static final String versionNumber = "@VERSION@"; // public static final String buildNumber = "@BUILD@"; // // public static int getBuildNumber() { // if (buildNumber.equals("@" + "BUILD" + "@")) // return 0; // return Integer.parseInt(buildNumber); // } // // public static boolean isDevelopmentEnvironment() { // return getBuildNumber() == 0; // } // } // // Path: src/main/java/pcl/OpenFM/OFMConfiguration.java // public class OFMConfiguration { // // // All config values // public static String defaultURL = "StreamURL"; // public static boolean enableMUD = true; // public static boolean enableStreams = true; // public static Integer maxSpeakers = 10; // public static Configuration config; // // // Called by OpenFM preInit() // public static void init(File configFile) { // // config = new Configuration(configFile); // // try { // config.load(); // defaultURL = config.get("general", "defaultURL", defaultURL, "The default stream of the player.").getString(); // enableMUD = config.get("general", "enableMUD", enableMUD, "Automatically check for mod updates.").getBoolean(); // enableStreams = config.get("general", "enableStreams", enableStreams, "Should we try to play streams at all? If false streams will not work in game. (Client side only)").getBoolean(); // maxSpeakers = config.get("general", "maxSpeakers", maxSpeakers, "Maximum speakers that can be attached to a radio, higher numbers may cause performance issues").getInt(10); // } catch(Exception e) { // OpenFM.logger.error("OpenFM encountered a problem with loading the config file."); // } finally { // if (config.hasChanged()) { // config.save(); // } // } // } // // public static void sync() { // if (config.hasChanged()) { // config.save(); // } // } // // public static ConfigCategory getCategory(String name) { // // TODO Auto-generated method stub // return config.getCategory(name.toLowerCase()).setLanguageKey(name.toLowerCase().replace(" ", "")); // } // } // Path: src/main/java/pcl/OpenFM/GUI/OFMConfigGUI.java import pcl.OpenFM.BuildInfo; import pcl.OpenFM.OFMConfiguration; import cpw.mods.fml.client.config.GuiConfig; import net.minecraft.client.gui.GuiScreen; import net.minecraftforge.common.config.ConfigElement; import net.minecraftforge.common.config.Configuration; package pcl.OpenFM.GUI; public class OFMConfigGUI extends GuiConfig { @SuppressWarnings({ "unchecked", "rawtypes" }) public OFMConfigGUI(GuiScreen parent) {
super(parent, new ConfigElement(OFMConfiguration.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), BuildInfo.modID, false, false, "OpenFM Configuation");
PC-Logix/OpenFM
src/main/java/pcl/OpenFM/GUI/OFMConfigGUI.java
// Path: src/main/java/pcl/OpenFM/BuildInfo.java // public class BuildInfo { // public static final String modName = "OpenFM"; // public static final String modID = "openfm"; // // public static final String versionNumber = "@VERSION@"; // public static final String buildNumber = "@BUILD@"; // // public static int getBuildNumber() { // if (buildNumber.equals("@" + "BUILD" + "@")) // return 0; // return Integer.parseInt(buildNumber); // } // // public static boolean isDevelopmentEnvironment() { // return getBuildNumber() == 0; // } // } // // Path: src/main/java/pcl/OpenFM/OFMConfiguration.java // public class OFMConfiguration { // // // All config values // public static String defaultURL = "StreamURL"; // public static boolean enableMUD = true; // public static boolean enableStreams = true; // public static Integer maxSpeakers = 10; // public static Configuration config; // // // Called by OpenFM preInit() // public static void init(File configFile) { // // config = new Configuration(configFile); // // try { // config.load(); // defaultURL = config.get("general", "defaultURL", defaultURL, "The default stream of the player.").getString(); // enableMUD = config.get("general", "enableMUD", enableMUD, "Automatically check for mod updates.").getBoolean(); // enableStreams = config.get("general", "enableStreams", enableStreams, "Should we try to play streams at all? If false streams will not work in game. (Client side only)").getBoolean(); // maxSpeakers = config.get("general", "maxSpeakers", maxSpeakers, "Maximum speakers that can be attached to a radio, higher numbers may cause performance issues").getInt(10); // } catch(Exception e) { // OpenFM.logger.error("OpenFM encountered a problem with loading the config file."); // } finally { // if (config.hasChanged()) { // config.save(); // } // } // } // // public static void sync() { // if (config.hasChanged()) { // config.save(); // } // } // // public static ConfigCategory getCategory(String name) { // // TODO Auto-generated method stub // return config.getCategory(name.toLowerCase()).setLanguageKey(name.toLowerCase().replace(" ", "")); // } // }
import pcl.OpenFM.BuildInfo; import pcl.OpenFM.OFMConfiguration; import cpw.mods.fml.client.config.GuiConfig; import net.minecraft.client.gui.GuiScreen; import net.minecraftforge.common.config.ConfigElement; import net.minecraftforge.common.config.Configuration;
package pcl.OpenFM.GUI; public class OFMConfigGUI extends GuiConfig { @SuppressWarnings({ "unchecked", "rawtypes" }) public OFMConfigGUI(GuiScreen parent) {
// Path: src/main/java/pcl/OpenFM/BuildInfo.java // public class BuildInfo { // public static final String modName = "OpenFM"; // public static final String modID = "openfm"; // // public static final String versionNumber = "@VERSION@"; // public static final String buildNumber = "@BUILD@"; // // public static int getBuildNumber() { // if (buildNumber.equals("@" + "BUILD" + "@")) // return 0; // return Integer.parseInt(buildNumber); // } // // public static boolean isDevelopmentEnvironment() { // return getBuildNumber() == 0; // } // } // // Path: src/main/java/pcl/OpenFM/OFMConfiguration.java // public class OFMConfiguration { // // // All config values // public static String defaultURL = "StreamURL"; // public static boolean enableMUD = true; // public static boolean enableStreams = true; // public static Integer maxSpeakers = 10; // public static Configuration config; // // // Called by OpenFM preInit() // public static void init(File configFile) { // // config = new Configuration(configFile); // // try { // config.load(); // defaultURL = config.get("general", "defaultURL", defaultURL, "The default stream of the player.").getString(); // enableMUD = config.get("general", "enableMUD", enableMUD, "Automatically check for mod updates.").getBoolean(); // enableStreams = config.get("general", "enableStreams", enableStreams, "Should we try to play streams at all? If false streams will not work in game. (Client side only)").getBoolean(); // maxSpeakers = config.get("general", "maxSpeakers", maxSpeakers, "Maximum speakers that can be attached to a radio, higher numbers may cause performance issues").getInt(10); // } catch(Exception e) { // OpenFM.logger.error("OpenFM encountered a problem with loading the config file."); // } finally { // if (config.hasChanged()) { // config.save(); // } // } // } // // public static void sync() { // if (config.hasChanged()) { // config.save(); // } // } // // public static ConfigCategory getCategory(String name) { // // TODO Auto-generated method stub // return config.getCategory(name.toLowerCase()).setLanguageKey(name.toLowerCase().replace(" ", "")); // } // } // Path: src/main/java/pcl/OpenFM/GUI/OFMConfigGUI.java import pcl.OpenFM.BuildInfo; import pcl.OpenFM.OFMConfiguration; import cpw.mods.fml.client.config.GuiConfig; import net.minecraft.client.gui.GuiScreen; import net.minecraftforge.common.config.ConfigElement; import net.minecraftforge.common.config.Configuration; package pcl.OpenFM.GUI; public class OFMConfigGUI extends GuiConfig { @SuppressWarnings({ "unchecked", "rawtypes" }) public OFMConfigGUI(GuiScreen parent) {
super(parent, new ConfigElement(OFMConfiguration.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), BuildInfo.modID, false, false, "OpenFM Configuation");
eli1982/intellij-perl-plugin
src/com/intellij/perlplugin/psi/impl/PerlVisitor.java
// Path: src/com/intellij/perlplugin/psi/PerlNamedElement.java // public interface PerlNamedElement extends PsiNameIdentifierOwner { // }
import com.intellij.perlplugin.psi.PerlNamedElement; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElementVisitor; import org.jetbrains.annotations.NotNull;
// This is a generated file. Not intended for manual editing. package com.intellij.perlplugin.psi.impl; public class PerlVisitor extends PsiElementVisitor { public void visitProperty(@NotNull PerlProperty o) { visitNamedElement(o); }
// Path: src/com/intellij/perlplugin/psi/PerlNamedElement.java // public interface PerlNamedElement extends PsiNameIdentifierOwner { // } // Path: src/com/intellij/perlplugin/psi/impl/PerlVisitor.java import com.intellij.perlplugin.psi.PerlNamedElement; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElementVisitor; import org.jetbrains.annotations.NotNull; // This is a generated file. Not intended for manual editing. package com.intellij.perlplugin.psi.impl; public class PerlVisitor extends PsiElementVisitor { public void visitProperty(@NotNull PerlProperty o) { visitNamedElement(o); }
public void visitNamedElement(@NotNull PerlNamedElement o) {
eli1982/intellij-perl-plugin
src/com/intellij/perlplugin/psi/PerlPsiImplUtil.java
// Path: src/com/intellij/perlplugin/language/PerlIcons.java // public class PerlIcons { // public static final Icon LANGUAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_16x16.png"); // public static final Icon LANGUAGE_32 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_32x32.png"); // public static final Icon LANGUAGE_256 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_256x256.png"); // public static final Icon PACKAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/package_16x16.png"); // public static final Icon SUBROUTINE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon CONSTRUCTOR = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon VARIABLE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/variable_16x16.png"); // } // // Path: src/com/intellij/perlplugin/psi/impl/PerlElementFactory.java // public class PerlElementFactory { // public static PerlProperty createProperty(Project project, String name, String value) { // final PerlFile file = createFile(project, name + " = " + value); // return (PerlProperty) file.getFirstChild(); // } // // public static PerlProperty createProperty(Project project, String name) { // final PerlFile file = createFile(project, name); // return (PerlProperty) file.getFirstChild(); // } // // public static PsiElement createCRLF(Project project) { // final PerlFile file = createFile(project, "\n"); // return file.getFirstChild(); // } // // public static PerlFile createFile(Project project, String text) { // String name = "dummy.Perl"; // return (PerlFile) PsiFileFactory.getInstance(project). // createFileFromText(name, PerlFileType.INSTANCE, text); // } // } // // Path: src/com/intellij/perlplugin/psi/impl/PerlProperty.java // public interface PerlProperty extends PerlNamedElement, PsiReference { // // String getKey(); // // String getValue(); // // String getName(); // // PsiElement setName(String newName); // // PsiElement getNameIdentifier(); // // ItemPresentation getPresentation(); // // @NotNull // @Override // PsiReference[] getReferences(); // // @Nullable // @Override // PsiReference getReference(); // }
import com.intellij.lang.ASTNode; import com.intellij.navigation.ItemPresentation; import com.intellij.perlplugin.language.PerlIcons; import com.intellij.perlplugin.psi.impl.PerlElementFactory; import com.intellij.perlplugin.psi.impl.PerlProperty; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.Nullable; import javax.swing.*;
package com.intellij.perlplugin.psi; public class PerlPsiImplUtil { public static String getKey(PerlProperty element) { ASTNode keyNode = element.getNode().findChildByType(PerlTypes.KEY); if (keyNode != null) { return keyNode.getText(); } else { return null; } } public static String getValue(PerlProperty element) { ASTNode valueNode = element.getNode().findChildByType(PerlTypes.VALUE); if (valueNode != null) { return valueNode.getText(); } else { return null; } } public static String getName(PerlProperty element) { return getKey(element); } public static PsiElement setName(PerlProperty element, String newName) { ASTNode keyNode = element.getNode().findChildByType(PerlTypes.KEY); if (keyNode != null) {
// Path: src/com/intellij/perlplugin/language/PerlIcons.java // public class PerlIcons { // public static final Icon LANGUAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_16x16.png"); // public static final Icon LANGUAGE_32 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_32x32.png"); // public static final Icon LANGUAGE_256 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_256x256.png"); // public static final Icon PACKAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/package_16x16.png"); // public static final Icon SUBROUTINE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon CONSTRUCTOR = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon VARIABLE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/variable_16x16.png"); // } // // Path: src/com/intellij/perlplugin/psi/impl/PerlElementFactory.java // public class PerlElementFactory { // public static PerlProperty createProperty(Project project, String name, String value) { // final PerlFile file = createFile(project, name + " = " + value); // return (PerlProperty) file.getFirstChild(); // } // // public static PerlProperty createProperty(Project project, String name) { // final PerlFile file = createFile(project, name); // return (PerlProperty) file.getFirstChild(); // } // // public static PsiElement createCRLF(Project project) { // final PerlFile file = createFile(project, "\n"); // return file.getFirstChild(); // } // // public static PerlFile createFile(Project project, String text) { // String name = "dummy.Perl"; // return (PerlFile) PsiFileFactory.getInstance(project). // createFileFromText(name, PerlFileType.INSTANCE, text); // } // } // // Path: src/com/intellij/perlplugin/psi/impl/PerlProperty.java // public interface PerlProperty extends PerlNamedElement, PsiReference { // // String getKey(); // // String getValue(); // // String getName(); // // PsiElement setName(String newName); // // PsiElement getNameIdentifier(); // // ItemPresentation getPresentation(); // // @NotNull // @Override // PsiReference[] getReferences(); // // @Nullable // @Override // PsiReference getReference(); // } // Path: src/com/intellij/perlplugin/psi/PerlPsiImplUtil.java import com.intellij.lang.ASTNode; import com.intellij.navigation.ItemPresentation; import com.intellij.perlplugin.language.PerlIcons; import com.intellij.perlplugin.psi.impl.PerlElementFactory; import com.intellij.perlplugin.psi.impl.PerlProperty; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.Nullable; import javax.swing.*; package com.intellij.perlplugin.psi; public class PerlPsiImplUtil { public static String getKey(PerlProperty element) { ASTNode keyNode = element.getNode().findChildByType(PerlTypes.KEY); if (keyNode != null) { return keyNode.getText(); } else { return null; } } public static String getValue(PerlProperty element) { ASTNode valueNode = element.getNode().findChildByType(PerlTypes.VALUE); if (valueNode != null) { return valueNode.getText(); } else { return null; } } public static String getName(PerlProperty element) { return getKey(element); } public static PsiElement setName(PerlProperty element, String newName) { ASTNode keyNode = element.getNode().findChildByType(PerlTypes.KEY); if (keyNode != null) {
PerlProperty property = PerlElementFactory.createProperty(element.getProject(), newName);
eli1982/intellij-perl-plugin
src/com/intellij/perlplugin/psi/PerlPsiImplUtil.java
// Path: src/com/intellij/perlplugin/language/PerlIcons.java // public class PerlIcons { // public static final Icon LANGUAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_16x16.png"); // public static final Icon LANGUAGE_32 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_32x32.png"); // public static final Icon LANGUAGE_256 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_256x256.png"); // public static final Icon PACKAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/package_16x16.png"); // public static final Icon SUBROUTINE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon CONSTRUCTOR = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon VARIABLE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/variable_16x16.png"); // } // // Path: src/com/intellij/perlplugin/psi/impl/PerlElementFactory.java // public class PerlElementFactory { // public static PerlProperty createProperty(Project project, String name, String value) { // final PerlFile file = createFile(project, name + " = " + value); // return (PerlProperty) file.getFirstChild(); // } // // public static PerlProperty createProperty(Project project, String name) { // final PerlFile file = createFile(project, name); // return (PerlProperty) file.getFirstChild(); // } // // public static PsiElement createCRLF(Project project) { // final PerlFile file = createFile(project, "\n"); // return file.getFirstChild(); // } // // public static PerlFile createFile(Project project, String text) { // String name = "dummy.Perl"; // return (PerlFile) PsiFileFactory.getInstance(project). // createFileFromText(name, PerlFileType.INSTANCE, text); // } // } // // Path: src/com/intellij/perlplugin/psi/impl/PerlProperty.java // public interface PerlProperty extends PerlNamedElement, PsiReference { // // String getKey(); // // String getValue(); // // String getName(); // // PsiElement setName(String newName); // // PsiElement getNameIdentifier(); // // ItemPresentation getPresentation(); // // @NotNull // @Override // PsiReference[] getReferences(); // // @Nullable // @Override // PsiReference getReference(); // }
import com.intellij.lang.ASTNode; import com.intellij.navigation.ItemPresentation; import com.intellij.perlplugin.language.PerlIcons; import com.intellij.perlplugin.psi.impl.PerlElementFactory; import com.intellij.perlplugin.psi.impl.PerlProperty; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.Nullable; import javax.swing.*;
} return element; } public static PsiElement getNameIdentifier(PerlProperty element) { ASTNode keyNode = element.getNode().findChildByType(PerlTypes.KEY); if (keyNode != null) { return keyNode.getPsi(); } else { return null; } } public static ItemPresentation getPresentation(final PerlProperty element) { return new ItemPresentation() { @Nullable @Override public String getPresentableText() { return element.getKey(); } @Nullable @Override public String getLocationString() { return element.getContainingFile().getName(); } @Nullable @Override public Icon getIcon(boolean unused) {
// Path: src/com/intellij/perlplugin/language/PerlIcons.java // public class PerlIcons { // public static final Icon LANGUAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_16x16.png"); // public static final Icon LANGUAGE_32 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_32x32.png"); // public static final Icon LANGUAGE_256 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_256x256.png"); // public static final Icon PACKAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/package_16x16.png"); // public static final Icon SUBROUTINE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon CONSTRUCTOR = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon VARIABLE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/variable_16x16.png"); // } // // Path: src/com/intellij/perlplugin/psi/impl/PerlElementFactory.java // public class PerlElementFactory { // public static PerlProperty createProperty(Project project, String name, String value) { // final PerlFile file = createFile(project, name + " = " + value); // return (PerlProperty) file.getFirstChild(); // } // // public static PerlProperty createProperty(Project project, String name) { // final PerlFile file = createFile(project, name); // return (PerlProperty) file.getFirstChild(); // } // // public static PsiElement createCRLF(Project project) { // final PerlFile file = createFile(project, "\n"); // return file.getFirstChild(); // } // // public static PerlFile createFile(Project project, String text) { // String name = "dummy.Perl"; // return (PerlFile) PsiFileFactory.getInstance(project). // createFileFromText(name, PerlFileType.INSTANCE, text); // } // } // // Path: src/com/intellij/perlplugin/psi/impl/PerlProperty.java // public interface PerlProperty extends PerlNamedElement, PsiReference { // // String getKey(); // // String getValue(); // // String getName(); // // PsiElement setName(String newName); // // PsiElement getNameIdentifier(); // // ItemPresentation getPresentation(); // // @NotNull // @Override // PsiReference[] getReferences(); // // @Nullable // @Override // PsiReference getReference(); // } // Path: src/com/intellij/perlplugin/psi/PerlPsiImplUtil.java import com.intellij.lang.ASTNode; import com.intellij.navigation.ItemPresentation; import com.intellij.perlplugin.language.PerlIcons; import com.intellij.perlplugin.psi.impl.PerlElementFactory; import com.intellij.perlplugin.psi.impl.PerlProperty; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.Nullable; import javax.swing.*; } return element; } public static PsiElement getNameIdentifier(PerlProperty element) { ASTNode keyNode = element.getNode().findChildByType(PerlTypes.KEY); if (keyNode != null) { return keyNode.getPsi(); } else { return null; } } public static ItemPresentation getPresentation(final PerlProperty element) { return new ItemPresentation() { @Nullable @Override public String getPresentableText() { return element.getKey(); } @Nullable @Override public String getLocationString() { return element.getContainingFile().getName(); } @Nullable @Override public Icon getIcon(boolean unused) {
return PerlIcons.LANGUAGE;
eli1982/intellij-perl-plugin
src/com/intellij/perlplugin/extensions/module/builder/PerlModuleBuilder.java
// Path: src/com/intellij/perlplugin/language/PerlIcons.java // public class PerlIcons { // public static final Icon LANGUAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_16x16.png"); // public static final Icon LANGUAGE_32 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_32x32.png"); // public static final Icon LANGUAGE_256 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_256x256.png"); // public static final Icon PACKAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/package_16x16.png"); // public static final Icon SUBROUTINE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon CONSTRUCTOR = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon VARIABLE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/variable_16x16.png"); // }
import com.intellij.ide.util.projectWizard.*; import com.intellij.openapi.Disposable; import com.intellij.openapi.module.ModuleType; import com.intellij.openapi.options.ConfigurationException; import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.SdkTypeId; import com.intellij.openapi.roots.CompilerModuleExtension; import com.intellij.openapi.roots.ContentEntry; import com.intellij.openapi.roots.ModifiableRootModel; import com.intellij.openapi.roots.OrderRootType; import com.intellij.openapi.roots.libraries.Library; import com.intellij.openapi.roots.libraries.LibraryTable; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.perlplugin.language.PerlIcons; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List;
package com.intellij.perlplugin.extensions.module.builder; /** * Created by ELI-HOME on 25-Apr-15. */ public class PerlModuleBuilder extends ModuleBuilder implements SourcePathsBuilder { private Project myProject; private String myCompilerOutputPath; private List<Pair<String, String>> mySourcePaths; public String getBuilderId() { return getClass().getName(); } public String getPresentableName() { return "Perl"; } public String getDescription() { return "Perl Module - supports features for .pm and .pl files"; } public Icon getBigIcon() {
// Path: src/com/intellij/perlplugin/language/PerlIcons.java // public class PerlIcons { // public static final Icon LANGUAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_16x16.png"); // public static final Icon LANGUAGE_32 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_32x32.png"); // public static final Icon LANGUAGE_256 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_256x256.png"); // public static final Icon PACKAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/package_16x16.png"); // public static final Icon SUBROUTINE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon CONSTRUCTOR = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon VARIABLE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/variable_16x16.png"); // } // Path: src/com/intellij/perlplugin/extensions/module/builder/PerlModuleBuilder.java import com.intellij.ide.util.projectWizard.*; import com.intellij.openapi.Disposable; import com.intellij.openapi.module.ModuleType; import com.intellij.openapi.options.ConfigurationException; import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.SdkTypeId; import com.intellij.openapi.roots.CompilerModuleExtension; import com.intellij.openapi.roots.ContentEntry; import com.intellij.openapi.roots.ModifiableRootModel; import com.intellij.openapi.roots.OrderRootType; import com.intellij.openapi.roots.libraries.Library; import com.intellij.openapi.roots.libraries.LibraryTable; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.perlplugin.language.PerlIcons; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; package com.intellij.perlplugin.extensions.module.builder; /** * Created by ELI-HOME on 25-Apr-15. */ public class PerlModuleBuilder extends ModuleBuilder implements SourcePathsBuilder { private Project myProject; private String myCompilerOutputPath; private List<Pair<String, String>> mySourcePaths; public String getBuilderId() { return getClass().getName(); } public String getPresentableName() { return "Perl"; } public String getDescription() { return "Perl Module - supports features for .pm and .pl files"; } public Icon getBigIcon() {
return PerlIcons.LANGUAGE_32;
eli1982/intellij-perl-plugin
src/com/intellij/perlplugin/psi/PerlTypes.java
// Path: src/com/intellij/perlplugin/psi/impl/PerlPropertyImpl.java // public class PerlPropertyImpl extends ASTWrapperPsiElement implements PerlProperty, PsiReference { // // public PerlPropertyImpl(ASTNode node) { // super(node); // } // // public void accept(@NotNull PsiElementVisitor visitor) { // if (visitor instanceof PerlVisitor) ((PerlVisitor) visitor).visitProperty(this); // else super.accept(visitor); // } // // @Override // public PsiReference getReference() { // return super.getReference(); // } // // @NotNull // @Override // public PsiReference[] getReferences() { // return super.getReferences(); // } // // public String getKey() { // return PerlPsiImplUtil.getKey(this); // } // // public String getValue() { // return PerlPsiImplUtil.getValue(this); // } // // public String getName() { // return PerlPsiImplUtil.getName(this); // } // // public PsiElement setName(String newName) { // return PerlPsiImplUtil.setName(this, newName); // } // // public PsiElement getNameIdentifier() { // return PerlPsiImplUtil.getNameIdentifier(this); // } // // public ItemPresentation getPresentation() { // return PerlPsiImplUtil.getPresentation(this); // } // // @Override // public PsiElement getElement() { // return null; // } // // @Override // public TextRange getRangeInElement() { // return null; // } // // @Nullable // @Override // public PsiElement resolve() { // return null; // } // // @NotNull // @Override // public String getCanonicalText() { // return null; // } // // @Override // public PsiElement handleElementRename(String s) throws IncorrectOperationException { // return null; // } // // @Override // public PsiElement bindToElement(@NotNull PsiElement psiElement) throws IncorrectOperationException { // return null; // } // // @Override // public boolean isReferenceTo(PsiElement psiElement) { // return false; // } // // @NotNull // @Override // public Object[] getVariants() { // return new Object[0]; // } // // @Override // public boolean isSoft() { // return false; // } // }
import com.intellij.lang.ASTNode; import com.intellij.perlplugin.psi.impl.PerlPropertyImpl; import com.intellij.psi.PsiElement; import com.intellij.psi.tree.IElementType;
// This is a generated file. Not intended for manual editing. package com.intellij.perlplugin.psi; public interface PerlTypes { IElementType PROPERTY = new PerlElementType("PROPERTY"); IElementType CRLF = new PerlTokenType("CRLF"); IElementType KEY = new PerlTokenType("KEY"); IElementType OPERATOR = new PerlTokenType("OPERATOR"); IElementType BRACES = new PerlTokenType("BRACES"); IElementType VALUE = new PerlTokenType("VALUE"); IElementType WHITESPACE = new PerlTokenType("WHITESPACE"); IElementType SUBROUTINE = new PerlTokenType("SUBROUTINE"); IElementType PACKAGE = new PerlTokenType("PACKAGE"); IElementType POINTER = new PerlTokenType("POINTER"); IElementType LINE_COMMENT = new PerlTokenType("LINE_COMMENT"); IElementType MARKUP = new PerlTokenType("MARKUP"); IElementType LANG_VARIABLE = new PerlTokenType("LANG_VARIABLE"); IElementType LANG_FUNCTION = new PerlTokenType("LANG_FUNCTION"); IElementType LANG_SYNTAX = new PerlTokenType("LANG_SYNTAX"); IElementType LANG_FILE_HANDLES = new PerlTokenType("LANG_FILE_HANDLES"); IElementType ARGUMENTS = new PerlTokenType("ARGUMENTS"); IElementType VARIABLE = new PerlTokenType("VARIABLE"); IElementType HASH_KEY = new PerlTokenType("HASH_KEY"); IElementType PREDICATE = new PerlTokenType("PREDICATE"); class Factory { public static PsiElement createElement(ASTNode node) { IElementType type = node.getElementType(); // if (type == PROPERTY) {
// Path: src/com/intellij/perlplugin/psi/impl/PerlPropertyImpl.java // public class PerlPropertyImpl extends ASTWrapperPsiElement implements PerlProperty, PsiReference { // // public PerlPropertyImpl(ASTNode node) { // super(node); // } // // public void accept(@NotNull PsiElementVisitor visitor) { // if (visitor instanceof PerlVisitor) ((PerlVisitor) visitor).visitProperty(this); // else super.accept(visitor); // } // // @Override // public PsiReference getReference() { // return super.getReference(); // } // // @NotNull // @Override // public PsiReference[] getReferences() { // return super.getReferences(); // } // // public String getKey() { // return PerlPsiImplUtil.getKey(this); // } // // public String getValue() { // return PerlPsiImplUtil.getValue(this); // } // // public String getName() { // return PerlPsiImplUtil.getName(this); // } // // public PsiElement setName(String newName) { // return PerlPsiImplUtil.setName(this, newName); // } // // public PsiElement getNameIdentifier() { // return PerlPsiImplUtil.getNameIdentifier(this); // } // // public ItemPresentation getPresentation() { // return PerlPsiImplUtil.getPresentation(this); // } // // @Override // public PsiElement getElement() { // return null; // } // // @Override // public TextRange getRangeInElement() { // return null; // } // // @Nullable // @Override // public PsiElement resolve() { // return null; // } // // @NotNull // @Override // public String getCanonicalText() { // return null; // } // // @Override // public PsiElement handleElementRename(String s) throws IncorrectOperationException { // return null; // } // // @Override // public PsiElement bindToElement(@NotNull PsiElement psiElement) throws IncorrectOperationException { // return null; // } // // @Override // public boolean isReferenceTo(PsiElement psiElement) { // return false; // } // // @NotNull // @Override // public Object[] getVariants() { // return new Object[0]; // } // // @Override // public boolean isSoft() { // return false; // } // } // Path: src/com/intellij/perlplugin/psi/PerlTypes.java import com.intellij.lang.ASTNode; import com.intellij.perlplugin.psi.impl.PerlPropertyImpl; import com.intellij.psi.PsiElement; import com.intellij.psi.tree.IElementType; // This is a generated file. Not intended for manual editing. package com.intellij.perlplugin.psi; public interface PerlTypes { IElementType PROPERTY = new PerlElementType("PROPERTY"); IElementType CRLF = new PerlTokenType("CRLF"); IElementType KEY = new PerlTokenType("KEY"); IElementType OPERATOR = new PerlTokenType("OPERATOR"); IElementType BRACES = new PerlTokenType("BRACES"); IElementType VALUE = new PerlTokenType("VALUE"); IElementType WHITESPACE = new PerlTokenType("WHITESPACE"); IElementType SUBROUTINE = new PerlTokenType("SUBROUTINE"); IElementType PACKAGE = new PerlTokenType("PACKAGE"); IElementType POINTER = new PerlTokenType("POINTER"); IElementType LINE_COMMENT = new PerlTokenType("LINE_COMMENT"); IElementType MARKUP = new PerlTokenType("MARKUP"); IElementType LANG_VARIABLE = new PerlTokenType("LANG_VARIABLE"); IElementType LANG_FUNCTION = new PerlTokenType("LANG_FUNCTION"); IElementType LANG_SYNTAX = new PerlTokenType("LANG_SYNTAX"); IElementType LANG_FILE_HANDLES = new PerlTokenType("LANG_FILE_HANDLES"); IElementType ARGUMENTS = new PerlTokenType("ARGUMENTS"); IElementType VARIABLE = new PerlTokenType("VARIABLE"); IElementType HASH_KEY = new PerlTokenType("HASH_KEY"); IElementType PREDICATE = new PerlTokenType("PREDICATE"); class Factory { public static PsiElement createElement(ASTNode node) { IElementType type = node.getElementType(); // if (type == PROPERTY) {
return new PerlPropertyImpl(node);
eli1982/intellij-perl-plugin
src/com/intellij/perlplugin/filters/FileFilter.java
// Path: src/com/intellij/perlplugin/Utils.java // public class Utils { // public static boolean verbose = false; // public static boolean debug = verbose || false; // protected static OSType detectedOS; // // public enum OSType { // Windows, MacOS, Linux, os, Other // } // // ; // // public static void alert(String str) { // System.out.println("ERROR: " + str);//TODO:: Log an exception properly // } // // public static void print(Object obj) { // System.out.println(obj); // } // // public static String readFile(String filePath) { // try { // return new String(Files.readAllBytes(Paths.get(filePath))); // } catch (Exception e) { // Utils.alert(e.getMessage()); // } // return ""; // } // // public static Matcher applyRegex(String regex, String content) { // return applyRegex(regex, content, 0); // } // // public static Matcher applyRegex(String regex, String content, int flags) { // Pattern pattern = Pattern.compile(regex, flags); // return pattern.matcher(content); // } // // public static int getFilesCount(File file, FileFilter fileFilter) { // File[] files = file.listFiles(fileFilter); // int count = 0; // for (File f : files) // if (f.isDirectory()) // count += getFilesCount(f, fileFilter); // else // count++; // // return count; // } // // public static boolean isValidateExtension(String path) { // return path.endsWith(Constants.FILE_TYPE_PM) || path.endsWith(Constants.FILE_TYPE_PL); // } // // public static OSType getOperatingSystemType() { // if (detectedOS == null) { // String OS = System.getProperty("os.name", "generic").toLowerCase(Locale.ENGLISH); // if ((OS.indexOf("mac") >= 0) || (OS.indexOf("darwin") >= 0)) { // detectedOS = OSType.MacOS; // } else if (OS.indexOf("win") >= 0) { // detectedOS = OSType.Windows; // } else if (OS.indexOf("nux") >= 0) { // detectedOS = OSType.Linux; // } else { // detectedOS = OSType.Other; // } // } // return detectedOS; // } // } // // Path: src/com/intellij/perlplugin/language/Constants.java // public class Constants { // public static final String ID = "perl"; // public static final String LANGUAGE_NAME = "Perl"; // public static final String FILE_TYPE_PM = "pm"; // public static final String FILE_TYPE_PL = "pl"; // public static final String PM_EXTENSION = ".pm"; // public static final String PL_EXTENSION = ".pl"; // public static final String FILE_NAME = "Perl file"; // public static final String DESCRIPTION = "Perl language file"; // }
import com.intellij.perlplugin.Utils; import com.intellij.perlplugin.language.Constants; import java.io.File; import java.io.FilenameFilter; import java.io.IOException;
package com.intellij.perlplugin.filters; /** * Created by eli on 28-11-14. */ public class FileFilter implements FilenameFilter { @Override public boolean accept(File file, String path) { try {
// Path: src/com/intellij/perlplugin/Utils.java // public class Utils { // public static boolean verbose = false; // public static boolean debug = verbose || false; // protected static OSType detectedOS; // // public enum OSType { // Windows, MacOS, Linux, os, Other // } // // ; // // public static void alert(String str) { // System.out.println("ERROR: " + str);//TODO:: Log an exception properly // } // // public static void print(Object obj) { // System.out.println(obj); // } // // public static String readFile(String filePath) { // try { // return new String(Files.readAllBytes(Paths.get(filePath))); // } catch (Exception e) { // Utils.alert(e.getMessage()); // } // return ""; // } // // public static Matcher applyRegex(String regex, String content) { // return applyRegex(regex, content, 0); // } // // public static Matcher applyRegex(String regex, String content, int flags) { // Pattern pattern = Pattern.compile(regex, flags); // return pattern.matcher(content); // } // // public static int getFilesCount(File file, FileFilter fileFilter) { // File[] files = file.listFiles(fileFilter); // int count = 0; // for (File f : files) // if (f.isDirectory()) // count += getFilesCount(f, fileFilter); // else // count++; // // return count; // } // // public static boolean isValidateExtension(String path) { // return path.endsWith(Constants.FILE_TYPE_PM) || path.endsWith(Constants.FILE_TYPE_PL); // } // // public static OSType getOperatingSystemType() { // if (detectedOS == null) { // String OS = System.getProperty("os.name", "generic").toLowerCase(Locale.ENGLISH); // if ((OS.indexOf("mac") >= 0) || (OS.indexOf("darwin") >= 0)) { // detectedOS = OSType.MacOS; // } else if (OS.indexOf("win") >= 0) { // detectedOS = OSType.Windows; // } else if (OS.indexOf("nux") >= 0) { // detectedOS = OSType.Linux; // } else { // detectedOS = OSType.Other; // } // } // return detectedOS; // } // } // // Path: src/com/intellij/perlplugin/language/Constants.java // public class Constants { // public static final String ID = "perl"; // public static final String LANGUAGE_NAME = "Perl"; // public static final String FILE_TYPE_PM = "pm"; // public static final String FILE_TYPE_PL = "pl"; // public static final String PM_EXTENSION = ".pm"; // public static final String PL_EXTENSION = ".pl"; // public static final String FILE_NAME = "Perl file"; // public static final String DESCRIPTION = "Perl language file"; // } // Path: src/com/intellij/perlplugin/filters/FileFilter.java import com.intellij.perlplugin.Utils; import com.intellij.perlplugin.language.Constants; import java.io.File; import java.io.FilenameFilter; import java.io.IOException; package com.intellij.perlplugin.filters; /** * Created by eli on 28-11-14. */ public class FileFilter implements FilenameFilter { @Override public boolean accept(File file, String path) { try {
return (Utils.isValidateExtension(path) || (new File(file.getCanonicalPath() + "/" + path).isDirectory()) && file.exists());
eli1982/intellij-perl-plugin
src/com/intellij/perlplugin/psi/PerlElementType.java
// Path: src/com/intellij/perlplugin/language/PerlLanguage.java // public class PerlLanguage extends Language { // public static final PerlLanguage INSTANCE = new PerlLanguage(); // // public PerlLanguage() { // super(Constants.LANGUAGE_NAME); // SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(this, new PerlSyntaxHighlighterFactory() { // @NotNull // protected SyntaxHighlighter createHighlighter() { // return new PerlSyntaxHighlighter(); // } // }); // } // // }
import com.intellij.perlplugin.language.PerlLanguage; import com.intellij.psi.tree.IElementType; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull;
package com.intellij.perlplugin.psi; public class PerlElementType extends IElementType { public PerlElementType(@NotNull @NonNls String debugName) {
// Path: src/com/intellij/perlplugin/language/PerlLanguage.java // public class PerlLanguage extends Language { // public static final PerlLanguage INSTANCE = new PerlLanguage(); // // public PerlLanguage() { // super(Constants.LANGUAGE_NAME); // SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(this, new PerlSyntaxHighlighterFactory() { // @NotNull // protected SyntaxHighlighter createHighlighter() { // return new PerlSyntaxHighlighter(); // } // }); // } // // } // Path: src/com/intellij/perlplugin/psi/PerlElementType.java import com.intellij.perlplugin.language.PerlLanguage; import com.intellij.psi.tree.IElementType; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; package com.intellij.perlplugin.psi; public class PerlElementType extends IElementType { public PerlElementType(@NotNull @NonNls String debugName) {
super(debugName, PerlLanguage.INSTANCE);
eli1982/intellij-perl-plugin
src/com/intellij/perlplugin/extensions/PerlFileTypeFactory.java
// Path: src/com/intellij/perlplugin/language/Constants.java // public class Constants { // public static final String ID = "perl"; // public static final String LANGUAGE_NAME = "Perl"; // public static final String FILE_TYPE_PM = "pm"; // public static final String FILE_TYPE_PL = "pl"; // public static final String PM_EXTENSION = ".pm"; // public static final String PL_EXTENSION = ".pl"; // public static final String FILE_NAME = "Perl file"; // public static final String DESCRIPTION = "Perl language file"; // } // // Path: src/com/intellij/perlplugin/language/PerlFileType.java // public class PerlFileType extends LanguageFileType { // public static final PerlFileType INSTANCE = new PerlFileType(); // // private PerlFileType() { // super(PerlLanguage.INSTANCE); // } // // @NotNull // @Override // public String getName() { // return Constants.FILE_NAME; // } // // @NotNull // @Override // public String getDescription() { // return Constants.DESCRIPTION; // } // // @NotNull // @Override // public String getDefaultExtension() { // return Constants.FILE_TYPE_PM; // } // // @Nullable // @Override // public Icon getIcon() { // return PerlIcons.LANGUAGE; // } // }
import com.intellij.openapi.fileTypes.FileTypeConsumer; import com.intellij.openapi.fileTypes.FileTypeFactory; import com.intellij.perlplugin.language.Constants; import com.intellij.perlplugin.language.PerlFileType; import org.jetbrains.annotations.NotNull;
package com.intellij.perlplugin.extensions; public class PerlFileTypeFactory extends FileTypeFactory { @Override public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
// Path: src/com/intellij/perlplugin/language/Constants.java // public class Constants { // public static final String ID = "perl"; // public static final String LANGUAGE_NAME = "Perl"; // public static final String FILE_TYPE_PM = "pm"; // public static final String FILE_TYPE_PL = "pl"; // public static final String PM_EXTENSION = ".pm"; // public static final String PL_EXTENSION = ".pl"; // public static final String FILE_NAME = "Perl file"; // public static final String DESCRIPTION = "Perl language file"; // } // // Path: src/com/intellij/perlplugin/language/PerlFileType.java // public class PerlFileType extends LanguageFileType { // public static final PerlFileType INSTANCE = new PerlFileType(); // // private PerlFileType() { // super(PerlLanguage.INSTANCE); // } // // @NotNull // @Override // public String getName() { // return Constants.FILE_NAME; // } // // @NotNull // @Override // public String getDescription() { // return Constants.DESCRIPTION; // } // // @NotNull // @Override // public String getDefaultExtension() { // return Constants.FILE_TYPE_PM; // } // // @Nullable // @Override // public Icon getIcon() { // return PerlIcons.LANGUAGE; // } // } // Path: src/com/intellij/perlplugin/extensions/PerlFileTypeFactory.java import com.intellij.openapi.fileTypes.FileTypeConsumer; import com.intellij.openapi.fileTypes.FileTypeFactory; import com.intellij.perlplugin.language.Constants; import com.intellij.perlplugin.language.PerlFileType; import org.jetbrains.annotations.NotNull; package com.intellij.perlplugin.extensions; public class PerlFileTypeFactory extends FileTypeFactory { @Override public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
fileTypeConsumer.consume(PerlFileType.INSTANCE, Constants.FILE_TYPE_PM);
eli1982/intellij-perl-plugin
src/com/intellij/perlplugin/extensions/PerlFileTypeFactory.java
// Path: src/com/intellij/perlplugin/language/Constants.java // public class Constants { // public static final String ID = "perl"; // public static final String LANGUAGE_NAME = "Perl"; // public static final String FILE_TYPE_PM = "pm"; // public static final String FILE_TYPE_PL = "pl"; // public static final String PM_EXTENSION = ".pm"; // public static final String PL_EXTENSION = ".pl"; // public static final String FILE_NAME = "Perl file"; // public static final String DESCRIPTION = "Perl language file"; // } // // Path: src/com/intellij/perlplugin/language/PerlFileType.java // public class PerlFileType extends LanguageFileType { // public static final PerlFileType INSTANCE = new PerlFileType(); // // private PerlFileType() { // super(PerlLanguage.INSTANCE); // } // // @NotNull // @Override // public String getName() { // return Constants.FILE_NAME; // } // // @NotNull // @Override // public String getDescription() { // return Constants.DESCRIPTION; // } // // @NotNull // @Override // public String getDefaultExtension() { // return Constants.FILE_TYPE_PM; // } // // @Nullable // @Override // public Icon getIcon() { // return PerlIcons.LANGUAGE; // } // }
import com.intellij.openapi.fileTypes.FileTypeConsumer; import com.intellij.openapi.fileTypes.FileTypeFactory; import com.intellij.perlplugin.language.Constants; import com.intellij.perlplugin.language.PerlFileType; import org.jetbrains.annotations.NotNull;
package com.intellij.perlplugin.extensions; public class PerlFileTypeFactory extends FileTypeFactory { @Override public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
// Path: src/com/intellij/perlplugin/language/Constants.java // public class Constants { // public static final String ID = "perl"; // public static final String LANGUAGE_NAME = "Perl"; // public static final String FILE_TYPE_PM = "pm"; // public static final String FILE_TYPE_PL = "pl"; // public static final String PM_EXTENSION = ".pm"; // public static final String PL_EXTENSION = ".pl"; // public static final String FILE_NAME = "Perl file"; // public static final String DESCRIPTION = "Perl language file"; // } // // Path: src/com/intellij/perlplugin/language/PerlFileType.java // public class PerlFileType extends LanguageFileType { // public static final PerlFileType INSTANCE = new PerlFileType(); // // private PerlFileType() { // super(PerlLanguage.INSTANCE); // } // // @NotNull // @Override // public String getName() { // return Constants.FILE_NAME; // } // // @NotNull // @Override // public String getDescription() { // return Constants.DESCRIPTION; // } // // @NotNull // @Override // public String getDefaultExtension() { // return Constants.FILE_TYPE_PM; // } // // @Nullable // @Override // public Icon getIcon() { // return PerlIcons.LANGUAGE; // } // } // Path: src/com/intellij/perlplugin/extensions/PerlFileTypeFactory.java import com.intellij.openapi.fileTypes.FileTypeConsumer; import com.intellij.openapi.fileTypes.FileTypeFactory; import com.intellij.perlplugin.language.Constants; import com.intellij.perlplugin.language.PerlFileType; import org.jetbrains.annotations.NotNull; package com.intellij.perlplugin.extensions; public class PerlFileTypeFactory extends FileTypeFactory { @Override public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
fileTypeConsumer.consume(PerlFileType.INSTANCE, Constants.FILE_TYPE_PM);
eli1982/intellij-perl-plugin
src/com/intellij/perlplugin/actions/NewFileAction.java
// Path: src/com/intellij/perlplugin/language/Constants.java // public class Constants { // public static final String ID = "perl"; // public static final String LANGUAGE_NAME = "Perl"; // public static final String FILE_TYPE_PM = "pm"; // public static final String FILE_TYPE_PL = "pl"; // public static final String PM_EXTENSION = ".pm"; // public static final String PL_EXTENSION = ".pl"; // public static final String FILE_NAME = "Perl file"; // public static final String DESCRIPTION = "Perl language file"; // } // // Path: src/com/intellij/perlplugin/language/PerlIcons.java // public class PerlIcons { // public static final Icon LANGUAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_16x16.png"); // public static final Icon LANGUAGE_32 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_32x32.png"); // public static final Icon LANGUAGE_256 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_256x256.png"); // public static final Icon PACKAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/package_16x16.png"); // public static final Icon SUBROUTINE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon CONSTRUCTOR = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon VARIABLE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/variable_16x16.png"); // }
import com.intellij.ide.IdeBundle; import com.intellij.ide.actions.CreateFileAction; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Messages; import com.intellij.perlplugin.language.Constants; import com.intellij.perlplugin.language.PerlIcons; import com.intellij.psi.PsiDirectory; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NotNull;
package com.intellij.perlplugin.actions; /** * Created by ELI-HOME on 22-Feb-15. */ public class NewFileAction extends CreateFileAction { @NotNull @Override protected PsiElement[] invokeDialog(Project project, PsiDirectory directory) { final CreateFileAction.MyValidator validator = new CreateFileAction.MyValidator(project, directory){ @Override public boolean checkInput(String inputString) {
// Path: src/com/intellij/perlplugin/language/Constants.java // public class Constants { // public static final String ID = "perl"; // public static final String LANGUAGE_NAME = "Perl"; // public static final String FILE_TYPE_PM = "pm"; // public static final String FILE_TYPE_PL = "pl"; // public static final String PM_EXTENSION = ".pm"; // public static final String PL_EXTENSION = ".pl"; // public static final String FILE_NAME = "Perl file"; // public static final String DESCRIPTION = "Perl language file"; // } // // Path: src/com/intellij/perlplugin/language/PerlIcons.java // public class PerlIcons { // public static final Icon LANGUAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_16x16.png"); // public static final Icon LANGUAGE_32 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_32x32.png"); // public static final Icon LANGUAGE_256 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_256x256.png"); // public static final Icon PACKAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/package_16x16.png"); // public static final Icon SUBROUTINE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon CONSTRUCTOR = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon VARIABLE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/variable_16x16.png"); // } // Path: src/com/intellij/perlplugin/actions/NewFileAction.java import com.intellij.ide.IdeBundle; import com.intellij.ide.actions.CreateFileAction; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Messages; import com.intellij.perlplugin.language.Constants; import com.intellij.perlplugin.language.PerlIcons; import com.intellij.psi.PsiDirectory; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NotNull; package com.intellij.perlplugin.actions; /** * Created by ELI-HOME on 22-Feb-15. */ public class NewFileAction extends CreateFileAction { @NotNull @Override protected PsiElement[] invokeDialog(Project project, PsiDirectory directory) { final CreateFileAction.MyValidator validator = new CreateFileAction.MyValidator(project, directory){ @Override public boolean checkInput(String inputString) {
if(!inputString.endsWith(Constants.PM_EXTENSION) && !inputString.endsWith(Constants.PL_EXTENSION)){
eli1982/intellij-perl-plugin
src/com/intellij/perlplugin/actions/NewFileAction.java
// Path: src/com/intellij/perlplugin/language/Constants.java // public class Constants { // public static final String ID = "perl"; // public static final String LANGUAGE_NAME = "Perl"; // public static final String FILE_TYPE_PM = "pm"; // public static final String FILE_TYPE_PL = "pl"; // public static final String PM_EXTENSION = ".pm"; // public static final String PL_EXTENSION = ".pl"; // public static final String FILE_NAME = "Perl file"; // public static final String DESCRIPTION = "Perl language file"; // } // // Path: src/com/intellij/perlplugin/language/PerlIcons.java // public class PerlIcons { // public static final Icon LANGUAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_16x16.png"); // public static final Icon LANGUAGE_32 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_32x32.png"); // public static final Icon LANGUAGE_256 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_256x256.png"); // public static final Icon PACKAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/package_16x16.png"); // public static final Icon SUBROUTINE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon CONSTRUCTOR = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon VARIABLE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/variable_16x16.png"); // }
import com.intellij.ide.IdeBundle; import com.intellij.ide.actions.CreateFileAction; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Messages; import com.intellij.perlplugin.language.Constants; import com.intellij.perlplugin.language.PerlIcons; import com.intellij.psi.PsiDirectory; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NotNull;
package com.intellij.perlplugin.actions; /** * Created by ELI-HOME on 22-Feb-15. */ public class NewFileAction extends CreateFileAction { @NotNull @Override protected PsiElement[] invokeDialog(Project project, PsiDirectory directory) { final CreateFileAction.MyValidator validator = new CreateFileAction.MyValidator(project, directory){ @Override public boolean checkInput(String inputString) { if(!inputString.endsWith(Constants.PM_EXTENSION) && !inputString.endsWith(Constants.PL_EXTENSION)){ return false; } return super.checkInput(inputString); } };
// Path: src/com/intellij/perlplugin/language/Constants.java // public class Constants { // public static final String ID = "perl"; // public static final String LANGUAGE_NAME = "Perl"; // public static final String FILE_TYPE_PM = "pm"; // public static final String FILE_TYPE_PL = "pl"; // public static final String PM_EXTENSION = ".pm"; // public static final String PL_EXTENSION = ".pl"; // public static final String FILE_NAME = "Perl file"; // public static final String DESCRIPTION = "Perl language file"; // } // // Path: src/com/intellij/perlplugin/language/PerlIcons.java // public class PerlIcons { // public static final Icon LANGUAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_16x16.png"); // public static final Icon LANGUAGE_32 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_32x32.png"); // public static final Icon LANGUAGE_256 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_256x256.png"); // public static final Icon PACKAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/package_16x16.png"); // public static final Icon SUBROUTINE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon CONSTRUCTOR = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon VARIABLE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/variable_16x16.png"); // } // Path: src/com/intellij/perlplugin/actions/NewFileAction.java import com.intellij.ide.IdeBundle; import com.intellij.ide.actions.CreateFileAction; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Messages; import com.intellij.perlplugin.language.Constants; import com.intellij.perlplugin.language.PerlIcons; import com.intellij.psi.PsiDirectory; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NotNull; package com.intellij.perlplugin.actions; /** * Created by ELI-HOME on 22-Feb-15. */ public class NewFileAction extends CreateFileAction { @NotNull @Override protected PsiElement[] invokeDialog(Project project, PsiDirectory directory) { final CreateFileAction.MyValidator validator = new CreateFileAction.MyValidator(project, directory){ @Override public boolean checkInput(String inputString) { if(!inputString.endsWith(Constants.PM_EXTENSION) && !inputString.endsWith(Constants.PL_EXTENSION)){ return false; } return super.checkInput(inputString); } };
Messages.showInputDialog(project, IdeBundle.message("prompt.enter.new.file.name", new Object[0]) + " (must end with pl/pm)", IdeBundle.message("title.new.file", new Object[0]), PerlIcons.LANGUAGE, null, validator);
eli1982/intellij-perl-plugin
src/com/intellij/perlplugin/psi/impl/PerlPropertyImpl.java
// Path: src/com/intellij/perlplugin/psi/PerlPsiImplUtil.java // public class PerlPsiImplUtil { // public static String getKey(PerlProperty element) { // ASTNode keyNode = element.getNode().findChildByType(PerlTypes.KEY); // if (keyNode != null) { // return keyNode.getText(); // } else { // return null; // } // } // // public static String getValue(PerlProperty element) { // ASTNode valueNode = element.getNode().findChildByType(PerlTypes.VALUE); // if (valueNode != null) { // return valueNode.getText(); // } else { // return null; // } // } // // public static String getName(PerlProperty element) { // return getKey(element); // } // // public static PsiElement setName(PerlProperty element, String newName) { // ASTNode keyNode = element.getNode().findChildByType(PerlTypes.KEY); // if (keyNode != null) { // // PerlProperty property = PerlElementFactory.createProperty(element.getProject(), newName); // ASTNode newKeyNode = property.getFirstChild().getNode(); // element.getNode().replaceChild(keyNode, newKeyNode); // } // return element; // } // // public static PsiElement getNameIdentifier(PerlProperty element) { // ASTNode keyNode = element.getNode().findChildByType(PerlTypes.KEY); // if (keyNode != null) { // return keyNode.getPsi(); // } else { // return null; // } // } // // public static ItemPresentation getPresentation(final PerlProperty element) { // return new ItemPresentation() { // @Nullable // @Override // public String getPresentableText() { // return element.getKey(); // } // // @Nullable // @Override // public String getLocationString() { // return element.getContainingFile().getName(); // } // // @Nullable // @Override // public Icon getIcon(boolean unused) { // return PerlIcons.LANGUAGE; // } // }; // } // // }
import com.intellij.extapi.psi.ASTWrapperPsiElement; import com.intellij.lang.ASTNode; import com.intellij.navigation.ItemPresentation; import com.intellij.openapi.util.TextRange; import com.intellij.perlplugin.psi.PerlPsiImplUtil; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElementVisitor; import com.intellij.psi.PsiReference; import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable;
// This is a generated file. Not intended for manual editing. package com.intellij.perlplugin.psi.impl; public class PerlPropertyImpl extends ASTWrapperPsiElement implements PerlProperty, PsiReference { public PerlPropertyImpl(ASTNode node) { super(node); } public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof PerlVisitor) ((PerlVisitor) visitor).visitProperty(this); else super.accept(visitor); } @Override public PsiReference getReference() { return super.getReference(); } @NotNull @Override public PsiReference[] getReferences() { return super.getReferences(); } public String getKey() {
// Path: src/com/intellij/perlplugin/psi/PerlPsiImplUtil.java // public class PerlPsiImplUtil { // public static String getKey(PerlProperty element) { // ASTNode keyNode = element.getNode().findChildByType(PerlTypes.KEY); // if (keyNode != null) { // return keyNode.getText(); // } else { // return null; // } // } // // public static String getValue(PerlProperty element) { // ASTNode valueNode = element.getNode().findChildByType(PerlTypes.VALUE); // if (valueNode != null) { // return valueNode.getText(); // } else { // return null; // } // } // // public static String getName(PerlProperty element) { // return getKey(element); // } // // public static PsiElement setName(PerlProperty element, String newName) { // ASTNode keyNode = element.getNode().findChildByType(PerlTypes.KEY); // if (keyNode != null) { // // PerlProperty property = PerlElementFactory.createProperty(element.getProject(), newName); // ASTNode newKeyNode = property.getFirstChild().getNode(); // element.getNode().replaceChild(keyNode, newKeyNode); // } // return element; // } // // public static PsiElement getNameIdentifier(PerlProperty element) { // ASTNode keyNode = element.getNode().findChildByType(PerlTypes.KEY); // if (keyNode != null) { // return keyNode.getPsi(); // } else { // return null; // } // } // // public static ItemPresentation getPresentation(final PerlProperty element) { // return new ItemPresentation() { // @Nullable // @Override // public String getPresentableText() { // return element.getKey(); // } // // @Nullable // @Override // public String getLocationString() { // return element.getContainingFile().getName(); // } // // @Nullable // @Override // public Icon getIcon(boolean unused) { // return PerlIcons.LANGUAGE; // } // }; // } // // } // Path: src/com/intellij/perlplugin/psi/impl/PerlPropertyImpl.java import com.intellij.extapi.psi.ASTWrapperPsiElement; import com.intellij.lang.ASTNode; import com.intellij.navigation.ItemPresentation; import com.intellij.openapi.util.TextRange; import com.intellij.perlplugin.psi.PerlPsiImplUtil; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElementVisitor; import com.intellij.psi.PsiReference; import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; // This is a generated file. Not intended for manual editing. package com.intellij.perlplugin.psi.impl; public class PerlPropertyImpl extends ASTWrapperPsiElement implements PerlProperty, PsiReference { public PerlPropertyImpl(ASTNode node) { super(node); } public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof PerlVisitor) ((PerlVisitor) visitor).visitProperty(this); else super.accept(visitor); } @Override public PsiReference getReference() { return super.getReference(); } @NotNull @Override public PsiReference[] getReferences() { return super.getReferences(); } public String getKey() {
return PerlPsiImplUtil.getKey(this);
eli1982/intellij-perl-plugin
src/com/intellij/perlplugin/Utils.java
// Path: src/com/intellij/perlplugin/filters/FileFilter.java // public class FileFilter implements FilenameFilter { // @Override // public boolean accept(File file, String path) { // try { // return (Utils.isValidateExtension(path) || (new File(file.getCanonicalPath() + "/" + path).isDirectory()) && file.exists()); // } catch (IOException e) { // return false; // } // } // } // // Path: src/com/intellij/perlplugin/language/Constants.java // public class Constants { // public static final String ID = "perl"; // public static final String LANGUAGE_NAME = "Perl"; // public static final String FILE_TYPE_PM = "pm"; // public static final String FILE_TYPE_PL = "pl"; // public static final String PM_EXTENSION = ".pm"; // public static final String PL_EXTENSION = ".pl"; // public static final String FILE_NAME = "Perl file"; // public static final String DESCRIPTION = "Perl language file"; // }
import com.intellij.perlplugin.filters.FileFilter; import com.intellij.perlplugin.language.Constants; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Locale; import java.util.regex.Matcher; import java.util.regex.Pattern;
package com.intellij.perlplugin; /** * Created by eli on 27-11-14. */ public class Utils { public static boolean verbose = false; public static boolean debug = verbose || false; protected static OSType detectedOS; public enum OSType { Windows, MacOS, Linux, os, Other } ; public static void alert(String str) { System.out.println("ERROR: " + str);//TODO:: Log an exception properly } public static void print(Object obj) { System.out.println(obj); } public static String readFile(String filePath) { try { return new String(Files.readAllBytes(Paths.get(filePath))); } catch (Exception e) { Utils.alert(e.getMessage()); } return ""; } public static Matcher applyRegex(String regex, String content) { return applyRegex(regex, content, 0); } public static Matcher applyRegex(String regex, String content, int flags) { Pattern pattern = Pattern.compile(regex, flags); return pattern.matcher(content); }
// Path: src/com/intellij/perlplugin/filters/FileFilter.java // public class FileFilter implements FilenameFilter { // @Override // public boolean accept(File file, String path) { // try { // return (Utils.isValidateExtension(path) || (new File(file.getCanonicalPath() + "/" + path).isDirectory()) && file.exists()); // } catch (IOException e) { // return false; // } // } // } // // Path: src/com/intellij/perlplugin/language/Constants.java // public class Constants { // public static final String ID = "perl"; // public static final String LANGUAGE_NAME = "Perl"; // public static final String FILE_TYPE_PM = "pm"; // public static final String FILE_TYPE_PL = "pl"; // public static final String PM_EXTENSION = ".pm"; // public static final String PL_EXTENSION = ".pl"; // public static final String FILE_NAME = "Perl file"; // public static final String DESCRIPTION = "Perl language file"; // } // Path: src/com/intellij/perlplugin/Utils.java import com.intellij.perlplugin.filters.FileFilter; import com.intellij.perlplugin.language.Constants; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Locale; import java.util.regex.Matcher; import java.util.regex.Pattern; package com.intellij.perlplugin; /** * Created by eli on 27-11-14. */ public class Utils { public static boolean verbose = false; public static boolean debug = verbose || false; protected static OSType detectedOS; public enum OSType { Windows, MacOS, Linux, os, Other } ; public static void alert(String str) { System.out.println("ERROR: " + str);//TODO:: Log an exception properly } public static void print(Object obj) { System.out.println(obj); } public static String readFile(String filePath) { try { return new String(Files.readAllBytes(Paths.get(filePath))); } catch (Exception e) { Utils.alert(e.getMessage()); } return ""; } public static Matcher applyRegex(String regex, String content) { return applyRegex(regex, content, 0); } public static Matcher applyRegex(String regex, String content, int flags) { Pattern pattern = Pattern.compile(regex, flags); return pattern.matcher(content); }
public static int getFilesCount(File file, FileFilter fileFilter) {
eli1982/intellij-perl-plugin
src/com/intellij/perlplugin/Utils.java
// Path: src/com/intellij/perlplugin/filters/FileFilter.java // public class FileFilter implements FilenameFilter { // @Override // public boolean accept(File file, String path) { // try { // return (Utils.isValidateExtension(path) || (new File(file.getCanonicalPath() + "/" + path).isDirectory()) && file.exists()); // } catch (IOException e) { // return false; // } // } // } // // Path: src/com/intellij/perlplugin/language/Constants.java // public class Constants { // public static final String ID = "perl"; // public static final String LANGUAGE_NAME = "Perl"; // public static final String FILE_TYPE_PM = "pm"; // public static final String FILE_TYPE_PL = "pl"; // public static final String PM_EXTENSION = ".pm"; // public static final String PL_EXTENSION = ".pl"; // public static final String FILE_NAME = "Perl file"; // public static final String DESCRIPTION = "Perl language file"; // }
import com.intellij.perlplugin.filters.FileFilter; import com.intellij.perlplugin.language.Constants; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Locale; import java.util.regex.Matcher; import java.util.regex.Pattern;
try { return new String(Files.readAllBytes(Paths.get(filePath))); } catch (Exception e) { Utils.alert(e.getMessage()); } return ""; } public static Matcher applyRegex(String regex, String content) { return applyRegex(regex, content, 0); } public static Matcher applyRegex(String regex, String content, int flags) { Pattern pattern = Pattern.compile(regex, flags); return pattern.matcher(content); } public static int getFilesCount(File file, FileFilter fileFilter) { File[] files = file.listFiles(fileFilter); int count = 0; for (File f : files) if (f.isDirectory()) count += getFilesCount(f, fileFilter); else count++; return count; } public static boolean isValidateExtension(String path) {
// Path: src/com/intellij/perlplugin/filters/FileFilter.java // public class FileFilter implements FilenameFilter { // @Override // public boolean accept(File file, String path) { // try { // return (Utils.isValidateExtension(path) || (new File(file.getCanonicalPath() + "/" + path).isDirectory()) && file.exists()); // } catch (IOException e) { // return false; // } // } // } // // Path: src/com/intellij/perlplugin/language/Constants.java // public class Constants { // public static final String ID = "perl"; // public static final String LANGUAGE_NAME = "Perl"; // public static final String FILE_TYPE_PM = "pm"; // public static final String FILE_TYPE_PL = "pl"; // public static final String PM_EXTENSION = ".pm"; // public static final String PL_EXTENSION = ".pl"; // public static final String FILE_NAME = "Perl file"; // public static final String DESCRIPTION = "Perl language file"; // } // Path: src/com/intellij/perlplugin/Utils.java import com.intellij.perlplugin.filters.FileFilter; import com.intellij.perlplugin.language.Constants; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Locale; import java.util.regex.Matcher; import java.util.regex.Pattern; try { return new String(Files.readAllBytes(Paths.get(filePath))); } catch (Exception e) { Utils.alert(e.getMessage()); } return ""; } public static Matcher applyRegex(String regex, String content) { return applyRegex(regex, content, 0); } public static Matcher applyRegex(String regex, String content, int flags) { Pattern pattern = Pattern.compile(regex, flags); return pattern.matcher(content); } public static int getFilesCount(File file, FileFilter fileFilter) { File[] files = file.listFiles(fileFilter); int count = 0; for (File f : files) if (f.isDirectory()) count += getFilesCount(f, fileFilter); else count++; return count; } public static boolean isValidateExtension(String path) {
return path.endsWith(Constants.FILE_TYPE_PM) || path.endsWith(Constants.FILE_TYPE_PL);
eli1982/intellij-perl-plugin
src/com/intellij/perlplugin/extensions/run/configuration/PerlConfigurationType.java
// Path: src/com/intellij/perlplugin/language/Constants.java // public class Constants { // public static final String ID = "perl"; // public static final String LANGUAGE_NAME = "Perl"; // public static final String FILE_TYPE_PM = "pm"; // public static final String FILE_TYPE_PL = "pl"; // public static final String PM_EXTENSION = ".pm"; // public static final String PL_EXTENSION = ".pl"; // public static final String FILE_NAME = "Perl file"; // public static final String DESCRIPTION = "Perl language file"; // } // // Path: src/com/intellij/perlplugin/language/PerlIcons.java // public class PerlIcons { // public static final Icon LANGUAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_16x16.png"); // public static final Icon LANGUAGE_32 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_32x32.png"); // public static final Icon LANGUAGE_256 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_256x256.png"); // public static final Icon PACKAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/package_16x16.png"); // public static final Icon SUBROUTINE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon CONSTRUCTOR = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon VARIABLE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/variable_16x16.png"); // }
import com.intellij.execution.configurations.ConfigurationTypeBase; import com.intellij.perlplugin.language.Constants; import com.intellij.perlplugin.language.PerlIcons;
package com.intellij.perlplugin.extensions.run.configuration; /** * Created by ELI-HOME on 20-May-15. * configuration type */ public class PerlConfigurationType extends ConfigurationTypeBase { protected PerlConfigurationType() {
// Path: src/com/intellij/perlplugin/language/Constants.java // public class Constants { // public static final String ID = "perl"; // public static final String LANGUAGE_NAME = "Perl"; // public static final String FILE_TYPE_PM = "pm"; // public static final String FILE_TYPE_PL = "pl"; // public static final String PM_EXTENSION = ".pm"; // public static final String PL_EXTENSION = ".pl"; // public static final String FILE_NAME = "Perl file"; // public static final String DESCRIPTION = "Perl language file"; // } // // Path: src/com/intellij/perlplugin/language/PerlIcons.java // public class PerlIcons { // public static final Icon LANGUAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_16x16.png"); // public static final Icon LANGUAGE_32 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_32x32.png"); // public static final Icon LANGUAGE_256 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_256x256.png"); // public static final Icon PACKAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/package_16x16.png"); // public static final Icon SUBROUTINE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon CONSTRUCTOR = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon VARIABLE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/variable_16x16.png"); // } // Path: src/com/intellij/perlplugin/extensions/run/configuration/PerlConfigurationType.java import com.intellij.execution.configurations.ConfigurationTypeBase; import com.intellij.perlplugin.language.Constants; import com.intellij.perlplugin.language.PerlIcons; package com.intellij.perlplugin.extensions.run.configuration; /** * Created by ELI-HOME on 20-May-15. * configuration type */ public class PerlConfigurationType extends ConfigurationTypeBase { protected PerlConfigurationType() {
super(Constants.ID, Constants.LANGUAGE_NAME, Constants.DESCRIPTION, PerlIcons.LANGUAGE);
eli1982/intellij-perl-plugin
src/com/intellij/perlplugin/extensions/run/configuration/PerlConfigurationType.java
// Path: src/com/intellij/perlplugin/language/Constants.java // public class Constants { // public static final String ID = "perl"; // public static final String LANGUAGE_NAME = "Perl"; // public static final String FILE_TYPE_PM = "pm"; // public static final String FILE_TYPE_PL = "pl"; // public static final String PM_EXTENSION = ".pm"; // public static final String PL_EXTENSION = ".pl"; // public static final String FILE_NAME = "Perl file"; // public static final String DESCRIPTION = "Perl language file"; // } // // Path: src/com/intellij/perlplugin/language/PerlIcons.java // public class PerlIcons { // public static final Icon LANGUAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_16x16.png"); // public static final Icon LANGUAGE_32 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_32x32.png"); // public static final Icon LANGUAGE_256 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_256x256.png"); // public static final Icon PACKAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/package_16x16.png"); // public static final Icon SUBROUTINE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon CONSTRUCTOR = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon VARIABLE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/variable_16x16.png"); // }
import com.intellij.execution.configurations.ConfigurationTypeBase; import com.intellij.perlplugin.language.Constants; import com.intellij.perlplugin.language.PerlIcons;
package com.intellij.perlplugin.extensions.run.configuration; /** * Created by ELI-HOME on 20-May-15. * configuration type */ public class PerlConfigurationType extends ConfigurationTypeBase { protected PerlConfigurationType() {
// Path: src/com/intellij/perlplugin/language/Constants.java // public class Constants { // public static final String ID = "perl"; // public static final String LANGUAGE_NAME = "Perl"; // public static final String FILE_TYPE_PM = "pm"; // public static final String FILE_TYPE_PL = "pl"; // public static final String PM_EXTENSION = ".pm"; // public static final String PL_EXTENSION = ".pl"; // public static final String FILE_NAME = "Perl file"; // public static final String DESCRIPTION = "Perl language file"; // } // // Path: src/com/intellij/perlplugin/language/PerlIcons.java // public class PerlIcons { // public static final Icon LANGUAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_16x16.png"); // public static final Icon LANGUAGE_32 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_32x32.png"); // public static final Icon LANGUAGE_256 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_256x256.png"); // public static final Icon PACKAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/package_16x16.png"); // public static final Icon SUBROUTINE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon CONSTRUCTOR = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon VARIABLE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/variable_16x16.png"); // } // Path: src/com/intellij/perlplugin/extensions/run/configuration/PerlConfigurationType.java import com.intellij.execution.configurations.ConfigurationTypeBase; import com.intellij.perlplugin.language.Constants; import com.intellij.perlplugin.language.PerlIcons; package com.intellij.perlplugin.extensions.run.configuration; /** * Created by ELI-HOME on 20-May-15. * configuration type */ public class PerlConfigurationType extends ConfigurationTypeBase { protected PerlConfigurationType() {
super(Constants.ID, Constants.LANGUAGE_NAME, Constants.DESCRIPTION, PerlIcons.LANGUAGE);
eli1982/intellij-perl-plugin
src/com/intellij/perlplugin/extensions/module/builder/PerlModuleType.java
// Path: src/com/intellij/perlplugin/language/PerlIcons.java // public class PerlIcons { // public static final Icon LANGUAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_16x16.png"); // public static final Icon LANGUAGE_32 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_32x32.png"); // public static final Icon LANGUAGE_256 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_256x256.png"); // public static final Icon PACKAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/package_16x16.png"); // public static final Icon SUBROUTINE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon CONSTRUCTOR = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon VARIABLE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/variable_16x16.png"); // }
import com.intellij.icons.AllIcons.Nodes; import com.intellij.ide.util.projectWizard.ModuleBuilder; import com.intellij.ide.util.projectWizard.ModuleWizardStep; import com.intellij.ide.util.projectWizard.ProjectWizardStepFactory; import com.intellij.ide.util.projectWizard.SettingsStep; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleType; import com.intellij.openapi.module.ModuleTypeManager; import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.projectRoots.SdkTypeId; import com.intellij.openapi.roots.ModuleRootManager; import com.intellij.openapi.util.Condition; import com.intellij.perlplugin.language.PerlIcons; import com.intellij.psi.JavaPsiFacade; import javax.swing.Icon; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jps.model.java.JavaModuleSourceRootTypes;
public PerlModuleType() { this(MODULE_TYPE); } protected PerlModuleType(@NonNls String id) { super(id); } @NotNull public PerlModuleBuilder createModuleBuilder() { return new PerlModuleBuilder(); } @NotNull public String getName() { String var10000 = MODULE_NAME; if(MODULE_NAME == null) { throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[]{"com/intellij/perlplugin/extensions/module/builder/PerlModuleType", "getName"})); } else { return var10000; } } @NotNull public String getDescription() { return "Perl Module"; } public Icon getBigIcon() {
// Path: src/com/intellij/perlplugin/language/PerlIcons.java // public class PerlIcons { // public static final Icon LANGUAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_16x16.png"); // public static final Icon LANGUAGE_32 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_32x32.png"); // public static final Icon LANGUAGE_256 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_256x256.png"); // public static final Icon PACKAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/package_16x16.png"); // public static final Icon SUBROUTINE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon CONSTRUCTOR = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon VARIABLE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/variable_16x16.png"); // } // Path: src/com/intellij/perlplugin/extensions/module/builder/PerlModuleType.java import com.intellij.icons.AllIcons.Nodes; import com.intellij.ide.util.projectWizard.ModuleBuilder; import com.intellij.ide.util.projectWizard.ModuleWizardStep; import com.intellij.ide.util.projectWizard.ProjectWizardStepFactory; import com.intellij.ide.util.projectWizard.SettingsStep; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleType; import com.intellij.openapi.module.ModuleTypeManager; import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.projectRoots.SdkTypeId; import com.intellij.openapi.roots.ModuleRootManager; import com.intellij.openapi.util.Condition; import com.intellij.perlplugin.language.PerlIcons; import com.intellij.psi.JavaPsiFacade; import javax.swing.Icon; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jps.model.java.JavaModuleSourceRootTypes; public PerlModuleType() { this(MODULE_TYPE); } protected PerlModuleType(@NonNls String id) { super(id); } @NotNull public PerlModuleBuilder createModuleBuilder() { return new PerlModuleBuilder(); } @NotNull public String getName() { String var10000 = MODULE_NAME; if(MODULE_NAME == null) { throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[]{"com/intellij/perlplugin/extensions/module/builder/PerlModuleType", "getName"})); } else { return var10000; } } @NotNull public String getDescription() { return "Perl Module"; } public Icon getBigIcon() {
return PerlIcons.LANGUAGE_32;
eli1982/intellij-perl-plugin
src/com/intellij/perlplugin/extensions/run/configuration/PerlExecutor.java
// Path: src/com/intellij/perlplugin/language/Constants.java // public class Constants { // public static final String ID = "perl"; // public static final String LANGUAGE_NAME = "Perl"; // public static final String FILE_TYPE_PM = "pm"; // public static final String FILE_TYPE_PL = "pl"; // public static final String PM_EXTENSION = ".pm"; // public static final String PL_EXTENSION = ".pl"; // public static final String FILE_NAME = "Perl file"; // public static final String DESCRIPTION = "Perl language file"; // } // // Path: src/com/intellij/perlplugin/language/PerlIcons.java // public class PerlIcons { // public static final Icon LANGUAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_16x16.png"); // public static final Icon LANGUAGE_32 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_32x32.png"); // public static final Icon LANGUAGE_256 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_256x256.png"); // public static final Icon PACKAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/package_16x16.png"); // public static final Icon SUBROUTINE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon CONSTRUCTOR = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon VARIABLE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/variable_16x16.png"); // }
import com.intellij.execution.Executor; import com.intellij.perlplugin.language.Constants; import com.intellij.perlplugin.language.PerlIcons; import org.jetbrains.annotations.NotNull; import javax.swing.*;
package com.intellij.perlplugin.extensions.run.configuration; /** * Created by ELI-HOME on 22-May-15. * Perl Executor for more info: * https://confluence.jetbrains.com/display/IDEADEV/Run+Configurations */ public class PerlExecutor extends Executor { @Override public String getToolWindowId() { return "Perl Tool Window"; } @Override public Icon getToolWindowIcon() {
// Path: src/com/intellij/perlplugin/language/Constants.java // public class Constants { // public static final String ID = "perl"; // public static final String LANGUAGE_NAME = "Perl"; // public static final String FILE_TYPE_PM = "pm"; // public static final String FILE_TYPE_PL = "pl"; // public static final String PM_EXTENSION = ".pm"; // public static final String PL_EXTENSION = ".pl"; // public static final String FILE_NAME = "Perl file"; // public static final String DESCRIPTION = "Perl language file"; // } // // Path: src/com/intellij/perlplugin/language/PerlIcons.java // public class PerlIcons { // public static final Icon LANGUAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_16x16.png"); // public static final Icon LANGUAGE_32 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_32x32.png"); // public static final Icon LANGUAGE_256 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_256x256.png"); // public static final Icon PACKAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/package_16x16.png"); // public static final Icon SUBROUTINE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon CONSTRUCTOR = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon VARIABLE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/variable_16x16.png"); // } // Path: src/com/intellij/perlplugin/extensions/run/configuration/PerlExecutor.java import com.intellij.execution.Executor; import com.intellij.perlplugin.language.Constants; import com.intellij.perlplugin.language.PerlIcons; import org.jetbrains.annotations.NotNull; import javax.swing.*; package com.intellij.perlplugin.extensions.run.configuration; /** * Created by ELI-HOME on 22-May-15. * Perl Executor for more info: * https://confluence.jetbrains.com/display/IDEADEV/Run+Configurations */ public class PerlExecutor extends Executor { @Override public String getToolWindowId() { return "Perl Tool Window"; } @Override public Icon getToolWindowIcon() {
return PerlIcons.LANGUAGE;
eli1982/intellij-perl-plugin
src/com/intellij/perlplugin/extensions/run/configuration/PerlExecutor.java
// Path: src/com/intellij/perlplugin/language/Constants.java // public class Constants { // public static final String ID = "perl"; // public static final String LANGUAGE_NAME = "Perl"; // public static final String FILE_TYPE_PM = "pm"; // public static final String FILE_TYPE_PL = "pl"; // public static final String PM_EXTENSION = ".pm"; // public static final String PL_EXTENSION = ".pl"; // public static final String FILE_NAME = "Perl file"; // public static final String DESCRIPTION = "Perl language file"; // } // // Path: src/com/intellij/perlplugin/language/PerlIcons.java // public class PerlIcons { // public static final Icon LANGUAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_16x16.png"); // public static final Icon LANGUAGE_32 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_32x32.png"); // public static final Icon LANGUAGE_256 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_256x256.png"); // public static final Icon PACKAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/package_16x16.png"); // public static final Icon SUBROUTINE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon CONSTRUCTOR = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon VARIABLE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/variable_16x16.png"); // }
import com.intellij.execution.Executor; import com.intellij.perlplugin.language.Constants; import com.intellij.perlplugin.language.PerlIcons; import org.jetbrains.annotations.NotNull; import javax.swing.*;
package com.intellij.perlplugin.extensions.run.configuration; /** * Created by ELI-HOME on 22-May-15. * Perl Executor for more info: * https://confluence.jetbrains.com/display/IDEADEV/Run+Configurations */ public class PerlExecutor extends Executor { @Override public String getToolWindowId() { return "Perl Tool Window"; } @Override public Icon getToolWindowIcon() { return PerlIcons.LANGUAGE; } @NotNull @Override public Icon getIcon() { return PerlIcons.LANGUAGE; } @Override public Icon getDisabledIcon() { return PerlIcons.PACKAGE; } @Override public String getDescription() {
// Path: src/com/intellij/perlplugin/language/Constants.java // public class Constants { // public static final String ID = "perl"; // public static final String LANGUAGE_NAME = "Perl"; // public static final String FILE_TYPE_PM = "pm"; // public static final String FILE_TYPE_PL = "pl"; // public static final String PM_EXTENSION = ".pm"; // public static final String PL_EXTENSION = ".pl"; // public static final String FILE_NAME = "Perl file"; // public static final String DESCRIPTION = "Perl language file"; // } // // Path: src/com/intellij/perlplugin/language/PerlIcons.java // public class PerlIcons { // public static final Icon LANGUAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_16x16.png"); // public static final Icon LANGUAGE_32 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_32x32.png"); // public static final Icon LANGUAGE_256 = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/icon_256x256.png"); // public static final Icon PACKAGE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/package_16x16.png"); // public static final Icon SUBROUTINE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon CONSTRUCTOR = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/subroutine_16x16.png"); // public static final Icon VARIABLE = IconLoader.getIcon("/com/intellij/perlplugin/resources/icons/variable_16x16.png"); // } // Path: src/com/intellij/perlplugin/extensions/run/configuration/PerlExecutor.java import com.intellij.execution.Executor; import com.intellij.perlplugin.language.Constants; import com.intellij.perlplugin.language.PerlIcons; import org.jetbrains.annotations.NotNull; import javax.swing.*; package com.intellij.perlplugin.extensions.run.configuration; /** * Created by ELI-HOME on 22-May-15. * Perl Executor for more info: * https://confluence.jetbrains.com/display/IDEADEV/Run+Configurations */ public class PerlExecutor extends Executor { @Override public String getToolWindowId() { return "Perl Tool Window"; } @Override public Icon getToolWindowIcon() { return PerlIcons.LANGUAGE; } @NotNull @Override public Icon getIcon() { return PerlIcons.LANGUAGE; } @Override public Icon getDisabledIcon() { return PerlIcons.PACKAGE; } @Override public String getDescription() {
return Constants.DESCRIPTION;
eli1982/intellij-perl-plugin
src/com/intellij/perlplugin/extensions/formatting/PerlFormattingModelBuilder.java
// Path: src/com/intellij/perlplugin/psi/PerlTypes.java // public interface PerlTypes { // // IElementType PROPERTY = new PerlElementType("PROPERTY"); // IElementType CRLF = new PerlTokenType("CRLF"); // IElementType KEY = new PerlTokenType("KEY"); // IElementType OPERATOR = new PerlTokenType("OPERATOR"); // IElementType BRACES = new PerlTokenType("BRACES"); // IElementType VALUE = new PerlTokenType("VALUE"); // IElementType WHITESPACE = new PerlTokenType("WHITESPACE"); // IElementType SUBROUTINE = new PerlTokenType("SUBROUTINE"); // IElementType PACKAGE = new PerlTokenType("PACKAGE"); // IElementType POINTER = new PerlTokenType("POINTER"); // IElementType LINE_COMMENT = new PerlTokenType("LINE_COMMENT"); // IElementType MARKUP = new PerlTokenType("MARKUP"); // IElementType LANG_VARIABLE = new PerlTokenType("LANG_VARIABLE"); // IElementType LANG_FUNCTION = new PerlTokenType("LANG_FUNCTION"); // IElementType LANG_SYNTAX = new PerlTokenType("LANG_SYNTAX"); // IElementType LANG_FILE_HANDLES = new PerlTokenType("LANG_FILE_HANDLES"); // IElementType ARGUMENTS = new PerlTokenType("ARGUMENTS"); // IElementType VARIABLE = new PerlTokenType("VARIABLE"); // IElementType HASH_KEY = new PerlTokenType("HASH_KEY"); // IElementType PREDICATE = new PerlTokenType("PREDICATE"); // // class Factory { // public static PsiElement createElement(ASTNode node) { // IElementType type = node.getElementType(); // // if (type == PROPERTY) { // return new PerlPropertyImpl(node); // // } // // throw new AssertionError("Unknown element type: " + type); // } // } // // }
import com.intellij.formatting.*; import com.intellij.lang.ASTNode; import com.intellij.openapi.util.TextRange; import com.intellij.perlplugin.psi.PerlTypes; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.psi.codeStyle.CodeStyleSettings; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable;
package com.intellij.perlplugin.extensions; public class PerlFormattingModelBuilder implements FormattingModelBuilder { @NotNull @Override public FormattingModel createModel(PsiElement element, CodeStyleSettings settings) { return FormattingModelProvider.createFormattingModelForPsiFile(element.getContainingFile(), new PerlBlock(element.getNode(), Wrap.createWrap(WrapType.NONE, false), Alignment.createAlignment(), createSpaceBuilder(settings)), settings); } private static SpacingBuilder createSpaceBuilder(CodeStyleSettings settings) { SpacingBuilder spacingBuilder = new SpacingBuilder(settings);
// Path: src/com/intellij/perlplugin/psi/PerlTypes.java // public interface PerlTypes { // // IElementType PROPERTY = new PerlElementType("PROPERTY"); // IElementType CRLF = new PerlTokenType("CRLF"); // IElementType KEY = new PerlTokenType("KEY"); // IElementType OPERATOR = new PerlTokenType("OPERATOR"); // IElementType BRACES = new PerlTokenType("BRACES"); // IElementType VALUE = new PerlTokenType("VALUE"); // IElementType WHITESPACE = new PerlTokenType("WHITESPACE"); // IElementType SUBROUTINE = new PerlTokenType("SUBROUTINE"); // IElementType PACKAGE = new PerlTokenType("PACKAGE"); // IElementType POINTER = new PerlTokenType("POINTER"); // IElementType LINE_COMMENT = new PerlTokenType("LINE_COMMENT"); // IElementType MARKUP = new PerlTokenType("MARKUP"); // IElementType LANG_VARIABLE = new PerlTokenType("LANG_VARIABLE"); // IElementType LANG_FUNCTION = new PerlTokenType("LANG_FUNCTION"); // IElementType LANG_SYNTAX = new PerlTokenType("LANG_SYNTAX"); // IElementType LANG_FILE_HANDLES = new PerlTokenType("LANG_FILE_HANDLES"); // IElementType ARGUMENTS = new PerlTokenType("ARGUMENTS"); // IElementType VARIABLE = new PerlTokenType("VARIABLE"); // IElementType HASH_KEY = new PerlTokenType("HASH_KEY"); // IElementType PREDICATE = new PerlTokenType("PREDICATE"); // // class Factory { // public static PsiElement createElement(ASTNode node) { // IElementType type = node.getElementType(); // // if (type == PROPERTY) { // return new PerlPropertyImpl(node); // // } // // throw new AssertionError("Unknown element type: " + type); // } // } // // } // Path: src/com/intellij/perlplugin/extensions/formatting/PerlFormattingModelBuilder.java import com.intellij.formatting.*; import com.intellij.lang.ASTNode; import com.intellij.openapi.util.TextRange; import com.intellij.perlplugin.psi.PerlTypes; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.psi.codeStyle.CodeStyleSettings; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; package com.intellij.perlplugin.extensions; public class PerlFormattingModelBuilder implements FormattingModelBuilder { @NotNull @Override public FormattingModel createModel(PsiElement element, CodeStyleSettings settings) { return FormattingModelProvider.createFormattingModelForPsiFile(element.getContainingFile(), new PerlBlock(element.getNode(), Wrap.createWrap(WrapType.NONE, false), Alignment.createAlignment(), createSpaceBuilder(settings)), settings); } private static SpacingBuilder createSpaceBuilder(CodeStyleSettings settings) { SpacingBuilder spacingBuilder = new SpacingBuilder(settings);
spacingBuilder.between(PerlTypes.LANG_SYNTAX, PerlTypes.VARIABLE).spaces(1);
eli1982/intellij-perl-plugin
src/com/intellij/perlplugin/extensions/run/configuration/PerlConfigurationFactory.java
// Path: src/com/intellij/perlplugin/extensions/run/configuration/ui/PerlSettingsEditor.java // public class PerlSettingsEditor extends SettingsEditor { // // @Override // protected void resetEditorFrom(Object o) { // //TODO::implement // } // // @Override // protected void applyEditorTo(Object o) throws ConfigurationException { // //TODO::implement // } // // @NotNull // @Override // protected JComponent createEditor() { // JPanel jPanel = new JPanel(); // return jPanel; // } // }
import com.intellij.execution.ExecutionException; import com.intellij.execution.Executor; import com.intellij.execution.configurations.*; import com.intellij.execution.runners.ExecutionEnvironment; import com.intellij.openapi.options.SettingsEditor; import com.intellij.openapi.project.Project; import com.intellij.perlplugin.extensions.run.configuration.ui.PerlSettingsEditor; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable;
package com.intellij.perlplugin.extensions.run.configuration; /** * Created by ELI-HOME on 22-May-15. */ public class PerlConfigurationFactory extends ConfigurationFactory { protected PerlConfigurationFactory(ConfigurationType type) { super(type); } @Override public RunConfiguration createTemplateConfiguration(Project project) { return new RunConfigurationBase(project,this,"Perl RunConfiguration Template") { @NotNull @Override public SettingsEditor<? extends RunConfiguration> getConfigurationEditor() {
// Path: src/com/intellij/perlplugin/extensions/run/configuration/ui/PerlSettingsEditor.java // public class PerlSettingsEditor extends SettingsEditor { // // @Override // protected void resetEditorFrom(Object o) { // //TODO::implement // } // // @Override // protected void applyEditorTo(Object o) throws ConfigurationException { // //TODO::implement // } // // @NotNull // @Override // protected JComponent createEditor() { // JPanel jPanel = new JPanel(); // return jPanel; // } // } // Path: src/com/intellij/perlplugin/extensions/run/configuration/PerlConfigurationFactory.java import com.intellij.execution.ExecutionException; import com.intellij.execution.Executor; import com.intellij.execution.configurations.*; import com.intellij.execution.runners.ExecutionEnvironment; import com.intellij.openapi.options.SettingsEditor; import com.intellij.openapi.project.Project; import com.intellij.perlplugin.extensions.run.configuration.ui.PerlSettingsEditor; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; package com.intellij.perlplugin.extensions.run.configuration; /** * Created by ELI-HOME on 22-May-15. */ public class PerlConfigurationFactory extends ConfigurationFactory { protected PerlConfigurationFactory(ConfigurationType type) { super(type); } @Override public RunConfiguration createTemplateConfiguration(Project project) { return new RunConfigurationBase(project,this,"Perl RunConfiguration Template") { @NotNull @Override public SettingsEditor<? extends RunConfiguration> getConfigurationEditor() {
return new PerlSettingsEditor();
eli1982/intellij-perl-plugin
src/com/intellij/perlplugin/extensions/syntax/highlighting/PerlSyntaxHighlighter.java
// Path: src/com/intellij/perlplugin/language/PerlLexerAdapter.java // public class PerlLexerAdapter extends FlexAdapter { // public PerlLexerAdapter() { // super(new _PerlLexer((Reader) null)); // } // } // // Path: src/com/intellij/perlplugin/psi/PerlTypes.java // public interface PerlTypes { // // IElementType PROPERTY = new PerlElementType("PROPERTY"); // IElementType CRLF = new PerlTokenType("CRLF"); // IElementType KEY = new PerlTokenType("KEY"); // IElementType OPERATOR = new PerlTokenType("OPERATOR"); // IElementType BRACES = new PerlTokenType("BRACES"); // IElementType VALUE = new PerlTokenType("VALUE"); // IElementType WHITESPACE = new PerlTokenType("WHITESPACE"); // IElementType SUBROUTINE = new PerlTokenType("SUBROUTINE"); // IElementType PACKAGE = new PerlTokenType("PACKAGE"); // IElementType POINTER = new PerlTokenType("POINTER"); // IElementType LINE_COMMENT = new PerlTokenType("LINE_COMMENT"); // IElementType MARKUP = new PerlTokenType("MARKUP"); // IElementType LANG_VARIABLE = new PerlTokenType("LANG_VARIABLE"); // IElementType LANG_FUNCTION = new PerlTokenType("LANG_FUNCTION"); // IElementType LANG_SYNTAX = new PerlTokenType("LANG_SYNTAX"); // IElementType LANG_FILE_HANDLES = new PerlTokenType("LANG_FILE_HANDLES"); // IElementType ARGUMENTS = new PerlTokenType("ARGUMENTS"); // IElementType VARIABLE = new PerlTokenType("VARIABLE"); // IElementType HASH_KEY = new PerlTokenType("HASH_KEY"); // IElementType PREDICATE = new PerlTokenType("PREDICATE"); // // class Factory { // public static PsiElement createElement(ASTNode node) { // IElementType type = node.getElementType(); // // if (type == PROPERTY) { // return new PerlPropertyImpl(node); // // } // // throw new AssertionError("Unknown element type: " + type); // } // } // // }
import com.intellij.lexer.Lexer; import com.intellij.openapi.editor.DefaultLanguageHighlighterColors; import com.intellij.openapi.editor.colors.TextAttributesKey; import com.intellij.openapi.editor.markup.TextAttributes; import com.intellij.openapi.fileTypes.SyntaxHighlighterBase; import com.intellij.perlplugin.language.PerlLexerAdapter; import com.intellij.perlplugin.psi.PerlTypes; import com.intellij.psi.TokenType; import com.intellij.psi.tree.IElementType; import org.jetbrains.annotations.NotNull; import java.awt.*; import static com.intellij.openapi.editor.colors.TextAttributesKey.createTextAttributesKey;
public static final TextAttributesKey ARGUMENTS = createTextAttributesKey("ARGUMENTS", DefaultLanguageHighlighterColors.PARAMETER); public static final TextAttributesKey ATTRIBUTE = createTextAttributesKey("VARIABLE", DefaultLanguageHighlighterColors.PREDEFINED_SYMBOL); public static final TextAttributesKey SUBROUTINE = createTextAttributesKey("SUBROUTINE", DefaultLanguageHighlighterColors.KEYWORD); public static final TextAttributesKey BAD_CHARACTER = createTextAttributesKey("BAD_CHARACTER", getTextAttribute(Color.RED, true)); private static final TextAttributesKey[] MARKUP_KEYS = new TextAttributesKey[]{MARKUP}; private static final TextAttributesKey[] BAD_CHAR_KEYS = new TextAttributesKey[]{BAD_CHARACTER}; private static final TextAttributesKey[] BRACES_KEYS = new TextAttributesKey[]{BRACES}; private static final TextAttributesKey[] OPERATOR_KEYS = new TextAttributesKey[]{OPERATOR}; private static final TextAttributesKey[] KEY_KEYS = new TextAttributesKey[]{KEY}; private static final TextAttributesKey[] PACKAGE_KEYS = new TextAttributesKey[]{PACKAGE}; private static final TextAttributesKey[] VALUE_KEYS = new TextAttributesKey[]{VALUE}; private static final TextAttributesKey[] COMMENT_KEYS = new TextAttributesKey[]{COMMENTS}; private static final TextAttributesKey[] SUBROUTINE_KEYS = new TextAttributesKey[]{SUBROUTINE}; private static final TextAttributesKey[] VARIABLES_KEYS = new TextAttributesKey[]{ATTRIBUTE}; private static final TextAttributesKey[] ARGUMENTS_KEYS = new TextAttributesKey[]{ARGUMENTS}; private static final TextAttributesKey[] LANG_VARIABLE_KEYS = new TextAttributesKey[]{LANG_VARIABLE}; private static final TextAttributesKey[] LANG_FUNCTION_KEYS = new TextAttributesKey[]{LANG_FUNCTION}; private static final TextAttributesKey[] LANG_SYNTAX_KEYS = new TextAttributesKey[]{LANG_SYNTAX}; private static final TextAttributesKey[] LANG_FILE_HANDLES_KEYS = new TextAttributesKey[]{LANG_FILE_HANDLES}; private static final TextAttributesKey[] EMPTY_KEYS = new TextAttributesKey[0]; private static TextAttributes getTextAttribute(Color color, boolean bold) { return new TextAttributes(color, null, null, null, (bold) ? Font.BOLD : Font.PLAIN); } @NotNull @Override public Lexer getHighlightingLexer() {
// Path: src/com/intellij/perlplugin/language/PerlLexerAdapter.java // public class PerlLexerAdapter extends FlexAdapter { // public PerlLexerAdapter() { // super(new _PerlLexer((Reader) null)); // } // } // // Path: src/com/intellij/perlplugin/psi/PerlTypes.java // public interface PerlTypes { // // IElementType PROPERTY = new PerlElementType("PROPERTY"); // IElementType CRLF = new PerlTokenType("CRLF"); // IElementType KEY = new PerlTokenType("KEY"); // IElementType OPERATOR = new PerlTokenType("OPERATOR"); // IElementType BRACES = new PerlTokenType("BRACES"); // IElementType VALUE = new PerlTokenType("VALUE"); // IElementType WHITESPACE = new PerlTokenType("WHITESPACE"); // IElementType SUBROUTINE = new PerlTokenType("SUBROUTINE"); // IElementType PACKAGE = new PerlTokenType("PACKAGE"); // IElementType POINTER = new PerlTokenType("POINTER"); // IElementType LINE_COMMENT = new PerlTokenType("LINE_COMMENT"); // IElementType MARKUP = new PerlTokenType("MARKUP"); // IElementType LANG_VARIABLE = new PerlTokenType("LANG_VARIABLE"); // IElementType LANG_FUNCTION = new PerlTokenType("LANG_FUNCTION"); // IElementType LANG_SYNTAX = new PerlTokenType("LANG_SYNTAX"); // IElementType LANG_FILE_HANDLES = new PerlTokenType("LANG_FILE_HANDLES"); // IElementType ARGUMENTS = new PerlTokenType("ARGUMENTS"); // IElementType VARIABLE = new PerlTokenType("VARIABLE"); // IElementType HASH_KEY = new PerlTokenType("HASH_KEY"); // IElementType PREDICATE = new PerlTokenType("PREDICATE"); // // class Factory { // public static PsiElement createElement(ASTNode node) { // IElementType type = node.getElementType(); // // if (type == PROPERTY) { // return new PerlPropertyImpl(node); // // } // // throw new AssertionError("Unknown element type: " + type); // } // } // // } // Path: src/com/intellij/perlplugin/extensions/syntax/highlighting/PerlSyntaxHighlighter.java import com.intellij.lexer.Lexer; import com.intellij.openapi.editor.DefaultLanguageHighlighterColors; import com.intellij.openapi.editor.colors.TextAttributesKey; import com.intellij.openapi.editor.markup.TextAttributes; import com.intellij.openapi.fileTypes.SyntaxHighlighterBase; import com.intellij.perlplugin.language.PerlLexerAdapter; import com.intellij.perlplugin.psi.PerlTypes; import com.intellij.psi.TokenType; import com.intellij.psi.tree.IElementType; import org.jetbrains.annotations.NotNull; import java.awt.*; import static com.intellij.openapi.editor.colors.TextAttributesKey.createTextAttributesKey; public static final TextAttributesKey ARGUMENTS = createTextAttributesKey("ARGUMENTS", DefaultLanguageHighlighterColors.PARAMETER); public static final TextAttributesKey ATTRIBUTE = createTextAttributesKey("VARIABLE", DefaultLanguageHighlighterColors.PREDEFINED_SYMBOL); public static final TextAttributesKey SUBROUTINE = createTextAttributesKey("SUBROUTINE", DefaultLanguageHighlighterColors.KEYWORD); public static final TextAttributesKey BAD_CHARACTER = createTextAttributesKey("BAD_CHARACTER", getTextAttribute(Color.RED, true)); private static final TextAttributesKey[] MARKUP_KEYS = new TextAttributesKey[]{MARKUP}; private static final TextAttributesKey[] BAD_CHAR_KEYS = new TextAttributesKey[]{BAD_CHARACTER}; private static final TextAttributesKey[] BRACES_KEYS = new TextAttributesKey[]{BRACES}; private static final TextAttributesKey[] OPERATOR_KEYS = new TextAttributesKey[]{OPERATOR}; private static final TextAttributesKey[] KEY_KEYS = new TextAttributesKey[]{KEY}; private static final TextAttributesKey[] PACKAGE_KEYS = new TextAttributesKey[]{PACKAGE}; private static final TextAttributesKey[] VALUE_KEYS = new TextAttributesKey[]{VALUE}; private static final TextAttributesKey[] COMMENT_KEYS = new TextAttributesKey[]{COMMENTS}; private static final TextAttributesKey[] SUBROUTINE_KEYS = new TextAttributesKey[]{SUBROUTINE}; private static final TextAttributesKey[] VARIABLES_KEYS = new TextAttributesKey[]{ATTRIBUTE}; private static final TextAttributesKey[] ARGUMENTS_KEYS = new TextAttributesKey[]{ARGUMENTS}; private static final TextAttributesKey[] LANG_VARIABLE_KEYS = new TextAttributesKey[]{LANG_VARIABLE}; private static final TextAttributesKey[] LANG_FUNCTION_KEYS = new TextAttributesKey[]{LANG_FUNCTION}; private static final TextAttributesKey[] LANG_SYNTAX_KEYS = new TextAttributesKey[]{LANG_SYNTAX}; private static final TextAttributesKey[] LANG_FILE_HANDLES_KEYS = new TextAttributesKey[]{LANG_FILE_HANDLES}; private static final TextAttributesKey[] EMPTY_KEYS = new TextAttributesKey[0]; private static TextAttributes getTextAttribute(Color color, boolean bold) { return new TextAttributes(color, null, null, null, (bold) ? Font.BOLD : Font.PLAIN); } @NotNull @Override public Lexer getHighlightingLexer() {
return new PerlLexerAdapter();
eli1982/intellij-perl-plugin
src/com/intellij/perlplugin/extensions/syntax/highlighting/PerlSyntaxHighlighter.java
// Path: src/com/intellij/perlplugin/language/PerlLexerAdapter.java // public class PerlLexerAdapter extends FlexAdapter { // public PerlLexerAdapter() { // super(new _PerlLexer((Reader) null)); // } // } // // Path: src/com/intellij/perlplugin/psi/PerlTypes.java // public interface PerlTypes { // // IElementType PROPERTY = new PerlElementType("PROPERTY"); // IElementType CRLF = new PerlTokenType("CRLF"); // IElementType KEY = new PerlTokenType("KEY"); // IElementType OPERATOR = new PerlTokenType("OPERATOR"); // IElementType BRACES = new PerlTokenType("BRACES"); // IElementType VALUE = new PerlTokenType("VALUE"); // IElementType WHITESPACE = new PerlTokenType("WHITESPACE"); // IElementType SUBROUTINE = new PerlTokenType("SUBROUTINE"); // IElementType PACKAGE = new PerlTokenType("PACKAGE"); // IElementType POINTER = new PerlTokenType("POINTER"); // IElementType LINE_COMMENT = new PerlTokenType("LINE_COMMENT"); // IElementType MARKUP = new PerlTokenType("MARKUP"); // IElementType LANG_VARIABLE = new PerlTokenType("LANG_VARIABLE"); // IElementType LANG_FUNCTION = new PerlTokenType("LANG_FUNCTION"); // IElementType LANG_SYNTAX = new PerlTokenType("LANG_SYNTAX"); // IElementType LANG_FILE_HANDLES = new PerlTokenType("LANG_FILE_HANDLES"); // IElementType ARGUMENTS = new PerlTokenType("ARGUMENTS"); // IElementType VARIABLE = new PerlTokenType("VARIABLE"); // IElementType HASH_KEY = new PerlTokenType("HASH_KEY"); // IElementType PREDICATE = new PerlTokenType("PREDICATE"); // // class Factory { // public static PsiElement createElement(ASTNode node) { // IElementType type = node.getElementType(); // // if (type == PROPERTY) { // return new PerlPropertyImpl(node); // // } // // throw new AssertionError("Unknown element type: " + type); // } // } // // }
import com.intellij.lexer.Lexer; import com.intellij.openapi.editor.DefaultLanguageHighlighterColors; import com.intellij.openapi.editor.colors.TextAttributesKey; import com.intellij.openapi.editor.markup.TextAttributes; import com.intellij.openapi.fileTypes.SyntaxHighlighterBase; import com.intellij.perlplugin.language.PerlLexerAdapter; import com.intellij.perlplugin.psi.PerlTypes; import com.intellij.psi.TokenType; import com.intellij.psi.tree.IElementType; import org.jetbrains.annotations.NotNull; import java.awt.*; import static com.intellij.openapi.editor.colors.TextAttributesKey.createTextAttributesKey;
private static final TextAttributesKey[] BAD_CHAR_KEYS = new TextAttributesKey[]{BAD_CHARACTER}; private static final TextAttributesKey[] BRACES_KEYS = new TextAttributesKey[]{BRACES}; private static final TextAttributesKey[] OPERATOR_KEYS = new TextAttributesKey[]{OPERATOR}; private static final TextAttributesKey[] KEY_KEYS = new TextAttributesKey[]{KEY}; private static final TextAttributesKey[] PACKAGE_KEYS = new TextAttributesKey[]{PACKAGE}; private static final TextAttributesKey[] VALUE_KEYS = new TextAttributesKey[]{VALUE}; private static final TextAttributesKey[] COMMENT_KEYS = new TextAttributesKey[]{COMMENTS}; private static final TextAttributesKey[] SUBROUTINE_KEYS = new TextAttributesKey[]{SUBROUTINE}; private static final TextAttributesKey[] VARIABLES_KEYS = new TextAttributesKey[]{ATTRIBUTE}; private static final TextAttributesKey[] ARGUMENTS_KEYS = new TextAttributesKey[]{ARGUMENTS}; private static final TextAttributesKey[] LANG_VARIABLE_KEYS = new TextAttributesKey[]{LANG_VARIABLE}; private static final TextAttributesKey[] LANG_FUNCTION_KEYS = new TextAttributesKey[]{LANG_FUNCTION}; private static final TextAttributesKey[] LANG_SYNTAX_KEYS = new TextAttributesKey[]{LANG_SYNTAX}; private static final TextAttributesKey[] LANG_FILE_HANDLES_KEYS = new TextAttributesKey[]{LANG_FILE_HANDLES}; private static final TextAttributesKey[] EMPTY_KEYS = new TextAttributesKey[0]; private static TextAttributes getTextAttribute(Color color, boolean bold) { return new TextAttributes(color, null, null, null, (bold) ? Font.BOLD : Font.PLAIN); } @NotNull @Override public Lexer getHighlightingLexer() { return new PerlLexerAdapter(); } @NotNull @Override public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
// Path: src/com/intellij/perlplugin/language/PerlLexerAdapter.java // public class PerlLexerAdapter extends FlexAdapter { // public PerlLexerAdapter() { // super(new _PerlLexer((Reader) null)); // } // } // // Path: src/com/intellij/perlplugin/psi/PerlTypes.java // public interface PerlTypes { // // IElementType PROPERTY = new PerlElementType("PROPERTY"); // IElementType CRLF = new PerlTokenType("CRLF"); // IElementType KEY = new PerlTokenType("KEY"); // IElementType OPERATOR = new PerlTokenType("OPERATOR"); // IElementType BRACES = new PerlTokenType("BRACES"); // IElementType VALUE = new PerlTokenType("VALUE"); // IElementType WHITESPACE = new PerlTokenType("WHITESPACE"); // IElementType SUBROUTINE = new PerlTokenType("SUBROUTINE"); // IElementType PACKAGE = new PerlTokenType("PACKAGE"); // IElementType POINTER = new PerlTokenType("POINTER"); // IElementType LINE_COMMENT = new PerlTokenType("LINE_COMMENT"); // IElementType MARKUP = new PerlTokenType("MARKUP"); // IElementType LANG_VARIABLE = new PerlTokenType("LANG_VARIABLE"); // IElementType LANG_FUNCTION = new PerlTokenType("LANG_FUNCTION"); // IElementType LANG_SYNTAX = new PerlTokenType("LANG_SYNTAX"); // IElementType LANG_FILE_HANDLES = new PerlTokenType("LANG_FILE_HANDLES"); // IElementType ARGUMENTS = new PerlTokenType("ARGUMENTS"); // IElementType VARIABLE = new PerlTokenType("VARIABLE"); // IElementType HASH_KEY = new PerlTokenType("HASH_KEY"); // IElementType PREDICATE = new PerlTokenType("PREDICATE"); // // class Factory { // public static PsiElement createElement(ASTNode node) { // IElementType type = node.getElementType(); // // if (type == PROPERTY) { // return new PerlPropertyImpl(node); // // } // // throw new AssertionError("Unknown element type: " + type); // } // } // // } // Path: src/com/intellij/perlplugin/extensions/syntax/highlighting/PerlSyntaxHighlighter.java import com.intellij.lexer.Lexer; import com.intellij.openapi.editor.DefaultLanguageHighlighterColors; import com.intellij.openapi.editor.colors.TextAttributesKey; import com.intellij.openapi.editor.markup.TextAttributes; import com.intellij.openapi.fileTypes.SyntaxHighlighterBase; import com.intellij.perlplugin.language.PerlLexerAdapter; import com.intellij.perlplugin.psi.PerlTypes; import com.intellij.psi.TokenType; import com.intellij.psi.tree.IElementType; import org.jetbrains.annotations.NotNull; import java.awt.*; import static com.intellij.openapi.editor.colors.TextAttributesKey.createTextAttributesKey; private static final TextAttributesKey[] BAD_CHAR_KEYS = new TextAttributesKey[]{BAD_CHARACTER}; private static final TextAttributesKey[] BRACES_KEYS = new TextAttributesKey[]{BRACES}; private static final TextAttributesKey[] OPERATOR_KEYS = new TextAttributesKey[]{OPERATOR}; private static final TextAttributesKey[] KEY_KEYS = new TextAttributesKey[]{KEY}; private static final TextAttributesKey[] PACKAGE_KEYS = new TextAttributesKey[]{PACKAGE}; private static final TextAttributesKey[] VALUE_KEYS = new TextAttributesKey[]{VALUE}; private static final TextAttributesKey[] COMMENT_KEYS = new TextAttributesKey[]{COMMENTS}; private static final TextAttributesKey[] SUBROUTINE_KEYS = new TextAttributesKey[]{SUBROUTINE}; private static final TextAttributesKey[] VARIABLES_KEYS = new TextAttributesKey[]{ATTRIBUTE}; private static final TextAttributesKey[] ARGUMENTS_KEYS = new TextAttributesKey[]{ARGUMENTS}; private static final TextAttributesKey[] LANG_VARIABLE_KEYS = new TextAttributesKey[]{LANG_VARIABLE}; private static final TextAttributesKey[] LANG_FUNCTION_KEYS = new TextAttributesKey[]{LANG_FUNCTION}; private static final TextAttributesKey[] LANG_SYNTAX_KEYS = new TextAttributesKey[]{LANG_SYNTAX}; private static final TextAttributesKey[] LANG_FILE_HANDLES_KEYS = new TextAttributesKey[]{LANG_FILE_HANDLES}; private static final TextAttributesKey[] EMPTY_KEYS = new TextAttributesKey[0]; private static TextAttributes getTextAttribute(Color color, boolean bold) { return new TextAttributes(color, null, null, null, (bold) ? Font.BOLD : Font.PLAIN); } @NotNull @Override public Lexer getHighlightingLexer() { return new PerlLexerAdapter(); } @NotNull @Override public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
if (tokenType.equals(PerlTypes.LANG_VARIABLE)) {
eli1982/intellij-perl-plugin
src/com/intellij/perlplugin/psi/impl/PerlElementFactory.java
// Path: src/com/intellij/perlplugin/language/PerlFile.java // public class PerlFile extends PsiFileBase { // public PerlFile(@NotNull FileViewProvider viewProvider) { // super(viewProvider, PerlLanguage.INSTANCE); // } // // @NotNull // @Override // public FileType getFileType() { // return PerlFileType.INSTANCE; // } // // @Override // public String toString() { // return Constants.FILE_NAME; // } // // @Override // public Icon getIcon(int flags) { // return super.getIcon(flags); // } // } // // Path: src/com/intellij/perlplugin/language/PerlFileType.java // public class PerlFileType extends LanguageFileType { // public static final PerlFileType INSTANCE = new PerlFileType(); // // private PerlFileType() { // super(PerlLanguage.INSTANCE); // } // // @NotNull // @Override // public String getName() { // return Constants.FILE_NAME; // } // // @NotNull // @Override // public String getDescription() { // return Constants.DESCRIPTION; // } // // @NotNull // @Override // public String getDefaultExtension() { // return Constants.FILE_TYPE_PM; // } // // @Nullable // @Override // public Icon getIcon() { // return PerlIcons.LANGUAGE; // } // }
import com.intellij.openapi.project.Project; import com.intellij.perlplugin.language.PerlFile; import com.intellij.perlplugin.language.PerlFileType; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFileFactory;
package com.intellij.perlplugin.psi.impl; public class PerlElementFactory { public static PerlProperty createProperty(Project project, String name, String value) {
// Path: src/com/intellij/perlplugin/language/PerlFile.java // public class PerlFile extends PsiFileBase { // public PerlFile(@NotNull FileViewProvider viewProvider) { // super(viewProvider, PerlLanguage.INSTANCE); // } // // @NotNull // @Override // public FileType getFileType() { // return PerlFileType.INSTANCE; // } // // @Override // public String toString() { // return Constants.FILE_NAME; // } // // @Override // public Icon getIcon(int flags) { // return super.getIcon(flags); // } // } // // Path: src/com/intellij/perlplugin/language/PerlFileType.java // public class PerlFileType extends LanguageFileType { // public static final PerlFileType INSTANCE = new PerlFileType(); // // private PerlFileType() { // super(PerlLanguage.INSTANCE); // } // // @NotNull // @Override // public String getName() { // return Constants.FILE_NAME; // } // // @NotNull // @Override // public String getDescription() { // return Constants.DESCRIPTION; // } // // @NotNull // @Override // public String getDefaultExtension() { // return Constants.FILE_TYPE_PM; // } // // @Nullable // @Override // public Icon getIcon() { // return PerlIcons.LANGUAGE; // } // } // Path: src/com/intellij/perlplugin/psi/impl/PerlElementFactory.java import com.intellij.openapi.project.Project; import com.intellij.perlplugin.language.PerlFile; import com.intellij.perlplugin.language.PerlFileType; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFileFactory; package com.intellij.perlplugin.psi.impl; public class PerlElementFactory { public static PerlProperty createProperty(Project project, String name, String value) {
final PerlFile file = createFile(project, name + " = " + value);
eli1982/intellij-perl-plugin
src/com/intellij/perlplugin/psi/impl/PerlElementFactory.java
// Path: src/com/intellij/perlplugin/language/PerlFile.java // public class PerlFile extends PsiFileBase { // public PerlFile(@NotNull FileViewProvider viewProvider) { // super(viewProvider, PerlLanguage.INSTANCE); // } // // @NotNull // @Override // public FileType getFileType() { // return PerlFileType.INSTANCE; // } // // @Override // public String toString() { // return Constants.FILE_NAME; // } // // @Override // public Icon getIcon(int flags) { // return super.getIcon(flags); // } // } // // Path: src/com/intellij/perlplugin/language/PerlFileType.java // public class PerlFileType extends LanguageFileType { // public static final PerlFileType INSTANCE = new PerlFileType(); // // private PerlFileType() { // super(PerlLanguage.INSTANCE); // } // // @NotNull // @Override // public String getName() { // return Constants.FILE_NAME; // } // // @NotNull // @Override // public String getDescription() { // return Constants.DESCRIPTION; // } // // @NotNull // @Override // public String getDefaultExtension() { // return Constants.FILE_TYPE_PM; // } // // @Nullable // @Override // public Icon getIcon() { // return PerlIcons.LANGUAGE; // } // }
import com.intellij.openapi.project.Project; import com.intellij.perlplugin.language.PerlFile; import com.intellij.perlplugin.language.PerlFileType; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFileFactory;
package com.intellij.perlplugin.psi.impl; public class PerlElementFactory { public static PerlProperty createProperty(Project project, String name, String value) { final PerlFile file = createFile(project, name + " = " + value); return (PerlProperty) file.getFirstChild(); } public static PerlProperty createProperty(Project project, String name) { final PerlFile file = createFile(project, name); return (PerlProperty) file.getFirstChild(); } public static PsiElement createCRLF(Project project) { final PerlFile file = createFile(project, "\n"); return file.getFirstChild(); } public static PerlFile createFile(Project project, String text) { String name = "dummy.Perl"; return (PerlFile) PsiFileFactory.getInstance(project).
// Path: src/com/intellij/perlplugin/language/PerlFile.java // public class PerlFile extends PsiFileBase { // public PerlFile(@NotNull FileViewProvider viewProvider) { // super(viewProvider, PerlLanguage.INSTANCE); // } // // @NotNull // @Override // public FileType getFileType() { // return PerlFileType.INSTANCE; // } // // @Override // public String toString() { // return Constants.FILE_NAME; // } // // @Override // public Icon getIcon(int flags) { // return super.getIcon(flags); // } // } // // Path: src/com/intellij/perlplugin/language/PerlFileType.java // public class PerlFileType extends LanguageFileType { // public static final PerlFileType INSTANCE = new PerlFileType(); // // private PerlFileType() { // super(PerlLanguage.INSTANCE); // } // // @NotNull // @Override // public String getName() { // return Constants.FILE_NAME; // } // // @NotNull // @Override // public String getDescription() { // return Constants.DESCRIPTION; // } // // @NotNull // @Override // public String getDefaultExtension() { // return Constants.FILE_TYPE_PM; // } // // @Nullable // @Override // public Icon getIcon() { // return PerlIcons.LANGUAGE; // } // } // Path: src/com/intellij/perlplugin/psi/impl/PerlElementFactory.java import com.intellij.openapi.project.Project; import com.intellij.perlplugin.language.PerlFile; import com.intellij.perlplugin.language.PerlFileType; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFileFactory; package com.intellij.perlplugin.psi.impl; public class PerlElementFactory { public static PerlProperty createProperty(Project project, String name, String value) { final PerlFile file = createFile(project, name + " = " + value); return (PerlProperty) file.getFirstChild(); } public static PerlProperty createProperty(Project project, String name) { final PerlFile file = createFile(project, name); return (PerlProperty) file.getFirstChild(); } public static PsiElement createCRLF(Project project) { final PerlFile file = createFile(project, "\n"); return file.getFirstChild(); } public static PerlFile createFile(Project project, String text) { String name = "dummy.Perl"; return (PerlFile) PsiFileFactory.getInstance(project).
createFileFromText(name, PerlFileType.INSTANCE, text);